diff --git a/main.js b/main.js
index e864e70065fb8d74d8077a9503729a7c8ff41e71..820f5f2eeb23e5e35f8142f4808d45ccedb70f57 100644
--- a/main.js
+++ b/main.js
@@ -10,10 +10,10 @@ Vue.prototype.$tools = require('@/utils/tools')
// Vue.prototype.$cloud = require('@/utils/cloud')
Vue.config.productionTip = false
Vue.component('nodata', nodata)
-Vue.component('navbar',navbar)
-const msg = (title, duration=1500, mask=false, icon='none')=>{
+Vue.component('navbar', navbar)
+const msg = (title, duration = 1500, mask = false, icon = 'none') => {
//统一提示方便全局修改
- if(Boolean(title) === false){
+ if (Boolean(title) === false) {
return;
}
uni.showToast({
@@ -26,17 +26,49 @@ const msg = (title, duration=1500, mask=false, icon='none')=>{
Vue.prototype.$msg = msg
App.mpType = 'app'
const app = new Vue({
- ...App
+ ...App
})
app.$mount()
// #endif
// #ifdef VUE3
-import { createSSRApp } from 'vue'
+import {
+ createSSRApp
+} from 'vue'
export function createApp() {
- const app = createSSRApp(App)
- return {
- app
- }
+ const app = createSSRApp(App)
+ return {
+ app
+ }
}
-// #endif
\ No newline at end of file
+// #endif
+
+
+const whiteRoute = ["login", "cate/list", "public/send/sms"]
+
+
+uni.addInterceptor('request', {
+ invoke(args) {
+ let flag = false
+ console.log(args.url);
+ whiteRoute.forEach((i, v) => {
+ if (i == args.url) {
+ // 放行
+ flag = true
+ }
+ })
+
+ let token = localStorage.getItem("token")
+ if (!flag) {
+ if (!token) {
+ uni.navigateTo({
+ url: "/pages/mine/mine"
+ })
+ }
+ }
+ args.url = 'http://127.0.0.1:9999/' + args.url
+ },
+
+
+
+})
\ No newline at end of file
diff --git a/pages/brush/category.vue b/pages/brush/category.vue
index d44cf4289742b2b17d86f8301c8165eca5eef758..03f40a3895612b65e3efcc7f8e265c7916dd467c 100644
--- a/pages/brush/category.vue
+++ b/pages/brush/category.vue
@@ -48,7 +48,7 @@
methods: {
async getCateList() {
uni.request({
- url: "http://127.0.0.1:9999/cate/list/0",
+ url: "cate/list/0",
header: {
"content-type": "application/json"
},
@@ -62,7 +62,7 @@
async loadData() {
// 载入对应二级分类
uni.request({
- url: "http://127.0.0.1:9999/cate/list/" + this.currentId,
+ url: "cate/list/" + this.currentId,
header: {
"content-type": "application/json"
},
diff --git a/pages/index/index.vue b/pages/index/index.vue
index e10c3e54b1345216ff1cce5e75518198a7edd25f..366d4a82cc047353e8914774fe40136bd87e889b 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -142,7 +142,7 @@
},
async getCategoryList() {
uni.request({
- url: "http://127.0.0.1:9999/cate/list/0",
+ url: "cate/list/0",
header: {
"content-type": "application/json"
},
@@ -156,7 +156,7 @@
// 外链
async getExChainListList() {
uni.request({
- url: "http://127.0.0.1:9999/exchain/list",
+ url: "hexchain/list",
header: {
"content-type": "application/json"
},
diff --git a/pages/mine/mine.vue b/pages/mine/mine.vue
index c3fee2fc319727fe3dd71329a8721f0f775a55c5..d5119d23c39774468629f19b7edcef97a1ccbf4e 100644
--- a/pages/mine/mine.vue
+++ b/pages/mine/mine.vue
@@ -3,11 +3,11 @@
-
+
-
+
{{getShowName()}}
@@ -146,7 +146,7 @@
}
},
onLoad() {
- uni.hideHomeButton()
+ // uni.hideHomeButton()
},
onShow() {
let storeInfo = uni.getStorageSync('storeInfo')
@@ -179,10 +179,27 @@
})
},
login() {
- this.$tools.login('all')
+ uni.request({
+ url:"login",
+ method:"POST",
+ data:{
+ "mobile": "13507055473",
+ "code": "7790"
+ },
+ header: {
+ "content-type": "application/json",
+ },
+ success: (res) => {
+ if (res.data.code == 0){
+ let token = res.data.data
+ // 设置token 到localStorage
+ localStorage.setItem("token", JSON.stringify(token))
+ }
+ }
+ })
},
async toPage(url) {
- await this.$tools.login('all')
+ // await this.$tools.login('all')
this.$tools.toPage(url)
},
},