cyl/develop
jscyl13849007907 1 year ago
parent 155c89547b
commit 0a6104c483

@ -9,8 +9,10 @@ Page({
list:[ list:[
{ {
id:-1, id:-1,
type:'text' type:'text',
} isUp:false,
isDown:false,
},
] ]
}, },
@ -73,16 +75,67 @@ Page({
}, },
handleEvent(e){ handleEvent(e){
console.log('handleEvent',e);
let that = this; let that = this;
that.animate(); that.animate();
that.setData({ that.setData({
eventType:e.currentTarget.dataset.type == 'input' ? 'voice':'input' eventType:e.currentTarget.dataset.type == 'input' ? 'voice':'input'
}) })
}, },
handleUp(e){
let that = this;
that.animate();
const list = [...that.data.list];
const index = e.currentTarget.dataset.index;
list[index].isUp = !list[index].isUp;
that.setData({
list: list
});
},
handleDown(e){
let that = this;
that.animate();
const list = [...that.data.list];
const index = e.currentTarget.dataset.index;
list[index].isDown = !list[index].isDown;
that.setData({
list: list
});
},
handleCopy(e){
let that = this;
that.animate();
const index = e.currentTarget.dataset.index;
let content = that.data.list[index].content; // 获取要复制的内容
if(index == 0){
content = "Hi我是大鹏你的智能工作助理。以后找工作不用跟老板谈了直接来跟大鹏谈。来说说你的要求我们开始吧…"
}
wx.setClipboardData({
data: content,
success: function (res) {
wx.showToast({
title: '复制成功',
icon: 'success',
duration: 2000
});
},
fail: function (res) {
wx.showToast({
title: '复制失败',
icon: 'none',
duration: 2000
});
}
});
},
handleShare(){
let that = this;
that.animate();
},
animate($type='light') { animate($type='light') {
wx.vibrateShort({ wx.vibrateShort({
type:$type type:$type
}); });
} },
}) })

@ -27,12 +27,26 @@
</view> </view>
<view class="item-opera g_flex_row_between"> <view class="item-opera g_flex_row_between">
<view class="g_flex_row_start"> <view class="g_flex_row_start">
<i class="iconfont icon-useful era-icon g_mr_12"></i> <i class="iconfont icon-useful era-icon g_mr_12 {{item.isUp ? 'icon-active' : ''}}"
<i class="iconfont icon-un_useful era-icon"></i> data-up="{{item.isUp}}"
data-index="{{index}}"
bindtap="handleUp"
></i>
<i class="iconfont icon-un_useful era-icon {{item.isDown ? 'icon-active' : ''}}"
data-down="{{item.isDown}}"
data-index="{{index}}"
bindtap="handleDown"
></i>
</view> </view>
<view class="g_flex_row_end"> <view class="g_flex_row_end">
<i class="iconfont icon-fuzhi11 era-icon g_mr_12"></i> <i class="iconfont icon-fuzhi11 era-icon g_mr_12"
<i class="iconfont icon-fenxiangfenxiangshare era-icon"></i> data-copy="{{item.content}}"
data-index="{{index}}"
bindtap="handleCopy"
></i>
<i class="iconfont icon-fenxiangfenxiangshare era-icon"
bindtap="handleShare"
></i>
</view> </view>
</view> </view>
</view> </view>

@ -221,3 +221,6 @@ textarea {
.g_mr_12{ .g_mr_12{
margin-right: 12px; margin-right: 12px;
} }
.icon-active{
color: #3578f6;
}
Loading…
Cancel
Save