diff --git a/App.vue b/App.vue index 778f2a6..6fa2369 100644 --- a/App.vue +++ b/App.vue @@ -20,6 +20,9 @@ getUserInfo } from '@/api/user.js'; + import { + parseToken + } from "@/api/appLet.js"; import { HTTP_REQUEST_URL } from './config/app'; @@ -29,6 +32,7 @@ history } from '@/api/public.js' import Routine from './libs/routine.js'; +import { Toast } from "./libs/uniApi"; export default { data() { @@ -93,16 +97,52 @@ key: 'launchFlag' }) + // 用于调试中台登录 + // parseToken({ + // token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJjZXNoaS1taWRkbGUubGloYWluay5jbiIsImF1ZCI6ImNlc2hpLW1pZGRsZS5saWhhaW5rLmNuIiwiaWF0IjoxNzAwNjIwMjUxLCJuYmYiOjE3MDA2MjAyNTEsImV4cCI6MTcwMTIyNTA1MSwiZGF0YSI6eyJ1aWQiOjUsInBob25lIjoiMTc2ODUxNTE2NDMiLCJhdmF0YXIiOiIvcmVzb3VyY2UvaW1hZ2UvYWRtaW5hcGkvZGVmYXVsdC9kZWZhdWx0X2F2YXRhci5wbmciLCJuaWNrbmFtZSI6Ilx1NzUyOFx1NjIzNzE3Njg1MTUxNjQzIn19.sTWAHCScRY9FExwJw1MReHTnRBcK7tYu1AMSia_Sm4M' + // }).then((res)=>{ + // this.$store.commit("LOGIN", { + // 'token': res.data.token, + // 'time': 604800 + // }); + // this.$isResolve() + // }).catch((err)=>{ + // if(err=='签名错误'){ + // this.$store.commit("LOGIN", { + // 'token': option.referrerInfo?.extraData?.uniMP, + // 'time': 604800 + // }); + // }else { + // Toast(err); + // } + // this.$isResolve() + // }) - - if (option.referrerInfo?.extraData?.uniMP) { + if (option?.referrerInfo?.extraData?.uniMP) { uni.setStorageSync('uniMP', option.referrerInfo?.extraData?.uniMP); - // uni.setStorageSync('APP_token', option.referrerInfo?.extraData?.token); - this.$store.commit("LOGIN", { - 'token': option.referrerInfo?.extraData?.token, - 'time': 604800 - }); - } + // this.$store.commit("LOGIN", { + // 'token': option.referrerInfo?.extraData?.token, + // 'time': 604800 + // }); + parseToken({ + token: option.referrerInfo?.extraData?.token + }).then((res)=>{ + this.$store.commit("LOGIN", { + 'token': res.data.token, + 'time': 604800 + }); + this.$isResolve() + }).catch((err)=>{ + this.$store.commit("LOGIN", { + 'token': option.referrerInfo?.extraData?.token, + 'time': 604800 + }); + console.log('TOKEN解析错误:', err); + this.$isResolve() + }) + }else { + this.$isResolve() + } // #ifdef APP-PLUS // #endif diff --git a/api/appLet.js b/api/appLet.js new file mode 100644 index 0000000..8aa6650 --- /dev/null +++ b/api/appLet.js @@ -0,0 +1,9 @@ +import request from "@/utils/request.js"; + +/** + * 文章详情 + * + */ +export function parseToken(data) { + return request.post('parse/token', data, { noAuth: true }); +} \ No newline at end of file diff --git a/api/requesta.js b/api/requesta.js index a2d0070..50708da 100644 --- a/api/requesta.js +++ b/api/requesta.js @@ -23,3 +23,7 @@ export function getCartList(data) { export function getCartCounts(data) { return request.get("user/cart/count", data); } + +export function getCategoryListLevel(data) { + return request.get("category/list_level", data); +} \ No newline at end of file diff --git a/main.js b/main.js index b0e2175..e044deb 100644 --- a/main.js +++ b/main.js @@ -34,6 +34,12 @@ Vue.prototype.$eventHub = new Vue(); Vue.config.productionTip = false Vue.prototype.$bus = new Vue(); +// initRouter() +// 让app的onLaunch先执行,主要是用来进行登录 +Vue.prototype.$onLaunched = new Promise(resolve => { + Vue.prototype.$isResolve = resolve +}) + // #ifdef H5 import { parseQuery diff --git a/pages.json b/pages.json index c9b61e7..0ee15b6 100644 --- a/pages.json +++ b/pages.json @@ -1332,7 +1332,15 @@ "path" : "addGood/addGood", "style" : { - "navigationBarTitleText" : "", + "navigationBarTitleText" : "商品设置", + "enablePullDownRefresh" : false + } + }, + { + "path" : "addGood/specGood", + "style" : + { + "navigationBarTitleText" : "规格设置", "enablePullDownRefresh" : false } }, diff --git a/pages/admin/order/index.vue b/pages/admin/order/index.vue index 0d670c0..44dfb07 100644 --- a/pages/admin/order/index.vue +++ b/pages/admin/order/index.vue @@ -1,5 +1,5 @@