From 19c8f1e119e14e29957f7912102c20903a0102e7 Mon Sep 17 00:00:00 2001 From: xuyuanfeng <986771570@qq.com> Date: Tue, 7 May 2019 16:46:18 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E4=BF=AE=E5=A4=8D=E7=99=BB=E9=99=86?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E4=B9=8B=E5=90=8E=20=E9=A1=B5=E9=9D=A2js?= =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E6=89=A7=E8=A1=8C=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scetc-show-videos-page/app.json | 14 +-- scetc-show-videos-page/pages/mine/mine.js | 124 ++++++++++----------- scetc-show-videos-page/project.config.json | 2 + scetc-show-videos-page/sitemap.json | 7 ++ 4 files changed, 75 insertions(+), 72 deletions(-) create mode 100644 scetc-show-videos-page/sitemap.json diff --git a/scetc-show-videos-page/app.json b/scetc-show-videos-page/app.json index 07c1cf28..4d42b937 100644 --- a/scetc-show-videos-page/app.json +++ b/scetc-show-videos-page/app.json @@ -1,13 +1,13 @@ { - "pages": [ + "pages": [ "pages/category/category", "pages/userLogin/login", - "pages/userRegist/regist", + "pages/userRegist/regist", "pages/mine/mine", - "pages/chooseBgm/chooseBgm", - "pages/index/index", + "pages/chooseBgm/chooseBgm", + "pages/index/index", "pages/videoInfo/videoInfo", - "pages/searchVideos/searchVideos", + "pages/searchVideos/searchVideos", "pages/report/report", "pages/bootstrap/bootstrap", "pages/upload/upload" @@ -46,6 +46,6 @@ } ] }, - "debug": true - + "debug": true, + "sitemapLocation": "sitemap.json" } \ No newline at end of file diff --git a/scetc-show-videos-page/pages/mine/mine.js b/scetc-show-videos-page/pages/mine/mine.js index 02de5f42..36cb14f5 100644 --- a/scetc-show-videos-page/pages/mine/mine.js +++ b/scetc-show-videos-page/pages/mine/mine.js @@ -3,37 +3,35 @@ const app = getApp() Page({ data: { faceUrl: "../resource/images/noneface.png", - fansCounts:"", - followCounts:"", - videoList:[], - receiveLikeCounts:"", - nickname:"", + fansCounts: "", + followCounts: "", + videoList: [], + receiveLikeCounts: "", + nickname: "", isMe: true, isFollowed: false, - serverUrl:"", + serverUrl: "", publisherId: "" }, - onGotUserInfo: function (e) { - + }, - onShow:function() - { + onShow: function () { var me = this; var serverUrl = app.serverUrl; var user = app.getGlobalUserInfo(); var userId = user.id; var publisherId = app.globalData.publisherId; app.globalData.publisherId = null; - if (user==null||user==undefined||user=='') - { + if (user == null || user == undefined || user == '') { wx.redirectTo({ - url: '../userLogin/login', - }) - } + url: '../userLogin/login', + }) + return ; + } me.setData( { - isMe:true + isMe: true } ) if (publisherId != null && publisherId != '' && publisherId != undefined && publisherId != userId) { @@ -46,8 +44,7 @@ Page({ ) } var that = this; - var serverUrl = app.serverUrl; - wx.request({ + var serverUrl = app.serverUrl; wx.request({ url: serverUrl + "/user/query?userId=" + userId, method: "post" , @@ -128,13 +125,12 @@ Page({ var userId = user.id; var publisherId = app.globalData.publisherId; app.globalData.publisherId = null; - console.log("user" + user); if (user == null || user == undefined || user == '') { wx.redirectTo({ url: '../userLogin/login', }) - } - console.log("----------------------------------"); + return ; + } if (publisherId != null && publisherId != '' && publisherId != undefined && publisherId != userId) { userId = publisherId; me.setData( @@ -151,11 +147,11 @@ Page({ method: "post" , header: - { - 'content-type': 'application/json'//默认值 - }, + { + 'content-type': 'application/json'//默认值 + }, success: function (res) { - var serverUrl = app.serverUrl; + var serverUrl = app.serverUrl; if (res.data.status == 200) { var userInfo = res.data.data; @@ -181,31 +177,29 @@ Page({ { isFollowed: res.data.data }) - //如果此时用户点击的其他人 则应该查询出他人的视频 - var userId=user.id; - var isMe=me.data.isMe; - if (isMe==false) - { - userId=publisherId; + //如果此时用户点击的其他人 则应该查询出他人的视频 + var userId = user.id; + var isMe = me.data.isMe; + if (isMe == false) { + userId = publisherId; } - //继续查询 查询自己发布的视频 - wx.request({ - url: serverUrl + '/video/queryVideosByUser?userId=' + userId, - method:"post", - success(res) - { - //根据视频的id去查询 - var videoList=res.data.data; - me.setData( - { - videoList: videoList, - serverUrl: app.serverUrl - } - ) - //保存videoList对象 - //遍历videoList对象并显示到页面上 - } - }) + //继续查询 查询自己发布的视频 + wx.request({ + url: serverUrl + '/video/queryVideosByUser?userId=' + userId, + method: "post", + success(res) { + //根据视频的id去查询 + var videoList = res.data.data; + me.setData( + { + videoList: videoList, + serverUrl: app.serverUrl + } + ) + //保存videoList对象 + //遍历videoList对象并显示到页面上 + } + }) } }) } @@ -244,7 +238,7 @@ Page({ { isFollowed: true, } - + ) var that = me; var serverUrl = app.serverUrl; @@ -253,9 +247,9 @@ Page({ method: "post" , header: - { - 'content-type': 'application/json'//默认值 - }, + { + 'content-type': 'application/json'//默认值 + }, success: function (res) { if (res.data.status == 200) { var userInfo = res.data.data; @@ -271,8 +265,8 @@ Page({ receiveLikeCounts: userInfo.receiveLikeCounts, }) } - } - }) + } + }) } }) }, @@ -300,9 +294,9 @@ Page({ method: "post" , header: - { - 'content-type': 'application/json'//默认值 - }, + { + 'content-type': 'application/json'//默认值 + }, success: function (res) { if (res.data.status == 200) { var userInfo = res.data.data; @@ -320,7 +314,7 @@ Page({ } } }) - + } }) @@ -349,9 +343,9 @@ Page({ filePath: tempFilePaths[0], name: 'file', header: - { - 'content-type': 'application/json'//默认值 - }, + { + 'content-type': 'application/json'//默认值 + }, success: function (res) { var data = JSON.parse(res.data); wx.hideLoading(); @@ -434,9 +428,9 @@ Page({ url: serverUrl + '/logout?userId=' + user.id, method: "POST", header: - { - 'content-type': 'application/json'//默认值 - }, + { + 'content-type': 'application/json'//默认值 + }, success: function (res) { diff --git a/scetc-show-videos-page/project.config.json b/scetc-show-videos-page/project.config.json index 028d65d1..e268224e 100644 --- a/scetc-show-videos-page/project.config.json +++ b/scetc-show-videos-page/project.config.json @@ -16,6 +16,8 @@ "appid": "wxcf9c100b9ccb1914", "projectname": "Show%E7%A7%80%E8%A7%86%E9%A2%91", "isGameTourist": false, + "simulatorType": "wechat", + "simulatorPluginLibVersion": {}, "condition": { "search": { "current": -1, diff --git a/scetc-show-videos-page/sitemap.json b/scetc-show-videos-page/sitemap.json new file mode 100644 index 00000000..ca02add2 --- /dev/null +++ b/scetc-show-videos-page/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file