Просмотр исходного кода

Merge branch 'master' of http://gitlab.smartai.com/zhupei/smartai2dian0

zhupei@smartai.com 1 год назад
Родитель
Сommit
6ae3734548

+ 17 - 1
public/i18n/lang-en.json

@@ -47,7 +47,23 @@
     "search": "Search",
     "createKnowledgeBase": "Create Knowledge Base",
     "setModel": "System Model Settings",
-    "createIntelligent": "Create Intelligent Agent"
+    "createIntelligent": "Create Intelligent Agent",
+    "document": "Document",
+    "edit": "Edit",
+    "delete": "Delete",
+    "online": "Online",
+    "offline": "Offline",
+    "createUser": "Create User",
+    "addedModel": "Added Models",
+    "unaddModel": "Models to be Added",
+    "addModelBtn": "Add Model",
+    "showMoreModelBtn": "Show More Models",
+    "downBtn": "Expand",
+    "upBtn": "Collapse",
+    "useBtn": "Use",
+    "addLabelBtn": "Add Label",
+    "loadingData": "Loading data, please wait...",
+    "noMoreData": "No more data available"
   },
   "permission": {
     "role": "Role",

+ 17 - 1
public/i18n/lang-zh.json

@@ -47,7 +47,23 @@
     "search": "搜索",
     "createKnowledgeBase": "创建知识库",
     "setModel": "系统模型设置",
-    "createIntelligent": "新建智能体"
+    "createIntelligent": "新建智能体",
+    "document": "文档",
+    "edit": "编辑",
+    "delete": "删除",
+    "online": "在线",
+    "offline": "下线",
+    "createUser": "创建用户",
+    "addedModel": "添加了的模型",
+    "unaddModel": "待添加的模型",
+    "addModelBtn": "添加模型",
+    "showMoreModelBtn": "展示更多模型",
+    "downBtn": "展开",
+    "upBtn": "收起",
+    "useBtn": "使用",
+    "addLabelBtn": "添加标签",
+    "loadingDataTip": "正在加载数据,请稍后……",
+    "noMoreData": "没有更多数据了"
   },
   "permission": {
     "role": "角色",

+ 13 - 0
src/apis/intelligent.js

@@ -0,0 +1,13 @@
+import request from '../base/ajax';
+
+/**
+ * 获取智能体列表
+ * @param {number} current 当前页数
+ * @param {number} pageSize 每页条数
+ * */
+export function getDialogList(current, pageSize) {
+  return request({
+    url: `/api/dialog/list?current=${current}&pageSize=${pageSize}`,
+    method: 'get'
+  });
+}

+ 3 - 0
src/base/event-bus.js

@@ -8,3 +8,6 @@ import EventBus from './event-bus/EventBus';
  * 任意 event bus 的定义,必须添加 bus_ 前缀
  */
 export const bus_themeChange = new EventBus('theme_change');
+
+export const bus_knowledgeSearch = new EventBus('knowledge_search');
+export const bus_intelligentSearch = new EventBus('intelligent_search');

+ 1 - 1
src/base/event-bus/EventBus.js

@@ -12,7 +12,7 @@ export default class EventBus {
 
   on(fn) {
     if (typeof fn === 'function') {
-      this.emitter(this.event_name, (e) => {
+      this.emitter.on(this.event_name, (e) => {
         fn(e);
       });
     }

+ 1 - 1
src/modules/Model/CollapseItem.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="collapse-item">
     <div class="name">{{ models.name }}</div>
-    <a-button type="primary" @click="toUse">使用</a-button>
+    <a-button type="primary" @click="toUse">{{ $t('management.useBtn') }}</a-button>
     <icon-delete class="delete-icon" @click="toDelete" />
   </div>
 </template>

+ 10 - 11
src/modules/Model/MessageBody.vue

@@ -2,10 +2,10 @@
   <div class="model-body">
     <div class="body-item">
       <div class="item-title">
-        <div class="title">添加了的模型</div>
+        <div class="title">{{ $t('management.addedModel') }}</div>
         <div class="icon" @click="changeStatusAdd">
-          <template v-if="added_show_status"> 收起 <icon-up /> </template>
-          <template v-if="!added_show_status"> 展开 <icon-down /> </template>
+          <template v-if="added_show_status"> {{ $t('management.upBtn') }} <icon-up /> </template>
+          <template v-if="!added_show_status"> {{ $t('management.downBtn') }} <icon-down /> </template>
         </div>
       </div>
       <transition name="expand-collapse" @before-enter="beforeEnter" @enter="enter" @leave="leave">
@@ -16,10 +16,10 @@
     </div>
     <div class="body-item">
       <div class="item-title">
-        <div class="title">待添加的模型</div>
+        <div class="title">{{ $t('management.unaddModel') }}</div>
         <div class="icon" @click="changeStatusUnAdd">
-          <template v-if="unadd_show_status"> 收起 <icon-up /> </template>
-          <template v-if="!unadd_show_status"> 展开 <icon-down /> </template>
+          <template v-if="unadd_show_status"> {{ $t('management.upBtn') }} <icon-up /> </template>
+          <template v-if="!unadd_show_status"> {{ $t('management.downBtn') }} <icon-down /> </template>
         </div>
       </div>
       <transition name="expand-collapse" @before-enter="beforeEnter" @enter="enter" @leave="leave">
@@ -33,7 +33,7 @@
             </template>
             <template #bottom>
               <a-button>
-                <template #icon> <icon-plus /> </template>添加模型</a-button
+                <template #icon> <icon-plus /> </template>{{ $t('management.addModelBtn') }}</a-button
               ></template
             >
           </CardItem>
@@ -46,7 +46,7 @@
 <script setup>
 import { ref } from 'vue';
 import ModelList from './ModelList.vue';
-import CardItem from '../../views/manage-common/CardItem.vue';
+import CardItem from '../../views/manage/CardItem.vue';
 import intelligentFrame1 from '../../assets/image/management/intelligent-frame1.png';
 import intelligentFrame2 from '../../assets/image/management/intelligent-frame2.png';
 import intelligentFrame3 from '../../assets/image/management/intelligent-frame3.png';
@@ -208,9 +208,8 @@ const showMoreModel = (item) => {
   font-weight: bold;
 }
 .card-list {
-  display: flex;
-  flex-direction: row;
-  flex-wrap: wrap;
+  display: grid;
+  grid-template-columns: repeat(5, 1fr);
   gap: 20px;
   transition: all 0.3s ease;
 }

+ 2 - 2
src/modules/Model/ModelList.vue

@@ -14,10 +14,10 @@
             <template #icon>
               <icon-plus />
             </template>
-            添加模型
+            {{ $t('management.addModelBtn') }}
           </a-button>
           <a-button @click="showMoreModel(model_item)">
-            展示更多模型
+            {{ $t('management.showMoreModelBtn') }}
             <template v-if="model_item.show_more">
               <icon-down />
             </template>

+ 86 - 92
src/modules/intelligent/MessageBody.vue

@@ -1,128 +1,117 @@
 <template>
-  <div class="body-container">
+  <div class="body-container" ref="body_container">
     <CardItem v-for="item in moke_data" :key="item.id" :name="item.name" :img_src="item.img_src" :height="200">
       <template #description> {{ item.desc }}> </template>
       <template #settings>
         <a-switch v-model="item.online">
-          <template #checked> 上线 </template>
-          <template #unchecked> 下线 </template>
+          <template #checked> {{ $t('management.online') }} </template>
+          <template #unchecked> {{ $t('management.offline') }} </template>
         </a-switch>
       </template>
-      <template #labels v-if="item.has_label">
+      <template #labels>
         <div class="label-btn">
           <icon-subscribe />
-          <div>添加标签</div>
+          <div>{{ $t('management.addLabelBtn') }}</div>
         </div>
       </template>
       <template #bottom>
         <div class="bottom">
-          <div class="user"><icon-user /> 创建用户:{{ item.user }}</div>
+          <div class="user"><icon-user /> {{ $t('management.createUser') }}:{{ item.user }}</div>
           <div class="tools">
             <icon-more :style="{ fontSize: '20px' }" />
           </div>
         </div>
       </template>
     </CardItem>
+    <div class="loading-tips">
+      <a-spin v-if="scroll_bottom && pages.current < total_pages" :tip="$t('management.loadingData')" />
+      <div v-if="scroll_bottom && pages.current >= total_pages">{{ $t('management.noMoreData') }}</div>
+    </div>
   </div>
 </template>
 
 <script setup>
-import { ref } from 'vue';
-import CardItem from '../../views/manage-common/CardItem.vue';
-import intelligentFrame1 from '../../assets/image/management/intelligent-frame1.png';
-import intelligentFrame2 from '../../assets/image/management/intelligent-frame2.png';
-import intelligentFrame3 from '../../assets/image/management/intelligent-frame3.png';
-import intelligentFrame4 from '../../assets/image/management/intelligent-frame4.png';
-import intelligentFrame5 from '../../assets/image/management/intelligent-frame5.png';
-import intelligentFrame6 from '../../assets/image/management/intelligent-frame6.png';
-import intelligentFrame7 from '../../assets/image/management/intelligent-frame7.png';
-import intelligentFrame8 from '../../assets/image/management/intelligent-frame8.png';
+import { ref, reactive, onMounted, onBeforeUnmount } from 'vue';
+import CardItem from '../../views/manage/CardItem.vue';
+import { getImageIntelligent } from '../../views/manage/common';
+import { getDialogList } from '../../apis/intelligent';
+import { bus_intelligentSearch } from '../../base/event-bus';
 
 const moke_data = ref([
-  {
-    id: 1,
-    name: '智能问答',
-    img_src: intelligentFrame1,
-    desc: '极目新闻记者了解到,这些患者都有一些共同的习惯:经常把未吃完的食物放在桌上敞着',
-    user: 'admin',
-    online: false,
-    has_label: false
-  },
-  {
-    id: 2,
-    name: '智能客服',
-    img_src: intelligentFrame2,
-    desc: '极目新闻记者了解到,这些患者都有一些共同的习惯:经常把未吃完的食物放在桌上敞着',
-    user: 'admin',
-    online: false,
-    has_label: true
-  },
-  {
-    id: 3,
-    name: '继题组卷',
-    img_src: intelligentFrame3,
-    desc: '极目新闻记者了解到,这些患者都有一些共同的习惯:经常把未吃完的食物放在桌上敞着',
-    user: 'admin',
-    online: true,
-    has_label: false
-  },
-  {
-    id: 4,
-    name: '小数绘图',
-    img_src: intelligentFrame4,
-    desc: '极目新闻记者了解到,这些患者都有一些共同的习惯:经常把未吃完的食物放在桌上敞着',
-    user: 'admin',
-    online: true,
-    has_label: true
-  },
-  {
-    id: 5,
-    name: '材据分析',
-    img_src: intelligentFrame5,
-    desc: '极目新闻记者了解到,这些患者都有一些共同的习惯:经常把未吃完的食物放在桌上敞着',
-    user: 'admin',
-    online: true,
-    has_label: false
-  },
-  {
-    id: 6,
-    name: '报告自动生成 ',
-    img_src: intelligentFrame6,
-    desc: '极目新闻记者了解到,这些患者都有一些共同的习惯:经常把未吃完的食物放在桌上敞着',
-    user: 'admin',
-    online: true,
-    has_label: false
-  },
-  {
-    id: 7,
-    name: '文档创作',
-    img_src: intelligentFrame7,
-    desc: '极目新闻记者了解到,这些患者都有一些共同的习惯:经常把未吃完的食物放在桌上敞着',
-    user: 'admin',
-    online: false,
-    has_label: true
-  },
-  {
-    id: 8,
-    name: '设备检测',
-    img_src: intelligentFrame8,
-    desc: '极目新闻记者了解到,这些患者都有一些共同的习惯:经常把未吃完的食物放在桌上敞着',
-    user: 'admin',
-    online: true,
-    has_label: true
-  }
+  // {
+  //   id: 1,
+  //   name: '智能问答',
+  //   img_src: intelligentFrame1,
+  //   desc: '极目新闻记者了解到,这些患者都有一些共同的习惯:经常把未吃完的食物放在桌上敞着',
+  //   user: 'admin',
+  //   online: false,
+  // },
 ]);
+const pages = reactive({
+  current: 1,
+  pageSize: 25
+});
+// 总页码
+const total_pages = ref(5);
+const body_container = ref(null);
+const scroll_bottom = ref(false);
+const search_text = ref('');
+
+const getDialog = async () => {
+  try {
+    const res = await getDialogList(pages.current, pages.pageSize);
+    const data = res.data.rows.map((item) => {
+      return {
+        ...item,
+        time: new Date(item.update_time).toLocaleString('zh-CN'),
+        desc: item.description,
+        img_src: getImageIntelligent(item.icon),
+        user: item.user || 'admin',
+        online: item.status == 1
+      };
+    });
+    moke_data.value.push(...data);
+  } catch (err) {
+    console.log(err);
+  }
+};
+const scrollHandler = (e) => {
+  if (e.target.scrollTop + e.target.clientHeight >= e.target.scrollHeight) {
+    scroll_bottom.value = true;
+    // 调用函数加载更多数据
+    if (pages.current < total_pages.value) {
+      pages.current += 1;
+      getDialog();
+    } else {
+    }
+  }
+};
+bus_intelligentSearch.on((text) => {
+  search_text.value = text;
+  getDialog();
+});
+onMounted(() => {
+  getDialog();
+  body_container.value.addEventListener('scroll', scrollHandler);
+});
+
+onBeforeUnmount(() => {
+  body_container.value.removeEventListener('scroll', scrollHandler);
+  bus_intelligentSearch.off();
+});
 </script>
 <style scoped lang="css">
 .body-container {
-  display: flex;
-  flex-direction: row;
-  flex-wrap: wrap;
+  display: grid;
+  grid-template-columns: repeat(6, 1fr);
   align-content: flex-start;
   gap: 20px;
-  overflow: auto;
+  overflow-y: scroll;
   height: calc(100% - 80px);
 }
+.body-container::-webkit-scrollbar {
+  display: none;
+}
 .label-btn {
   display: flex;
   gap: 10px;
@@ -136,4 +125,9 @@ const moke_data = ref([
   justify-content: space-between;
   align-items: center;
 }
+.loading-tips {
+  grid-column: 1/-1;
+  grid-row-start: auto;
+  text-align: center;
+}
 </style>

+ 19 - 2
src/modules/intelligent/TopSetting.vue

@@ -1,6 +1,12 @@
 <template>
   <a-space size="large">
-    <a-input :placeholder="$t('management.search')" style="width: 300px" allow-clear @input="handleSearch">
+    <a-input
+      v-model="searchText"
+      :placeholder="$t('management.search')"
+      style="width: 300px"
+      allow-clear
+      @input="handleSearch"
+    >
       <template #prefix>
         <icon-search />
       </template>
@@ -15,8 +21,19 @@
 </template>
 
 <script setup>
+import { ref } from 'vue';
+import { funcDebounce } from '../../utils/utils';
+import { bus_intelligentSearch } from '../../base/event-bus';
+
+const searchText = ref('');
 // 搜索
-const handleSearch = () => {};
+const handleSearch = funcDebounce(
+  () => {
+    bus_intelligentSearch.emit(searchText.value);
+  },
+  300,
+  false
+);
 // 创建智能体
 const handleCreate = () => {};
 </script>

+ 70 - 67
src/modules/knowledge/MessageBody.vue

@@ -1,9 +1,9 @@
 <template>
-  <div class="body-container">
+  <div class="body-container" ref="body_container">
     <CardItem v-for="item in moke_data" :key="item.name" :name="item.name" :img_src="item.img_src">
       <template #bottom>
         <div class="bottom">
-          <div>{{ item.count }}文档</div>
+          <div>{{ item.count }}{{ $t('management.document') }}</div>
           <div>|</div>
           <div>{{ item.time }}</div>
         </div>
@@ -12,111 +12,114 @@
         <a-dropdown trigger="hover" @select="handleSelect">
           <icon-more :style="{ fontSize: '20px' }" />
           <template #content>
-            <a-doption :value="{ value: 'edit' }">编辑</a-doption>
-            <a-doption :value="{ value: 'delete' }">删除</a-doption>
+            <a-doption :value="{ value: 'edit' }">{{ $t('management.edit') }}</a-doption>
+            <a-doption :value="{ value: 'delete' }">{{ $t('management.delete') }}</a-doption>
           </template>
         </a-dropdown>
       </template>
     </CardItem>
+    <div class="loading-tips">
+      <a-spin v-if="scroll_bottom && pages.current < total_pages" :tip="$t('management.loadingData')" />
+      <div v-if="scroll_bottom && pages.current >= total_pages">{{ $t('management.noMoreData') }}</div>
+    </div>
   </div>
 </template>
 
 <script setup>
-import { ref, reactive, onMounted } from 'vue';
-
-import CardItem from '../../views/manage-common/CardItem.vue';
-import knowledgeFrame1 from '../../assets/image/management/knowledge-frame1.png';
-import knowledgeFrame2 from '../../assets/image/management/knowledge-frame2.png';
-import knowledgeFrame3 from '../../assets/image/management/knowledge-frame3.png';
-import knowledgeFrame4 from '../../assets/image/management/knowledge-frame4.png';
+import { ref, reactive, onMounted, onBeforeUnmount } from 'vue';
+import CardItem from '../../views/manage/CardItem.vue';
+import { getImageKnowLedge } from '../../views/manage/common';
 import { getKnowledgeList } from '../../apis/knowledge';
+import { bus_knowledgeSearch } from '../../base/event-bus';
 
 const moke_data = ref([
-  {
-    name: '知识库1',
-    img_src: knowledgeFrame1,
-    count: 292,
-    time: '2024:11:11 12:00:00'
-  },
-  {
-    name: '知识库2',
-    img_src: knowledgeFrame2,
-    count: 292,
-    time: '2024:11:11 12:00:00'
-  },
-  {
-    name: '知识库3',
-    img_src: knowledgeFrame3,
-    count: 292,
-    time: '2024:11:11 12:00:00'
-  },
-  {
-    name: '知识库4',
-    img_src: knowledgeFrame4,
-    count: 292,
-    time: '2024:11:11 12:00:00'
-  },
-  {
-    name: '知识库5',
-    img_src: knowledgeFrame1,
-    count: 292,
-    time: '2024:11:11 12:00:00'
-  },
-  {
-    name: '知识库6',
-    img_src: knowledgeFrame2,
-    count: 292,
-    time: '2024:11:11 12:00:00'
-  },
-  {
-    name: '知识库7',
-    img_src: knowledgeFrame3,
-    count: 292,
-    time: '2024:11:11 12:00:00'
-  },
-  {
-    name: '知识库8',
-    img_src: knowledgeFrame4,
-    count: 292,
-    time: '2024:11:11 12:00:00'
-  }
+  // {
+  //   name: '知识库1',
+  //   img_src: knowledgeFrame1,
+  //   count: 292,
+  //   time: '2024:11:11 12:00:00'
+  // }
 ]);
 const pages = reactive({
   current: 1,
-  pageSize: 18
+  pageSize: 25
 });
+// 总页码
+const total_pages = ref(5);
+const body_container = ref(null);
+const scroll_bottom = ref(false);
+// 搜索文本
+const search_text = ref('');
 
 const handleSelect = ({ value }) => {
   if (value === 'edit') {
   } else {
   }
 };
-
 const getKnowledge = async () => {
+  // TODO: 等待接口修改后,需要将searchText传到接口中
   try {
     const res = await getKnowledgeList(pages.current, pages.pageSize);
-    console.log(res);
+    if (res.code == 200) {
+      const data = res.data.rows.map((item) => {
+        return {
+          ...item,
+          time: new Date(item.update_time).toLocaleString('zh-CN'),
+          img_src: getImageKnowLedge(item.avatar),
+          count: item.count ? item.count : 292
+        };
+      });
+      moke_data.value.push(...data);
+    }
   } catch (err) {
     console.log(err, 'flag');
   }
 };
+const scrollHandler = (e) => {
+  if (e.target.scrollTop + e.target.clientHeight >= e.target.scrollHeight) {
+    scroll_bottom.value = true;
+    // 调用函数加载更多数据
+    if (pages.current < total_pages.value) {
+      pages.current += 1;
+      getKnowledge();
+    } else {
+    }
+  }
+};
+
+bus_knowledgeSearch.on((text) => {
+  search_text.value = text;
+  getKnowledge();
+});
 
 onMounted(() => {
   getKnowledge();
+  body_container.value.addEventListener('scroll', scrollHandler);
+});
+
+onBeforeUnmount(() => {
+  bus_knowledgeSearch.off();
+  body_container.value.removeEventListener('scroll', scrollHandler);
 });
 </script>
 <style scoped lang="css">
 .body-container {
-  display: flex;
-  flex-direction: row;
-  flex-wrap: wrap;
-  align-content: flex-start;
+  display: grid;
+  grid-template-columns: repeat(6, 1fr);
   gap: 20px;
-  overflow: auto;
+  overflow-y: scroll;
   height: calc(100% - 80px);
 }
+.body-container::-webkit-scrollbar {
+  display: none;
+}
 .bottom {
   display: flex;
   gap: 10px;
 }
+.loading-tips {
+  grid-column: 1/-1;
+  grid-row-start: auto;
+  text-align: center;
+}
 </style>

+ 19 - 2
src/modules/knowledge/TopSetting.vue

@@ -1,6 +1,12 @@
 <template>
   <a-space size="large">
-    <a-input :placeholder="$t('management.search')" style="width: 300px" allow-clear @input="handleSearch">
+    <a-input
+      v-model="searchText"
+      :placeholder="$t('management.search')"
+      style="width: 300px"
+      allow-clear
+      @input="handleSearch"
+    >
       <template #prefix>
         <icon-search />
       </template>
@@ -15,8 +21,19 @@
 </template>
 
 <script setup>
+import { ref } from 'vue';
+import { funcDebounce } from '../../utils/utils';
+import { bus_knowledgeSearch } from '../../base/event-bus';
+
+const searchText = ref('');
 // 搜索
-const handleSearch = () => {};
+const handleSearch = funcDebounce(
+  () => {
+    bus_knowledgeSearch.emit(searchText.value);
+  },
+  300,
+  false
+);
 // 创建知识库
 const handleCreate = () => {};
 </script>

+ 27 - 0
src/utils/utils.js

@@ -14,3 +14,30 @@ export const jsonParse = (val) => {
     return null;
   }
 };
+/**
+ * 防抖函数
+ * @param func 要执行的函数
+ * @param wait 延迟时间
+ * @param immediate 是否立即执行
+ * */
+export const funcDebounce = (func, wait, immediate) => {
+  if (typeof func !== 'function') {
+    return new Error('debounce func is not a function');
+  }
+  if (typeof wait === undefined) wait = 300;
+  if (typeof immediate === undefined) immediate = false;
+  if (typeof wait === 'boolean') {
+    immediate = wait;
+    wait = 300;
+  }
+  let timer;
+  return function (...args) {
+    const that = this;
+    timer && clearTimeout(timer);
+    immediate && !timer ? func.apply(that, args) : null;
+    timer = setTimeout(function () {
+      timer = null;
+      !immediate ? func.apply(that, args) : null;
+    }, wait);
+  };
+};

+ 1 - 1
src/views/Intelligent.vue

@@ -14,7 +14,7 @@
 <script setup>
 import LayoutExperience from './layout/LayoutExperience.vue';
 import ContentContainer from './layout/ContentContainer.vue';
-import HeadManage from './manage-common/HeadManage.vue';
+import HeadManage from './manage/HeadManage.vue';
 import TopSetting from '../modules/intelligent/TopSetting.vue';
 import MessageBody from '../modules/intelligent/MessageBody.vue';
 </script>

+ 1 - 1
src/views/Knowledge.vue

@@ -14,7 +14,7 @@
 <script setup>
 import LayoutExperience from './layout/LayoutExperience.vue';
 import ContentContainer from './layout/ContentContainer.vue';
-import HeadManage from './manage-common/HeadManage.vue';
+import HeadManage from './manage/HeadManage.vue';
 import TopSetting from '../modules/knowledge/TopSetting.vue';
 import MessageBody from '../modules/knowledge/MessageBody.vue';
 </script>

+ 1 - 1
src/views/Model.vue

@@ -14,7 +14,7 @@
 <script setup>
 import LayoutExperience from './layout/LayoutExperience.vue';
 import ContentContainer from './layout/ContentContainer.vue';
-import HeadManage from './manage-common/HeadManage.vue';
+import HeadManage from './manage/HeadManage.vue';
 import TopSetting from '../modules/model/TopSetting.vue';
 import MessageBody from '../modules/model/MessageBody.vue';
 </script>

+ 0 - 2
src/views/manage-common/CardItem.vue → src/views/manage/CardItem.vue

@@ -37,8 +37,6 @@ const props = defineProps({
 <style scoped lang="css">
 .card-container {
   position: relative;
-  width: calc((100vw / 7) - 18px);
-  flex-grow: 0;
   padding: 10px 20px;
   background-color: var(--color-bg-2);
 }

+ 0 - 0
src/views/manage-common/HeadManage.vue → src/views/manage/HeadManage.vue


+ 40 - 0
src/views/manage/common.js

@@ -0,0 +1,40 @@
+import knowledgeFrame1 from '../../assets/image/management/knowledge-frame1.png';
+import knowledgeFrame2 from '../../assets/image/management/knowledge-frame2.png';
+import knowledgeFrame3 from '../../assets/image/management/knowledge-frame3.png';
+import knowledgeFrame4 from '../../assets/image/management/knowledge-frame4.png';
+import intelligentFrame1 from '../../assets/image/management/intelligent-frame1.png';
+import intelligentFrame2 from '../../assets/image/management/intelligent-frame2.png';
+import intelligentFrame3 from '../../assets/image/management/intelligent-frame3.png';
+import intelligentFrame4 from '../../assets/image/management/intelligent-frame4.png';
+import intelligentFrame5 from '../../assets/image/management/intelligent-frame5.png';
+import intelligentFrame6 from '../../assets/image/management/intelligent-frame6.png';
+import intelligentFrame7 from '../../assets/image/management/intelligent-frame7.png';
+import intelligentFrame8 from '../../assets/image/management/intelligent-frame8.png';
+
+const image_knowLedge_map = {
+  knowledgeFrame1: knowledgeFrame1,
+  knowledgeFrame2: knowledgeFrame2,
+  knowledgeFrame3: knowledgeFrame3,
+  knowledgeFrame4: knowledgeFrame4
+};
+const image_intelligent_map = {
+  intelligentFrame1: intelligentFrame1,
+  intelligentFrame2: intelligentFrame2,
+  intelligentFrame3: intelligentFrame3,
+  intelligentFrame4: intelligentFrame4,
+  intelligentFrame5: intelligentFrame5,
+  intelligentFrame6: intelligentFrame6,
+  intelligentFrame7: intelligentFrame7,
+  intelligentFrame8: intelligentFrame8
+};
+/**
+ * @description: 图片映射表
+ * avatar: 图片名称
+ * defaultImg: 默认图片
+ */
+export const getImageKnowLedge = (avatar) => {
+  return image_knowLedge_map[avatar] || knowledgeFrame1;
+};
+export const getImageIntelligent = (avatar) => {
+  return image_intelligent_map[avatar] || intelligentFrame1;
+};