积分商城功能完善
This commit is contained in:
@@ -1,16 +1,58 @@
|
||||
export const back=()=>{
|
||||
export const back = () => {
|
||||
console.log('调用返回方法back');
|
||||
try {
|
||||
const arr= getCurrentPages()
|
||||
if(arr.length>=2){
|
||||
const arr = getCurrentPages()
|
||||
if (arr.length >= 2) {
|
||||
return uni.navigateBack()
|
||||
}else{
|
||||
} else {
|
||||
uni.reLaunch({
|
||||
url:'/pages/index/index'
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('页面返回出错',error)
|
||||
console.error('页面返回出错', error)
|
||||
//TODO handle the exception
|
||||
}
|
||||
}
|
||||
|
||||
import {
|
||||
APIuserlogin,
|
||||
APIuser
|
||||
} from "@/common/api/api.js";
|
||||
|
||||
export const getOpenId = () => {
|
||||
// #ifdef MP-WEIXIN
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.login({
|
||||
provider: "weixin",
|
||||
success: (data) => {
|
||||
// 微信小程序环境
|
||||
uni.getUserInfo({
|
||||
provider: "weixin",
|
||||
success: async (infoRes) => {
|
||||
let res = await APIuserlogin({
|
||||
code: data.code, //临时登录凭证
|
||||
rawData: infoRes.rawData,
|
||||
source: "wechat",
|
||||
});
|
||||
if (res) {
|
||||
resolve(res.userInfo
|
||||
.wechatOpenId);
|
||||
} else {
|
||||
reject(false);
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(false);
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
})
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-ALIPAY
|
||||
|
||||
// #endif
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user