Commit 95271782 by fengzhaoyu

MOD:action进不去,跳转重新登录页面,加下拉刷新

parent e4f256da
...@@ -40,14 +40,14 @@ const $http = (url, data, type, loadingType) => { ...@@ -40,14 +40,14 @@ const $http = (url, data, type, loadingType) => {
// 修改系统繁忙时loading隐藏 // 修改系统繁忙时loading隐藏
dd.hideLoading(); dd.hideLoading();
dd.alert({ dd.alert({
content: '系统繁忙', content: '系统异常',
buttonText: '确定' buttonText: '确定'
}); });
} }
}, },
fail: function(res) { fail: function(res) {
dd.alert({ dd.alert({
content:'系统繁忙', content:'系统异常',
buttonText:'确定' buttonText:'确定'
}) })
dd.hideLoading(); dd.hideLoading();
...@@ -90,7 +90,7 @@ const $http = (url, data, type, loadingType) => { ...@@ -90,7 +90,7 @@ const $http = (url, data, type, loadingType) => {
}, },
fail: function(res) { fail: function(res) {
dd.alert({ dd.alert({
content:'系统繁忙', content:'系统异常',
buttonText:'确定' buttonText:'确定'
}) })
dd.hideLoading(); dd.hideLoading();
...@@ -99,7 +99,7 @@ const $http = (url, data, type, loadingType) => { ...@@ -99,7 +99,7 @@ const $http = (url, data, type, loadingType) => {
} }
else { else {
dd.alert({ dd.alert({
content: '登录超时,请连接网络重新登录', content: '您暂时无网',
buttonText: '确定' buttonText: '确定'
}); });
dd.hideLoading() dd.hideLoading()
......
...@@ -10,13 +10,14 @@ ...@@ -10,13 +10,14 @@
"pages/rechargeSuccess/rechargeSuccess", "pages/rechargeSuccess/rechargeSuccess",
"pages/billDetails/billDetails", "pages/billDetails/billDetails",
"pages/noPermission/noPermission", "pages/noPermission/noPermission",
"pages/allowanceRecordList/allowanceRecordList" "pages/allowanceRecordList/allowanceRecordList",
"pages/reTry/reTry"
], ],
"window": { "window": {
"enableWK": "YES", "enableWK": "YES",
"enableDSL": true, "enableDSL": true,
"defaultTitle": "小程序", "defaultTitle": "小程序",
"pullRefresh": false, "pullRefresh": true,
"allowsBounceVertical": true "allowsBounceVertical": true
}, },
"debug": true "debug": true
......
...@@ -25,16 +25,19 @@ Page({ ...@@ -25,16 +25,19 @@ Page({
} }
// 无网络状态 // 无网络状态
else { else {
if (dd.getStorageSync({ key: 'token' }).data.access_token) { if (dd.getStorageSync({ key: 'token' }).data) {
dd.redirectTo({ dd.redirectTo({
url: '/pages/index/index' url: '/pages/index/index'
}) })
} }
else { else {
dd.alert({ dd.alert({
content: '登录超时,请连接网络重新登录', content: '登录超时,请连接网络重',
buttonText: '确定' buttonText: '确定'
}); });
dd.redirectTo({
url:'/pages/reTry/reTry'
})
dd.hideLoading() dd.hideLoading()
} }
} }
...@@ -71,9 +74,8 @@ Page({ ...@@ -71,9 +74,8 @@ Page({
_that.getUserToken(data.mingUserId) _that.getUserToken(data.mingUserId)
} }
else { else {
dd.alert({ dd.redirectTo({
content: '系统繁忙', url:'pages/reTry/reTry'
buttonText: '确定'
}) })
dd.hideLoading() dd.hideLoading()
} }
...@@ -87,9 +89,8 @@ Page({ ...@@ -87,9 +89,8 @@ Page({
}) })
} }
else { else {
dd.alert({ dd.redirectTo({
content:'系统繁忙', url:'/pages/reTry/reTry'
buttonText:'确定'
}) })
} }
dd.hideLoading(); dd.hideLoading();
...@@ -111,6 +112,7 @@ Page({ ...@@ -111,6 +112,7 @@ Page({
grant_type: 'password' grant_type: 'password'
}, },
url:`${app.globalData.globalUrl}/auth/oauth/token`, url:`${app.globalData.globalUrl}/auth/oauth/token`,
// url:`${app.globalData.globalUrl}/auth/oauth/`,
method: 'POST', method: 'POST',
dataType: 'json', dataType: 'json',
success: function(res) { success: function(res) {
...@@ -130,74 +132,14 @@ Page({ ...@@ -130,74 +132,14 @@ Page({
}, },
fail: function(res) { fail: function(res) {
console.log('err',res) console.log('err',res)
dd.alert({ dd.redirectTo({
content: '系统繁忙', url:'/pages/reTry/reTry'
buttonText: '确定'
}) })
dd.hideLoading() dd.hideLoading()
} }
}) })
}, },
// 有网络的状态更新用户userId和token
// getUserMsg(code) {
// const _that = this;
// let token = dd.getStorageSync({ key: 'token' }).data ? dd.getStorageSync({ key: 'token' }).data.access_token : '';
// let orgId = dd.corpId;
// dd.httpRequest({
// headers: {
// "Content-Type": "application/json",
// "Authorization": `Bearer ${token}`
// },
// url: `https://${app.globalData.globalUrl}/v1/auth/userToken?version=v1&code=${code}&token=${token}&orgId=${orgId}`,
// method: 'POST',
// dataType: 'json',
// success: function(res) {
// console.log(res)
// // 全局存储用户信息token和用户信息
// if(res.data.resultCode === '0'){
// const data = res.data.data;
// // 更新用户内部信息
// dd.setStorageSync({
// key: 'token',
// data: {
// access_token: data.accessToken.access_token,
// token_type: data.accessToken.token_type,
// expires_in: data.accessToken.expires_in,
// loginTime: (new Date()).getTime()
// }
// });
// dd.setStorageSync({
// key: 'userId',
// data: data.oapiUser.userid
// });
// dd.setStorageSync({
// key: 'avatar',
// data: data.oapiUser.avatar
// });
// dd.hideLoading();
// dd.redirectTo({
// url: '/pages/index/index'
// })
// }else{
// dd.hideLoading();
// dd.redirectTo({
// url: '/pages/noPermission/noPermission'
// })
// }
// },
// fail: function(res) {
// console.log('err',res)
// dd.alert({
// content: '系统繁忙',
// buttonText: '确定'
// });
// dd.hideLoading();
// }
// });
// },
onReady() { onReady() {
// 页面加载完成 // 页面加载完成
}, },
...@@ -213,9 +155,6 @@ Page({ ...@@ -213,9 +155,6 @@ Page({
onTitleClick() { onTitleClick() {
// 标题被点击 // 标题被点击
}, },
onPullDownRefresh() {
// 页面被下拉
},
onReachBottom() { onReachBottom() {
// 页面被拉到底部 // 页面被拉到底部
}, },
......
...@@ -128,12 +128,16 @@ Page({ ...@@ -128,12 +128,16 @@ Page({
}, },
onUnload() { onUnload() {
// 页面被关闭 // 页面被关闭
dd.stopPullDownRefresh()
}, },
onTitleClick() { onTitleClick() {
// 标题被点击 // 标题被点击
}, },
onPullDownRefresh() { onPullDownRefresh() {
// 页面被下拉 // 页面被下拉
dd.redirectTo({
url:'/pages/alipayRecharge/alipayRecharge'
})
}, },
onReachBottom() { onReachBottom() {
// 页面被拉到底部 // 页面被拉到底部
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
font-size: 30rpx; font-size: 30rpx;
flex: 1; flex: 1;
display: flex; display: flex;
line-height: 20px
} }
.availableItemFullMoney,.availableItemBalance{ .availableItemFullMoney,.availableItemBalance{
padding-left: 60rpx; padding-left: 60rpx;
...@@ -33,6 +34,7 @@ ...@@ -33,6 +34,7 @@
.availableItemTime{ .availableItemTime{
color: #636363; color: #636363;
font-size: 24rpx; font-size: 24rpx;
line-height: 20px;
} }
.availableItemDetails{ .availableItemDetails{
font-size: 24rpx; font-size: 24rpx;
......
...@@ -90,12 +90,16 @@ Page({ ...@@ -90,12 +90,16 @@ Page({
}, },
onUnload() { onUnload() {
// 页面被关闭 // 页面被关闭
dd.stopPullDownRefresh()
}, },
onTitleClick() { onTitleClick() {
// 标题被点击 // 标题被点击
}, },
onPullDownRefresh() { onPullDownRefresh() {
// 页面被下拉 // 页面被下拉
dd.redirectTo({
url: '/pages/allowanceList/allowanceList'
})
}, },
onReachBottom() { onReachBottom() {
let currentNum = ''; let currentNum = '';
......
...@@ -86,12 +86,16 @@ Page({ ...@@ -86,12 +86,16 @@ Page({
}, },
onUnload() { onUnload() {
// 页面被关闭 // 页面被关闭
// dd.stopPullDownRefresh
}, },
onTitleClick() { onTitleClick() {
// 标题被点击 // 标题被点击
}, },
onPullDownRefresh() { onPullDownRefresh() {
// 页面被下拉 // 页面被下拉
// dd.redirectTo({
// url: '/pages/allowanceRecordList/allowanceRecordList'
// })
}, },
onReachBottom() { onReachBottom() {
let currentNum = ''; let currentNum = '';
......
{} {
\ No newline at end of file "pullRefresh": false
}
\ No newline at end of file
...@@ -53,12 +53,16 @@ Page({ ...@@ -53,12 +53,16 @@ Page({
}, },
onUnload() { onUnload() {
// 页面被关闭 // 页面被关闭
// dd.stopPullDownRefresh()
}, },
onTitleClick() { onTitleClick() {
// 标题被点击 // 标题被点击
}, },
onPullDownRefresh() { onPullDownRefresh() {
// 页面被下拉 // 页面被下拉
// dd.redirectTo({
// url: '/pages/billDetails/billDetails'
// })
}, },
onReachBottom() { onReachBottom() {
// 页面被拉到底部 // 页面被拉到底部
......
{} {
\ No newline at end of file "pullRefresh": false
}
\ No newline at end of file
...@@ -16,6 +16,7 @@ Page({ ...@@ -16,6 +16,7 @@ Page({
// }, // },
onLoad(query) { onLoad(query) {
const _that = this; const _that = this;
dd.setNavigationBar({ dd.setNavigationBar({
title: '一卡通', title: '一卡通',
...@@ -83,12 +84,18 @@ Page({ ...@@ -83,12 +84,18 @@ Page({
}, },
onUnload() { onUnload() {
// 页面被关闭 // 页面被关闭
dd.stopPullDownRefresh()
}, },
onTitleClick() { onTitleClick() {
// 标题被点击 // 标题被点击
}, },
onPullDownRefresh() { onPullDownRefresh() {
// 页面被下拉 // 页面被下拉
dd.redirectTo({
url: '/pages/index/index'
})
}, },
onReachBottom() { onReachBottom() {
......
...@@ -31,9 +31,10 @@ Page({ ...@@ -31,9 +31,10 @@ Page({
onTitleClick() { onTitleClick() {
// 标题被点击 // 标题被点击
}, },
onPullDownRefresh() { // onPullDownRefresh() {
// 页面被下拉 // // 页面被下拉
}, // dd.stopPullDownRefresh()
// },
onReachBottom() { onReachBottom() {
// 页面被拉到底部 // 页面被拉到底部
}, },
......
{} {
\ No newline at end of file "pullRefresh": false
}
\ No newline at end of file
...@@ -191,6 +191,7 @@ Page({ ...@@ -191,6 +191,7 @@ Page({
}, },
onUnload() { onUnload() {
// 页面被关闭 // 页面被关闭
dd.stopPullDownRefresh()
console.log('onUnload') console.log('onUnload')
const _that = this; const _that = this;
clearInterval(timeRefreshQRcode); clearInterval(timeRefreshQRcode);
...@@ -204,6 +205,9 @@ Page({ ...@@ -204,6 +205,9 @@ Page({
}, },
onPullDownRefresh() { onPullDownRefresh() {
// 页面被下拉 // 页面被下拉
dd.redirectTo({
url: '/pages/payment/payment'
})
}, },
onReachBottom() { onReachBottom() {
// 页面被拉到底部 // 页面被拉到底部
......
.noPermissionContent{
width: 7.5rem;
text-align: center;
padding-top: 380rpx;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.noPermissionContent image{
width: 280rpx;
height: 220rpx;
display: block;
/* margin-bottom: 20rpx; */
}
.noPermissionContent text{
display: block;
font-size: 28rpx;
color: rgba(25, 31, 37, 0.48);
margin-bottom: 20rpx;
}
.reTry {
width: 132rpx;
height: 60rpx;
margin-top: 0 auto;
border-radius: 8rpx;
line-height: 60rpx;
text-align: center;
background: #2474FF;
color: white;
font-size: 32rpx;
}
\ No newline at end of file
<view>
<view class="noPermissionContent">
<image mode="scaleToFill" src="../../../assets/noPermission.png"/>
<text>登录失败,请重试</text>
<button class='reTry' onTap="reTry">重试</button>
</view>
</view>
\ No newline at end of file
const app = getApp()
import $http from './../../API/http'
Page({
data:{
},
onLoad(query) {
dd.setNavigationBar({
title: '一卡通',
backgroundColor: '#2474FF'
});
},
reTry() {
dd.redirectTo({
url: '/pages/action/action'
})
},
onReady() {
},
onShow() {
// 页面显示
},
onHide() {
// 页面隐藏
},
onUnload() {
// 页面被关闭
},
onTitleClick() {
// 标题被点击
},
onReachBottom() {
},
onShareAppMessage() {
// 返回自定义分享信息
return {
title: 'My App',
desc: 'My App description',
path: 'pages/index/index',
};
},
});
{
"pullRefresh": false
}
\ No newline at end of file
{} {
\ No newline at end of file "pullRefresh": false
}
\ No newline at end of file
...@@ -218,13 +218,17 @@ Page({ ...@@ -218,13 +218,17 @@ Page({
}, },
onUnload() { onUnload() {
// 页面被关闭 // 页面被关闭
dd.stopPullDownRefresh()
}, },
onTitleClick() { onTitleClick() {
// 标题被点击 // 标题被点击
}, },
// onPullDownRefresh() { onPullDownRefresh() {
// // 页面被下拉 // 页面被下拉
// }, dd.redirectTo({
url:'/pages/recordList/recordList'
})
},
onReachBottom() { onReachBottom() {
// dd.alert({ // dd.alert({
// content: '111111', // content: '111111',
......
...@@ -27,10 +27,10 @@ var webSocket = { ...@@ -27,10 +27,10 @@ var webSocket = {
* complete Function 否 接口调用结束的回调函数(调用成功、失败都会执行) * complete Function 否 接口调用结束的回调函数(调用成功、失败都会执行)
*/ */
connectSocket: function(options) { connectSocket: function(options) {
dd.showLoading({ // dd.showLoading({
title: '', // title: '',
mask: true, // mask: true,
}) // })
socketOpen = false socketOpen = false
socketClose = false socketClose = false
socketMsgQueue = [] socketMsgQueue = []
...@@ -183,7 +183,6 @@ var webSocket = { ...@@ -183,7 +183,6 @@ var webSocket = {
// 监听WebSocket连接打开事件。callback 回调函数 // 监听WebSocket连接打开事件。callback 回调函数
dd.onSocketOpen(function(res) { dd.onSocketOpen(function(res) {
console.log('WebSocket连接已打开!') console.log('WebSocket连接已打开!')
dd.hideLoading();
// 如果已经调用过关闭function // 如果已经调用过关闭function
if (socketClose) { if (socketClose) {
webSocket.closeSocket(); webSocket.closeSocket();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment