chore: 重新与HuaweiPay分支比较,起点
This commit is contained in:
42
main.js
42
main.js
@@ -56,41 +56,19 @@ import NsLogin from "@/components/ns-login/ns-login.vue"
|
||||
Vue.component('ns-login', NsLogin);
|
||||
|
||||
import PrivacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// 只保留一次组件注册(删除重复行)
|
||||
Vue.component('privacy-popup', PrivacyPopup)
|
||||
|
||||
// 全局登录方法(替换成你的真实后端接口地址)
|
||||
Vue.prototype.$doGlobalLogin = async function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.login({
|
||||
success: async (loginRes) => {
|
||||
if (!loginRes.code) {
|
||||
reject("获取登录凭证失败,请重试");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// !!替换为你的真实后端登录接口地址!!
|
||||
const res = await uni.request({
|
||||
url: "https://dev.aigc-quickapp.com/api/user/login",
|
||||
method: "POST",
|
||||
data: { code: loginRes.code }
|
||||
});
|
||||
if (res.data?.success) {
|
||||
uni.setStorageSync("token", res.data.token);
|
||||
resolve(true);
|
||||
} else {
|
||||
reject(res.data?.msg || "登录失败");
|
||||
}
|
||||
} catch (err) {
|
||||
reject("网络异常");
|
||||
}
|
||||
},
|
||||
fail: () => reject("登录授权失败")
|
||||
});
|
||||
});
|
||||
};
|
||||
// ========== 新增:注册diy系列组件 ==========
|
||||
import DiyBottomNav from '@/components/diy-components/diy-bottom-nav.vue'
|
||||
import DiyGroup from '@/components/diy-components/diy-group.vue'
|
||||
import DiyCategory from '@/components/diy-components/diy-category.vue'
|
||||
import DiyIcon from '@/components/diy-components/diy-icon.vue' // 补充diy-icon
|
||||
|
||||
// 只创建一次Vue实例(删除重复声明)
|
||||
Vue.component('diy-bottom-nav', DiyBottomNav) // 修正拼写错误
|
||||
Vue.component('diy-group', DiyGroup)
|
||||
Vue.component('diy-category', DiyCategory)
|
||||
Vue.component('diy-icon', DiyIcon) // 注册diy-icon
|
||||
// ========== 新增结束 ==========
|
||||
const app = new Vue({
|
||||
...App,
|
||||
store
|
||||
|
||||
Reference in New Issue
Block a user