Forráskód Böngészése

feat 代码优化

Funny 3 éve
szülő
commit
337fb9c236
5 módosított fájl, 47 hozzáadás és 22 törlés
  1. 2 2
      src/api/http.js
  2. 14 9
      src/background.js
  3. 24 5
      src/common/sider.vue
  4. 6 5
      src/components/about.vue
  5. 1 1
      src/store/index.js

+ 2 - 2
src/api/http.js

@@ -1,9 +1,9 @@
 import axios from 'axios';
 import qs from 'qs';
 import { message } from 'element-ui';
-// const requestUrl = 'http://153.37.175.42:8086/'; // 测试内部接口
+const requestUrl = 'http://153.37.175.42:8086/'; // 测试内部接口
 // const requestUrl = 'http://192.168.50.97:8082/'; // 测试内部接口
-const requestUrl = 'https://api.liebaoai.cn/'; // 统一正式接口
+// const requestUrl = 'https://api.liebaoai.cn/'; // 统一正式接口
 //创建axios实例
 const service = axios.create({
   timeout: 30000 //超时时间

+ 14 - 9
src/background.js

@@ -34,16 +34,21 @@ async function createWindow() {
   })
   // 检查更新
   // updateHandle();
+
+  // 修改成加载项目地址
+  // await win.loadURL('http://pctest.liebaoai.cn:88/#/login') // 测试环境
+  await win.loadURL('https://pc.liebaoai.cn/#/login') // 正式环境
   
-  if (process.env.WEBPACK_DEV_SERVER_URL) {
-    // Load the url of the dev server if in development mode
-    await win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
-    if (!process.env.IS_TEST) win.webContents.openDevTools()
-  } else {
-    createProtocol('app')
-    // Load the index.html when not in development
-    win.loadURL('app://./index.html')
-  }
+  // if (process.env.WEBPACK_DEV_SERVER_URL) {
+  //   // Load the url of the dev server if in development mode
+  //   await win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
+  //   if (!process.env.IS_TEST) win.webContents.openDevTools()
+  // } else {
+  //   createProtocol('app')
+  //   // Load the index.html when not in development
+  //   win.loadURL('app://./index.html')
+  // }
+
   // // 32位 64位
   // if (process.arch === 'x64') {
   //   uploadUrl = uploadUrl + 'dist_electron';

+ 24 - 5
src/common/sider.vue

@@ -19,7 +19,7 @@
                   <el-menu-item v-for="(threeItem,i) in subItem.children" :key="i" :index="threeItem.path">
                     {{ threeItem.title }}</el-menu-item>
                 </el-submenu>
-                <el-menu-item v-else :index="subItem.path" :key="subItem.path">{{ subItem.title }}</el-menu-item>
+                <el-menu-item v-show="['pictureManagement'].includes(subItem.name) ? memberType === 1 ? false : true : true" v-else :index="subItem.path" :key="subItem.path">{{ subItem.title }}</el-menu-item>
               </template>
             </el-submenu>
           </template>
@@ -43,7 +43,7 @@ export default {
   data() {
     return {
       collapse: false,
-      //items: []
+      memberType: this.$store.state.userInfo.memberType,
       items: [
         {
           path: "/",
@@ -116,9 +116,9 @@ export default {
           icon: require("../../static/image/help-icon.png"),
         },
         {
-          path: '/download',
-          name: 'download',
-          title: '下载中心',
+          path: "/download",
+          name: "download",
+          title: "下载中心",
           icon: require("../../static/image/download-icon.png"),
         },
         {
@@ -130,6 +130,14 @@ export default {
       ],
     };
   },
+  watch: {
+    "$store.state.userInfo": {
+      handler(newVal, oldVal) {
+        this.memberType = newVal.memberType;
+      },
+      deep: true,
+    },
+  },
   created() {
     // console.log(router.options.routes);
     //this.items = [...router.options.routes];
@@ -139,6 +147,16 @@ export default {
       bus.$emit("collapse-content", msg);
     });
   },
+  methods: {
+    showTitle(name) {
+      if (name === "c") {
+        if (this.memberType === 1) {
+          return false;
+        }
+      }
+      return true;
+    },
+  },
 };
 </script>
 
@@ -200,5 +218,6 @@ export default {
 
 .sidebar > ul {
   height: 100%;
+  overflow-y: auto;
 }
 </style>

+ 6 - 5
src/components/about.vue

@@ -7,17 +7,20 @@
       <div class="scan">扫码下载APP</div>
       <div class="version">
         <img class="pc" src="../../static/image/pc-icon.png" alt="">
-        <div class="versoin-num">猎豹AI聚合配送PC版版本V1.0.1</div>
+        <div class="versoin-num">猎豹AI聚合配送PC版版本V{{version}}</div>
       </div>
     </div>
   </div>
 </template>
 
 <script>
+import config from "../../package.json";
 export default {
   name: "about",
   data() {
-    return {};
+    return {
+      version: config.version,
+    };
   },
   // 监听属性 类似于data概念
   computed: {},
@@ -29,9 +32,7 @@ export default {
   // 生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {},
   // 方法集合
-  methods: {
-    
-  },
+  methods: {},
 };
 </script>
 

+ 1 - 1
src/store/index.js

@@ -16,7 +16,7 @@ const actions = {
   getUserInfo(context) {
     getConfig().then(res => {
       if (res.code === 200) {
-        context.commit('SET_USERINFO', data)
+        context.commit('SET_USERINFO', res.data)
       } else {
         this.$message({
           type: 'error',