guoxiaohuan 4 years ago
parent
commit
58c71128a7
3 changed files with 38 additions and 66 deletions
  1. 9 5
      src/components/404.vue
  2. 2 1
      src/components/menuList.vue
  3. 27 60
      src/store/index.js

+ 9 - 5
src/components/404.vue

@@ -3,7 +3,7 @@
         <div class='not-img'>
             <img src='@/assets/imgs/dlsb.png' alt />
         </div>
-        <div class='not-text' v-if='permissions.length==0'>
+        <div class='not-text' v-if='permissions && permissions.includes("GLSMS_VIEW")'>
             <span>您的权限不足……</span>
             <span>建议您联系管理员开通管理说明书相关权限</span>
         </div>
@@ -25,12 +25,16 @@ export default {
     computed: {
         ...mapGetters(['permissions'])
     },
-    mounted() {
-        console.log(this)
-    },
+    mounted() {},
     methods: {
         goLogin() {
-            window.open('http://oauth.wanda-dev.cn/login', true)
+            let ssoServer = 'http://oauth.wanda-dev.cn'
+            this.$store.commit('SETSSOTOKEN', null)
+            let systemcode = 'CAD156',
+                signal = new Date().getTime(),
+                version = '1.0.0'
+            window.location.href = `${ssoServer}/login?systemcode=${systemcode}&signal=${signal}&version=${version}`
+            window.open(`${window.location.href}`, true)
         }
     }
 }

+ 2 - 1
src/components/menuList.vue

@@ -5,7 +5,8 @@
             <div class='downright'></div>
             <div class='home-box'>
                 <img src='@/assets/imgs/logo.png' alt />
-                <span v-if='plazas'>{{plazas.length>0?formatter(plazaId,plazas):'--'}}</span>
+                <span>大连高新万达广场</span>
+                <!-- <span v-if='plazas'>{{plazas.length>0?formatter(plazaId,plazas):'--'}}</span> -->
             </div>
         </div>
         <div>

+ 27 - 60
src/store/index.js

@@ -1,15 +1,9 @@
-import Vue from "vue"
-import Vuex from "vuex"
-import {
-    login,
-    queryFloor,
-    queryfmapID
-} from "@/api/login.js"
-import {
-    queryBrand
-} from "@/api/public.js"
-import axios from "axios"
-import router from "../router"
+import Vue from 'vue'
+import Vuex from 'vuex'
+import { login, queryFloor, queryfmapID } from '@/api/login.js'
+import { queryBrand } from '@/api/public.js'
+import axios from 'axios'
+import router from '../router'
 
 Vue.use(Vuex)
 export default new Vuex.Store({
@@ -17,25 +11,25 @@ export default new Vuex.Store({
         // ssoToken: 'admin:lengqiang',
         ssoToken: null,
         isPreview: false,
-        lastRoute: "",
+        lastRoute: '',
         isrequestAuth: true, // 是否请求登录校验接口
         permissions: [], //权限信息 "GLSMS_VIEW":"说明书查看"、"GLSMS_SYMBOL_MANAGE": "图例库管理"、 "GLSMS_PLANARGRAPH_MANAGE":"平面图维护"
         plazas: [], //项目列表
         userInfo: {
-            employeename: "", //用户名称:艾宇;
-            orgCode: "",
-            username: "lengqiang", //账户名称
+            employeename: '', //用户名称:艾宇;
+            orgCode: '',
+            username: 'lengqiang', //账户名称
         },
-        plazaId: "1000423", //项目Id
-        projectName: "", //全局项目名称
+        plazaId: '1000423', //项目Id
+        projectName: '', //全局项目名称
         floorsArr: [], //楼层数组
         floorSelect: [], //楼层下拉框
-        fmapID: "",
+        fmapID: '',
         haveFengMap: false, //是否有蜂鸟地图的数据
         isMessage: true, //是否有发布的图
         scpzTable: [], //土建系统图例展示
         legendTable: [], //除土建系统图例展示
-        remarksText: "", //备注
+        remarksText: '', //备注
         bunkObj: {}, // 铺位名称
         currentFloor: {}, //当前选中的楼层信息
     },
@@ -117,54 +111,27 @@ export default new Vuex.Store({
     },
     actions: {
         // 获取项目列表、userId
-        async getUserInfo({
-            commit
-        }, palyload) {
+        async getUserInfo({ commit }, palyload) {
             await login({}).then((res) => {
-                if (res.result == "success") {
+                if (res.result == 'success') {
                     // token校验成功 拿到权限
                     //commit("SETISREQUESTtAUTH", true)
-                    console.log("-----", palyload)
                     if (res.permissions.length == 0) {
-                        //权限不足
-                        console.log("权限不足!!")
-                        router.push({
-                            path: "/404",
-                            query: {
-                                result: "权限不足"
-                            }
-                        })
+                        router.push('/404')
                     }
-                    commit("SETAUTHMSG", res)
-                } else if (res.result == "no_auth") {
-                    //登录失败
-                    console.log("登录失败!!")
-                    commit("SETISREQUESTtAUTH", false)
-                    router.push({
-                        path: "/404",
-                        query: {
-                            result: "登录失败"
-                        }
-                    })
+                    commit('SETAUTHMSG', res)
                 } else {
-                    //访问出错 500
-                    console.log("访问出错!!")
-                    commit("SETISREQUESTtAUTH", false)
-                    router.push({
-                        path: "/404",
-                        query: {
-                            result: "访问出错"
-                        }
-                    })
+                    commit('SETISREQUESTtAUTH', false)
+                    router.push('/404')
                 }
             })
         },
         getFloors(context) {
             queryFloor({
-                plazaId: context.state.plazaId
+                plazaId: context.state.plazaId,
             }).then((res) => {
-                if (res.result == "success") {
-                    context.commit("SETFLOORS", res.data)
+                if (res.result == 'success') {
+                    context.commit('SETFLOORS', res.data)
                 }
             })
         },
@@ -172,7 +139,7 @@ export default new Vuex.Store({
             await queryfmapID({
                 mapId: context.state.plazaId,
             }).then((res) => {
-                context.commit("SETMAPID", `${context.state.plazaId}_${res.mapVersion}`)
+                context.commit('SETMAPID', `${context.state.plazaId}_${res.mapVersion}`)
             })
         },
         async getBrand(context) {
@@ -180,7 +147,7 @@ export default new Vuex.Store({
                 plazaId: context.state.plazaId,
             }
             await queryBrand({
-                data
+                data,
             }).then((res) => {
                 let obj = {}
                 if (res.data.data) {
@@ -189,9 +156,9 @@ export default new Vuex.Store({
                         obj[i.bunkdesc] = i
                     })
                 }
-                context.commit("SETBUNKOBJ", obj)
+                context.commit('SETBUNKOBJ', obj)
             })
         },
     },
     modules: {},
-})
+})