Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
[update] 修复登陆跳转之后 页面js继续执行的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
RAOE committed May 7, 2019
1 parent 79778b1 commit 19c8f1e
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 72 deletions.
14 changes: 7 additions & 7 deletions scetc-show-videos-page/app.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -46,6 +46,6 @@
}
]
},
"debug": true

"debug": true,
"sitemapLocation": "sitemap.json"
}
124 changes: 59 additions & 65 deletions scetc-show-videos-page/pages/mine/mine.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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"
,
Expand Down Expand Up @@ -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(
Expand All @@ -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;
Expand All @@ -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对象并显示到页面上
}
})
}
})
}
Expand Down Expand Up @@ -244,7 +238,7 @@ Page({
{
isFollowed: true,
}
)
var that = me;
var serverUrl = app.serverUrl;
Expand All @@ -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;
Expand All @@ -271,8 +265,8 @@ Page({
receiveLikeCounts: userInfo.receiveLikeCounts,
})
}
}
})
}
})
}
})
},
Expand Down Expand Up @@ -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;
Expand All @@ -320,7 +314,7 @@ Page({
}
}
})
}
})
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions scetc-show-videos-page/project.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions scetc-show-videos-page/sitemap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}

0 comments on commit 19c8f1e

Please sign in to comment.