Commit eebc71c7 by jscat

nyx weapp: 功能更新

1. 添加新增live的功能
parent 48bd0359
......@@ -836,5 +836,57 @@ App({
})
},
onCheckAndUploadFiles(file) {
var _this = this;
var strUrl = config.check_upload_pic_url
console.log("===onCheckAndUploadFiles_" + strUrl)
let promise = Promise.all(file.map((pic, index) => {
return new Promise(function (resolve, reject) {
_this.checkAndUploadFiles(strUrl, pic, index, resolve, reject)
});
}))
return promise
},
checkAndUploadFiles: function( strUrl, pic, index, resolve, reject) {
var _this = this;
wx.uploadFile({
url: strUrl, //上传的接口地址
filePath: pic, //上传的图片(每次单张,一张张上传)
name: 'file',
success: function (res) { // resultCode: "200"
var num = parseInt(index)+1
var imgUrl = config.image_url
//成功,文件返回值存入成功列表
var result = JSON.parse(res.data);
if (result && result.data && result.data.errcode == '0') {
console.log('upload...', result.data);
//上传成功之后,可以做别的操作,例如发送消息,上传头像等。
_this.globalData.photoArray.push(imgUrl + result.data.paths[0])
resolve("第" + num + "张图片状态码_" + result.data.errcode)
}
else {
resolve("第" + i + "张图片状态码_" + result.data.errcode)
if (result.data.errcode == '87014') {
wx.hideLoading();
wx.showModal({
content: '第' + num + '张图存在敏感内容, 请更换',
showCancel: false,
confirmText: '明白了'
})
} else {
wx.hideLoading();
wx.showModal({
content: '系统错误,请稍后再试',
showCancel: false,
confirmText: '明白了'
})
}
}
},
})
}
})
......@@ -3,7 +3,7 @@
// env = 0; //本地java测试,需要启动java后台
// env = 1; //阿里云服务器测试版本
// env = 2; //阿里云服务器生产版本
var env = 0;
var env = 1;
var debug = 0; //是否打印调试信息
var host_key = "https://fun.hisuhong.com";
......@@ -83,5 +83,6 @@ var config={
redis_update_like_url: host_key + "/api/nyx/redis/update/like",
redis_query_like_url: host_key + "/api/nyx/redis/search/like",
live_query_url: host_key + "/api/nyx/live/query",
live_add_url: host_key + "/api/nyx/live/add",
}
module.exports=config;
\ No newline at end of file
......@@ -92,7 +92,7 @@ Page({
}
],
bottom_val: 0,
bottom_val: 20, //否则就直接贴在屏幕最下面了
pxToRpxScale: 0,
tabBarHeight: 0,
......@@ -169,7 +169,7 @@ Page({
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.initSocket(sid, nyxCode, "来到"+_this.data.streamer_name+"现场")
app.globalData.socketClose = false
}
}
......@@ -412,14 +412,14 @@ Page({
console.log("===tabBarHeight", tabBarHeight)
console.log("===pxToRpxScale", pxToRpxScale)
_this.setData({
bottom_val: e.detail.height==0 ? 0 : e.detail.height*pxToRpxScale - tabBarHeight
bottom_val: e.detail.height==0 ? 20 : e.detail.height*pxToRpxScale - tabBarHeight
})
},
inputBlur: function(e){
console.log(e)
var _this = this;
_this.setData({
bottom_val: 0,
bottom_val: 20,
})
},
......
......@@ -4,7 +4,7 @@
<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>
<!-- start_of_tab-content -->
<scroll-view scroll-y="true" scroll-top="0">
......
......@@ -129,7 +129,9 @@ Page({
navigateToEdit() {
var _this = this;
var newFilePaths = _this.data.photoArray
let promise_checkPic = app.onCheckPic(newFilePaths)
//设置全局图片函数为[]
app.globalData.photoArray = []
let promise_checkPic = app.onCheckAndUploadFiles(newFilePaths)
//在本轮event loop(事件循环)运行完成之前,回调函数是不会被调用的
//then后的括号里应该是参数param
//https://www.cnblogs.com/qlongbg/p/11603328.html
......@@ -142,7 +144,7 @@ Page({
_this.setData({ canClick })
//离开的时候再赋值全局变量
app.globalData.postData.photoArray = newFilePaths
//app.globalData.postData.photoArray = newFilePaths
wx.navigateTo({ url: './live-submit/live-submit' })
},
function (value) {
......
......@@ -192,9 +192,11 @@ Page({
submitLive: function () {
var _this = this;
var title = app.globalData.postData.photoTitle
var content = app.globalData.postData.photoContent; //获取content
var logoArray = _this.__data__.logoArray
var title = _this.data.title
var city = _this.data.defaultCity
var address = _this.data.address
var logoArray = app.globalData.photoArray
var note_image = logoArray.join("::")
//先设置按钮不可点击
var canClick = false;
......@@ -205,10 +207,11 @@ Page({
// 如果是"推荐"和"搜索",需要单独处理
// '搜索'tab的时候, 需要转换为搜索的关键词(_this.__data__.strSearch)
var query_url = '&title=' + "上"
var query_url = '?title=' + title + '&city=' + city +
'&address=' + address + '&noteImage=' + note_image +
'&liveId=' + app.globalData.nyxCode
var strUrl = config.activity_query_url + "?pageCount=" + 4
+ "&pageNum=" + 1 + query_url
var strUrl = config.live_add_url + query_url
config.debug == 1 ? console.log("===strUrl is: \"" + strUrl + "\"") : ""
wx.request({
url: strUrl,
......@@ -279,9 +282,8 @@ Page({
//跳转到/live.wxml页面
// 重置数据
app.globalData.postData = {
photoArray: [],
}
app.globalData.photoArray = []
// jscat 20200913 消息提示框
/*
......
......@@ -263,12 +263,10 @@ Page({
onReachBottom: function () {
console.log('页面上拉触底')
var _this = this;
var curIndex = _this.__data__.curIndex
var strCity = _this.__data__.city
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
var activityType = _this.__data__.activityType
var liveType = _this.__data__.liveType
var isHideLoadMore = _this.__data__.isHideLoadMore;
var pageIndex = _this.__data__.pageIndex;
......@@ -279,7 +277,7 @@ Page({
console.log('加载更多')
setTimeout(() => {
//_this.getActivities(1, pageIndex, 4, strCity, activityType, strCategory, strSearch);
_this.getLives(1, pageIndex, 4, strCity, liveType, strSearch);
}, 1000)
}
else {
......@@ -379,18 +377,17 @@ Page({
// 取消搜索
hideInput: function () {
var _this = this;
var curIndex = _this.__data__.curIndex
var strCity = _this.__data__.city
var strCategory = _this.__data__.category[curIndex].order
var activityType = _this.__data__.activityType
var strSearch = ""
var liveType = _this.__data__.liveType
this.setData({
strSearch: strSearch,
inputShowed: false,
});
//_this.getActivities(0, 1, 4, strCity, activityType, strCategory, strSearch);
_this.getLives(0, 1, 4, strCity, liveType, strSearch);
},
// * 删除输入字符串
......@@ -404,12 +401,10 @@ Page({
startSearch: function (e) {
var _this = this;
var strSearch = e.detail.value
var curIndex = _this.__data__.curIndex
var strCity = _this.__data__.city
var strCategory = _this.__data__.category[curIndex].order
var activityType = _this.__data__.activityType
console.log("===input search text_" + strSearch)
//_this.getActivities(0, 1, 4, strCity, activityType, strCategory, strSearch);
var liveType = _this.__data__.liveType
_this.getLives(0, 1, 4, strCity, liveType, strSearch);
_this.setData({
strSearch: strSearch,
......@@ -538,13 +533,11 @@ Page({
// used by switchcity.js
onUpdateData: function(){
var _this = this;
var strCity = app.globalData.defaultCity
var curIndex = _this.__data__.curIndex
var strCategory = _this.__data__.category[curIndex].order
var strCity = _this.__data__.city
var strSearch = _this.__data__.strSearch
var activityType = _this.__data__.activityType
//_this.getActivities(0, 1, 4, strCity, activityType, strCategory, strSearch);
var liveType = _this.__data__.liveType
_this.getLives(0, 1, 4, strCity, liveType, strSearch);
},
......
......@@ -5,7 +5,7 @@
需求重点: 谁看, 看什么,
需求目标: 专业+好玩
Req1-11_25
1. 现场标签: 图片, 名字, 在看人数, 主播
1. 现场标签: 图片, 名字, 在看人数, 聊天室
2. 搜索形式: 城市 + 搜索框(店名)
3. 展示形式: 我关注的人(id), 在看自动倒序()
4. 播放形式: 图文
......
......@@ -4,7 +4,7 @@
<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>
<!-- start_of_tab-content -->
<scroll-view scroll-y="true" scroll-top="0">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论