Commit 8d728f61 by jscat

nyx weapp: 功能更新

1. 实现多播放窗口
parent 465d59c3
{ {
"pages": [ "pages": [
"pages/live/live",
"pages/live/live-info/live-info",
"pages/activity/activity", "pages/activity/activity",
"pages/share/share", "pages/share/share",
"pages/live/live",
"pages/live/live-info/live-info",
"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",
......
// pages/activity/activity-info/activity-info.js // pages/key/key.js
var config = wx.getStorageSync("config"); var config = wx.getStorageSync("config");
var app = getApp(); var app = getApp();
var event = require('./../../../utils/event.js')
var util = require('./../../../utils/util.js')
Page({ Page({
/** /**
* 系统配置:主要用于置底页面设置 step1
*/
keyHeight: '',
chatHeight: "",
/**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { 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: true,
/* 用户信息及商家信息 */ // socket
nyxCode : "", user_input_text: '',//用户输入文字
authStatus : "", // 授权状态: 00-未授权, 01-已授权 inputValue: '',
userInfo : {}, returnValue: '',
members : [], // 商家信息 addImg: false,
member: {}, // 默认商家信息 //格式示例数据,可为空
allContentList: [],
num: 0,
sid: "key",
chatUserInfo: {},
scrollTop: 0,
windowHeight: "", //头像点击参数
windowWidth: "", touchStart: 0,
contentHeight: "", touchEnd: 0,
scrollLeft: 0, //切换栏的滚动条位置 touchTime: 0,
touchId: "",
// 基础数据 //榜单栏 jscat 2020/11/20
curImage: 0, // 用于image switch, //图片轮循的时候, 不同步更新价格 jscat 20200921 /*
curIndex: 0, // 给选中的tab加粗 榜单数据流: 1_server vs n_client
activityInfo: {}, // 活动基础信息 1) client: socket: 上传文字 @cincin #南沙, dict->string
products: [], // 活动类别详情 2) client: weapp : dict->string, 调用server, 更新redis
products_string : {}, //活动类别详情对应的string, 主要用于navigator传值 3) server: jaapp : 解析并更新redis
4) server: socket: sendData to n_client
5) client: socket: receive , 更新 local rankData_raw, 更新list
6) client: weapp : 点击; rankData_raw -> list data
//点赞模块 */
likeDictUpdate: {}, // 判断当前页面是否存在点赞操作 selected : '@',
likeStatus: 0, // 判断like图标的状态 likeUrl: "../../../icon/activity/like_selected.png", // like图标的url
likeUrl: "../../../icon/activity/like.png", // like图标的url //directly to redis
rankData_raw_like: {
//swiper的高度 '@叁年间' : 100,
swiperViewHeight: 0 '@cincin' : 40,
'@rbar' : 40,
'@Piupiu' : 40,
"#六尾的大baby": 100,
"#南沙": 39,
"#小妹最乖哦": 3123,
},
rankData: [
{
name: "@叁年间",
like:100
},
{
name:"@cincin",
like:40
}
],
bottom_val: 0,
pxToRpxScale: 0,
tabBarHeight: 0,
streamer_name: "",
}, },
...@@ -44,18 +104,9 @@ Page({ ...@@ -44,18 +104,9 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
var _this = this; var _this = this;
var windowHeight = wx.getSystemInfoSync().windowHeight;//获取设备高度,小程序自带的方法 console.log('===onLoad, options_', JSON.stringify(options));
var windowWidth = wx.getSystemInfoSync().windowWidth;//获取设备高度,小程序自带的方法
this.setData({
windowHeight: windowHeight,
windowWidth: windowWidth,
contentHeight : windowHeight * 0.675,
})
wx.setNavigationBarTitle({
title: '活动详情',
})
//step1: 初始化商家及用户数据 /*step1 先确定用户信息 */
var nyxCode = wx.getStorageSync('nyxCode'); var nyxCode = wx.getStorageSync('nyxCode');
//不存在 //不存在
if (!nyxCode) if (!nyxCode)
...@@ -63,332 +114,807 @@ Page({ ...@@ -63,332 +114,807 @@ Page({
//注册新用户 //注册新用户
console.log("===onLoad_regUser") console.log("===onLoad_regUser")
wx.clearStorageSync('nyxCode'); wx.clearStorageSync('nyxCode');
var nyxCode = "uid_" + util.wxuuid() nyxCode = "uid_" + util.wxuuid()
wx.setStorageSync('nyxCode', nyxCode); wx.setStorageSync('nyxCode', nyxCode);
app.globalData.nyxCode = nyxCode; app.globalData.nyxCode = nyxCode;
app.regUser(nyxCode); // nyxCode, userInfo, authStatus: storage, globalData app.regUser(nyxCode);
} }
else { else //存在
_this.setData({ {
nyxCode: wx.getStorageSync('nyxCode'), //更新用户信息
userInfo: wx.getStorageSync('userInfo'), var strUrl = config.userinfo_query_url + "?userid=" + nyxCode
authStatus: wx.getStorageSync('authStatus'), wx.setStorageSync('nyxCode', nyxCode);
members : wx.getStorageSync('members'), 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")
}
}) })
} }
//step2: 获取上一页面传入的数据 //step2: 获取上一页面传入的数据
var activityInfo = _this.__data__.activityInfo var sid = _this.__data__.sid
if (Object.keys(activityInfo).length==0 && options.title != "") var streamer_name = _this.__data__.streamer_name
if ( options.sid != "")
{ {
activityInfo['activity_id'] = options.activity_id; sid = options.sid;
activityInfo['note_image'] = options.note_image.split("::"); streamer_name = options.streamer_name;
activityInfo['title'] = options.title;
activityInfo['content'] = options.content;
activityInfo['num_like'] = options.num_like;
activityInfo['address_name'] = options.address_name;
activityInfo['product_desc'] = options.product_desc;
activityInfo['unit_price'] = parseFloat(options.unit_price).toFixed(2);
activityInfo['member_id'] = options.member_id;
activityInfo['member_name'] = options.member_name;
activityInfo['member_slogan'] = options.member_slogan;
activityInfo['start_datetime'] = options.start_datetime;
activityInfo['end_datetime'] = options.end_datetime;
activityInfo['member_logo'] = options.member_logo==""?'/icon/icon_avatar1.png':options.member_logo;
} }
_this.setData({ activityInfo }) _this.setData({ sid, streamer_name })
//step3: 获取products, 活动的具体类别 //初始化socket
_this.getProducts(activityInfo['activity_id']) 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, "来到"+_this.data.streamer_name+"现场")
app.globalData.socketClose = false
}
}
wx.setNavigationBarTitle({
title: "现场播放"
})
// step4 确定member信息, 写入 data.members /**
let promise_member = new Promise(function (resolve, reject) { * 系统配置:主要用于置底页面设置 step2
app.getMembers(0, 1, 20, resolve, reject); let h = 750 * res.windowHeight/res.windowWidth
*/
let systemInfo = wx.getSystemInfoSync()
// px转换到rpx的比例
let pxToRpxScale = 750 / systemInfo.windowWidth;
//获取设备高度,小程序自带的方法
var windowHeight = systemInfo.windowHeight;
var keyHeight = windowHeight*0.3
keyHeight = 16*3+8*(3+2) // 16: font-size; 8: padding: 16rpx
var chatHeight = windowHeight - keyHeight - 60 // in px
_this.setData({
keyHeight: keyHeight * pxToRpxScale, //in rpx for compatible
chatHeight: chatHeight * pxToRpxScale, // in rpx for compatible
}) })
promise_member.then( // 状态栏的高度
function (value){ let ktxStatusHeight = systemInfo.statusBarHeight * pxToRpxScale
var members = wx.getStorageSync('members')
var member = wx.getStorageSync('member')
_this.setData({ member, members})
console.log("===enter promise_member then_passed_" + value)
},
function (value){
console.log("===enter promise_member then_failed_" + value)
},
);
// step5 数据载入页面, 初始化 // 计算导航栏的高度
// 初始载入'我已收藏'的清单, 存入storage // 此高度基于右上角菜单在导航栏位置垂直居中计算得到
let promise_like = new Promise(function (resolve, reject) { // ipx: 44
app.getCollectsStorage(0, 1, 100, resolve, reject); // ipx: height + (top - statusBarHeight) * 2;
}) var navBarHeight = 44
let navigationHeight = navBarHeight * pxToRpxScale
promise_like.then( // window的宽度
function (value){ // let ktxWindowWidth = systemInfo.windowWidth * pxToRpxScale
var likeDictStorage = wx.getStorageSync('likeDictStorage') // window的高度
if(likeDictStorage.hasOwnProperty([activityInfo['activity_id']]) let ktxWindowHeight = systemInfo.windowHeight * pxToRpxScale
&& likeDictStorage[activityInfo['activity_id']] == 1 ) // 屏幕的高度
{ let ktxScreentHeight = systemInfo.screenHeight * pxToRpxScale
//同步更新likeStatus和likeUrl // 底部tabBar的高度
var likeStatus = 1 let tabBarHeight = ktxScreentHeight - ktxStatusHeight - navigationHeight - ktxWindowHeight
var likeUrl = "../../../icon/activity/like_selected.png" _this.setData({ pxToRpxScale, tabBarHeight })
_this.setData({ //模拟表情数据
likeStatus: likeStatus, let emotion = emotionFun();
likeUrl: likeUrl, this.setData({
}) emotionArr: emotion,
emotionHost: app.globalData.emotionHost
})
//构建榜单数据
_this.onGetRedisLike()
},
// 初始化socket, 监听socket
onShow: function () {
var _this = this;
//构建榜单数据
_this.onGetRedisLike()
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, "来到"+_this.data.streamer_name+"现场")
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)
} }
console.log("===enter promise_like then_passed_" + value)
}, for (var i = 0; i < app.globalData.socketMsgQueue.length; i++) {
function (value){ _this.sendSocketMessage(app.globalData.socketMsgQueue[i])
console.log("===enter promise_like then_failed_" + value) }
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, "来到"+_this.data.streamer_name+"现场")
}, 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 () { onReady: function (){
var _this = this;
}, },
/** /*
* 生命周期函数--监听页面显示
*/
onShow: function () {
*/
//点击空白页,隐藏表情和图片选择
cancelShow() {
this.setData({
isEmotion: false,
isMedia: false
})
}, },
/** //打开媒体选择
* 生命周期函数--监听页面隐藏 openMedia() {
*/ this.scrollBottom();
onHide: function () { this.setData({
isMedia: !this.data.isMedia,
isEmotion: 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 () { onUnload: function () {
app.closeSocket();
console.log('===onUnload webSocket 连接关闭事件。')
},
//聚焦
inputFocus:function(e)
{
console.log(e)
var _this = this; var _this = this;
var tabBarHeight = _this.__data__.tabBarHeight
var pxToRpxScale = _this.__data__.pxToRpxScale
console.log("===tabBarHeight", tabBarHeight)
console.log("===pxToRpxScale", pxToRpxScale)
_this.setData({
bottom_val: e.detail.height==0 ? 0 : e.detail.height*pxToRpxScale - tabBarHeight
})
},
inputBlur: function(e){
console.log(e)
var _this = this;
_this.setData({
bottom_val: 0,
})
},
// 获取likeDictUpdate //发送消息
var likeDictUpdate = _this.__data__.likeDictUpdate messageSend: function () {
var userId = _this.__data__.nyxCode let self = this;
var activityId = _this.__data__.activityInfo['activity_id'] let messageVal = self.data.messageInputVal;
var numLike = _this.__data__.activityInfo['num_like'] if (!messageVal) {
// 如果存在update操作, 则更新 wx.showToast({
if (likeDictUpdate.hasOwnProperty(activityId) && likeDictUpdate[activityId] != 0 ) { title: '请输入内容',
icon: 'none',
// step1: 更新数据库 duration: 2000
_this.submitLike(userId, activityId, likeDictUpdate[activityId]) })
return false;
// step2: 通过eventBus影响订阅页(首页或者收藏页)的数据 }
var data = {
'activity_id': activityId, //表情处理
'num_like' : numLike var reg = /\[.+?\]/g;
} let newVal = messageVal.replace(reg, function (a, b) {
event.emit('LikeChanged', data); 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.submitToLike(messageVal, 'txt')
self.submitTo(messageVal, 'txt')
//更新数据(模拟请求历史数据)
self.setData({
messageInputVal: "",
messageList: newMessageArr,
isEmotion: false,
isMedia: false,
isShowAdd: true,
showSend: 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
})
this.isShowAddFun();
},
//是否显示添加按钮
isShowAddFun() {
//如果有输入显示发送按钮,隐藏加号添加图片功能
if (this.data.messageInputVal) {
this.setData({
isShowAdd: false
})
} else {
this.setData({
isShowAdd: true
})
} }
}, },
/** //选择图片, 审核图片, 上传图片
* 页面相关事件处理函数--监听用户下拉动作 /*
*/ 目标: 顺序审核+上传; 错误才提示
onPullDownRefresh: function () { 流程
1. 上传server
2. 图片检测
resolve: 上传并返回地址
reject : showModal
*/
selectImg() {
let self = this;
//默认选择完之后自动隐藏
self.setData({
isMedia: false
})
wx.chooseImage({
count: 3,
sizeType: ['original', 'compressed'],
sourceType: ['album'],
success(res) {
// tempFilePath可以作为img标签的src属性显示图片
const tempFilePaths = res.tempFilePaths
// console.log(tempFilePaths);
checkAndUploadFiles(self, tempFilePaths, 0);
}
})
}, },
//拍照
selectCamera() {
let self = this;
//默认选择完之后自动隐藏
self.setData({
isMedia: false
})
wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['camera'],
success(res) {
// tempFilePath可以作为img标签的src属性显示图片
const tempFilePaths = res.tempFilePaths;
// console.log(tempFilePaths);
checkAndUploadFiles(self, tempFilePaths, 0);
}
})
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
}, },
//图片预览
imagePreview(e) {
//console.log(e.currentTarget.dataset.src);
let img = e.currentTarget.dataset.src;
let urlsArr = [];
urlsArr.push(img);
wx.previewImage({
current: img, //当前预览的图片
urls: urlsArr, //所有要预览的图片
})
},
/** // 提交文字
* 用户分享 submitTo: function (inputValue, type) {
* 1. 点击右上角分享 let _this = this;
* 2. 点击tab栏分享
*/ if (app.globalData.socketTask.readyState == 1) {
onShareAppMessage: function (options) { // 如果打开了socket就发送数据给服务器
var _this = this; var msg = JSON.stringify({
var url_activity = "/pages/activity/activity-info/activity-info?" 'cmd': 'onData',
+"activity_id="+_this.data.activityInfo["activity_id"] 'uid': app.globalData.nyxCode,
+"&note_image="+_this.data.activityInfo['note_image'].join("::") 'msg': inputValue,
+"&title="+_this.data.activityInfo["title"] 'type': type, // txt: 对应文字; img: 对应图片
+"&content="+_this.data.activityInfo["content"] })
+"&num_like="+_this.data.activityInfo['num_like'] _this.sendSocketMessage(msg)
+"&address_name="+_this.data.activityInfo["address_name"]
+"&member_id="+_this.data.activityInfo["member_id"]
+"&member_name="+_this.data.activityInfo["member_name"]
+"&member_slogan="+_this.data.activityInfo["member_slogan"]
+"&member_logo="+_this.data.activityInfo["member_logo"]
+"&start_datetime="+_this.data.activityInfo["start_datetime"]
+"&end_datetime="+_this.data.activityInfo["end_datetime"]
var shareObj = {
    title: "好友推荐: "+ _this.data.activityInfo['title'],
    path: url_activity, // 默认是当前页面,必须是以'/'开头的完整路径
    imageUrl: _this.data.activityInfo['note_image'][0]
} }
// 来自页面内的按钮的转发
  if( options.from == 'button' ){
    // 此处可以修改 shareObj 中的内容
    shareObj.path = url_activity;
  }
return shareObj;
}, },
/** // 提交引用 Like
* submitToLike: function (inputValue, type) {
* 用户自定义函数 jscat 20200903 let _this = this;
*/
//获取活动的具体子项; products
getProducts(activity_id){
var _this = this;
var pageCount = 10 if (app.globalData.socketTask.readyState == 1) {
var pageNum = 1 // 如果打开了socket就发送数据给服务器
var query_url = '&activityId=' + activity_id var msg = JSON.stringify({
var strUrl = config.product_query_url + "?pageCount=" + pageCount 'cmd': 'onLike',
+ "&pageNum=" + pageNum + query_url 'uid': app.globalData.nyxCode,
config.debug == 1 ? console.log("===strUrl is: \"" + strUrl + "\"") : "" 'msg': inputValue,
wx.request({ 'type': type
url: strUrl, })
method: 'GET', _this.sendSocketMessage(msg)
header: { _this.onUpdateRedisLike(inputValue)
'Cookie': wx.getStorageSync('cookieKey'), }
}, },
success: function (res) {
if (res.data.resultCode == 200) { bindKeyInput: function (e) {
//表示HTTP请求成功 this.setData({
console.log(res.data); inputValue: e.detail.value
var products = [] })
var products_string = {} },
for (var i = 0; i < res.data.data.length; i++) {
var result = {} /*
result["productId"] = res.data.data[i].productId mark: tabbar 切换之后触发onHide()
result["productDesc"] = res.data.data[i].productDesc */
result["unitPrice"] = res.data.data[i].unitPrice.toFixed(2) onHide: function () {
result["quantity"] = res.data.data[i].quantity app.closeSocket();
result["defaultStatus"] = res.data.data[i].defaultStatus console.log('===onHide WebSocket 连接关闭')
products.push(result) },
}
_this.setData({ products }) // 发送和接收 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 = ""
var type = 'txt'
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"
_this.processOpen(text, nickName, avater)
}
else if (json["cmd"] == "onData") {
text = json["msg"]
type = json["type"]
nickName = _this.data.chatUserInfo.nickName
avater = _this.data.chatUserInfo.avatarUrl
_this.processInfo(text, nickName, avater, type)
}
else if (json["cmd"] == "onLike")
{
text = json["msg"]
//https://www.runoob.com/jsref/jsref-obj-regexp.html
// js regex
//获取名字 name,
/*
1. 空格结尾或者没有空格
2. 不包括'@ '和'# '情况
3. #123 #123 这种情况要去掉
*/
var reg = /(@|#)\S.+?(\s+|$)/g;
let newList = text.match(reg);
if(newList != null)
{
var str = uniqueList(newList).join("::")
nickName = _this.data.chatUserInfo.nickName
avater = _this.data.chatUserInfo.avatarUrl
_this.processLike(str, nickName, avater)
}
}
},
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("====")
            }
        }
    })
 }
}, },
//切换所选的类别
switchCategory(e) { switchCategory(e) {
var _this = this; var _this = this;
var curIndex = e.currentTarget.dataset.index ? e.currentTarget.dataset.index : 0 var curIndex = e.currentTarget.dataset.index ? e.currentTarget.dataset.index : 0
this.setData({ curIndex }) this.setData({
curIndex: curIndex,
})
}, },
//滑动获取选中商品 jscat 20201012, obsolete; 不在需要去选中商品 selected: function (e) {
getSelectItem: function (e) { var _this = this;
var that = this; var raw = _this.__data__.rankData_raw_like
var preCurImage = that.data.curImage; //js的e.currentTarget.id 对应wxml的 id="tab0"
var itemWidth = e.detail.scrollWidth / that.data.activityInfo.note_image.length;//每个商品的宽度 //js的e.currentTarget.dataSet.id 对应wxml的 data-id="tab0"
var scrollLeft = e.detail.scrollLeft;//滚动宽度 var index = e.currentTarget.id
if(scrollLeft <= 0 ) let selected = index=='@' ? '@' : "#"
this.setData({
selected
})
_this.genRankData(raw, selected)
},
//处理Like
processLike:function(text, nickName, avater)
{
var _this = this;
var raw = _this.__data__.rankData_raw_like
var selected = _this.__data__.selected
//获取名字 name
//input: @叁年间::#南沙
//output: ['@叁年间', '#南沙']
let newVal = text.split("::")
for(let i=0; i<newVal.length; i++)
{ {
scrollLeft = 0; if(raw.hasOwnProperty(newVal[i]))
{
raw[newVal[i]] = parseInt(raw[newVal[i]])+1
}
else
{
raw[newVal[i]] = 1
}
} }
console.log("===scrollLeft_", scrollLeft)
var curImage = Math.round(scrollLeft / itemWidth);//通过Math.round方法对滚动大于一半的位置进行进位 //更新数据(模拟请求历史数据)
var newScrollLeft = 0 _this.genRankData(raw, selected)
// 目标: 始终让图片居中显示
if (curImage != preCurImage },
|| (curImage == that.data.activityInfo.note_image.length - 1 && scrollLeft > that.data.windowWidth * (that.data.activityInfo.note_image.length - 1))
) //处理open的代码
processOpen:function(text, nickName, avater)
{
var _this = this;
//表情处理
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 (
(app.globalData.onOpenOp.key!=true)
|| (_this.data.chatUserInfo.userid != app.globalData.nyxCode)
)
{ {
newScrollLeft = that.data.windowWidth * curImage messageArr.push(objL);
scrollLeft = newScrollLeft
} }
that.setData({ app.globalData.onOpenOp.key = true;
scrollLeft : scrollLeft,
curImage : curImage, //图片轮循的时候, 不同步更新价格 jscat 20200921 let newMessageArr = _this.data.messageList.concat(messageArr);
});
//更新数据(模拟请求历史数据)
_this.setData({
messageInputVal: "",
messageList: newMessageArr,
isEmotion: false,
isMedia: false,
})
_this.scrollBottom();
}, },
//跳转到结算页 order.wxml //处理info data, main func
toBuy: function (e) { /*
type: 'txt'|'img'
*/
processInfo: function(text, nickName, avater, type)
{
var _this = this; var _this = this;
var products_string = JSON.stringify(_this.data.products); //表情处理
var url = "/pages/mall/order/order?" var reg = /\[.+?\]/g;
+ "&activity_id=" + _this.__data__.activityInfo["activity_id"] let newVal = text.replace(reg, function (a, b) {
+ "&productsstring=" + products_string return face(a) ? face(a) : a;
+ "&curIndex=" + _this.data.curIndex });
wx.navigateTo({
url: url //回复
}); let objL = {
}, nickName: nickName,
type: 'L',
//跳转到结算页 order.wxml messageType: type,
toOrder: function (e) { con: newVal,
var _this = this; avater: avater,
var products_string = JSON.stringify(_this.data.products); };
var url = "/pages/mall/order/order?" let messageArr = [];
+ "&activity_id=" + _this.__data__.activityInfo["activity_id"]
+ "&products_string=" + products_string //jscat 20200314 most important!
+ "&product_image=" + _this.__data__.activityInfo['note_image'][0] // 判断内容是否显示
+ "&member_name=" + _this.__data__.activityInfo['member_name'] // 1. 发送data,同时非自己
+ "&title=" + _this.__data__.activityInfo['title'] // 2. (自己登陆,不需要重复发送),
+ "&curIndex=" + _this.data.curIndex // 3. (竞答完成后,需要发送内容)
wx.navigateTo({ // 4. (别人登陆, 需要发送)
url: url if (
}); (_this.data.chatUserInfo.userid != app.globalData.nyxCode)
}, )
{
messageArr.push(objL);
}
let newMessageArr = _this.data.messageList.concat(messageArr);
//更新数据(模拟请求历史数据)
_this.setData({
messageInputVal: "",
messageList: newMessageArr,
isEmotion: false,
isMedia: false,
})
_this.scrollBottom();
//跳转到首页 },
toHome: function (e) {
wx.switchTab({ genRankData: function(raw, rankType)
url: "/pages/activity/activity" {
});
},
//点击clone后跳转至活动创建页面
// 数据通过app.globalData
// app.globalData.postData
// photoTag: "",
// photoTitle: "",
// photoContent: "",
// photoProduct: [],
// startDatetime: "",
// endDatetime: "",
onClickClone: function (e) {
var _this = this; var _this = this;
var url = "/pages/member/activity-post/activity-post" //raw: dict, {"@叁年间":100, "#123":34}
// 构造数据 //rankType: string, "@"
app.globalData.postData.startDatetime = _this.data.activityInfo["start_datetime"] var rankData = []
app.globalData.postData.endDatetime = _this.data.activityInfo["end_datetime"] var res = Object.keys(raw).sort(function(a,b){ return raw[b]-raw[a]; });
app.globalData.postData.photoTitle = _this.data.activityInfo["title"] for (var key in res)
app.globalData.postData.photoContent = _this.data.activityInfo["content"] {
app.globalData.postData.photoProduct = _this.data.products if(res[key][0] == rankType)
{
var dict = {}
var key1 = res[key].replace(rankType,"")
dict["name"] = key1
dict["like"] = raw[res[key]]
rankData.push(dict)
}
}
_this.setData({rankData })
wx.switchTab({
url: url
});
}, },
submitLike: function (userId, activityId, op) { updateRedisLike: function(strUrl)
{
var _this = this; var _this = this;
var query_url = '?activityId=' + activityId + '&userId=' + userId
var strUrl = op == 1 ? config.collect_like_url + query_url : config.collect_like_del_url + query_url
config.debug == 1 ? console.log("===submitLike strUrl is: " + strUrl) : ""
wx.request({ wx.request({
url: strUrl, url: strUrl,
method: 'GET', method: 'GET',
...@@ -396,88 +922,340 @@ Page({ ...@@ -396,88 +922,340 @@ Page({
'Cookie': wx.getStorageSync('cookieKey'), 'Cookie': wx.getStorageSync('cookieKey'),
}, },
success: function (res) { success: function (res) {
if (res.statusCode == 200) { if ( res.data.resultCode == 200 ) {
//表示查询成功 //表示query成功
console.log(res.data); console.log("===updateRedisLike完成");
} }
},
fail : function(res)
{
console.log("===updateRedisLike失败")
} }
}) })
}, },
// 接收前端请求 //调用java接口, 同步更新redis的like数据
onSubmitLike: function (e) { onUpdateRedisLike: function(text)
{
var _this = this; var _this = this;
let activityId = e.currentTarget.dataset.id; // 获取活动id
var activityInfo = _this.__data__.activityInfo
// storage.likeDictStorage 只负责前端显示
// data.likeDictUpdate 负责数据库操作
var likeStatus = 0
var likeDictUpdate = _this.__data__.likeDictUpdate
var likeDictStorage = wx.getStorageSync('likeDictStorage') || {}
// 添加操作, 一定是storage的值为0或者undefined
if (!likeDictStorage.hasOwnProperty(activityId) || likeDictStorage[activityId] == 0 ) {
// 同步更新likeDictStorage, likeDictUpdate和activityInfo, like+1
// 同步更新前端
activityInfo['num_like'] = parseInt(activityInfo['num_like']) + 1
likeDictStorage[activityId] = 1
likeStatus = 1
// 表示本页面有数据操作
likeDictUpdate[activityId] = likeDictUpdate.hasOwnProperty(activityId) ? likeDictUpdate[activityId] + 1 : 1
wx.setStorageSync('likeDictStorage', likeDictStorage)
} var reg = /(@|#)\S.+?(\s+|$)/g;
// 删除操作, 一定是storage的值为1 let newList = text.match(reg);
else if(likeDictStorage.hasOwnProperty(activityId) && likeDictStorage[activityId] == 1 ) if(newList != null)
{ {
//同步更新likeDict和activityInfo, like-1 var str = uniqueList(newList).join("::").replace(/#/g, "%23")
activityInfo['num_like'] = parseInt(activityInfo['num_like']) - 1 var strUrl = config.redis_update_like_url + "?keyString="+str
likeDictStorage[activityId] = 0 config.debug == 1?console.log("===updateRedisLike strUrl "+strUrl):""
likeStatus = 0
likeDictUpdate[activityId] = likeDictUpdate.hasOwnProperty(activityId) ? likeDictUpdate[activityId] - 1 : -1 _this.updateRedisLike(strUrl)
wx.setStorageSync('likeDictStorage', likeDictStorage)
} }
_this.setData({ },
likeDictUpdate: likeDictUpdate,
likeStatus: likeStatus, //调用java接口, 同步查询redis的like数据
likeUrl:likeStatus==1?"../../../icon/activity/like_selected.png":"../../../icon/activity/like.png", getRedisLike: function(strUrl)
activityInfo: activityInfo, {
var _this = this;
wx.request({
url: strUrl,
method: 'GET',
header: {
'Cookie': wx.getStorageSync('cookieKey'),
},
success: function (res) {
if ( res.data.resultCode == 200 ) {
//表示query成功
console.log("===updateRedisLike完成");
var rankData_raw_like = res.data.data
_this.setData({ rankData_raw_like })
_this.genRankData(rankData_raw_like, '@')
}
},
fail : function(res)
{
console.log("===updateRedisLike失败")
}
}) })
}, },
//动态设置swiper的高度; jscat 20201012, obsolete //调用java接口, 同步get redis的like数据
setSwiperHeight: function () { onGetRedisLike: function(){
let that = this var _this = this;
wx.getSystemInfo({ var strUrl = config.redis_query_like_url
success: function(res) { config.debug == 1?console.log("===getRedisLike strUrl "+strUrl):""
that.setData({ _this.getRedisLike(strUrl)
windowHeight: res.windowHeight,
}); },
})
//通过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)
} }
}); })
// 根据文档中的介绍,先创建一个SelectorQuery对象实例 })
let query = wx.createSelectorQuery().in(this); }
query.select('.image_view').boundingClientRect();
// 执行上面所指定的请求,结果会按照顺序存放于一个数组中,在callback的第一个参数中返回
query.exec((res) => {
//取出表头高度
let headerHeight = res[0].height;
// 计算出去除表头剩余的高度
let swiperViewHeight = headerHeight;
this.setData({
swiperViewHeight: swiperViewHeight
});
});
},
/**
* 采用递归的方式多文件上传
* imgPaths:需要上传的文件列表
* index:imgPaths开始上传的序号
*/
function checkAndUploadFiles(self, imgPaths, index) {
var strUrl = config.check_upload_pic_url
wx.uploadFile({
url: strUrl, //上传的接口地址
filePath: imgPaths[index], //上传的图片(每次单张,一张张上传)
name: 'file',
success: function (res) { // resultCode: "200"
var imgUrl = config.image_url
//成功,文件返回值存入成功列表
var result = JSON.parse(res.data);
if (result && result.data && result.data.errcode == '0') {
console.log('upload...', result.data);
//上传成功之后,可以做别的操作,例如发送消息,上传头像等。
let objR = {
type: 'R',
con: imgUrl + result.data.paths[0],
messageType: 'img',
avater: app.globalData.userInfo.avatarUrl,
};
let messageArr = [];
messageArr.push(objR);
let newMessageArr = self.data.messageList.concat(messageArr);
self.submitTo(imgUrl + result.data.paths[0], 'img')
//更新数据
self.setData({
messageInputVal: "",
messageList: newMessageArr,
isEmotion: false,
isMedia: false
})
}
else {
if (result.data.errcode == '87014') {
wx.hideLoading();
var num = parseInt(index)+1
wx.showModal({
content: '第' + num + '张图存在敏感内容, 请更换',
showCancel: false,
confirmText: '明白了'
})
} else {
wx.hideLoading();
wx.showModal({
content: '系统错误,请稍后再试',
showCancel: false,
confirmText: '明白了'
})
}
}
},
complete: function (e) {
index++; //下一张
if (index < imgPaths.length) {
//递归调用,上传下一张
checkAndUploadFiles(self, imgPaths, index);
}
}
})
}
/**
* 采用递归的方式多文件上传
* imgPaths:需要上传的文件列表
* index:imgPaths开始上传的序号
*/
function uploadFiles(self, imgPaths, index) {
var strUrl = config.upload_url
wx.uploadFile({
url: strUrl, //上传的接口地址
filePath: imgPaths[index], //上传的图片(每次单张,一张张上传)
name: 'file',
success: function (res) {
var imgUrl = config.image_url
//成功,文件返回值存入成功列表
if (res && res.data) {
var data = JSON.parse(res.data);
console.log('upload...', data.data);
//上传成功之后,可以做别的操作,例如发送消息,上传头像等。
let objR = {
type: 'R',
con: imgUrl + data.data[0],
messageType: 'img',
avater: app.globalData.userInfo.avatarUrl,
};
let messageArr = [];
messageArr.push(objR);
let newMessageArr = self.data.messageList.concat(messageArr);
self.submitTo(imgUrl + data.data[0], 'img')
//更新数据
self.setData({
messageInputVal: "",
messageList: newMessageArr,
isEmotion: false,
isMedia: false
})
}
},
complete: function (e) {
index++; //下一张
if (index < imgPaths.length) {
//递归调用,上传下一张
uploadFiles(self, imgPaths, index);
}
}
})
}
//表情文件
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;
}
}) //表情转换
\ No newline at end of file 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];
}
function uniqueList(arr) {
var res = [];
var json = {};
var r = /\s+/g;
for(var i = 0; i < arr.length; i++){
var str = arr[i].replace(r,'')
if(!json[str]){
res.push(str);
json[str] = 1;
}
}
return res;
}
\ No newline at end of file
<wxs module="tutil" src="./../../../utils/date.wxs"></wxs> <!--pages/share/share.wxml-->
<view class="page"> <view class="page">
<!-- start key view -->
<!-- 图片 --> <view class="page__hd" style="position:fixed; top:0;width: 750rpx;">
<scroll-view class="scroll-view_H" scroll-x scroll-with-animation style="width: 100%;height: 100%;"> <view class="tab-title">
<block wx:for="{{activityInfo.note_image}}" wx:key="unique" wx:for-index="id" wx:for-item="item"> <view class="{{selected=='@'?'border-tottom':'default'}}" id="@" bindtap="selected">热度商家榜</view>
<view class="scroll_item"> <view class="{{selected=='#'?'border-tottom':'default'}}" id="#" bindtap="selected">活跃主播榜</view>
<image src="{{item}}" mode="widthFix"/> </view>
<!-- start_of_tab-content -->
<scroll-view scroll-y="true" scroll-top="0">
<view class="tab-content" style="height:{{keyHeight}}rpx;">
<view class="rank-info" wx:for="{{rankData}}"
wx:key="{{item.id}}" data-id="{{item.id}}" data-index="{{index}}"
bindtap="switchCategory">
<view class="rank">
<view class="rank-left">{{item.name}}</view>
<view class="rank-right">
<view class="rank-row"><image src="{{likeUrl}}"></image> {{item.like}}</view>
</view> </view>
</block> </view>
</view>
</view>
</scroll-view> </scroll-view>
<!-- end_of_tab-content -->
</view>
<!-- 文字内容 --> <!--end key view -->
<view class="note">
<view class="note-price" style="font-weight: bold">
<view class="clone">
<view class="clone-left">¥{{products[curIndex].unitPrice}}</view>
<!-- start 点赞 like --> <!--公屏view-->
<block> <view style="height:{{chatHeight}}rpx;position:fixed; bottom:0;">
<view class="clone-right" bindtap="onSubmitLike" data-id='{{activityInfo.activity_id}}'> <view class="weui-cell weui-cell_access">
<view class="note-column" style="font-size: 24rpx;font-weight:normal;color: #000;align-items:center"> <view class="weui-cell__bd">{{streamer_name}}</view>
<image src="{{likeUrl}}"></image> </view>
{{activityInfo.num_like}} <scroll-view scroll-y="true" scroll-top="{{scrollTop}}" style="height:{{chatHeight-80}}rpx;position:fixed; bottom:0;">
</view> <view class="wrapper {{isShowAdd?'media-padd':''}} {{isEmotion?'emotion-padd':''}}" id="wrapperCon" bindtap="cancelShow" >
</view> <!-- 消息列表 -->
</block> <view class="chat {{item.type=='L'?'chat-l':'chat-r'}}" wx:for="{{messageList}}" wx:for-item="item">
<!-- end 点赞 like --> <!-- <view class="c-date">2019年3月23日 15:33</view> -->
<!-- start 克隆 --> <view class="message-list">
<block wx:if="{{members.length > 0}}"> <view class="avater {{item.type=='R'?'avater-r':''}}">
<view class="clone-right" bindtap="onClickClone" data-id='{{activityInfo.activity_id}}'> <!-- refer https://www.jianshu.com/p/7ad22e35b556 -->
<view class="note-column" style="font-size: 24rpx;font-weight:normal;color: #000;align-items:center;margin-left: 10rpx;"> <image src='{{item.avater}}' bindtouchstart='touchstart_long' bindtouchend='touchEnd' data-id="{{item.nickName}}"></image>
<image src="../../../icon/activity/clone.png"></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>
</view> <view class="chat-con {{item.type=='L'?'chat-con-l':'chat-con-r'}} ">
</block> <rich-text wx:if="{{item.messageType=='txt'}}" nodes="{{item.con}}"></rich-text>
<!-- end 克隆 --> <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>
</view>
</view>
</scroll-view>
</view>
<view class="note-content" style="display: flex; flex-direction: column"> <!-- 消息输入 -->
<span>主题: {{activityInfo.title}}</span> <view class="message-input" style="position:absolute; bottom:{{bottom_val}}rpx">
<span>类别: <input class="{{isShowAdd?'':'showSend'}}" placeholder="请输入内容" type="text" value="{{messageInputVal}}" cursor-spacing="20" bindinput='messageInput' confirm-type="send" bindconfirm="messageSend" bindfocus="inputFocus" bindblur="inputBlur" adjust-position="{{false}}" />
<view class="cate-list {{curIndex==index?'on':''}}" wx:for="{{products}}" <button bindtap="messageSend" wx:if="{{!isShowAdd}}">发送</button>
wx:for-item="sub_item" wx:key="{{index}}" data-index="{{index}}" bindtap="switchCategory"> <image mode="widthFix" class="input-img {{isShowAdd?'':'showAdd'}}" src='../../../icon/chat/face1.png' id="face" bindtap="openEmotion"></image>
{{sub_item.productDesc}} <image mode="widthFix" class="input-img" wx:if="{{isShowAdd}}" src='../../../icon/chat/add1.png' id="add" bindtap="openMedia"></image>
</view> <!-- 媒体文件选择 -->
</span> <view class="media-box" wx:if="{{isMedia}}">
<view class="media-list" bindtap="selectImg">
<!-- 日期 --> <image mode="widthFix" class="media-img" src='../../../icon/chat/img2.png'></image>
<span>日期: {{tutil.formatDate_ymdw_today_interval(activityInfo.start_datetime, activityInfo.end_datetime)}}</span> <view>相册图片</view>
<!-- 时间 -->
<span>时间: {{tutil.formatDate_hm_interval(activityInfo.start_datetime, activityInfo.end_datetime)}}</span>
<span>地点: {{activityInfo.address_name}}</span>
</view> </view>
<view class="note-content"> <view class="media-list" bindtap="selectCamera">
<text>内容: {{activityInfo.content}}</text> <image mode="widthFix" class="media-img" src='../../../icon/chat/cam2.png'></image>
<view>相机拍照</view>
</view> </view>
</view>
<!-- 表情文件 -->
<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>
<!-- 企业信息 -->
<view class="note-row">
<view class="note-column-left align justify">
<image class="writer-image" src="{{activityInfo.member_logo}}"/>
</view>
<view class="note-column" style="margin-right: 4%">
<span class="name">{{activityInfo.member_name}}</span>
<span class="name">{{activityInfo.member_slogan}}</span>
</view>
</view>
<view class="bottom_placeholder"></view> </view>
<!-- start bottom-->
<!-- refer to https://www.jb51.net/article/129438.htm -->
<view class="page__bd">
<view class="weui-tabbar">
<view class="weui-tabbar__item" bindtap="toHome">
<view style="position: relative;display:inline-block;">
<image src="../../../icon/index.png" class="weui-tabbar__icon" style="width: 48rpx; height:48rpx"></image>
</view>
<view class="weui-tabbar__label">首页</view>
</view>
<view class="weui-tabbar__item">
<view style="position: relative;display:inline-block;">
<button class="share" open-type="share"></button>
<image src="../../../icon/activity/share.png" class="weui-tabbar__icon" style="width: 48rpx; height:48rpx"></image>
</view>
<view class="weui-tabbar__label">分享</view>
</view>
<!-- todo toBuy 因为现在还没跟商家谈妥 -->
<!-- <view class="weui-tabbar__item">
<view style="position: relative;display:inline-block;">
<button class="button-red" bindtap="toBuy">立即购买</button>
</view>
</view> -->
<!-- toOrder 仅仅是先预定 -->
<view class="weui-tabbar__item">
<view style="position: relative;display:inline-block;">
<button class="button-red" bindtap="toOrder">立即预定</button>
</view>
</view>
</view>
</view>
<!-- end bottom-->
</view>
.scroll-view_H{ .page{
position: relative; height: 100vh;
width: 100%; background: #F4F8FB;
text-align: center; }
transform: scale(1); .weui-cell__hd {
white-space: nowrap; font-size: 0;
} }
.scroll_item { .weui-cell__hd image {
position: relative; width: 100rpx;
width: 100%; height: 100rpx;
height: 100%; margin-right: 18px;
margin: 0; margin-left: 5px;
transform-origin: 50% 0;
left: 0%;
display: inline-block;
/* border-radius: 20rpx !important ; */
overflow: hidden;
/* transform: scale(0.9); */
vertical-align: middle; vertical-align: middle;
/* top: 0%; */
/* height: 72%; */
background-color: #fff;
}
.scroll_item:first-child{
margin: 0%;
left: 0;
}
.scroll_item:last-child{
margin: 0;
left: 0;
}
.scroll_item.selected{
/* transform: scale(0.9); */
border: solid 0px #ffcd54;
}
.scroll_item image {
width: 100%;
float: left;
margin-top: 0;
}
.note{
width: 100%;
/* position: fixed; */
background: #fff;
border-radius: 5rpx;
float: left;
margin-top: 20rpx;
margin-bottom: 20rpx;
}
.note-title{
font-size: 30rpx;
margin-left: 5%;
margin-right: 5%;
margin-top: 0;
text-align:justify;
}
.note-price{
font-size: 16px;
margin-left: 5%;
margin-right: 5%;
margin-top: 0;
text-align:justify;
color: #FF6600;
}
.note-content{
font-size: 32rpx;
/* 后期用于 '展开' 功能 */
/* overflow : hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical; */
margin-left: 5%;
margin-right: 4%;
/* margin-top: 20rpx; */
text-align:justify;
}
.note-row{
width: 100%;
display: flex;
flex-direction: row;
margin-bottom: 30rpx;
margin-top: 30rpx;
} }
.note-column{ .weui-cell__ft_in-access {
padding-right:13px;
position:relative;
}
.userInfo{
width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-left: 30rpx; align-items: center;
justify-content: center;
overflow: hidden;
} }
.note-column-left{ .thumb{
width : 140rpx; width: 120rpx;
margin-left: 5%; height: 120rpx;
display: flex; border-radius: 50%;
overflow: hidden;
} }
.writer-image{ .name{
width: 140rpx; margin: 30rpx;
height: 140rpx;
} }
/* start bottom style */ /* 公屏 */
.column { /*轮播控件 - start*/
display: flex;
flex-direction: column;
}
.row {
display: flex;
flex-direction: row;
align-items: center;
}
.bottom_line {
width: 100%;
height: 2rpx;
background: lightgray;
}
.bottom_placeholder { .home-swiper {
position: relative; width: 100%;
width: 100%; height: 400rpx;
height: 160rpx; }
line-height: 10rpx;
}
.bottom_total { .slide-image {
position: fixed; width: 100%;
display: flex; height: 100%;
flex-direction: column;
bottom: 0;
width: 100%;
height: 160rpx;
line-height: 10rpx;
background: white;
}
.button-red {
background-color: #f44336; /* 红色 */
font-size: 14px;
}
.button-brown {
background-color: #D1A96E; /* 红色 */
}
button {
color: white;
text-align: center;
font-size:32rpx;
height: 2.6em;
line-height: 2.6em;
}
.placeholder{
margin-left: 20rpx;
margin-right: 20rpx;
text-align: center;
/* vertical-align: middle; */
padding: 0 10px;
line-height: 2.3em;
color: rgba(0,0,0);
}
/* justify-content: center;(水平居中) align-items: center;(垂直居中) */
.justify{
justify-content: center;
} }
.align{
align-items: center; /*轮播控件 - end*/
.wrapper {
padding-top: 20rpx;
padding-bottom: 100rpx;
} }
.list .items{ .message-list {
display: flex; margin: 10rpx 30rpx 30rpx;
flex-direction: column;
text-align: center;
align-items: center;
} }
.items image{
width: 60rpx; .chat {
height: 60rpx; height: 100%;
margin-top: 20rpx; display: flex;
font-size: 0; flex-direction: column;
justify-content: space-between;
box-sizing: border-box;
}
.chat-con {
padding: 20rpx;
border-radius: 8rpx;
font-size: 30rpx;
color: #333;
position: relative;
} }
.items text{
/* display: block; */ /* left-message */
text-align: center;
margin-top: 0rpx; .chat-l {
margin-bottom: 20rpx; align-items: flex-start;
padding: 0rpx;
font-size: 28rpx;
} }
.list{ .avater {
display: flex; width: 90rpx;
flex-direction: row; height: 90rpx;
justify-content: space-between; position: relative;
margin-left: 30rpx; }
margin-right: 30rpx;
margin-top: 20rpx; .avater>image {
} width: 100%;
/* end bottom style */ height: 100%;
display: block;
/* 分享按钮 */ border-radius: 10%;
.share { }
position: absolute;
background-size: 50rpx 50rpx; .chat-con-l {
opacity: 0; background-color: #fff;
border:none; margin-left: 120rpx;
} margin-top: -50rpx;
}
/* 克隆图片 */
.clone{width: 100%; display: flex; margin-top: 0rpx; align-items: center;} .chat-con-l::after {
.clone-left{width: 80%; } content: '';
.cloner-right{width: 20%;} border-width: 20rpx;
.clone-right image{ border-style: solid;
width: 40rpx; border-color: transparent #fff transparent transparent;
height: 40rpx; position: absolute;
font-size: 0; top: 18rpx;
} left: -28rpx;
}
.weui-tabbar{
position:fixed; /* right-message */
bottom:0;
left:0; .chat-r {
right:0; align-items: flex-end;
} }
.cate-list{ .chat-con-r {
display: inline; background-color: #7dca4a;
/* margin: 15rpx 22rpx; */ margin-right: 120rpx;
text-align: center; margin-top: 35rpx;
font-size: 32rpx; }
/* color: #9d9d9d; */
background: #F4F4F4; .chat-con-r::after {
margin-right: 20rpx; content: '';
padding-right: 10rpx; border-width: 20rpx;
padding-top: 10rpx; border-style: solid;
padding-bottom: 10rpx; border-color: transparent transparent transparent #7dca4a;
} position: absolute;
.cate-list.on { top: 18rpx;
color: #FF6600; right: -28rpx;
font-weight: bold; }
/*
border:1px solid #FF6600; .avater-r {
border-radius: 6rpx; float: right;
*/ }
}
/* input-message */
\ No newline at end of file
.message-input {
position: fixed;
bottom: 0;
width: 100%;
background-color: #efefef;
padding: 20rpx 0 0;
z-index: 99;
}
.message-input>input {
font-size: 30rpx;
border: solid #ddd 1rpx;
width: 71%;
min-height: 60rpx;
height: 100%;
margin-left: 20rpx;
padding: 5rpx 10rpx;
border-radius: 8rpx;
margin-bottom: 15rpx;
color: #333;
background-color: #fff;
}
.showSend{
width:65% !important;
}
.showAdd {
left:73% !important;
}
.message-input>button {
width: 100rpx;
height: 60rpx;
background-color: #7dca4a;
font-size: 28rpx;
color: #fff;
margin-top: -82rpx;
float: right;
margin-right: 20rpx;
padding: 0;
line-height: 60rpx;
}
.input-m {
width: 500rpx;
max-width: 500rpx;
height: 70rpx;
max-height: 70rpx;
border: solid red 1px;
margin-left: 80rpx;
position: relative;
display: inline-block;
top: -80rpx;
overflow-y: scroll;
background-color: #fff;
}
.c-date {
font-size: 26rpx;
color: #999;
padding: 10rpx 0 30rpx;
text-align: center;
width: 100%;
}
.message-input .input-img {
width: 60rpx;
height: 60rpx;
}
#rec {
position: absolute;
top: 26rpx;
left: 10rpx;
}
#face {
position: absolute;
top: 20rpx;
left: 80%;
}
#add {
position: absolute;
top: 20rpx;
left: 90%;
}
.nick-name-l {
position: absolute;
top: -2%;
left: 138%;
z-index: 2;
font-size: 24rpx;
color: #666;
width: 200rpx;
}
.nick-name-r {
position: absolute;
top: -10%;
right: -25%;
z-index: 2;
font-size: 24rpx;
color: #666;
width: 200rpx;
}
.media-img {
width: 120rpx;
height: 120rpx;
display: inline-block;
}
.media-box {
background-color: #f0f0f0;
border-top: solid #e1e1e1 1rpx;
}
.media-list {
width: 150rpx;
height: 150rpx;
padding: 10px;
text-align: center;
display: inline-block;
}
.media-list>view {
font-size: 26rpx;
color: #666;
}
.emotion-box {
background-color: #f0f0f0;
padding-bottom: 40rpx;
border-top: solid #e1e1e1 1rpx;
}
.emotion-list {
margin: 20rpx auto 0;
text-align: center;
}
.emotion-list>image {
width: 55rpx;
height: 55rpx;
margin: 15rpx 30rpx;
}
.emotion-padd {
padding-bottom: 77% !important;
}
.media-padd{
padding-bottom: 42% !important;
}
.message-img {
width: 300rpx;
height: 200rpx;
display: inline-block;
vertical-align: middle;
}
.tab-title{
height: 60rpx;
background: #fff;
border-top: 1px solid #fafafa;
padding: 16rpx;
line-height: 60rpx;
display:flex;
flex-direction: row;
}
.tab-title view{
flex:auto;
text-align:center;
}
.tab-content{
height: 60rpx;
background: #fff;
padding: 16rpx;
}
.rank-info{
background: #fff;
}
.border-tottom{
border-bottom:1rpx solid red;
}
.show{display:block;}
.hidden{display:none;}
/* rank-info */
.rank{width: 100%; display: flex; margin-top: 0rpx; align-items: center;}
/* .rank-left{width: 50%; text-align: center;}
.rank-right{width: 50%; display: flex; justify-content: center;} */
.rank-left{width: 50%; padding-left:100rpx; margin-bottom: 12rpx;}
.rank-right{width: 50%; display: flex; padding-left:100rpx;}
.rank-right image{
width: 40rpx;
height: 40rpx;
font-size: 0;
}
.rank-row{
display: flex;
flex-direction: row;
}
\ No newline at end of file
...@@ -60,6 +60,25 @@ Page({ ...@@ -60,6 +60,25 @@ Page({
//活动类型 //活动类型
activityType: "00-饮事", activityType: "00-饮事",
lives: [
{
sid: "134",
note_image: "https://930-test-sh.oss-cn-shanghai.aliyuncs.com/user-dir/wx72555e77d9e5cee2.o6zAJszSNHnFKy8FTV5dg-Z7XDzQ.WaSJaxPezrVxcdaf58fbf674e7d3be131826ff708fa6.jpg",
title: "巅峰赛第一",
num_watcher: 1029,
streamer_name: "Azz·口袋",
streamer_logo: "../../icon/icon_avatar3.png"
},
{
sid: "123",
note_image: "https://930-test-sh.oss-cn-shanghai.aliyuncs.com/user-dir/wx72555e77d9e5cee2.o6zAJszSNHnFKy8FTV5dg-Z7XDzQ.WaSJaxPezrVxcdaf58fbf674e7d3be131826ff708fa6.jpg",
title: "单排84-101 把把C 不混",
num_watcher: 2040,
streamer_name: "六尾【混子】",
streamer_logo: "../../icon/icon_avatar3.png"
},
],
}, },
switchCategory(e) { switchCategory(e) {
......
<wxs module="tutil" src="./../../utils/date.wxs"></wxs> <wxs module="tutil" src="./../../utils/date.wxs"></wxs>
<!--
现场模快
需求重点: 谁看, 看什么,
需求目标: 专业+好玩
Req1-11_25
1. 现场标签: 图片, 名字, 在看人数, 主播
2. 搜索形式: 城市 + 搜索框(店名)
3. 展示形式: 我关注的人(id), 在看自动倒序()
4. 播放形式: 图文
-->
<view class="page"> <view class="page">
<!-- 搜索框 --> <!-- 搜索框 -->
<!--refer https://blog.csdn.net/weixin_44022446/article/details/86438015 --> <!--refer https://blog.csdn.net/weixin_44022446/article/details/86438015 -->
...@@ -74,13 +85,6 @@ ...@@ -74,13 +85,6 @@
</view> </view>
<!-- 导航栏 --> <!-- 导航栏 -->
<view class="navBar" >
<scroll-view class="navBar-box" scroll-x="true" style="white-space: nowrap; display:flex ">
<view class="cate-list {{curIndex==index?'on':''}}" wx:for="{{category}}"
wx:key="{{item.id}}" data-id="{{item.id}}" data-index="{{index}}"
bindtap="switchCategory">{{item.name}}</view>
</scroll-view>
</view>
<!-- 文章列表 --> <!-- 文章列表 -->
<!-- <!--
...@@ -92,33 +96,28 @@ ...@@ -92,33 +96,28 @@
--> -->
<!-- Content: refer to 有品·优惠券 + 点评(可使用) --> <!-- Content: refer to 有品·优惠券 + 点评(可使用) -->
<view class="coupon-list" wx:for="{{activities}}" wx:for-item="item" wx:key="{{index}}"> <view class="coupon-list" wx:for="{{lives}}" wx:for-item="item" wx:key="{{index}}">
<view class="item stamp stamp01" style="192rpx;"> <view class="item stamp stamp01">
<!-- 商品信息 --> <!-- 商品信息 -->
<view class="note-row"> <view class="note-row">
<navigator url='{{item.url}}&num_like={{item.num_like}}' > <navigator url='live-info/live-info?sid={{item.sid}}&streamer_name={{item.streamer_name}}' >
<image class="writer-image" src="{{item.note_image[0]}}"/> <image class="writer-image" src="{{item.note_image}}"/>
</navigator> </navigator>
<view class="note-column"> <view class="note-column">
<navigator url='{{item.url}}&num_like={{item.num_like}}' > <navigator url='live-info/live-info?sid={{item.sid}}&streamer_name={{item.streamer_name}}' >
<!-- 商家信息 --> <!-- 商家信息 -->
<text>{{item.title}}</text> <text>{{item.title}}</text>
<!-- 商品价格 --> <!-- 商品价格 -->
<span> <span>
<view class="price-row"> <view class="price-row">
<view class="sub-price">¥{{item.unit_price}}</view> <view class="sub-price">{{item.num_watcher}}人在看</view>
</view> </view>
</span> </span>
<!-- 活动日期 -->
<span class="desc">
{{tutil.formatDate_mdw_interval(item.start_datetime, item.end_datetime)}}
</span>
</navigator> </navigator>
<!-- 活动点赞 -->
<!-- <span>{{tutil.formatNumberLike(item.num_like)}}</span> -->
<!-- 商家名称 --> <!-- 商家名称 -->
<view class="note-row align"> <view class="note-row align">
<view class="desc-member-left">{{item.member_name}}</view> <view class="desc-member-left">
<image src="{{item.note_image}}"/>{{item.streamer_name}}</view>
<!-- todo 店铺功能尚未实现 --> <!-- todo 店铺功能尚未实现 -->
<!-- <view class="desc-member-right">进店 ></view> --> <!-- <view class="desc-member-right">进店 ></view> -->
</view> </view>
......
...@@ -66,8 +66,8 @@ ...@@ -66,8 +66,8 @@
} }
/* coupon css */ /* coupon css */
.coupon-list{width: 100%; margin: 0 auto} .coupon-list{width: 100%; margin: 0 auto; padding-top: 10rpx;}
.coupon-list .item{width: 100%; height: 300rpx;} .coupon-list .item{width: 100%;}
.coupon-list .item .float-li{width: 100%; height: 100%; border-right: 2rpx dashed rgba(255,255,255,.3)} .coupon-list .item .float-li{width: 100%; height: 100%; border-right: 2rpx dashed rgba(255,255,255,.3)}
.coupon-list .item .float-li-right{width: 220rpx; padding-right: 20rpx; height:100%; color: #fff} .coupon-list .item .float-li-right{width: 220rpx; padding-right: 20rpx; height:100%; color: #fff}
...@@ -384,6 +384,11 @@ ...@@ -384,6 +384,11 @@
color: #a7a7a7; color: #a7a7a7;
margin-right: 20rpx; margin-right: 20rpx;
} }
.desc-member-left image{
width: 40rpx;
height: 40rpx;
font-size: 0;
}
.desc-member-right { .desc-member-right {
font-size: 30rpx; font-size: 30rpx;
......
...@@ -48,7 +48,7 @@ Page({ ...@@ -48,7 +48,7 @@ Page({
//格式示例数据,可为空 //格式示例数据,可为空
allContentList: [], allContentList: [],
num: 0, num: 0,
sid: "key", sid: "mall",
chatUserInfo: {}, chatUserInfo: {},
scrollTop: 0, scrollTop: 0,
...@@ -379,7 +379,7 @@ Page({ ...@@ -379,7 +379,7 @@ Page({
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function () {
//app.closeSocket(); app.closeSocket();
console.log('===onUnload webSocket 连接关闭事件。') console.log('===onUnload webSocket 连接关闭事件。')
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论