zhoujump 1 mese fa
parent
commit
954c59c69f

+ 0 - 1
src/App.vue

@@ -41,7 +41,6 @@ export default {
   mounted() {
     this.initStore()
     this.refreshUser()
-    console.log(this.$route)
     this.$bus.$on('showPacket', (val) => {
       this.showPacket = val
     })

+ 42 - 29
src/layout/index.vue

@@ -9,20 +9,20 @@
         <el-menu :unique-opened="true" class="layout-menu-inner" :collapse="isCollapse" :default-active="menuActive+''">
           <template v-for="(route,index) in menuRouter">
             <template v-if="!route.meta.hidden">
-              <el-submenu :index="index+''" v-if="route.children" :key="route.path">
+              <el-submenu v-if="route.children" :key="route.path" :index="index+''">
                 <template slot="title">
-                  <i :class="[route.meta.icon,'icon']"></i>
+                  <i :class="[route.meta.icon,'icon']" />
                   <span slot="title">{{ route.meta.title }}</span>
                 </template>
                 <template v-for="(item,subIndex) in route.children">
-                  <el-menu-item v-if="!item.meta.hidden" :index="index+'-'+subIndex" @click="goto(item)" :key="item.path">
-                    <i :class="[item.meta.icon,'icon']"></i>
+                  <el-menu-item v-if="!item.meta.hidden" :key="item.path" :index="index+'-'+subIndex" @click="goto(item)">
+                    <i :class="[item.meta.icon,'icon']" />
                     <span slot="title">{{ item.meta.title }}</span>
                   </el-menu-item>
                 </template>
               </el-submenu>
-              <el-menu-item v-else :index="index+''" @click="goto(route)" :key="route.path">
-                <i :class="[route.meta.icon,'icon']"></i>
+              <el-menu-item v-else :key="route.path" :index="index+''" @click="goto(route)">
+                <i :class="[route.meta.icon,'icon']" />
                 <span slot="title">{{ route.meta.title }}</span>
               </el-menu-item>
             </template>
@@ -33,9 +33,9 @@
     <div class="layout-right">
       <div class="layout-breadcrumb">
         <div :class="['icon',isCollapse?'collapse':'']" @click="$emit('changeCollapse')">
-          <div class="icon-1"></div>
-          <div class="icon-2"></div>
-          <div class="icon-3"></div>
+          <div class="icon-1" />
+          <div class="icon-2" />
+          <div class="icon-3" />
         </div>
         <el-breadcrumb class="breadcrumb" separator="/">
           <el-breadcrumb-item v-for="item in breadcrumb" :key="item.path">
@@ -43,21 +43,21 @@
           </el-breadcrumb-item>
         </el-breadcrumb>
         <div class="packet">
-          <div class="item" @click="$bus.$emit('showPacket',true)" v-if="user.permission.includes('expo_invitation_management')">
-            <span class="el-icon-star-off"></span>
+          <div v-if="packetData.invitation" class="item" @click="$bus.$emit('showPacket',true)">
+            <span class="el-icon-star-off" />
             邀请函
           </div>
-          <div class="item lock" @click="$bus.$emit('showPacket',true)" v-else>
-            <span class="el-icon-lock"></span>
+          <div v-else class="item lock" @click="$bus.$emit('showPacket',true)">
+            <span class="el-icon-lock" />
             邀请函
           </div>
 
-          <div class="item" @click="$bus.$emit('showPacket',true)" v-if="user.permission.includes('expo_management')">
-            <span class="el-icon-star-off"></span>
+          <div v-if="packetData.expo" class="item" @click="$bus.$emit('showPacket',true)">
+            <span class="el-icon-star-off" />
             预登记
           </div>
-          <div class="item lock" @click="$bus.$emit('showPacket',true)" v-else>
-            <span class="el-icon-lock"></span>
+          <div v-else class="item lock" @click="$bus.$emit('showPacket',true)">
+            <span class="el-icon-lock" />
             预登记
           </div>
         </div>
@@ -69,12 +69,12 @@
             <div class="nick-name">
               {{ this.user.nickname }}
             </div>
-            <div @click="goto({name:'systemSetting'})" class="button">
-              <span class="el-icon-setting"></span>
+            <div class="button" @click="goto({name:'systemSetting'})">
+              <span class="el-icon-setting" />
               系统设置
             </div>
-            <div @click="logout" class="button">
-              <span class="el-icon-switch-button"></span>
+            <div class="button" @click="logout">
+              <span class="el-icon-switch-button" />
               退出登录
             </div>
           </div>
@@ -82,7 +82,7 @@
       </div>
       <div class="layout-body">
         <div class="body-inner" :class="{'animation':isAnimation}">
-          <router-view @completion-init="$emit('completionInit')" :is-completion-init="isCompletionInit" class="view-inner" />
+          <router-view :is-completion-init="isCompletionInit" class="view-inner" @completion-init="$emit('completionInit')" />
         </div>
         <div class="body-inner trans" :class="{'animation':isAnimation}" />
       </div>
@@ -104,7 +104,11 @@ export default {
   ],
   data() {
     return {
-      packet: {}
+      packet: {},
+      packetData: {
+        invitation: false,
+        expo: false
+      }
     }
   },
   computed: {
@@ -115,13 +119,22 @@ export default {
   },
   methods: {
     getPacket() {
-      let appList = this.user.app_list
-      console.log(appList)
-      appList.forEach(item => {
-        if (item.app_code === 'EXPOREG') {
-          this.packet = item
+      try {
+        const appList = this.user.app_list
+        appList.forEach(item => {
+          if (item.app_code === 'EXPOREG') {
+            this.packet = item
+          }
+        })
+        const permissions = this.user.permission
+        if (permissions.includes('expo_invitation_management')) {
+          this.packetData.invitation = true
         }
-      })
+        if (permissions.includes('expo_management')) {
+          this.packetData.expo = true
+        }
+      } catch (e) {
+      }
     },
     logout() {
       this.$confirm('确定要退出吗?', {

+ 9 - 4
src/permission.js

@@ -17,11 +17,16 @@ export function canIShow(roles) {
   return new Promise((resolve, reject) => {
     let timer = setTimeout(()=>{
       if(!is_init){
-        if(root.$store.getters.user.permission.includes('expo_management')) {
-          allPermission = allPermission.concat(permission.EXPO_MANAGEMENT)
+        try {
+          if(root.$store.getters.user.permission.includes('expo_management')) {
+            allPermission = allPermission.concat(permission.EXPO_MANAGEMENT)
+          }
+          if(root.$store.getters.user.permission.includes('expo_invitation_management')) {
+            allPermission = allPermission.concat(permission.EXPO_INVITATION_MANAGEMENT)
+          }
         }
-        if(root.$store.getters.user.permission.includes('expo_invitation_management')) {
-          allPermission = allPermission.concat(permission.EXPO_INVITATION_MANAGEMENT)
+        catch (e) {
+          resolve(false)
         }
         is_init = true
       }

+ 9 - 14
src/router/index.js

@@ -528,19 +528,14 @@ const createRouter = () => new Router({
 })
 const router = createRouter()
 router.beforeEach((to, from, next) => {
-  if (router.app.$store.getters.token) {
-    canIShow(to.meta.roles).then((res) => {
-      if (res) {
-        next()
-      } else {
-        next({
-          name: '401'
-        })
-      }
-    })
-  } else {
-    next()
-  }
-
+  canIShow(to.meta.roles).then((res) => {
+    if (res) {
+      next()
+    } else {
+      next({
+        name: '401'
+      })
+    }
+  })
 })
 export default router

+ 3 - 0
src/store/modules/user.js

@@ -37,6 +37,9 @@ export default {
             app_list: response.data.app_list,
             permission: response.data.permission
           })
+        }).catch(error => {
+          console.log(error)
+          reject('获取用户信息失败')
         })
       })
     },

+ 0 - 4
src/views/audienceManage/index.vue

@@ -61,7 +61,6 @@ export default Vue.extend({
         if (this.loading) { return }
         this.loading = true
         if (exhibitor_id === 0) {
-          console.log(exhibitor_id)
           getFormList(1, 1)
             .then(res => {
               if (res.data.data.length > 0) {
@@ -128,7 +127,6 @@ export default Vue.extend({
     },
     uploadExcel(event) {
       this.import_data.file = event.target.files[0]
-      console.log(this.import_data.file)
     },
     importData() {
       if (this.loading) { return }
@@ -196,7 +194,6 @@ export default Vue.extend({
     },
     getInvitationList() {
       getTemplateList(++this.invitation_data.page, 10).then(res => {
-        console.log(res)
         this.invitation_data.data = res.data.data || []
         this.last_page = res.data.last_page
         this.page = res.data.current_page
@@ -281,7 +278,6 @@ export default Vue.extend({
       this.invitation_data.is_sending = true
       const content = hugerte.activeEditor.getContent()
       sentInvitation([this.invitation_data.userSetting.id], content).then(res => {
-        console.log(res)
         this.closeDialog()
         this.$message.success('发送成功')
         this.invitation_data.is_sending = false

+ 8 - 4
src/views/components/packetList.vue

@@ -46,9 +46,13 @@ export default Vue.extend({
       })
     },
     computeInfo() {
-      const basePacket = this.user.app_list[0].ver_key.replace(/_STARTER|_PRO|_MONTH|_YEAR/gi, '')
-      const FullBasePacket = this.user.app_list[0].ver_key.replace(/_MONTH|_YEAR/gi, '')
-      console.log(basePacket)
+      let basePacket = ''
+      let FullBasePacket = ''
+      try {
+        basePacket = this.user.app_list[0].ver_key.replace(/_STARTER|_PRO|_MONTH|_YEAR/gi, '')
+        FullBasePacket = this.user.app_list[0].ver_key.replace(/_MONTH|_YEAR/gi, '')
+      } catch (e) {
+      }
       if (this.type === 'expoReg') {
         if (basePacket === 'EXPOREG_INVITATION') {
           if (this.cycle === 'month') {
@@ -84,7 +88,7 @@ export default Vue.extend({
           }
         }
       } else {
-        if(basePacket === 'EXPOREG_INVITATION') {
+        if (basePacket === 'EXPOREG_INVITATION') {
           if (this.cycle === 'month') {
             this.renderInfo.STARTER.price = this.getPacketByPKey('EXPOREG_INVITATION_STARTER_MONTH').price
             this.renderInfo.STARTER.button = FullBasePacket !== 'EXPOREG_INVITATION_STARTER' ? '立即订购' : '续费'

+ 0 - 7
src/views/exhibitorManage/exhibitorList.vue

@@ -35,19 +35,15 @@ export default Vue.extend({
       }, 500)
     },
     edit(row) {
-      console.log(row)
       this.$router.push({ path: '/exhibitor/edit/' + row.id })
     },
     setStatus(row) {
       this.loading = true
       setExpoStatus(row.id, row.status ? 0 : 1).then(res => {
         this.loading = false
-        console.log(res)
-        console.log(this.refresh)
         this.refresh()
       }).catch(err => {
         this.loading = false
-        console.log(err)
       })
     },
     del(row) {
@@ -62,7 +58,6 @@ export default Vue.extend({
               this.refresh()
             }).catch(err => {
               this.loading = false
-              console.log(err)
             })
           }
         }
@@ -72,7 +67,6 @@ export default Vue.extend({
       if (this.loading || this.current_page > this.last_page) return
       this.loading = true
       getExpoList(this.current_page, this.page_size, this.searchWord).then(res => {
-        console.log(res)
         this.current_page = res.data.current_page
         this.last_page = res.data.last_page
         this.total = res.data.total
@@ -84,7 +78,6 @@ export default Vue.extend({
       if (this.loading || this.current_page >= this.last_page) return
       this.loading = true
       getExpoList(this.current_page, this.page_size, this.searchWord).then(res => {
-        console.log(res)
         this.current_page = res.data.current_page
         this.last_page = res.data.last_page
         this.total = res.data.total

+ 0 - 8
src/views/exhibitorManage/exhibitorSetting.vue

@@ -49,23 +49,18 @@ export default Vue.extend({
           this.exhibitorSetting.images = JSON.parse(this.exhibitorSetting.images)
           this.exhibitorSetting.social_links = JSON.parse(this.exhibitorSetting.social_links)
           this.loading = false
-          console.log(res)
         }).catch(err => {
           this.loading = false
-          console.log(err)
         })
       }
       getFormList(1, 1000).then(res => {
         this.formList = res.data.data
       }).catch(err => {
-        console.log(err)
       })
     },
     uploadImage(event, type) {
       this.loading = true
-      console.log(event.target.files[0])
       upload(event.target.files[0]).then(res => {
-        console.log(res)
         if (type === 'logo') {
           this.exhibitorSetting.logo = res.data.file
         }
@@ -76,7 +71,6 @@ export default Vue.extend({
         this.loading = false
       }).catch(err => {
         this.loading = false
-        console.log(err)
         this.$message.error('上传图片时遇到问题')
       })
     },
@@ -118,12 +112,10 @@ export default Vue.extend({
         this.exhibitorSetting.seo_description,
         this.exhibitorSetting.seo_keywords
       ).then(res => {
-        console.log(res)
         this.$message.success('保存成功')
         this.loading = false
         this.$router.push('/exhibitor/list')
       }).catch(err => {
-        console.log(err)
         this.loading = false
         this.$message.error('保存失败')
       })

+ 0 - 4
src/views/invitationManage/edit.vue

@@ -326,7 +326,6 @@ export default Vue.extend({
         this.templateInfo.name = templateInfo.name
         this.templateInfo.description = templateInfo.description
         this.code = templateInfo.content
-        console.log(templateInfo)
         this.loading = false
       }
       getExpoList(1, 1000).then(res => {
@@ -363,7 +362,6 @@ export default Vue.extend({
           upload(picFile).then(res => {
             saveTemplate(this.templateInfo.id, this.templateInfo.name, this.templateInfo.description, this.code, res.data.file)
               .then(res => {
-                console.log(res)
                 this.$router.push('/invitation/list')
                 this.loading = false
               }).catch(err => {
@@ -393,7 +391,6 @@ export default Vue.extend({
       }, 500)
     },
     initEditor() {
-      console.log(this.$isCompletionInit)
       if (this.$getIsInit() === false) {
         this.$setIsInit()
         monaco.languages.registerCompletionItemProvider('html', {
@@ -437,7 +434,6 @@ export default Vue.extend({
                 }
               }
             })
-            console.log(this.userSetting, this.exhibitorSetting)
             return { suggestions: [...suggestions, ...suggestions_2] }
           }
         })

+ 0 - 1
src/views/login/third-login.vue

@@ -131,7 +131,6 @@ export default Vue.extend({
     },
     initLinkinLogin() {
       getLinkedinLogin().then(res => {
-        console.log(res)
         const linkedin_info = res.data
         const url = new URL(linkedin_info.url)
         url.searchParams.set('redirect_uri', location.origin + '/login')

+ 11 - 13
src/views/preRegManage/edit.vue

@@ -1,5 +1,6 @@
 <script lang="ts">
 import Vue from 'vue'
+import { canIShow } from '@/permission'
 import { saveForm, getFormInfo, getMyFields, saveMyFields } from '@/api/form'
 import guide from '@/views/components/guidePopover.vue'
 import draggable from 'vuedraggable'
@@ -492,19 +493,18 @@ export default Vue.extend({
       inForm: false
     }
   },
+  watch: {
+    $route() {
+      this.init()
+    }
+  },
   mounted() {
     this.init()
   },
 
   beforeDestroy() {
-    console.log('destroy')
     document.removeEventListener('keydown', this.KeyHandel)
   },
-  watch: {
-    $route() {
-      this.init()
-    }
-  },
   methods: {
     init() {
       if (this.$route.params.id) {
@@ -535,10 +535,8 @@ export default Vue.extend({
         if (item.quick) {
           try {
             const data = await saveMyFields('', item.field_label, item.field_type, item.field_data, item.is_required)
-            console.log(data)
             item.id = data.data
           } catch (e) {
-            console.log(e)
             this.$notify({
               title: '快速组件保存失败',
               message: '也许你已经创建过名为"' + item.field_label + '"的组件了,请直接在"我的组件"使用',
@@ -549,7 +547,6 @@ export default Vue.extend({
           }
         }
       }
-      console.log(this.formData)
       saveForm(this.formInfo.id, this.formInfo.name, this.formInfo.desc, this.formData).then(res => {
         this.loading = false
         this.$notify({
@@ -565,7 +562,6 @@ export default Vue.extend({
       if (this.loading) { return }
       this.loading = true
       saveForm('', this.formInfo.name + '(副本)', this.formInfo.desc, this.formData).then(res => {
-        console.log(res.data)
         this.loading = false
         this.$router.push({ path: '/preRegister/edit/' + res.data })
       }).catch(() => {
@@ -633,7 +629,9 @@ export default Vue.extend({
       const index = this.getIndexByKey(this.currentKey)
       if (e.ctrlKey) {
         if (e.key === 's') {
-          this.save()
+          canIShow('preReg.save').then(() => {
+            this.save()
+          })
           e.preventDefault()
           return
         }
@@ -949,9 +947,9 @@ export default Vue.extend({
         <div class="title">表单设定</div>
         <div class="body">
           <div class="tips">表单名称</div>
-          <el-input v-permission="'preReg.editName'" v-model="formInfo.name" placeholder="请输入表单名称" />
+          <el-input v-model="formInfo.name" v-permission="'preReg.editName'" placeholder="请输入表单名称" />
           <div class="tips">表单介绍</div>
-          <el-input v-permission="'preReg.editDesc'" v-model="formInfo.desc" type="textarea" placeholder="请输入表单介绍" />
+          <el-input v-model="formInfo.desc" v-permission="'preReg.editDesc'" type="textarea" placeholder="请输入表单介绍" />
         </div>
       </template>
       <template v-else>

+ 0 - 3
src/views/preRegManage/editBack.vue

@@ -193,7 +193,6 @@ export default Vue.extend({
         this.formInfo.id = this.$route.params.id
         getFormInfo(this.formInfo.id).then(res => {
           this.loading = false
-          console.log(res)
         }).catch(err => {
           this.loading = false
         })
@@ -208,11 +207,9 @@ export default Vue.extend({
         this.loading = false
         this.$message.success('保存成功')
         this.$router.push('/preRegister/list')
-        console.log(res)
       }).catch(err => {
         this.loading = false
         this.$message.error('保存失败')
-        console.log(err)
       })
     },
     choseComp(element) {

+ 0 - 3
src/views/preRegManage/editBack2.vue

@@ -245,7 +245,6 @@ export default Vue.extend({
               }
             })
           })
-          console.log(res)
         }).catch(err => {
           this.loading = false
         })
@@ -268,11 +267,9 @@ export default Vue.extend({
         this.loading = false
         this.$message.success('保存成功')
         this.$router.push('/preRegister/list')
-        console.log(res)
       }).catch(err => {
         this.loading = false
         this.$message.error('保存失败')
-        console.log(err)
       })
     },
     choseComp(element) {

+ 0 - 1
src/views/user/form.vue

@@ -45,7 +45,6 @@ export default Vue.extend({
           })
           this.expo_id = res.data.id
         }).catch(err => {
-          console.log('err')
         })
       } else {
         this.$router.push({

+ 0 - 2
src/views/user/register.vue

@@ -128,7 +128,6 @@ export default Vue.extend({
         login_type: this.regWay ? '0' : '1',
         login_portal: 0
       }).then(res => {
-        console.log(res)
         this.gotoForm()
       }).catch(err => {
 
@@ -153,7 +152,6 @@ export default Vue.extend({
         register(this.loginInfo.email, '', this.loginInfo.emailCode, 1, '').then(res => {
           this.loginInfo.pre_register_key = res.data.pre_register_key
           this.loginInfo.showPasswordDialog = true
-          console.log(res)
         }).catch(err => {
 
         })