Commit 23d860e1 by fengzhaoyu

11111

parent 830a2bba
......@@ -28,14 +28,15 @@ const $http = (url, data, type, loadingType) => {
"Content-Type": "application/json",
"Authorization": `Bearer ${token}`
},
url: `http://${app.globalData.globalUrl}/mingpay-phone/v1/${url}?${sendData}`,
url: `${app.globalData.globalUrl}/mingpay-phone/v1/${url}?${sendData}`,
method: type,
dataType: 'json',
success: function(res) {
if(res.data.resultCode === 0) {
console.log(res.data.data)
return resolve(res.data.data)
} else {
}
else {
// 修改系统繁忙时loading隐藏
dd.hideLoading();
dd.alert({
......@@ -45,12 +46,11 @@ const $http = (url, data, type, loadingType) => {
}
},
fail: function(res) {
console.log('调用失败')
dd.hideLoading();
dd.alert({
content: '系统繁忙',
buttonText: '确定'
});
content:'系统繁忙',
buttonText:'确定'
})
dd.hideLoading();
}
})
})
......@@ -72,7 +72,7 @@ const $http = (url, data, type, loadingType) => {
grant_type: 'refresh_token',
refresh_token: refresh_token
},
url:`http://${app.globalData.globalUrl}/auth/oauth/token`,
url:`${app.globalData.globalUrl}/mingpay-phone/auth/oauth/token`,
method: 'POST',
success: function(res) {
dd.setStorageSync({
......@@ -84,21 +84,16 @@ const $http = (url, data, type, loadingType) => {
loginTime: (new Date()).getTime()
}
})
dd.setStorageSync({
key: 'a',
data: 1
})
$http(url, data, type).then(res => {
return resolve(res)
})
},
fail: function(res) {
console.log('err',res)
dd.alert({
content: '系统繁忙',
buttonText: '确定'
})
dd.hideLoading()
dd.alert({
content:'系统繁忙',
buttonText:'确定'
})
dd.hideLoading();
}
})
}
......
......@@ -17,9 +17,9 @@ App({
// axios.defaults.baseURL = 'http://139.224.55.14:9999' // beta环境
globalData: {
loadingType: 0,
// globalUrl: '192.168.1.101:9999'
// globalUrl: 'http://192.167.1.101:9999'
// globalUrl: '192.168.1.102:9999'
globalUrl: '139.224.55.14:9999'
// globalUrl: ':9999'
// globalUrl: 'https://gateway.com'
globalUrl: 'https://gateway.mingwork.com'
}
});
......@@ -25,14 +25,14 @@ Page({
}
// 无网络状态
else {
if (dd.getStorageSync({ key: 'token' }).data) {
if (dd.getStorageSync({ key: 'token' }).data.access_token) {
dd.redirectTo({
url: '/pages/index/index'
})
}
else {
dd.alert({
content: '系统繁忙',
content: '登录超时,请连接网络重新登录',
buttonText: '确定'
});
dd.hideLoading()
......@@ -50,11 +50,11 @@ Page({
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
url: `http://${app.globalData.globalUrl}/mingpay-phone/v1/skipAuth/getUserInfoByCode?code=${code}&orgId=${orgId}`,
url: `${app.globalData.globalUrl}/mingpay-phone/v1/skipAuth/getUserInfoByCode?code=${code}&orgId=${orgId}`,
method: 'POST',
dataType: 'json',
success: function(res) {
console.log(res,res)
if(res.data.resultCode == 0) {
const data = res.data.data
dd.setStorageSync({
......@@ -69,7 +69,6 @@ Page({
key: 'avatar',
data: data.oapiUser.avatar
})
_that.getUserToken(data.mingUserId)
}
else {
......@@ -81,11 +80,19 @@ Page({
}
},
fail: function(res) {
console.log('err',res)
dd.alert({
content: '系统繁忙',
buttonText: '确定'
})
console.log('err',res.errorMessage)
if(res.errorMessage == "NETWORK ERROR") {
dd.alert({
content:'网络异常,稍后再试',
buttonText: '确定'
})
}
else {
dd.alert({
content:'系统繁忙',
buttonText:'确定'
})
}
dd.hideLoading();
}
......@@ -104,7 +111,7 @@ Page({
scope: 'server',
grant_type: 'password'
},
url:`http://${app.globalData.globalUrl}/auth/oauth/token`,
url:`${app.globalData.globalUrl}/auth/oauth/token`,
method: 'POST',
dataType: 'json',
success: function(res) {
......@@ -144,7 +151,7 @@ Page({
// "Content-Type": "application/json",
// "Authorization": `Bearer ${token}`
// },
// url: `http://${app.globalData.globalUrl}/v1/auth/userToken?version=v1&code=${code}&token=${token}&orgId=${orgId}`,
// url: `https://${app.globalData.globalUrl}/v1/auth/userToken?version=v1&code=${code}&token=${token}&orgId=${orgId}`,
// method: 'POST',
// dataType: 'json',
// success: function(res) {
......
......@@ -6,14 +6,15 @@
<view>
</view>
<view>
<!-- <canvas id="myQrcode" width="272" height="272" style="width:544rpx;height:544rpx;"></canvas> -->
<canvas
<canvas
a:if ='{{isTimeOut}}'
id="myQrcode"
class="am-dd-qrcode {{className}}"
width="{{size}}"
height="{{size}}"
style="width:544rpx;height:544rpx"
/>
<image a:else style="width:544rpx;height:544rpx;" mode="scaleToFill" src="../../assets/NetworkTimeout.png"/ >
</view>
<view onTap="clickRefreshQRcode" onTap="clickRefreshQRcode">
<image mode="scaleToFill" src="./../../assets/refresh.png" /><text>点击手动刷新</text>
......
......@@ -12,6 +12,7 @@ Page({
size: 272,
url: '',
ecc: 2,
isTimeOut: true
},
onLoad(query) {
// 页面加载
......@@ -31,6 +32,7 @@ Page({
},
// 生成二维码
refreshQRcode(){
console.log('erweima')
const _that = this;
let hasToken = dd.getStorageSync({ key: 'token' }).data;
let token = dd.getStorageSync({ key: 'token' }).data.access_token;
......@@ -47,10 +49,8 @@ Page({
let size = 272
let ecc = 2
let name = 'myQrcode'
console.log(111111111111)
const ctx = dd.createCanvasContext(name);
QR.draw(url, ctx, size, Number(ecc));
console.log(11111111111111)
}
else {
dd.getNetworkType({
......@@ -62,7 +62,7 @@ Page({
'Authorization': 'Basic bWluZ3BheS1waG9uZTptaW5ncGF5LXBob25l',
'Content-Type': 'application/x-www-form-urlencoded'
},
url: `http://${app.globalData.globalUrl}/auth/oauth/token`,
url: `${app.globalData.globalUrl}/auth/oauth/token`,
dataType: 'json',
data: {
grant_type: 'refresh_token',
......@@ -80,9 +80,9 @@ Page({
loginTime: (new Date()).getTime()
}
})
_that.setData({
b:1
})
_that.setData({
isTimeOut: true
})
hasToken = dd.getStorageSync({ key: 'token' }).data;
token = dd.getStorageSync({ key: 'token' }).data.access_token;
expires_in = dd.getStorageSync({ key: 'token' }).data.expires_in;
......@@ -114,6 +114,9 @@ Page({
content: '请连接网络后重新进入',
buttonText: '确定'
})
_that.setData({
isTimeOut: false
})
dd.hideLoading()
}
})
......@@ -135,47 +138,58 @@ Page({
},
onReady() {
// 页面加载完成
console.log(' onReady')
clearInterval(timeRefreshQRcode);
const _that = this;
_that.refreshQRcode();
timeRefreshQRcode = setInterval(function () {
_that.refreshQRcode();
}, 55000);
// console.log(' onReady')
},
onShow() {
console.log('进入onshow')
//刷新二维码
clearInterval(timeRefreshQRcode);
const _that = this;
setTimeout(function (){
clearInterval(timeRefreshQRcode);
_that.refreshQRcode();
timeRefreshQRcode = setInterval(function () {
_that.refreshQRcode();
}, 55000);
},500)
console.log(dd.corpId,'dd.corpId')
//页面显示
dd.connectSocket({
url: `ws://${app.globalData.globalUrl}/v1/mingpaywebsocket?param=${dd.corpId}_${dd.getStorageSync({ key: 'userId' }).data}`,
url: `wss://gateway.mingwork.com/mingpay-phone/v1/mingpaywebsocket?param=${dd.corpId}_${dd.getStorageSync({ key: 'userId' }).data}`,
data: {},
header:{
'content-type': 'application/json',
'Authorization': `Bearer ${dd.getStorageSync({ key: 'token' }).data.access_token}`
'content-type': 'application/json'
// 'Authorization': `Bearer ${dd.getStorageSync({ key: 'token' }).data.access_token}`
},
method:"GET",
success: (res) => {
console.log(res,'res')
},
fail: (err) => {
console.log(err,'err')
},
complete: (e) => {
console.log(e,'err')
}
});
dd.onSocketOpen(function(res) {
console.log('WebSocket 连接已打开!');
});
dd.onSocketError(function(res){
console.log(res)
console.log('WebSocket 连接打开失败,请检查!');
});
dd.onSocketMessage(function(res) {
console.log(JSON.parse(res.data))
let resData = JSON.parse(res.data)
console.log(resData)
if(resData.paymentCode === 0){
dd.onSocketClose(function(res) {
console.log('WebSocket 已关闭!')
})
dd.redirectTo({
url: `./../paySuccess/paySuccess?money=${(JSON.parse(res.data).orderAmount).toFixed(2)}`
url: `./../paySuccess/paySuccess?money=${(JSON.parse(res.data).orderAmount.toFixed(2))}`
})
}else if(resData.paymentCode === 10001){
dd.alert({
content: '账户状态异常',
......@@ -208,16 +222,16 @@ Page({
})
clearInterval(timeRefreshQRcode);
},
onUnload() {
// 页面被关闭
const _that = this;
clearInterval(timeRefreshQRcode);
dd.offSocketMessage()
dd.closeSocket()
dd.onSocketClose(function(res) {
console.log('WebSocket 已关闭!')
})
},
// onUnload() {
// // 页面被关闭
// const _that = this;
// clearInterval(timeRefreshQRcode);
// dd.offSocketMessage()
// dd.closeSocket()
// dd.onSocketClose(function(res) {
// console.log('WebSocket 已关闭!')
// })
// },
onTitleClick() {
// 标题被点击
},
......
......@@ -12,7 +12,7 @@ Page({
recordListData: [],
currentPage: 1,
totalCount: '',
pageNumber: 10,
pageNumber: 20,
},
onLoad(query) {
this.resetData()
......@@ -40,7 +40,7 @@ Page({
recordListData: [],
currentPage: 1,
totalCount: '',
pageNumber: 10,
pageNumber: 20,
})
},
chooseType() {
......@@ -51,7 +51,6 @@ Page({
cancelButtonText: '取消',
success: (res) => {
const btn = res.index === -1 ? '取消' : '第' + res.index + '个';
console.log(res)
if(res.index === -1){
return
}else{
......@@ -98,7 +97,6 @@ Page({
});
},
queryListPaymentRecord(str) {
console.log(str)
const _that = this;
let data = {
currentPage: this.data.currentPage,
......@@ -114,12 +112,10 @@ Page({
statusList: this.data.statusList
}
$http.$http('isv/consume/list_payment_record', data, 'GET').then((res) => {
console.log('record' + res)
let dataList = [...res.recordList];
let recordListDataSource = _that.data.recordListData
if (dataList.length > 0) {
dataList.map((item, index) => {
console.log(' item.createDate', item.createDate)
item.createDate = _that.timeToStr(item.createDate)
recordListDataSource.push(item)
})
......@@ -186,8 +182,6 @@ Page({
timeToStr (time) {
time = time.replace(/\-/g, "/")
let timeData = new Date(time)
console.log('time',time)
console.log('timeData',timeData)
let year = timeData.getFullYear()
let month = timeData.getMonth() + 1
let date = timeData.getDate()
......
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