Browse Source

no message

py 6 months ago
parent
commit
f585583d4d

+ 8 - 3
src/router/index.js

@@ -6,17 +6,22 @@ const routes = [
   {
     path: '/',
     name: 'login',
-    component: () => import('@/views/login/login_index.vue') //路由懒加载
+    component: () => import('@/views/login/login_index.vue') //登录
+  },
+  {
+    path: '/invite',
+    name: 'invite',
+    component: () => import('@/views/login/invite.vue') //邀请
   },
   {
     path: '/cc_list',
     name: 'cc_list',
-    component: () => import('@/views/index/cc-index.vue') //路由懒加载
+    component: () => import('@/views/index/cc-index.vue') //首页
   },
   {
     path: '/all_profit',
     name: 'all_profit',
-    component: () => import('@/views/my/inner-page/all_profit.vue') //路由懒加载
+    component: () => import('@/views/my/inner-page/all_profit.vue') //总收益
   }
   // {
   //   path: '/about',

+ 13 - 17
src/utils/routerEach.js

@@ -3,30 +3,26 @@ import router from '../router/index.js'
 // const routeList = router.options.routes[0].children
 
 
-const whiteList = ['/']
+const whiteList = ['/','/invite']
 router.beforeEach((to, from, next) => {
   let userToken = window.localStorage.getItem('token')
   if (userToken) {
-    // 如果用户已登录,并且跳转到登录页,则重定向到首页
-    // if (to.path === '/login') {
-    //   next({ path: '/' })
-    // } else {
-    //   // 判断用户是否有权限访问该页面
-    //   const hasPermission = store.getters.hasPermission
-    //   if (hasPermission) {
-    //     next()
-    //   } else {
-    //     // 如果没有权限,则跳转到 403 页面
-    //     next({ path: '/403' })
-    //   }
-    // }
-    next()
+    // 已登录用户禁止访问登录页,直接跳转到目标页
+    if (to.path === '/') {
+      next({ path: '/cc_list' });
+    } else {
+      next(); // 允许访问其他受保护路径
+    }
   } else {
     // 如果用户未登录,则判断是否在白名单中,如果在白名单中,则直接进入,否则重定向到登录页
-    if (whiteList.indexOf(to.path) !== -1) {
+    if (whiteList.includes(to.path)) {
       next()
     } else {
-      next('/')
+      if(from.path === '/') {
+        return
+      }else {
+        next('/')
+      }
     }
   }
 })

+ 26 - 0
src/views/login/invite.vue

@@ -0,0 +1,26 @@
+<script>
+export default {
+  name: "invite-page",
+  components: {},
+  data() {
+    return {};
+  },
+  mounted() {
+  },
+  methods: {},
+}
+</script>
+
+<template>
+  <div class="flex-common-css box-b align-items-center flex-justify-center">
+    <div class="fs-14 fc-f">
+      请输入邀请码
+    </div>
+  </div>
+</template>
+
+<style scoped lang="scss">
+.box-b {
+  background-image: linear-gradient(46deg, #3364d1, #42d6dd);
+}
+</style>

+ 6 - 16
src/views/login/login_index.vue

@@ -23,32 +23,22 @@ export default {
           this.$message.error(res.msg)
         }
       })
-      // if(!this.formData.phone) {
-      //   this.$message.error('请输入手机号')
-      // } else if(!this.formData.password) {
-      //   this.$message.error('请输入密码')
-      // } else {
-      //   userLogin.then((res) => {
-      //     if(res.code === 1) {
-      //       console.log('成功')
-      //     }else {
-      //       this.$message.error(res.msg)
-      //     }
-      //   })
-      // }
+    },
+    goToUrl() {
+      this.$router.push('/invite')
     }
   }
 }
 </script>
 
 <template>
-<div class="flex-common-css p-24 box-sizing-border">
+<div class="flex-common-css p-24 box-sizing-border bgc-f">
   <div class="fs-24 mb-30 fw-600">
     嗨,欢迎登录
   </div>
   <el-image
       class="img-box"
-      :src="require('@/assets/img/logo/1.png')"
+      :src="require('@/assets/img/logo/logo.png')"
       fit="cover"></el-image>
   <div class="text-align-center fw-600 mb-32">
     芭芭拉
@@ -71,7 +61,7 @@ export default {
     登录
   </div>
   <div class="fs-16 fc-9 align-items-center flex-justify-center">
-    没有账号?<p class="fs-16 fc-16BB5D">立即注册</p>
+    没有账号?<p class="fs-16 fc-16BB5D" @click="goToUrl">立即注册</p>
   </div>
 </div>
 </template>

+ 22 - 2
src/views/my/inner-page/all_profit.vue

@@ -7,12 +7,20 @@ export default {
   },
   mounted() {
   },
-  methods: {},
+  methods: {
+    returnBut() {
+      this.$router.back();
+    }
+  },
 }
 </script>
 
 <template>
-  <div class="flex-common-css p-10 box-sizing-border">
+  <div class="flex-common-css box-sizing-border box-b">
+    <div class="nav-box bgc-f box-sizing-border align-items-center">
+      <i @click="returnBut" class="el-icon-arrow-left fw-b fs-20 mr-10"></i>
+      <div class="fs-14 fw-b">总收益</div>
+    </div>
     <div class="head-box flex-direction-column align-items-center flex-justify-center b-rad-10 mb-10">
       <div class="fs-14 fc-f mb-4">
         总收益
@@ -49,6 +57,18 @@ export default {
 </template>
 
 <style scoped lang="scss">
+.box-b{
+  padding: 60px 10px 10px;
+}
+.nav-box{
+  width: 100%;
+  height: 40px;
+  line-height: 40px;
+  position: absolute;
+  top: 0;
+  left: 0;
+  padding-left: 10px;
+}
 .tx-box {
   width: 30%;
   height: 40px;