订单相关修改提测

This commit is contained in:
GaoHao
2024-09-09 11:08:04 +08:00
parent c2ff506543
commit 2dbcdf4300
45 changed files with 1377 additions and 3506 deletions

View File

@@ -1,4 +1,5 @@
import md5 from './md5'
import Api from "@/common/js/api.js"
/**
* 转换对象为x-www-form-urlencoded
@@ -232,11 +233,84 @@ const pluschooseImage = function() {
return true
}
// #endif
// #ifdef MP-WEIXIN
// #ifdef MP-WEIXIN || MP-ALIPAY
return true
// #endif
}
const getUserInfo = function (successCallback, failCallback) {
// #ifdef MP-WEIXIN
return new Promise((resolve, reject) => {
uni.login({
provider: 'weixin',
success: (data) => {
// 微信小程序环境
uni.getUserInfo({
provider: 'weixin',
success: async (infoRes) => {
let res = await Api.userwxlogin({
code: data.code, //临时登录凭证
rawData: infoRes.rawData,
})
if (res.code == 0) {
resolve(res)
// uni.cache.set('token', res.data.token);
// uni.cache.set('miniAppOpenId', res.data.userInfo
// .miniAppOpenId)
// uni.cache.set('userInfo', res.data.userInfo);
// let pages = getCurrentPages()
// let curPage = pages[pages.length -1 ]
// curPage.onLoad(curPage.options)
// curPage.onShow()
// // curPage.mounted()
// curPage.onReady()
}
},
fail: (err) => {}
});
}
});
})
// #endif
// #ifdef MP-ALIPAY
return new Promise((resolve, reject) => {
my.getAuthCode({
scopes: 'auth_user',
success: (data) => {
// 支付宝小程序环境
my.getAuthUserInfo({
success: async (infoRes) => {
uni.cache.set('weixincode', data.authCode);
let res = await Api.userwxlogin({
code: uni.cache.get('weixincode'), //临时登录凭证
rawData: JSON.stringify(infoRes),
})
if (res.code == 0) {
resolve(res)
// uni.cache.set('token', res.data.token);
// uni.cache.set('miniAppOpenId', res.data.userInfo
// .miniAppOpenId)
// uni.cache.set('userInfo', res.data.userInfo);
// let pages = getCurrentPages()
// let curPage = pages[pages.length -1 ]
// curPage.onLoad(curPage.options)
// curPage.onShow()
// // curPage.mounted()
// curPage.onReady()
}
},
fail: (err) => {}
});
}
});
})
// #endif
}
uni.utils = {
md5,
transformRequest,
@@ -253,5 +327,6 @@ uni.utils = {
debounce,
getCurrentPage,
getCurrentRoute,
pluschooseImage
pluschooseImage,
getUserInfo
}