Commit 4f510b4b by jscat

nyx weapp: 更新

parent e155a72b
...@@ -103,16 +103,17 @@ App({ ...@@ -103,16 +103,17 @@ App({
if(config.env == 0) if(config.env == 0)
{ {
strUrl = config.socket_url + "?sid=" + sid + "&uid=" + uid + "&msg=" + strMsg strUrl = config.socket_url + "?sid=" + sid + "&uid=" + uid + "&msg=" + strMsg
+ "&city=" + _this.globalData.defaultCity
} }
else else
{ {
strUrl = config.socket_url + "/wss?sid=" + sid + "&uid=" + uid + "&msg=" + strMsg strUrl = config.socket_url + "/wss?sid=" + sid + "&uid=" + uid + "&msg=" + strMsg
+ "&city=" + _this.globalData.defaultCity
} }
config.debug == 1 ? console.log("===initSocket_strUrl_" + strUrl) : "" config.debug == 1 ? console.log("===initSocket_strUrl_" + strUrl) : ""
_this.globalData.socketTask = wx.connectSocket({ _this.globalData.socketTask = wx.connectSocket({
//此处 url 可以用来测试 //此处 url 可以用来测试
url: strUrl, url: strUrl,
success: function (res) { success: function (res) {
console.log('===initSocket 创建成功', res) console.log('===initSocket 创建成功', res)
}, },
...@@ -885,7 +886,25 @@ App({ ...@@ -885,7 +886,25 @@ App({
} }
}, },
}) })
},
updateWatcherByRedis: function(sid, city, count) {
var _this = this;
console.log("===this is updateWatcherByRedis");
//token信息
var strUrl = config.redis_update_watcher_url + "?sid" + sid + "&city" + city + "&count" + count
wx.request({
url: strUrl,
method: 'GET',
header: {
'content-type': 'application/json'
},
success: res => {
console.log("===this is updateWatcherByRedis success");
} }
})
},
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
}, },
{ {
"pagePath": "pages/live/live-post/live-post", "pagePath": "pages/live/live-post/live-post",
"text": "添加", "text": "开播",
"iconPath": "./icon/add.png", "iconPath": "./icon/add.png",
"selectedIconPath": "./icon/add.png" "selectedIconPath": "./icon/add.png"
}, },
......
...@@ -82,6 +82,7 @@ var config={ ...@@ -82,6 +82,7 @@ var config={
image_url: host_key + "/images/", image_url: host_key + "/images/",
redis_update_like_url: host_key + "/api/nyx/redis/update/like", redis_update_like_url: host_key + "/api/nyx/redis/update/like",
redis_query_like_url: host_key + "/api/nyx/redis/search/like", redis_query_like_url: host_key + "/api/nyx/redis/search/like",
redis_update_watcher_url: host_key + "/api/nyx/redis/update/watcher",
live_query_url: host_key + "/api/nyx/live/query", live_query_url: host_key + "/api/nyx/live/query",
live_add_url: host_key + "/api/nyx/live/add", live_add_url: host_key + "/api/nyx/live/add",
} }
......
...@@ -71,6 +71,8 @@ Page({ ...@@ -71,6 +71,8 @@ Page({
selected : '@', selected : '@',
likeUrl: "../../../icon/activity/like_selected.png", // like图标的url likeUrl: "../../../icon/activity/like_selected.png", // like图标的url
redUrl: "../../../icon/live/red.png", // 在线图标的url redUrl: "../../../icon/live/red.png", // 在线图标的url
editUrl: "../../../icon/live/editTitle.png", // 编辑图标的url
saveUrl: "../../../icon/live/saveTitle.png", // 编辑图标的url
//directly to redis //directly to redis
rankData_raw_like: { rankData_raw_like: {
'@叁年间' : 100, '@叁年间' : 100,
...@@ -100,6 +102,10 @@ Page({ ...@@ -100,6 +102,10 @@ Page({
title: "", title: "",
num_watcher: "", num_watcher: "",
inputShowed: false,
onlineCount: 0, //当前sid的在线人数
editMode: 0, //标题是否处于编辑状态
}, },
/** /**
...@@ -645,12 +651,19 @@ Page({ ...@@ -645,12 +651,19 @@ Page({
var nickName = "" var nickName = ""
var avater = "" var avater = ""
var type = 'txt' var type = 'txt'
var count = 0
console.log("====chatUserInfo, ", _this.data.chatUserInfo) console.log("====chatUserInfo, ", _this.data.chatUserInfo)
if (json["cmd"] == "onOpen" || json["cmd"] == "onScore") { if (json["cmd"] == "onOpen" || json["cmd"] == "onScore") {
text = " " + _this.data.chatUserInfo.nickName + " " +json["msg"] text = " " + _this.data.chatUserInfo.nickName + " " +json["msg"]
count = json["count"]
nickName = "系统" nickName = "系统"
avater = "../../../icon/mall.png" avater = "../../../icon/mall.png"
_this.processOpen(text, nickName, avater) _this.processOpen(text, count, nickName, avater)
}
else if (json["cmd"] == "onClose") {
count = json["count"]
_this.processClose(count)
} }
else if (json["cmd"] == "onData") { else if (json["cmd"] == "onData") {
...@@ -801,7 +814,7 @@ Page({ ...@@ -801,7 +814,7 @@ Page({
}, },
//处理open的代码 //处理open的代码
processOpen:function(text, nickName, avater) processOpen:function(text, count, nickName, avater)
{ {
var _this = this; var _this = this;
//表情处理 //表情处理
...@@ -838,11 +851,24 @@ Page({ ...@@ -838,11 +851,24 @@ Page({
messageList: newMessageArr, messageList: newMessageArr,
isEmotion: false, isEmotion: false,
isMedia: false, isMedia: false,
onlineCount: count,
}) })
_this.scrollBottom(); _this.scrollBottom();
}, },
//处理close的代码
processClose:function(count)
{
var _this = this;
//更新数据(模拟请求历史数据)
_this.setData({
onlineCount: count,
})
},
//处理info data, main func //处理info data, main func
/* /*
type: 'txt'|'img' type: 'txt'|'img'
...@@ -993,6 +1019,22 @@ Page({ ...@@ -993,6 +1019,22 @@ Page({
}, },
//edit Title
editTitle: function()
{
var _this = this;
var editMode = "1"
_this.setData({ editMode })
},
//save Title
saveTitle: function()
{
var _this = this;
var editMode = "0"
_this.setData({ editMode })
}
}) })
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<!-- start key view --> <!-- start key view -->
<view class="page__hd" style="position:fixed; top:0;width: 100%;"> <view class="page__hd" style="position:fixed; top:0;width: 100%;">
<view class="tab-title"> <view class="tab-title">
<view class="{{selected=='@'?'border-tottom':'default'}}" id="@" bindtap="selected">热度商家榜</view> <view class="{{selected=='@'?'border-tottom':'default'}}" id="@" bindtap="selected">周贡榜</view>
<view class="{{selected=='#'?'border-tottom':'default'}}" id="#" bindtap="selected">活跃聊天室</view> <view class="{{selected=='#'?'border-tottom':'default'}}" id="#" bindtap="selected">粉丝榜</view>
</view> </view>
<!-- start_of_tab-content --> <!-- start_of_tab-content -->
<scroll-view scroll-y="true" scroll-top="0"> <scroll-view scroll-y="true" scroll-top="0">
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<view class="rank"> <view class="rank">
<view class="rank-left">{{item.name}}</view> <view class="rank-left">{{item.name}}</view>
<view class="rank-right"> <view class="rank-right">
<view class="rank-row"><image src="{{likeUrl}}"></image> {{item.like}}在线</view> <view class="rank-row"><image src="{{likeUrl}}"></image> {{item.like}}</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -30,9 +30,21 @@ ...@@ -30,9 +30,21 @@
<view style="height:{{chatHeight}}rpx;position:fixed; bottom:0; width:100%"> <view style="height:{{chatHeight}}rpx;position:fixed; bottom:0; width:100%">
<view class="weui-cell weui-cell_access"> <view class="weui-cell weui-cell_access">
<view class="live"> <view class="live">
<view class="live-left">{{title}}</view> <view class="live-left">
<block wx:if="{{editMode=='0'}}" >
<view class="live-row" bindtap="editTitle">
{{title}}<image src="{{editUrl}}"></image>
</view>
</block>
<block wx:else>
<view class="live-row">
<input type="text" value="{{title}}" focus="true" style="background-color: #FFFFCC"/>
<image src="{{saveUrl}}" bindtap="saveTitle"></image>
</view>
</block>
</view>
<view class="live-right"> <view class="live-right">
<view class="live-row"><image src="{{redUrl}}"></image> {{num_watcher}}在线</view> <view class="live-row"><image src="{{redUrl}}"></image> {{onlineCount}}在线</view>
</view> </view>
</view> </view>
</view> </view>
......
...@@ -350,7 +350,7 @@ align-items: center; ...@@ -350,7 +350,7 @@ align-items: center;
.live{width: 100%; display: flex; margin-top: 0rpx; align-items: center;margin-bottom: 12rpx;} .live{width: 100%; display: flex; margin-top: 0rpx; align-items: center;margin-bottom: 12rpx;}
.live-left{width: 65%; } .live-left{width: 65%; }
.live-right{width: 35%; display: flex;} .live-right{width: 35%; display: flex;}
.live-right image{ .live image{
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
font-size: 0; font-size: 0;
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<view class="items"> <view class="items">
<navigator url="/pages/activity/activity-list/activity-list?city={{city}}"> <navigator url="/pages/activity/activity-list/activity-list?city={{city}}">
<image src="../../icon/member/schedule.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image> <image src="../../icon/member/schedule.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">本周活动</text> <text style="font-size:28rpx;">排名: 1st</text>
</navigator> </navigator>
</view> </view>
</block> </block>
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<view class="items"> <view class="items">
<navigator url="/pages/my/my-collects/my-collects"> <navigator url="/pages/my/my-collects/my-collects">
<image src="../../icon/my/fav.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image> <image src="../../icon/my/fav.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">我的收藏</text> <text style="font-size:28rpx;">关注: 12.5k, +2300</text>
</navigator> </navigator>
</view> </view>
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
<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> <text style="font-size:28rpx;">留言: 1302</text>
</navigator> </navigator>
</view> </view>
......
...@@ -96,6 +96,9 @@ Page({ ...@@ -96,6 +96,9 @@ Page({
bottom_val: 0, bottom_val: 0,
pxToRpxScale: 0, pxToRpxScale: 0,
tabBarHeight: 0, tabBarHeight: 0,
//默认, input没有获取焦点事件,也没有键盘弹出
inputShowed: false,
onlineCount: 0, //当前sid的在线人数
}, },
...@@ -454,6 +457,7 @@ Page({ ...@@ -454,6 +457,7 @@ Page({
isMedia: false, isMedia: false,
isShowAdd: true, isShowAdd: true,
showSend: false, showSend: false,
inputShowed: true,
}) })
self.scrollBottom(); self.scrollBottom();
}, },
...@@ -627,12 +631,19 @@ Page({ ...@@ -627,12 +631,19 @@ Page({
var nickName = "" var nickName = ""
var avater = "" var avater = ""
var type = 'txt' var type = 'txt'
var count = 0
console.log("====chatUserInfo, ", _this.data.chatUserInfo) console.log("====chatUserInfo, ", _this.data.chatUserInfo)
if (json["cmd"] == "onOpen" || json["cmd"] == "onScore") { if (json["cmd"] == "onOpen" || json["cmd"] == "onScore") {
text = " " + _this.data.chatUserInfo.nickName + " " +json["msg"] text = " " + _this.data.chatUserInfo.nickName + " " +json["msg"]
count = json["count"]
nickName = "系统" nickName = "系统"
avater = "../../icon/mall.png" avater = "../../icon/mall.png"
_this.processOpen(text, nickName, avater) _this.processOpen(text, count, nickName, avater)
}
else if (json["cmd"] == "onClose") {
count = json["count"]
_this.processClose(count)
} }
else if (json["cmd"] == "onData") { else if (json["cmd"] == "onData") {
...@@ -783,7 +794,7 @@ Page({ ...@@ -783,7 +794,7 @@ Page({
}, },
//处理open的代码 //处理open的代码
processOpen:function(text, nickName, avater) processOpen:function(text, count, nickName, avater)
{ {
var _this = this; var _this = this;
//表情处理 //表情处理
...@@ -818,10 +829,22 @@ Page({ ...@@ -818,10 +829,22 @@ Page({
messageList: newMessageArr, messageList: newMessageArr,
isEmotion: false, isEmotion: false,
isMedia: false, isMedia: false,
onlineCount: count,
}) })
_this.scrollBottom(); _this.scrollBottom();
}, },
//处理close的代码
processClose:function(count)
{
var _this = this;
//更新数据(模拟请求历史数据)
_this.setData({
onlineCount: count,
})
},
//处理info data, main func //处理info data, main func
/* /*
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<view class="live"> <view class="live">
<view class="live-left">公屏发言</view> <view class="live-left">公屏发言</view>
<view class="live-right"> <view class="live-right">
<view class="live-row"><image src="{{redUrl}}"></image>100在线</view> <view class="live-row"><image src="{{redUrl}}"></image>{{onlineCount}}在线</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
<!-- 消息输入 --> <!-- 消息输入 -->
<view class="message-input" style="position:absolute; bottom:{{bottom_val}}rpx"> <view class="message-input" style="position:absolute; bottom:{{bottom_val}}rpx">
<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}}" /> <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}}" focus="{{inputShowed}}"/>
<button bindtap="messageSend" wx:if="{{!isShowAdd}}">发送</button> <button bindtap="messageSend" wx:if="{{!isShowAdd}}">发送</button>
<image mode="widthFix" class="input-img {{isShowAdd?'':'showAdd'}}" src='../../icon/chat/face1.png' id="face" bindtap="openEmotion"></image> <image mode="widthFix" class="input-img {{isShowAdd?'':'showAdd'}}" src='../../icon/chat/face1.png' id="face" bindtap="openEmotion"></image>
<image mode="widthFix" class="input-img" wx:if="{{isShowAdd}}" src='../../icon/chat/add1.png' id="add" bindtap="openMedia"></image> <image mode="widthFix" class="input-img" wx:if="{{isShowAdd}}" src='../../icon/chat/add1.png' id="add" bindtap="openMedia"></image>
......
...@@ -329,10 +329,10 @@ ...@@ -329,10 +329,10 @@
.hidden{display:none;} .hidden{display:none;}
/* rank-info */ /* rank-info */
.rank{width: 100%; display: flex; margin-top: 0rpx; align-items: center;margin-bottom: 12rpx;} .rank{width: 100%; display: flex; margin-top: 0rpx; align-items: center;}
/* .rank-left{width: 50%; text-align: center;} /* .rank-left{width: 50%; text-align: center;}
.rank-right{width: 50%; display: flex; justify-content: center;} */ .rank-right{width: 50%; display: flex; justify-content: center;} */
.rank-left{width: 50%; padding-left:100rpx;} .rank-left{width: 50%; padding-left:100rpx;margin-bottom: 12rpx;}
.rank-right{width: 50%; display: flex; padding-left:100rpx;} .rank-right{width: 50%; display: flex; padding-left:100rpx;}
.rank-right image{ .rank-right image{
width: 40rpx; width: 40rpx;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论