Commit 4f510b4b by jscat

nyx weapp: 更新

parent e155a72b
......@@ -103,16 +103,17 @@ App({
if(config.env == 0)
{
strUrl = config.socket_url + "?sid=" + sid + "&uid=" + uid + "&msg=" + strMsg
+ "&city=" + _this.globalData.defaultCity
}
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) : ""
_this.globalData.socketTask = wx.connectSocket({
//此处 url 可以用来测试
url: strUrl,
success: function (res) {
console.log('===initSocket 创建成功', res)
},
......@@ -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 @@
},
{
"pagePath": "pages/live/live-post/live-post",
"text": "添加",
"text": "开播",
"iconPath": "./icon/add.png",
"selectedIconPath": "./icon/add.png"
},
......
......@@ -82,6 +82,7 @@ var config={
image_url: host_key + "/images/",
redis_update_like_url: host_key + "/api/nyx/redis/update/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_add_url: host_key + "/api/nyx/live/add",
}
......
......@@ -71,6 +71,8 @@ Page({
selected : '@',
likeUrl: "../../../icon/activity/like_selected.png", // like图标的url
redUrl: "../../../icon/live/red.png", // 在线图标的url
editUrl: "../../../icon/live/editTitle.png", // 编辑图标的url
saveUrl: "../../../icon/live/saveTitle.png", // 编辑图标的url
//directly to redis
rankData_raw_like: {
'@叁年间' : 100,
......@@ -100,6 +102,10 @@ Page({
title: "",
num_watcher: "",
inputShowed: false,
onlineCount: 0, //当前sid的在线人数
editMode: 0, //标题是否处于编辑状态
},
/**
......@@ -645,12 +651,19 @@ Page({
var nickName = ""
var avater = ""
var type = 'txt'
var count = 0
console.log("====chatUserInfo, ", _this.data.chatUserInfo)
if (json["cmd"] == "onOpen" || json["cmd"] == "onScore") {
text = " " + _this.data.chatUserInfo.nickName + " " +json["msg"]
count = json["count"]
nickName = "系统"
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") {
......@@ -801,7 +814,7 @@ Page({
},
//处理open的代码
processOpen:function(text, nickName, avater)
processOpen:function(text, count, nickName, avater)
{
var _this = this;
//表情处理
......@@ -838,11 +851,24 @@ Page({
messageList: newMessageArr,
isEmotion: false,
isMedia: false,
onlineCount: count,
})
_this.scrollBottom();
},
//处理close的代码
processClose:function(count)
{
var _this = this;
//更新数据(模拟请求历史数据)
_this.setData({
onlineCount: count,
})
},
//处理info data, main func
/*
type: 'txt'|'img'
......@@ -992,7 +1018,23 @@ Page({
_this.getRedisLike(strUrl)
},
//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 @@
<!-- start key view -->
<view class="page__hd" style="position:fixed; top:0;width: 100%;">
<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>
<!-- start_of_tab-content -->
<scroll-view scroll-y="true" scroll-top="0">
......@@ -15,7 +15,7 @@
<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 class="rank-row"><image src="{{likeUrl}}"></image> {{item.like}}</view>
</view>
</view>
</view>
......@@ -30,9 +30,21 @@
<view style="height:{{chatHeight}}rpx;position:fixed; bottom:0; width:100%">
<view class="weui-cell weui-cell_access">
<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-row"><image src="{{redUrl}}"></image> {{num_watcher}}在线</view>
<view class="live-row"><image src="{{redUrl}}"></image> {{onlineCount}}在线</view>
</view>
</view>
</view>
......
......@@ -350,7 +350,7 @@ align-items: center;
.live{width: 100%; display: flex; margin-top: 0rpx; align-items: center;margin-bottom: 12rpx;}
.live-left{width: 65%; }
.live-right{width: 35%; display: flex;}
.live-right image{
.live image{
width: 40rpx;
height: 40rpx;
font-size: 0;
......
......@@ -45,7 +45,7 @@
<view class="items">
<navigator url="/pages/activity/activity-list/activity-list?city={{city}}">
<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>
</view>
</block>
......@@ -53,7 +53,7 @@
<view class="items">
<navigator url="/pages/my/my-collects/my-collects">
<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>
</view>
......@@ -61,7 +61,7 @@
<view class="items">
<navigator url="/pages/my/my-orders/my-orders">
<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>
</view>
......
......@@ -96,6 +96,9 @@ Page({
bottom_val: 0,
pxToRpxScale: 0,
tabBarHeight: 0,
//默认, input没有获取焦点事件,也没有键盘弹出
inputShowed: false,
onlineCount: 0, //当前sid的在线人数
},
......@@ -454,6 +457,7 @@ Page({
isMedia: false,
isShowAdd: true,
showSend: false,
inputShowed: true,
})
self.scrollBottom();
},
......@@ -627,14 +631,21 @@ Page({
var nickName = ""
var avater = ""
var type = 'txt'
var count = 0
console.log("====chatUserInfo, ", _this.data.chatUserInfo)
if (json["cmd"] == "onOpen" || json["cmd"] == "onScore") {
text = " " + _this.data.chatUserInfo.nickName + " " +json["msg"]
count = json["count"]
nickName = "系统"
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") {
text = json["msg"]
type = json["type"]
......@@ -783,7 +794,7 @@ Page({
},
//处理open的代码
processOpen:function(text, nickName, avater)
processOpen:function(text, count, nickName, avater)
{
var _this = this;
//表情处理
......@@ -818,10 +829,22 @@ Page({
messageList: newMessageArr,
isEmotion: false,
isMedia: false,
onlineCount: count,
})
_this.scrollBottom();
},
//处理close的代码
processClose:function(count)
{
var _this = this;
//更新数据(模拟请求历史数据)
_this.setData({
onlineCount: count,
})
},
//处理info data, main func
/*
......
......@@ -32,7 +32,7 @@
<view class="live">
<view class="live-left">公屏发言</view>
<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>
......@@ -60,7 +60,7 @@
<!-- 消息输入 -->
<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>
<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>
......
......@@ -329,10 +329,10 @@
.hidden{display:none;}
/* 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-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 image{
width: 40rpx;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论