USER-20230908AJ\Administrator 10 ماه پیش
والد
کامیت
4b9c0e42a9
3فایلهای تغییر یافته به همراه43 افزوده شده و 28 حذف شده
  1. 2 2
      src/utils/routerEach.js
  2. 19 10
      src/views/Forestage/Team/index.vue
  3. 22 16
      src/views/Forestage/Tourism/index.vue

+ 2 - 2
src/utils/routerEach.js

@@ -7,7 +7,7 @@ router.beforeEach((to, from, next) => {
   let userToken = window.localStorage.getItem('userToken')
   if (userToken) {
     let active = routeList.findIndex((item) => item === to.path)
-	
+
     if (active > -1) {
       active++
     }
@@ -15,7 +15,7 @@ router.beforeEach((to, from, next) => {
     next()
   } else {
     store.commit('user/setNavActive', 1)
-    if (to.path == '/Home'||to.path == '/login'||to.path == '/register'||to.path == '/forget-password') {
+    if (to.path == '/Home'||to.path == '/Tourism'||to.path == '/Team'||to.path == '/login'||to.path == '/register'||to.path == '/forget-password') {
       next()
     } else {
       next('/login')

+ 19 - 10
src/views/Forestage/Team/index.vue

@@ -92,18 +92,27 @@
 	},
 	methods:{
     copyData(){
-      this.$copyText(this.code).then(function () {
-        tools.success("Copy Success")
-      }, function () {
-        tools.success("Copy Failed")
-      })
+      if (this.code===''){
+        this.$router.push({ path: '/login' })
+      }else {
+        this.$copyText(this.code).then(function () {
+          tools.success("Copy Success")
+        }, function () {
+          tools.success("Copy Failed")
+        })
+      }
+
     },
     getInfo(){
-			userInfo().then((res)=>{
-				if(res.code == 1){
-					this.code = res.data.invite_code;
-				}
-			})
+    let  token= localStorage.getItem('userToken')
+      if (token){
+        userInfo().then((res)=>{
+          if(res.code == 1){
+            this.code = res.data.invite_code;
+          }
+        })
+      }
+
 		},
 	}
   }

+ 22 - 16
src/views/Forestage/Tourism/index.vue

@@ -90,22 +90,28 @@
 				}
 			},
 			pay(item) {
-				if(this.isAJAX){
-					return
-				}
-				this.isAJAX = true;
-				ordercreat({
-					goods_id: item.id
-				}).then((res) => {
-					if(res.code == 1){
-						this.isAJAX = false;
-						// tools.success(res.msg)
-            this.$refs.orderSett.setOpen(true)
-					}else{
-						this.isAJAX = false;
-						tools.error(res.msg)
-					}
-				})
+        let  token= localStorage.getItem('userToken')
+        if (token){
+          if(this.isAJAX){
+            return
+          }
+          this.isAJAX = true;
+          ordercreat({
+            goods_id: item.id
+          }).then((res) => {
+            if(res.code == 1){
+              this.isAJAX = false;
+              // tools.success(res.msg)
+              this.$refs.orderSett.setOpen(true)
+            }else{
+              this.isAJAX = false;
+              tools.error(res.msg)
+            }
+          })
+        }else {
+          this.$router.push({ path: '/login' })
+        }
+
 			},
 		},
 	}