فهرست منبع

头部小程序菜单等优化

pansl 2 سال پیش
والد
کامیت
98818d57e5
3فایلهای تغییر یافته به همراه17 افزوده شده و 8 حذف شده
  1. 15 6
      src/layout/components/header/index.vue
  2. 1 1
      src/router/modules/caster.ts
  3. 1 1
      src/views/user/caster/index.vue

+ 15 - 6
src/layout/components/header/index.vue

@@ -6,21 +6,20 @@
         <div class="flex items-center w-8 h-full ml-2 hover:cursor-pointer" @click="store.changeExpaned">
           <Icon name="list-bullet" class="w-6 h-8" />
         </div>
-        <div class="flex items-center pl-3 w-96 sm:pl-0">
+        <div class="flex items-center pl-3 w-96 sm:pl-0" v-if="isShowNavData">
           <!-- <Breadcrumbs /> -->
-          <el-select style="width:260px;" v-model="navData.advertiser" filterable value-key="id" remote
-            @change="adverChange" reserve-keyword placeholder="请选择投手" :remote-method="remoteMethod">
+          <el-select :disabled="isAdverDisabled" style="width:260px;" v-model="navData.advertiser" filterable
+            value-key="id" remote @change="adverChange" reserve-keyword placeholder="请选择投手" :remote-method="remoteMethod">
             <el-option v-for="item in navDataArr" :key="item.id" :label="item.username" :value="item" />
           </el-select>
           <el-select v-model="navData.app" style="width:260px;" class="m-2" @change="appChange" clearable filterable
             placeholder="请选择" size="default">
             <el-option v-for="item in miniPrograms" :key="item.id" :label="item.name" :value="item.app_name">
               <div class="flex items-center">
+                <el-image :src="item.type_logo" style="width: 20px; height: 20px" class="mr-5" fit="contain"></el-image>
                 <span class="mr-5">{{ item.name }}</span>
-                <el-image :src="item.type_logo" style="width: 20px; height: 20px" fit="contain"></el-image>
               </div>
             </el-option>
-
           </el-select>
         </div>
       </div>
@@ -57,9 +56,10 @@ const miniPrograms = ref([])
 const navData = ref({})
 const navDataArr = ref([])
 const searchMenuVisiable = ref(false)
+const isAdverDisabled = ref(false)
 const userStore = useUserStore()
 const adverChange = (e) => {
-  console.log(e, 'userStore', userStore, navData.value, 'navData.value');
+  console.log(e, 'userStore', userStore.roles, navData.value, 'navData.value');
   navData.value.app = ''
   miniPrograms.value = e.miniPrograms
 }
@@ -70,6 +70,15 @@ const remoteMethod = (query: string) => {
     init({})
   }
 }
+const isShowNavData = computed(() => {
+  console.log(userStore.getRoles, 'getRoles');
+  if (userStore.getRoles?.some(el => (el?.identify == 'optimizer'))) {
+    navData.value.advertiser = navDataArr.value[0]
+    miniPrograms.value = navDataArr.value[0]?.miniPrograms
+    isAdverDisabled.value = true;
+  }
+  return userStore.getRoles?.some(el => (el?.identify == 'optimizer' || el?.identify == 'company'))
+})
 const appChange = (e) => {
   Cache.set('nav_data', JSON.stringify(navData.value));
   router.push('/')

+ 1 - 1
src/router/modules/caster.ts

@@ -8,7 +8,7 @@
 //     meta: { title: '用户管理', icon: 'user' },
 //     children: [
 //       {
-//         path: 'index',
+//         path: 'caster',
 //         name: 'user-account',
 //         meta: { title: '添加优化师', icon: 'home' },
 //         component: () => import('@/views/user/caster/index.vue')

+ 1 - 1
src/views/user/caster/index.vue

@@ -34,8 +34,8 @@
           <el-table-column prop="miniProgramIds" label="已绑定小程序">
             <template #default="scope">
               <div v-for="applet in scope.row.miniPrograms" :key="applet.id" class="flex items-center h-8">
+                <el-image style="width: 20px; height: 20px" class="mt-1 mr-5" :src="applet.type_logo" fit="contain" />
                 <span class="mr-3 text-sm font-medium">{{ applet.name }}</span>
-                <el-image style="width: 20px; height: 20px" class="mt-1" :src="applet.type_logo" fit="contain" />
               </div>
             </template>
           </el-table-column>