喻文俊 3 lat temu
rodzic
commit
8a55d39ee5
36 zmienionych plików z 19470 dodań i 55 usunięć
  1. 2 1
      .env.development
  2. 12 0
      README.md
  3. 9 7
      layouts/app-ldm.vue
  4. 10 10
      layouts/app.vue
  5. 19282 1
      package-lock.json
  6. 1 0
      package.json
  7. 48 0
      pages/_old/_.vue
  8. 0 0
      pages/_template/app/approve/club/detail.vue
  9. 3 2
      pages/_template/app/approve/club/index.vue
  10. 7 5
      pages/_template/app/approve/device/_id.vue
  11. 3 3
      pages/_template/app/approve/device/index.vue
  12. 6 5
      pages/_template/app/approve/index.vue
  13. 0 0
      pages/_template/app/approve/personnel/operate/detail.vue
  14. 7 5
      pages/_template/app/approve/personnel/operate/index.vue
  15. 0 0
      pages/_template/app/database/article-detail.vue
  16. 3 2
      pages/_template/app/database/article.vue
  17. 0 0
      pages/_template/app/database/file.vue
  18. 0 0
      pages/_template/app/database/image.vue
  19. 0 0
      pages/_template/app/database/package.vue
  20. 0 0
      pages/_template/app/database/video.vue
  21. 0 0
      pages/_template/app/feedback/index.vue
  22. 6 5
      pages/_template/app/index.vue
  23. 2 1
      pages/_template/ldm/approve/club/detail.vue
  24. 2 1
      pages/_template/ldm/approve/club/index.vue
  25. 8 2
      pages/_template/ldm/approve/index.vue
  26. 0 0
      pages/_template/ldm/approve/personnel/operate/detail.vue
  27. 0 0
      pages/_template/ldm/approve/personnel/training/detail.vue
  28. 2 1
      pages/_template/ldm/approve/personnel/training/index.vue
  29. 0 0
      pages/_template/ldm/database/package.vue
  30. 2 1
      pages/_template/ldm/index.vue
  31. 1 1
      pages/entry/approve.vue
  32. 1 1
      pages/entry/doc.vue
  33. 1 1
      pages/entry/feedback.vue
  34. 1 0
      store/getters.js
  35. 6 0
      store/user.js
  36. 45 0
      utils/old-routes.js

+ 2 - 1
.env.development

@@ -2,7 +2,8 @@
 EVN = 'development'
 
 # 接口api地址
-BASE_URL = 'https://zplma-b.caimei365.com'
+# BASE_URL = 'https://zplma-b.caimei365.com'
+BASE_URL = 'http://192.168.2.68:8012'
 
 # 静态资源文件地址
 STATIC_URL = 'https://static.caimei365.com/www/authentic'

+ 12 - 0
README.md

@@ -17,6 +17,18 @@ $ npm run start
 $ npm run generate
 ```
 
+## 页面访问路由规则
+
+https://zp.caimei365.com/:供应商id/:模板名称
+
+现有模板:
+
+app:默认应用模板
+ldm:ldm 定制化模板
+
+例一:https://zp.caimei365.com/102/app 访问供应商 id 为 102 的认证通页面,使用默认模板
+例二:https://zp.caimei365.com/103/ldm 访问供应商 id 为 103 的认证通页面,使用 ldm 模板
+
 For detailed explanation on how things work, check out the [documentation](https://nuxtjs.org).
 
 ## Special Directories

+ 9 - 7
layouts/app-ldm.vue

@@ -15,7 +15,7 @@ import keys from '@/keys.config'
 import { mapGetters } from 'vuex'
 export default {
   computed: {
-    ...mapGetters(['userInfo', 'type', 'accessToken']),
+    ...mapGetters(['userInfo', 'type', 'accessToken', 'authUserId']),
   },
   data() {
     return {
@@ -35,15 +35,15 @@ export default {
     },
     // 初始化数据页面公共数据
     initPageData() {
-      const key = this.$route.path.split('/')[1]
+      const id = this.$route.params.template
       // 保存页面入口
-      this.$store.commit('user/SET_TYPE', key)
+      this.$store.commit('user/SET_TYPE', `${id}/app`)
       // 保存用户AppId
-      this.$store.commit('user/SET_APPID', keys[key].appId)
+      this.$store.commit('user/SET_AUTHUSERID', id)
 
       // 获取用户信息
       const userInfo = getCookies('userInfo')
-      if (userInfo) {
+      if (userInfo && userInfo.authUserId === id) {
         this.$store.commit('user/SET_USERINFO', JSON.parse(userInfo))
       }
       // 初始化供应商信息
@@ -52,10 +52,12 @@ export default {
 
     // 获取供应商信息
     async fetchSupplierInfo() {
-      const appId = this.$store.getters.appId
       try {
-        const res = await this.$http.api.fetchSupplierInfo({ appId })
+        const res = await this.$http.api.fetchSupplierInfo({
+          authUserId: this.authUserId,
+        })
         this.$store.commit('supplier/SET_SUPPLIER_INFO', res.data)
+        this.$store.commit('user/SET_APPID', res.data.appId)
       } catch (error) {
         console.log(error)
       } finally {

+ 10 - 10
layouts/app.vue

@@ -30,18 +30,16 @@
     <div class="footer flex justify-center items-center">
       - 由采美网提供技术支持 -
     </div>
-
-    <simple-login></simple-login>
+    <SimpleLogin></SimpleLogin>
   </div>
 </template>
 
 <script>
 import { getCookies } from '@/utils/auth'
-import keys from '@/keys.config'
 import { mapGetters } from 'vuex'
 export default {
   computed: {
-    ...mapGetters(['userInfo', 'type', 'accessToken']),
+    ...mapGetters(['userInfo', 'type', 'accessToken', 'authUserId']),
   },
   data() {
     return {
@@ -61,15 +59,15 @@ export default {
     },
     // 初始化数据页面公共数据
     initPageData() {
-      const key = this.$route.path.split('/')[1]
+      const id = this.$route.params.template
       // 保存页面入口
-      this.$store.commit('user/SET_TYPE', key)
+      this.$store.commit('user/SET_TYPE', `${id}/app`)
       // 保存用户AppId
-      this.$store.commit('user/SET_APPID', keys[key].appId)
+      this.$store.commit('user/SET_AUTHUSERID', id)
 
       // 获取用户信息
       const userInfo = getCookies('userInfo')
-      if (userInfo) {
+      if (userInfo && userInfo.authUserId === id) {
         this.$store.commit('user/SET_USERINFO', JSON.parse(userInfo))
       }
       // 初始化供应商信息
@@ -78,10 +76,12 @@ export default {
 
     // 获取供应商信息
     async fetchSupplierInfo() {
-      const appId = this.$store.getters.appId
       try {
-        const res = await this.$http.api.fetchSupplierInfo({ appId })
+        const res = await this.$http.api.fetchSupplierInfo({
+          authUserId: this.authUserId,
+        })
         this.$store.commit('supplier/SET_SUPPLIER_INFO', res.data)
+        this.$store.commit('user/SET_APPID', res.data.appId)
       } catch (error) {
         console.log(error)
       } finally {

Plik diff jest za duży
+ 19282 - 1
package-lock.json


+ 1 - 0
package.json

@@ -7,6 +7,7 @@
     "build:dev": "cross-env NODE_ENV=development ENV=development nuxt build",
     "build:prod": "cross-env NODE_ENV=production ENV=production nuxt build",
     "start": "nuxt start",
+    "generate:dev": "cross-env NODE_ENV=development ENV=development nuxt generate",
     "generate": "nuxt generate",
     "lint:prettier": "prettier --check .",
     "lint": "npm run lint:prettier",

+ 48 - 0
pages/_old/_.vue

@@ -0,0 +1,48 @@
+<template>
+  <div></div>
+</template>
+
+<script>
+import oldRoutes from '@/utils/old-routes'
+import { getQueryObject } from '@/utils/index'
+export default {
+  data() {
+    return {
+      appId: '',
+      redirectInfo: null,
+    }
+  },
+  mounted() {
+    this.initData()
+  },
+  methods: {
+    initData() {
+      // 获取页面hash值 因为老页面基于vue-router hash模式进行路由跳转
+      let hash = this.$route.hash
+      const query = getQueryObject(hash)
+      this.appId = query.appId
+
+      const index = hash.indexOf('?')
+      hash = hash.slice(1, index)
+      this.redirectInfo = oldRoutes.find((route) => hash === route.path)
+      if (this.redirectInfo) {
+        this.fetchSupplierInfo()
+      }
+    },
+    // 获取供应商信息
+    async fetchSupplierInfo() {
+      try {
+        const { data } = await this.$http.api.fetchSupplierInfo({
+          appId: this.appId,
+        })
+        const path = `/${data.authUserId}` + this.redirectInfo.redirect
+        this.$router.push(path)
+      } catch (error) {
+        console.log(error)
+      }
+    },
+  },
+}
+</script>
+
+<style scoped></style>

+ 0 - 0
pages/ph/approve/club/detail.vue → pages/_template/app/approve/club/detail.vue


+ 3 - 2
pages/ph/approve/club/index.vue → pages/_template/app/approve/club/index.vue

@@ -93,7 +93,7 @@ export default {
     }
   },
   computed: {
-    ...mapGetters(['supplierInfo', 'appId']),
+    ...mapGetters(['supplierInfo', 'appId', 'authUserId']),
     emptyList() {
       return 3 - (this.list.length % 3)
     },
@@ -108,7 +108,8 @@ export default {
     // 查看详情
     toDetail(item) {
       localStorage.setItem('clubInfo', JSON.stringify(item))
-      this.$router.push('/ph/approve/club/detail')
+      const url = `/${this.authUserId}/app/approve/club/detail`
+      this.$router.push(url)
     },
     // 初始化页面数据
     async initData() {

+ 7 - 5
pages/ph/approve/device/_id.vue → pages/_template/app/approve/device/_id.vue

@@ -26,14 +26,14 @@
             <div class="name" v-text="item.productName"></div>
             <div class="code">SN码:{{ item.snCode }}</div>
             <div class="club-name">
-              所属机构:<span @click="toClubDetail(item)">{{
+              所属机构:<span @click.stop="toClubDetail(item)">{{
                 item.clubName
               }}</span>
             </div>
           </div>
         </div>
 
-        <div class="empty" v-for="i in emptyList" :key="i"></div>
+        <div class="empty" v-for="i in emptyList" :key="'empty-' + i"></div>
       </div>
 
       <!-- 列表为空 -->
@@ -104,13 +104,15 @@ export default {
       this.fetchList()
     },
     // 设备详情
-    toDetail() {
+    toDetail(item) {
       window.location.href = `${process.env.CIMEI_LOCAL}/product/auth/product-${item.productId}.html`
     },
     // 机构详情
-    toClubDetail() {
+    toClubDetail(item) {
       localStorage.setItem('clubInfo', JSON.stringify({ authId: item.authId }))
-      this.$router.push('/ph/approve/club/detail')
+      const authUserId = this.$store.getters.authUserId
+      const url = `/${authUserId}/app/approve/club/detail`
+      this.$router.push(url)
     },
   },
 }

+ 3 - 3
pages/ph/approve/device/index.vue → pages/_template/app/approve/device/index.vue

@@ -22,12 +22,12 @@
           class="section flex items-center mb-4"
           v-for="item in list"
           :key="item.productTypeId"
-          :to="'/ph/approve/device/' + item.productTypeId"
+          :to="`/${authUserId}/app/approve/device/${item.productTypeId}`"
         >
           <img class="cover" :src="item.image" />
           <div class="name" v-text="item.name"></div>
         </nuxt-link>
-        <div class="empty" v-for="i in emptyList" :key="i"></div>
+        <div class="empty" v-for="i in emptyList" :key="'empty-' + i"></div>
       </div>
 
       <!-- 列表为空 -->
@@ -65,7 +65,7 @@ export default {
     }
   },
   computed: {
-    ...mapGetters(['supplierInfo', 'appId']),
+    ...mapGetters(['supplierInfo', 'appId', 'authUserId']),
     emptyList() {
       return 3 - (this.list.length % 3)
     },

+ 6 - 5
pages/ph/approve/index.vue → pages/_template/app/approve/index.vue

@@ -37,29 +37,30 @@ export default {
           id: 1,
           name: '机构认证',
           image: 'icon-club.png',
-          path: '/ph/approve/club',
+          path: '/app/approve/club',
         },
         {
           id: 2,
           name: '设备认证',
           image: 'icon-device.png',
-          path: '/ph/approve/device',
+          path: '/app/approve/device',
         },
         {
           id: 3,
           name: '医师认证',
           image: 'icon-doctor.png',
-          path: '/ph/approve/personnel/operate',
+          path: '/app/approve/personnel/operate',
         },
       ],
     }
   },
   computed: {
-    ...mapGetters(['supplierInfo']),
+    ...mapGetters(['supplierInfo', 'authUserId']),
   },
   methods: {
     toDetail(item) {
-      this.$router.push(item.path)
+      const url = `/${this.authUserId}${item.path}`
+      this.$router.push(url)
     },
   },
 }

+ 0 - 0
pages/ph/approve/personnel/operate/detail.vue → pages/_template/app/approve/personnel/operate/detail.vue


+ 7 - 5
pages/ph/approve/personnel/operate/index.vue → pages/_template/app/approve/personnel/operate/index.vue

@@ -71,7 +71,7 @@ export default {
     }
   },
   computed: {
-    ...mapGetters(['supplierInfo', 'appId']),
+    ...mapGetters(['supplierInfo', 'appId', 'authUserId']),
     isEmpty() {
       return this.list.length === 0
     },
@@ -108,12 +108,14 @@ export default {
     // 机构详情
     toClubDetail(item) {
       localStorage.setItem('clubInfo', JSON.stringify({ authId: item.authId }))
-      this.$router.push('/ph/approve/club/detail')
+      const url = `/${this.authUserId}/app/approve/club/detail`
+      this.$router.push(url)
     },
     // 医师详情
     toDetail(item) {
       localStorage.setItem('doctorInfo', JSON.stringify(item))
-      this.$router.push('/ph/approve/personnel/operate/detail')
+      const url = `/${this.authUserId}/app/approve/personnel/operate/detail`
+      this.$router.push(url)
     },
   },
 }
@@ -211,11 +213,11 @@ export default {
           .tag,
           .code,
           .club-name {
-            height: 24px;
+            height: 20px;
             position: relative;
             font-size: 14px;
             color: #404040;
-            line-height: 24px;
+            line-height: 20px;
             text-overflow: ellipsis;
             white-space: nowrap;
             overflow: hidden;

+ 0 - 0
pages/ph/database/article-detail.vue → pages/_template/app/database/article-detail.vue


+ 3 - 2
pages/ph/database/article.vue → pages/_template/app/database/article.vue

@@ -70,7 +70,7 @@ export default {
     }
   },
   computed: {
-    ...mapGetters(['userInfo', 'supplierInfo']),
+    ...mapGetters(['userInfo', 'supplierInfo', 'authUserId']),
   },
   mounted() {
     this.fetchList()
@@ -91,7 +91,8 @@ export default {
     // 详情
     toDetail(item) {
       localStorage.setItem('articleInfo', JSON.stringify(item))
-      this.$router.push('/ph/database/article-detail')
+      const url = `/${this.authUserId}/app/database/article-detail`
+      this.$router.push(url)
     },
     // tab切换
     onTabChange(item) {

+ 0 - 0
pages/ph/database/file.vue → pages/_template/app/database/file.vue


+ 0 - 0
pages/ph/database/image.vue → pages/_template/app/database/image.vue


+ 0 - 0
pages/ph/database/package.vue → pages/_template/app/database/package.vue


+ 0 - 0
pages/ph/database/video.vue → pages/_template/app/database/video.vue


+ 0 - 0
pages/ph/feedback/index.vue → pages/_template/app/feedback/index.vue


+ 6 - 5
pages/ph/index.vue → pages/_template/app/index.vue

@@ -46,7 +46,7 @@ export default {
           name: '授权认证',
           image: 'icon-approve.png',
           hover: 'icon-approve-active.png',
-          path: '/ph/approve',
+          path: '/app/approve',
           active: false,
         },
         {
@@ -54,7 +54,7 @@ export default {
           name: '资料库',
           image: 'icon-doc.png',
           hover: 'icon-doc-active.png',
-          path: '/ph/database/article',
+          path: '/app/database/article',
           active: false,
         },
         {
@@ -62,14 +62,14 @@ export default {
           name: '意见反馈',
           image: 'icon-feedback.png',
           hover: 'icon-feedback-active.png',
-          path: '/ph/feedback',
+          path: '/app/feedback',
           active: false,
         },
       ],
     }
   },
   computed: {
-    ...mapGetters(['supplierInfo']),
+    ...mapGetters(['supplierInfo', 'authUserId']),
   },
   created() {},
   methods: {
@@ -80,7 +80,8 @@ export default {
         this.$store.commit('app/SHOW_LOGIN')
         return
       }
-      this.$router.push(item.path)
+      const url = `/${this.authUserId}${item.path}`
+      this.$router.push(url)
     },
     onMouseover(item) {
       const isPc = this.$store.getters.isPc

+ 2 - 1
pages/ldm/approve/club/detail.vue → pages/_template/ldm/approve/club/detail.vue

@@ -69,7 +69,8 @@ export default {
   methods: {
     toDetail() {
       localStorage.setItem('doctorInfo', JSON.stringify(row))
-      this.$router.push('/ldm/approve/personnel/operate/detail')
+      const authUserId = this.$store.getters.authUserId
+      this.$router.push(`/${authUserId}/ldm/approve/personnel/operate/detail`)
     },
     // 初始化
     initData() {

+ 2 - 1
pages/ldm/approve/club/index.vue → pages/_template/ldm/approve/club/index.vue

@@ -103,7 +103,8 @@ export default {
     // 查看详情
     toDetail(item) {
       localStorage.setItem('clubInfo', JSON.stringify(item))
-      this.$router.push('/ldm/approve/club/detail')
+      const authUserId = this.$store.getters.authUserId
+      this.$router.push(`/${authUserId}/ldm/approve/club/detail`)
     },
     // 初始化页面数据
     async initData() {

+ 8 - 2
pages/ldm/approve/index.vue → pages/_template/ldm/approve/index.vue

@@ -20,10 +20,12 @@
         </div>
       </div>
       <div class="entry">
-        <nuxt-link class="section" to="/ldm/approve/club"
+        <nuxt-link class="section" :to="`/${authUserId}/ldm/approve/club`"
           >查询授权商家</nuxt-link
         >
-        <nuxt-link class="section" to="/ldm/approve/personnel/training"
+        <nuxt-link
+          class="section"
+          :to="`/${authUserId}/ldm/approve/personnel/training`"
           >查询官方培训师</nuxt-link
         >
       </div>
@@ -36,8 +38,12 @@
 </template>
 
 <script>
+import { mapGetters } from 'vuex'
 export default {
   layout: 'app-ldm',
+  computed: {
+    ...mapGetters(['authUserId']),
+  },
 }
 </script>
 

+ 0 - 0
pages/ldm/approve/personnel/operate/detail.vue → pages/_template/ldm/approve/personnel/operate/detail.vue


+ 0 - 0
pages/ldm/approve/personnel/training/detail.vue → pages/_template/ldm/approve/personnel/training/detail.vue


+ 2 - 1
pages/ldm/approve/personnel/training/index.vue → pages/_template/ldm/approve/personnel/training/index.vue

@@ -83,7 +83,8 @@ export default {
     // 医师详情
     toDetail(item) {
       localStorage.setItem('doctorInfo', JSON.stringify(item))
-      this.$router.push('/ldm/approve/personnel/training/detail')
+      const authUserId = this.$store.getters.authUserId
+      this.$router.push(`/${authUserId}/ldm/approve/personnel/training/detail`)
     },
   },
 }

+ 0 - 0
pages/ldm/database/package.vue → pages/_template/ldm/database/package.vue


+ 2 - 1
pages/ldm/index.vue → pages/_template/ldm/index.vue

@@ -61,7 +61,8 @@ export default {
         this.$store.commit('app/SHOW_LOGIN')
         return
       }
-      this.$router.push(item.path)
+      const authUserId = this.$store.getters.authUserId
+      this.$router.push(`/${authUserId}${item.path}`)
     },
   },
 }

+ 1 - 1
pages/entry/approve.vue

@@ -5,7 +5,7 @@
 <script>
 export default {
   asyncData({ redirect }) {
-    redirect('/ph/approve')
+    redirect('/app/approve')
   },
 }
 </script>

+ 1 - 1
pages/entry/doc.vue

@@ -5,7 +5,7 @@
 <script>
 export default {
   asyncData({ redirect }) {
-    redirect('/ph/database/article')
+    redirect('/app/database/article')
   },
 }
 </script>

+ 1 - 1
pages/entry/feedback.vue

@@ -5,7 +5,7 @@
 <script>
 export default {
   asyncData({ redirect }) {
-    redirect('/ph/feedback')
+    redirect('/app/feedback')
   },
 }
 </script>

+ 1 - 0
store/getters.js

@@ -4,6 +4,7 @@ export default {
   static: (state) => state.app.static,
   loginVisiable: (state) => state.app.loginVisiable,
   userInfo: (state) => state.user.userInfo,
+  authUserId: (state) => state.user.authUserId,
   accessToken: (state) => state.user.accessToken,
   appId: (state) => state.user.appId,
   accountType: (state) => state.user.accountType,

+ 6 - 0
store/user.js

@@ -1,6 +1,7 @@
 import { setCookies, removeCookies } from '@/utils/auth'
 
 const state = () => ({
+  authUserId: '',
   userInfo: {},
   accessToken: '',
   appId: '',
@@ -12,6 +13,7 @@ const mutations = {
   SET_USERINFO(state, data) {
     state.userInfo = data
     state.accessToken = data.accessToken
+    state.appId = data.appId
     setCookies('userInfo', JSON.stringify(data))
     setCookies('accessToken', data.accessToken)
   },
@@ -19,6 +21,10 @@ const mutations = {
     state.appId = appId
     setCookies('appId', appId)
   },
+  SET_AUTHUSERID(state, authUserId) {
+    state.authUserId = authUserId
+    setCookies('authUserId', authUserId)
+  },
   SET_TYPE(state, type) {
     state.type = type
   },

+ 45 - 0
utils/old-routes.js

@@ -0,0 +1,45 @@
+/**
+ * 旧版本路由重定向映射
+ *
+ */
+
+const oldRoutes = [
+  {
+    path: '/home',
+    redirect: '/app',
+  },
+  {
+    path: '/approve',
+    redirect: '/app/approve',
+  },
+  {
+    path: '/approve/page',
+    redirect: '/app/approve',
+  },
+  {
+    path: '/approve/club',
+    redirect: '/app/approve/club',
+  },
+  {
+    path: '/approve/club/detail',
+    redirect: '/app/approve/club/detail',
+  },
+  {
+    path: '/approve/device',
+    redirect: '/app/approve/device',
+  },
+  {
+    path: '/approve/device/detail',
+    redirect: '/app/approve/device/detail',
+  },
+  {
+    path: '/approve/doctor',
+    redirect: '/app/approve/personnel',
+  },
+  {
+    path: '/approve/doctor/detail',
+    redirect: '/app/approve/personnel/detail',
+  },
+]
+
+export default oldRoutes

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików