Commit b41918ec by jscat

nyx-dev: weapp

1. 添加分享组件
parent 62dabbc0
{ {
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
"pages/activity/activity", "pages/activity/activity",
"pages/community/community", "pages/community/community",
"pages/fair/fair", "pages/fair/fair",
"pages/share/share",
"pages/mall/order/order", "pages/mall/order/order",
"pages/activity/activity-list/activity-list", "pages/activity/activity-list/activity-list",
"pages/my/my-members/my-members", "pages/my/my-members/my-members",
...@@ -42,8 +43,8 @@ ...@@ -42,8 +43,8 @@
"selectedIconPath": "./icon/my/activity.png" "selectedIconPath": "./icon/my/activity.png"
}, },
{ {
"pagePath": "pages/fair/fair", "pagePath": "pages/share/share",
"text": "集市", "text": "互动",
"iconPath": "./icon/fair/fair.png", "iconPath": "./icon/fair/fair.png",
"selectedIconPath": "./icon/fair/fair.png" "selectedIconPath": "./icon/fair/fair.png"
}, },
......
<wxs module="tutil" src="./../../utils/date.wxs"></wxs> <wxs module="tutil" src="./../../utils/date.wxs"></wxs>
...@@ -66,8 +66,8 @@ ...@@ -66,8 +66,8 @@
<view class="items"> <view class="items">
<navigator url="/pages/my/my-orders/my-orders"> <navigator url="/pages/my/my-orders/my-orders">
<image src="../../icon/activity/order.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image> <image src="../../icon/activity/order.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">我的预订</text>
</navigator> </navigator>
<text style="font-size:28rpx;">我的预订</text>
</view> </view>
</view> </view>
......
// pages/key/key.js
// pages/key/key.js
var config = wx.getStorageSync("config");
var app = getApp();
var log = require('./../../utils/log.js')
var util = require('./../../utils/util.js')
Page({
/**
* 系统配置:主要用于置底页面设置 step1
*/
keyHeight: '',
chatHeight: "",
/**
* 页面的初始数据
*/
data: {
// 主要是公屏内容
autoplay: false,
interval: 3000,
duration: 1200,
indicatorDots: true,
emotionArr: [],
messageInputVal: '',
emotionHost: null,
nodes: [{
name: 'img'
}],
// {
// nickName : "张三"",
// type: 'L',
// messageType: 'txt',
// con: '微软开发者大会',
// avater: '../../imgs/avater.jpg'
// },
messageList: [],
isMedia: false,
isEmotion: false,
isShowAdd: false,
// socket
user_input_text: '',//用户输入文字
inputValue: '',
returnValue: '',
addImg: false,
//格式示例数据,可为空
allContentList: [],
num: 0,
sid: "key",
chatUserInfo: {},
scrollTop: 0,
//头像点击参数
touchStart: 0,
touchEnd: 0,
touchTime: 0,
touchId: "",
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var _this = this;
console.log('===onLoad, options_', JSON.stringify(options));
/*step1 先确定用户信息 */
var nyxCode = wx.getStorageSync('nyxCode');
//不存在
if (!nyxCode)
{
//注册新用户
console.log("===onLoad_regUser")
wx.clearStorageSync('nyxCode');
nyxCode = "uid_" + util.wxuuid()
wx.setStorageSync('nyxCode', nyxCode);
app.globalData.nyxCode = nyxCode;
app.regUser(nyxCode);
}
else //存在
{
//更新用户信息
var strUrl = config.userinfo_query_url + "?userid=" + nyxCode
wx.setStorageSync('nyxCode', nyxCode);
app.globalData.nyxCode = nyxCode;
config.debug == 1 ? console.log("===getLatestUserInfo strUrl_" + strUrl) : 1
getData(strUrl, "").then(res => {
console.log(res.data)
if(res.data.length==0) //数据库不存在该用户(误删除或者测试数据已删除)
{
//以该id注册新用户
console.log("===onLoad_Update User Info")
app.regUser(nyxCode);
}
else
{
var list = res.data[0]
app.globalData.nyxCode = nyxCode;
wx.setStorageSync('nyxCode', nyxCode);
app.globalData.userInfo = list
wx.setStorageSync('userInfo', list)
console.log("==onLoad_userInfo success")
}
})
}
//初始化socket
if (app.globalData.socketTask.readyState != 1 && app.globalData.socketTask.readyState != 0) {
var sid = _this.data.sid
if (sid != undefined && nyxCode != undefined && sid != "" && nyxCode != "") {
console.log("===onLoad_initSocket")
app.initSocket(sid, nyxCode, "驾临互动圈")
app.globalData.socketClose = false
}
}
wx.setNavigationBarTitle({
title: "新鲜互动"
})
/**
* 系统配置:主要用于置底页面设置 step2
let h = 750 * res.windowHeight/res.windowWidth
*/
//获取设备高度,小程序自带的方法
var windowHeight = wx.getSystemInfoSync().windowHeight;
var keyHeight = windowHeight*0.4
var chatHeight = windowHeight - keyHeight
_this.setData({
keyHeight: keyHeight,
chatHeight: chatHeight,
})
//模拟表情数据
let emotion = emotionFun();
this.setData({
emotionArr: emotion,
emotionHost: app.globalData.emotionHost
})
},
// 初始化socket, 监听socket
onShow: function () {
var _this = this;
console.log("===onShow_readyState_", app.globalData.socketTask.readyState)
var uid = wx.getStorageSync('nyxCode')
if (app.globalData.socketTask.readyState != 1 && app.globalData.socketTask.readyState != 0 && uid != "") {
var sid = _this.data.sid
if (sid != undefined && uid != undefined && sid != "" && uid != "") {
console.log("===onShow_initSocket")
app.initSocket(sid, uid, "驾临互动圈")
app.globalData.socketClose = false
}
}
// 最好放在onShow
app.globalData.socketTask.onOpen(function (res) {
console.log('chat-onOpen webSocket连接已打开! readyState=' + app.globalData.socketTask.readyState)
//console.log("chat-open res_", res)
if (app.globalData.socketClose) {
app.closeSocket();
}
else {
app.globalData.socketOpen = true;
// 发送答题积分消息
var sendMsg = wx.getStorageSync('sendMsg')
if (sendMsg) {
_this.sendSocketMessage(sendMsg)
}
for (var i = 0; i < app.globalData.socketMsgQueue.length; i++) {
_this.sendSocketMessage(app.globalData.socketMsgQueue[i])
}
app.globalData.socketMsgQueue = []
app.startHeartBeat();
}
})
app.globalData.socketTask.onError(function (res) {
console.log('chat-WebSocket连接错误! 错误信息', res)
})
/*
两种情形,注意区分
case1. 用户跳转到其他页面, 触发onHide, 则正式退出
case2. socket掉线,则需要重连
*/
app.globalData.socketTask.onClose(function (res) {
console.log('chat-WebSocket连接已关闭! readyState=' + app.globalData.socketTask.readyState)
//对应case1
if (!app.globalData.socketClose) {
clearTimeout(app.globalData.connectSocketTimeOut)
app.globalData.connectSocketTimeOut = setTimeout(() => {
console.log("===onClose_initSocket")
app.initSocket(_this.data.sid, app.globalData.nyxCode, "驾临互动圈")
}, 3000);
}
})
app.globalData.socketTask.onMessage(onMessage => {
//console.log('监听WebSocket接受到服务器的消息事件。服务器返回的消息', onMessage.data)
var json = JSON.parse(onMessage.data);
// uid
var uid = json["uid"];
if (json["cmd"] != "onHeart") {
console.log("===onMessage_json: ", json)
var strUrl = config.userinfo_query_url + "?userid=" + uid
//tofix 这个地方特别容易出错
config.debug == 1 ? console.log("===onMessage getData strUrl_" + strUrl) : 1
getData(strUrl, "").then(res => {
console.log("===onMessage_res_",res)
var list = {}
//成功返回,服务器没问题
if (res.resultCode == "200")
{
if (res.data.length == 0) {
list['userId'] = uid
list['nickName'] = "匿名用户"
list['avatarUrl'] = "https://930-test-sh.oss-cn-shanghai.aliyuncs.com/u_image/icon_avatar1.png"
}
else {
list = res.data[0]
}
console.log("===onMessage_chatUserInfo, ", list)
_this.setData({
chatUserInfo: list
})
_this.processData(json)
}
else
{
console.log("===onMessage, 系统错误")
}
})
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function (){
var _this = this;
},
onType: function (e) {
console.log(e)
switch (e.detail.idx) {
case '1':
wx.navigateTo({
url: '/pages/key/matchTest/matchTest'
})
break;
case '2':
wx.navigateTo({
url: '/pages/key/matchTest/matchTest'
})
break;
case '3':
wx.navigateTo({
url: '/pages/key/matchOne/matchOne'
})
break;
case '4':
wx.navigateTo({
url: '/pages/key/matchTwo/matchTwo'
})
break;
default:
break;
}
},
/*
*/
//点击空白页,隐藏表情和图片选择
cancelShow() {
this.setData({
isEmotion: false,
isMedia: false
})
},
//打开表情选择
openEmotion() {
this.scrollBottom();
this.setData({
isEmotion: !this.data.isEmotion,
isMedia: false
})
},
//选择表情
selectEmotion(e) {
let inputEmotion = this.data.messageInputVal.concat(e.currentTarget.dataset.txt);
this.setData({
messageInputVal: inputEmotion
})
//this.isShowAddFun();
},
//删除输入的值
deleteVal() {
// console.log(this.data.messageInputVal.length)
let newVal = this.data.messageInputVal.substring(0, this.data.messageInputVal.length - 1);
this.setData({
messageInputVal: newVal
})
//this.isShowAddFun();
},
//分享(带参数),在onLoad接收参数
onShareAppMessage: function () {
return {
title: '让有趣被发现',
path: 'pages/key/key', // 路径,传递参数到指定页面。
imageUrl: '../../icon/images/nyx.png' //自定义分享封面
}
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
//app.closeSocket();
console.log('===onUnload webSocket 连接关闭事件。')
},
//发送消息
messageSend: function () {
let self = this;
let messageVal = self.data.messageInputVal;
if (!messageVal) {
wx.showToast({
title: '请输入内容',
icon: 'none',
duration: 2000
})
return false;
}
//表情处理
var reg = /\[.+?\]/g;
let newVal = messageVal.replace(reg, function (a, b) {
return face(a) ? face(a) : a;
});
//发送的消息
let objR = {
nickName: app.globalData.userInfo.nickName,
type: 'R',
messageType: 'txt',
con: newVal,
avater: app.globalData.userInfo.avatarUrl,
};
let messageArr = [];
messageArr.push(objR);
let newMessageArr = self.data.messageList.concat(messageArr);
//判断公屏的文字是否合规
let promise = app.onCheckText(newVal)
//在本轮event loop(事件循环)运行完成之前,回调函数是不会被调用的
//then后的括号里应该是参数param
//https://www.cnblogs.com/qlongbg/p/11603328.html
promise.then(function (value) {
console.log("===enter promise then_pass_" + value)
self.submitTo(messageVal)
//更新数据(模拟请求历史数据)
self.setData({
messageInputVal: "",
messageList: newMessageArr,
isEmotion: false,
isMedia: false
})
self.scrollBottom();
},
function (value) {
console.log("===enter promise then_failed_" + value)
});
},
//使页面滚动到底部
//tofix 应该需要一些优化 jscat 2020/03/13
scrollBottom: function () {
// wx.createSelectorQuery().select('#wrapperCon').boundingClientRect(function (rect) {
// wx.pageScrollTo({
// scrollTop: rect.bottom * 1000 //加整数的目的是消息数量多的时候,解决滚动会出现不到底部,并且抖动的问题
// })
// }).exec();
this.setData({
scrollTop: 1000 * 10 // 这里我们的单对话区域最高1000,取了最大值,应该有方法取到精确的
});
},
//获取输入内容
messageInput: function (e) {
let inputVal = e.detail.value;
this.setData({
messageInputVal: inputVal
})
},
//是否显示添加按钮
isShowAddFun() {
//如果有输入显示发送按钮,隐藏加号添加图片功能
if (this.data.messageInputVal) {
this.setData({
isShowAdd: false
})
} else {
this.setData({
isShowAdd: true
})
}
},
// 提交文字
submitTo: function (inputValue) {
let _this = this;
if (app.globalData.socketTask.readyState == 1) {
// 如果打开了socket就发送数据给服务器
var msg = JSON.stringify({
'cmd': 'onData',
'uid': app.globalData.nyxCode,
'msg': inputValue
})
_this.sendSocketMessage(msg)
}
},
bindKeyInput: function (e) {
this.setData({
inputValue: e.detail.value
})
},
/*
mark: tabbar 切换之后触发onHide()
*/
onHide: function () {
app.closeSocket();
console.log('===onHide WebSocket 连接关闭')
},
// 发送和接收 socket 消息
sendSocketMessage: function (msg) {
let _this = this
return new Promise((resolve, reject) => {
app.sendSocketMessage(msg)
app.globalData.callback = function (res) {
console.log('===webSocket 收到服务器内容: ', res)
resolve(res)
}
})
},
//获取到了socket广播的消息 => 通过userid获取userInfo => 小程序端处理获取到的msg
processData(json) {
var _this = this;
/*
cmd==onOpen, text = "欢迎" + map.uid + "驾临互动圈"
cmd==onData, text = map.msg
if(chatUserinfo.nickName == app.globalData.userInfo.nickName) 不添加
*/
var text = ""
var nickName = ""
var avater = ""
console.log("====chatUserInfo, ", _this.data.chatUserInfo)
if (json["cmd"] == "onOpen" || json["cmd"] == "onScore") {
text = " " + _this.data.chatUserInfo.nickName + " " +json["msg"]
nickName = "系统"
avater = "../../icon/mall.png"
}
else if (json["cmd"] == "onData") {
text = json["msg"]
nickName = _this.data.chatUserInfo.nickName
avater = _this.data.chatUserInfo.avatarUrl
}
//表情处理
var reg = /\[.+?\]/g;
let newVal = text.replace(reg, function (a, b) {
return face(a) ? face(a) : a;
});
//回复
let objL = {
nickName: nickName,
type: 'L',
messageType: 'txt',
con: newVal,
avater: avater,
};
let messageArr = [];
//jscat 20200314 most important!
// 判断内容是否显示
// 1. 发送data,同时非自己
// 2. (自己登陆,不需要重复发送),
// 3. (竞答完成后,需要发送内容)
// 4. (别人登陆, 需要发送)
if (
(json["cmd"] == "onData" && _this.data.chatUserInfo.userid != app.globalData.nyxCode)
|| (json["cmd"] == "onOpen" && app.globalData.onOpenOp.key!=true)
|| (json["cmd"] == "onOpen" && _this.data.chatUserInfo.userid != app.globalData.nyxCode)
|| (json["cmd"] == "onScore")
)
{
messageArr.push(objL);
}
if ((json["cmd"] == "onScore" && wx.getStorageSync("sendMsg") != ""))
{
wx.setStorageSync('sendMsg', '');
}
if (json["cmd"] == "onOpen")
{
app.globalData.onOpenOp.key = true;
}
let newMessageArr = _this.data.messageList.concat(messageArr);
//更新数据(模拟请求历史数据)
_this.setData({
messageInputVal: "",
messageList: newMessageArr,
isEmotion: false,
isMedia: false,
})
_this.scrollBottom();
},
touchStart:function(e){
    var _this=this;
    _this.setData({
        touchStart:e.timeStamp
    })
},
touchstart_long: function(e) {
console.log(e)
var _this = this;
var dataId = e.currentTarget.dataset.id
    _this.setData({
        touchStart:e.timeStamp
    })
//长按头像1s, 显示 @nickName功能
setTimeout(function() {
console.log("touchStart___"+_this.data.touchEnd)
//if ( _this.data.touchEnd == 0 ) {
_this.setData({
messageInputVal: _this.data.messageInputVal + "@" + dataId + " "
})
//}
//重置
    _this.setData({
      touchEnd: 0
    })
console.log("touchStart__reset___")
},
1000)
},
touchEnd:function(e){
    var _this=this;
console.log("touchEnd___"+e.timeStamp)
    _this.setData({
        touchEnd: e.timeStamp
    })
},
pressTap:function(e){
var _this=this;
//js的e.currentTarget.id 对应wxml的 id="tab0"
//js的e.currentTarget.dataSet.id 对应wxml的 data-id="tab0"
var dataId = e.currentTarget.dataset.id
var touchTime=_this.data.touchEnd-_this.data.touchStart;
if(touchTime>1000){ //自定义长按时长,单位为ms
    wx.showModal({
        title:'提示',
        content:'你已长按头像: '+dataId,
        success:function(res){
            if(res.confirm){
console.log("====")
            }
        }
    })
 }
},
})
//通过Promise方式为wx.request添加同步操作
const getData = (url, param) => {
return new Promise((resolve, reject) => {
wx.request({
url: url,
method: 'GET',
data: param,
success(res) {
resolve(res.data)
},
fail(err) {
reject(err)
}
})
})
}
//表情文件
function emotionFun() {
let emoArr = [
{ "name": "Expression_1", "text": "[微笑]" },
{ "name": "Expression_2", "text": "[撇嘴]" },
{ "name": "Expression_3", "text": "[色]" },
{ "name": "Expression_4", "text": "[发呆]" },
{ "name": "Expression_5", "text": "[得意]" },
{ "name": "Expression_6", "text": "[流泪]" },
{ "name": "Expression_7", "text": "[害羞]" },
{ "name": "Expression_8", "text": "[闭嘴]" },
{ "name": "Expression_9", "text": "[睡]" },
{ "name": "Expression_10", "text": "[大哭]" },
{ "name": "Expression_11", "text": "[尴尬]" },
{ "name": "Expression_12", "text": "[发怒]" },
{ "name": "Expression_13", "text": "[调皮]" },
{ "name": "Expression_14", "text": "[呲牙]" },
{ "name": "Expression_15", "text": "[惊讶]" },
{ "name": "Expression_16", "text": "[难过]" },
{ "name": "Expression_17", "text": "[酷]" },
{ "name": "Expression_18", "text": "[冷汗]" },
{ "name": "Expression_19", "text": "[抓狂]" },
{ "name": "Expression_20", "text": "[吐]" },
{ "name": "Expression_21", "text": "[偷笑]" },
{ "name": "Expression_22", "text": "[愉快]" },
{ "name": "Expression_23", "text": "[白眼]" },
{ "name": "Expression_24", "text": "[傲慢]" },
{ "name": "Expression_25", "text": "[饥饿]" },
{ "name": "Expression_26", "text": "[困]" },
{ "name": "Expression_27", "text": "[恐惧]" },
{ "name": "Expression_28", "text": "[流汗]" },
{ "name": "Expression_29", "text": "[憨笑]" },
{ "name": "Expression_30", "text": "[悠闲]" },
{ "name": "Expression_31", "text": "[奋斗]" },
{ "name": "Expression_32", "text": "[咒骂]" },
{ "name": "Expression_33", "text": "[疑问]" },
{ "name": "Expression_34", "text": "[嘘]" },
{ "name": "Expression_35", "text": "[晕]" },
{ "name": "Expression_36", "text": "[疯了]" },
{ "name": "Expression_37", "text": "[衰]" },
{ "name": "Expression_38", "text": "[骷髅]" },
{ "name": "Expression_39", "text": "[敲打]" },
{ "name": "Expression_40", "text": "[再见]" },
{ "name": "Expression_41", "text": "[擦汗]" },
{ "name": "Expression_42", "text": "[抠鼻]" },
{ "name": "Expression_43", "text": "[鼓掌]" },
{ "name": "Expression_44", "text": "[糗大了]" },
{ "name": "Expression_45", "text": "[坏笑]" },
{ "name": "Expression_46", "text": "[左哼哼]" },
{ "name": "Expression_47", "text": "[右哼哼]" },
{ "name": "Expression_48", "text": "[哈欠]" },
{ "name": "Expression_49", "text": "[鄙视]" },
{ "name": "Expression_50", "text": "[委屈]" },
{ "name": "Expression_51", "text": "[快哭了]" },
{ "name": "Expression_52", "text": "[阴险]" },
{ "name": "Expression_53", "text": "[亲亲]" },
{ "name": "Expression_54", "text": "[吓]" },
{ "name": "Expression_55", "text": "[可怜]" },
{ "name": "Expression_56", "text": "[菜刀]" },
{ "name": "Expression_57", "text": "[西瓜]" },
{ "name": "Expression_58", "text": "[啤酒]" },
{ "name": "Expression_59", "text": "[篮球]" },
{ "name": "Expression_60", "text": "[乒乓]" },
{ "name": "Expression_61", "text": "[咖啡]" },
{ "name": "Expression_62", "text": "[饭]" },
{ "name": "Expression_63", "text": "[猪头]" },
{ "name": "Expression_64", "text": "[玫瑰]" },
{ "name": "Expression_65", "text": "[凋谢]" },
{ "name": "Expression_66", "text": "[嘴唇]" },
{ "name": "Expression_67", "text": "[爱心]" },
{ "name": "Expression_68", "text": "[心碎]" },
{ "name": "Expression_69", "text": "[蛋糕]" },
{ "name": "Expression_70", "text": "[闪电]" },
{ "name": "Expression_71", "text": "[炸弹]" },
{ "name": "Expression_72", "text": "[刀]" },
{ "name": "Expression_73", "text": "[足球]" },
{ "name": "Expression_74", "text": "[瓢虫]" },
{ "name": "Expression_75", "text": "[便便]" },
{ "name": "Expression_76", "text": "[月亮]" },
{ "name": "Expression_77", "text": "[太阳]" },
{ "name": "Expression_78", "text": "[礼物]" },
{ "name": "Expression_79", "text": "[拥抱]" },
{ "name": "Expression_80", "text": "[强]" },
{ "name": "Expression_81", "text": "[弱]" },
{ "name": "Expression_82", "text": "[握手]" },
{ "name": "Expression_83", "text": "[胜利]" },
{ "name": "Expression_84", "text": "[抱拳]" },
{ "name": "Expression_85", "text": "[勾引]" },
{ "name": "Expression_86", "text": "[拳头]" },
{ "name": "Expression_87", "text": "[差劲]" },
{ "name": "Expression_88", "text": "[爱你]" },
{ "name": "Expression_89", "text": "[NO]" },
{ "name": "Expression_90", "text": "[OK]" },
{ "name": "Expression_91", "text": "[爱情]" },
{ "name": "Expression_92", "text": "[飞吻]" },
{ "name": "Expression_93", "text": "[跳跳]" },
{ "name": "Expression_94", "text": "[发抖]" },
{ "name": "Expression_95", "text": "[怄火]" },
{ "name": "Expression_96", "text": "[转圈]" },
{ "name": "Expression_97", "text": "[磕头]" },
{ "name": "Expression_98", "text": "[回头]" },
{ "name": "Expression_99", "text": "[跳绳]" },
{ "name": "Expression_100", "text": "[投降]" },
{ "name": "Expression_101", "text": "[激动]" },
{ "name": "Expression_102", "text": "[街舞]" },
{ "name": "Expression_103", "text": "[献吻]" },
{ "name": "Expression_104", "text": "[左太极]" },
{ "name": "Expression_105", "text": "[右太极]" }
];
return emoArr;
}
//表情转换
function face(obj) {
let emotion = emotionFun();
let emotionHost = "https://930-test-sh.oss-cn-shanghai.aliyuncs.com/emoji/";
let face = {};
for (let i = 0; i < emotion.length; i++) {
face[emotion[i].text] = '<img src="' + emotionHost + emotion[i].name + '.png" style="widht:20px;height:20px;vertical-align: middle;"/>'
}
return face[obj];
}
\ No newline at end of file
{
{
"usingComponents": {}
}
\ No newline at end of file
<!--pages/key/key.wxml-->
<!--pages/key/key.wxml-->
<view class="page">
<!-- start key view -->
<view class="weui-cells">
<scroll-view scroll-y="true" style="height:{{keyHeight}}px;position:fixed; top:0;">
<navigator class="weui-cell weui-cell_access" hover-class="weui-cell_active" url="/pages/key/matchTest/matchTest">
<view class="weui-cell__hd">
<image src="/icon/daily.png" />
</view>
<view class="weui-cell__bd">随便看看</view>
<view class="weui-cell__ft weui-cell__ft_in-access"></view>
</navigator>
<navigator class="weui-cell weui-cell_access" hover-class="weui-cell_active" url="/pages/key/matchStudy/matchStudy">
<view class="weui-cell__hd">
<image src="/icon/study.png"/>
</view>
<view class="weui-cell__bd">知识学习</view>
<view class="weui-cell__ft weui-cell__ft_in-access"></view>
</navigator>
</scroll-view>
</view>
<!--end key view -->
<!--公屏view-->
<view style="height:{{chatHeight+40}}px;position:fixed; bottom:0;">
<view class="weui-cell weui-cell_access">
<view class="weui-cell__bd">公屏发言</view>
</view>
<scroll-view scroll-y="true" scroll-top="{{scrollTop}}" style="height:{{chatHeight}}px;position:fixed; bottom:0;">
<view class="wrapper {{isShowAdd?'media-padd':''}} {{isEmotion?'emotion-padd':''}}" id="wrapperCon" bindtap="cancelShow" >
<!-- 消息列表 -->
<view class="chat {{item.type=='L'?'chat-l':'chat-r'}}" wx:for="{{messageList}}" wx:for-item="item">
<!-- <view class="c-date">2019年3月23日 15:33</view> -->
<view class="message-list">
<view class="avater {{item.type=='R'?'avater-r':''}}">
<!-- refer https://www.jianshu.com/p/7ad22e35b556 -->
<image src='{{item.avater}}' bindtouchstart='touchstart_long' bindtouchend='touchEnd' data-id="{{item.nickName}}"></image>
<view class="{{item.type=='R'?'nick-name-r':'nick-name-l'}}" wx:if="{{item.type=='L'}}">{{item.nickName}}</view>
<view class="{{item.type=='R'?'nick-name-r':'nick-name-l'}}" wx:if="{{item.type=='R'}}">{{item.nickName}}</view>
</view>
<view class="chat-con {{item.type=='L'?'chat-con-l':'chat-con-r'}} ">
<rich-text wx:if="{{item.messageType=='txt'}}" nodes="{{item.con}}"></rich-text>
<image class="message-img" mode="widthFix" bindtap="imagePreview" data-src="{{item.con}}" wx:if="{{item.messageType=='img'}}" src="{{item.con}}"></image>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
<!-- 消息输入 -->
<view class="message-input">
<input class="{{isShowAdd?'':'showSend'}}" placeholder="请输入内容" type="text" value="{{messageInputVal}}" cursor-spacing="10" bindinput='messageInput' confirm-type="send" bindconfirm="messageSend" />
<button bindtap="messageSend">发送</button>
<image mode="widthFix" class="input-img {{isShowAdd?'':'showAdd'}}" src='../../icon/chat/face1.png' id="face" bindtap="openEmotion"></image>
<!-- 表情文件 -->
<view class="emotion-box" wx:if="{{isEmotion}}">
<swiper class="home-swiper" indicator-dots="true" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" indicator-dots="{{indicatorDots}}">
<swiper-item class="emotion-list">
<block wx:for-items="{{emotionArr}}" wx:key='index' wx:if="{{index<23}}">
<image bindtap="selectEmotion" data-txt="{{item.text}}" src="{{emotionHost+item.name}}.png" class="slide-image" />
</block>
<image src="../../icon/chat/delete.png" bindtap="deleteVal" class="slide-image" />
</swiper-item>
<swiper-item class="emotion-list">
<block wx:for-items="{{emotionArr}}" wx:key='index' wx:if="{{index>=23&&index<46}}">
<image bindtap="selectEmotion" data-txt="{{item.text}}" src="{{emotionHost+item.name}}.png" class="slide-image" />
</block>
<image src="../../icon/chat/delete.png" bindtap="deleteVal" class="slide-image" />
</swiper-item>
<swiper-item class="emotion-list">
<block wx:for-items="{{emotionArr}}" wx:key='index' wx:if="{{index>=46&&index<69}}">
<image bindtap="selectEmotion" data-txt="{{item.text}}" src="{{emotionHost+item.name}}.png" class="slide-image" />
</block>
<image src="../../icon/chat/delete.png" bindtap="deleteVal" class="slide-image" />
</swiper-item>
<swiper-item class="emotion-list">
<block wx:for-items="{{emotionArr}}" wx:key='index' wx:if="{{index>=69&&index<92}}">
<image bindtap="selectEmotion" data-txt="{{item.text}}" src="{{emotionHost+item.name}}.png" class="slide-image" />
</block>
<image src="../../icon/chat/delete.png" bindtap="deleteVal" class="slide-image" />
</swiper-item>
</swiper>
</view>
</view>
</view>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论