فهرست منبع

Merge branch 'yuan' of panhui/lasuo_nft_front into dev

yuanyuan 3 سال پیش
والد
کامیت
281055fcd4
3فایلهای تغییر یافته به همراه43 افزوده شده و 26 حذف شده
  1. 32 22
      src/router/index.js
  2. 9 3
      src/store/index.js
  3. 2 1
      src/views/account/Login.vue

+ 32 - 22
src/router/index.js

@@ -1,10 +1,19 @@
-import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router';
+import {
+    createRouter,
+    createWebHistory,
+    createWebHashHistory
+} from 'vue-router';
 import store from '../store';
 import store from '../store';
-import { Page } from './Page';
-import { Dialog } from 'vant';
+import {
+    Page
+} from './Page';
+import {
+    Dialog
+} from 'vant';
 import http from '../plugins/http';
 import http from '../plugins/http';
 
 
 jsapiSign();
 jsapiSign();
+
 function jsapiSign() {
 function jsapiSign() {
     return;
     return;
     // eslint-disable-next-line no-unreachable
     // eslint-disable-next-line no-unreachable
@@ -15,7 +24,9 @@ function jsapiSign() {
             }
             }
             let isIOS = /iphone|ipad/i.test(navigator.userAgent);
             let isIOS = /iphone|ipad/i.test(navigator.userAgent);
             http.http
             http.http
-                .get('/wx/jsapiSign', { url: isIOS ? store.state.firstUrl : location.origin + location.href })
+                .get('/wx/jsapiSign', {
+                    url: isIOS ? store.state.firstUrl : location.origin + location.href
+                })
                 .then(res => {
                 .then(res => {
                     wx.config({
                     wx.config({
                         debug: false,
                         debug: false,
@@ -40,14 +51,12 @@ function jsapiSign() {
                             title: '拉索宇宙',
                             title: '拉索宇宙',
                             desc: '全球首个基于区块链的游戏资产集换中心',
                             desc: '全球首个基于区块链的游戏资产集换中心',
                             link: location.origin + '/9th',
                             link: location.origin + '/9th',
-                            imgUrl:
-                                'https://9space-2021.oss-cn-shenzhen.aliyuncs.com/nft/2021-11-05-15-58-30YwqLzMjy.jpg'
+                            imgUrl: 'https://9space-2021.oss-cn-shenzhen.aliyuncs.com/nft/2021-11-05-15-58-30YwqLzMjy.jpg'
                         });
                         });
                         wx.updateTimelineShareData({
                         wx.updateTimelineShareData({
                             title: '拉索宇宙-全球首个基于区块链的游戏资产集换中心',
                             title: '拉索宇宙-全球首个基于区块链的游戏资产集换中心',
                             link: location.origin + '/9th',
                             link: location.origin + '/9th',
-                            imgUrl:
-                                'https://9space-2021.oss-cn-shenzhen.aliyuncs.com/nft/2021-11-05-15-58-30YwqLzMjy.jpg'
+                            imgUrl: 'https://9space-2021.oss-cn-shenzhen.aliyuncs.com/nft/2021-11-05-15-58-30YwqLzMjy.jpg'
                         });
                         });
                     });
                     });
                 })
                 })
@@ -56,8 +65,7 @@ function jsapiSign() {
     }, 200);
     }, 200);
 }
 }
 jsapiSign();
 jsapiSign();
-const routes = [
-    {
+const routes = [{
         path: '/',
         path: '/',
         redirect: 'home'
         redirect: 'home'
     },
     },
@@ -65,8 +73,7 @@ const routes = [
         path: '/',
         path: '/',
         name: 'index',
         name: 'index',
         component: () => import('../views/Index.vue'),
         component: () => import('../views/Index.vue'),
-        children: [
-            {
+        children: [{
                 path: '/home',
                 path: '/home',
                 name: 'home',
                 name: 'home',
                 component: () => import('../views/Home.vue'),
                 component: () => import('../views/Home.vue'),
@@ -102,7 +109,8 @@ const routes = [
                 component: () => import('../views/Store.vue'),
                 component: () => import('../views/Store.vue'),
                 meta: {
                 meta: {
                     menuPage: true,
                     menuPage: true,
-                    title: '拉索宇宙'
+                    title: '拉索宇宙',
+                    needBack: true
                 }
                 }
             },
             },
             {
             {
@@ -644,13 +652,14 @@ const routes = [
 ];
 ];
 
 
 const router = createRouter({
 const router = createRouter({
-    history:
-        process.env.VUE_APP_CORDOVA === 'true'
-            ? createWebHashHistory()
-            : createWebHistory(process.env.VUE_APP_PUBLIC_PATH),
+    history: process.env.VUE_APP_CORDOVA === 'true' ?
+        createWebHashHistory() : createWebHistory(process.env.VUE_APP_PUBLIC_PATH),
     routes,
     routes,
     scrollBehavior(to, from, savedPosition) {
     scrollBehavior(to, from, savedPosition) {
-        return { x: 0, y: 0 };
+        return {
+            x: 0,
+            y: 0
+        };
     }
     }
 });
 });
 
 
@@ -685,12 +694,13 @@ router.beforeEach((to, from, next) => {
                 })
                 })
                 .catch(() => {
                 .catch(() => {
                     Dialog.confirm({
                     Dialog.confirm({
-                        title: '提示',
-                        message: '用户未登录,是否立即登录'
-                    })
+                            title: '提示',
+                            message: '用户未登录,是否立即登录'
+                        })
                         .then(() => {
                         .then(() => {
                             let url = '/login';
                             let url = '/login';
                             if (to.meta.needBack) {
                             if (to.meta.needBack) {
+                                console.log(to)
                                 store.commit('setLoginBackUrl', to.fullPath);
                                 store.commit('setLoginBackUrl', to.fullPath);
                             }
                             }
                             next('/login');
                             next('/login');
@@ -722,4 +732,4 @@ function backNext(to) {
         return;
         return;
     }
     }
 }
 }
-export default router;
+export default router;

+ 9 - 3
src/store/index.js

@@ -1,4 +1,6 @@
-import { createStore } from 'vuex';
+import {
+    createStore
+} from 'vuex';
 import http from '../plugins/http';
 import http from '../plugins/http';
 
 
 export default createStore({
 export default createStore({
@@ -15,7 +17,8 @@ export default createStore({
         loginBackUrl: '',
         loginBackUrl: '',
         productId: '',
         productId: '',
         netTime: 0,
         netTime: 0,
-        usedBuy: true
+        usedBuy: true,
+        routerLogin: false,
     },
     },
     mutations: {
     mutations: {
         setFinished(state, finished) {
         setFinished(state, finished) {
@@ -56,6 +59,9 @@ export default createStore({
         },
         },
         setUsedBuy(state, usedBuy) {
         setUsedBuy(state, usedBuy) {
             state.usedBuy = usedBuy;
             state.usedBuy = usedBuy;
+        },
+        setRouterLogin(state, routerLogin) {
+            state.routerLogin = routerLogin
         }
         }
     },
     },
     actions: {
     actions: {
@@ -88,4 +94,4 @@ export default createStore({
         }
         }
     },
     },
     modules: {}
     modules: {}
-});
+});

+ 2 - 1
src/views/account/Login.vue

@@ -155,7 +155,8 @@ export default {
                         !fromRoute.name ||
                         !fromRoute.name ||
                         fromRoute.name === 'userRegister' ||
                         fromRoute.name === 'userRegister' ||
                         fromRoute.name === 'userLogin' ||
                         fromRoute.name === 'userLogin' ||
-                        fromRoute.name === 'agreement'
+                        fromRoute.name === 'agreement' || 
+                        fromRoute.name === 'store'
                     ) {
                     ) {
                         this.$router.replace('/home');
                         this.$router.replace('/home');
                     } else {
                     } else {