积分商城功能完善

This commit is contained in:
2025-12-10 19:33:29 +08:00
parent 6b53d30f69
commit 87f2ee8c3d
12 changed files with 1268 additions and 589 deletions

View File

@@ -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
}