Commit 23d860e1 by fengzhaoyu

11111

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