浏览代码

添加新闻类型

lrf 1 年之前
父节点
当前提交
55a0959220
共有 2 个文件被更改,包括 14 次插入2 次删除
  1. 13 1
      src/views/core/news/index.vue
  2. 1 1
      vite.config.ts

+ 13 - 1
src/views/core/news/index.vue

@@ -6,6 +6,9 @@
           <template #is_use>
             <el-option v-for="i in statusList" :key="i._id" :label="i.label" :value="i.value"></el-option>
           </template>
+          <template #type>
+            <el-option v-for="i in newsTypeList" :key="i._id" :label="i.label" :value="i.value"></el-option>
+          </template>
         </cSearch>
       </el-col>
       <el-col :span="24" class="two">
@@ -22,6 +25,9 @@
         <template #img>
           <cUpload model="img" :list="form.img" :limit="1" url="/files/canteen/news/upload" listType="picture-card" @change="onUpload"></cUpload>
         </template>
+        <template #type>
+          <el-option v-for="i in newsTypeList" :key="i._id" :label="i.label" :value="i.value"></el-option>
+        </template>
         <template #content>
           <cEditor v-model="form.content" url="/files/canteen/news/upload"></cEditor>
         </template>
@@ -55,12 +61,15 @@ const $checkRes = inject('$checkRes') as Function;
 // #region 字典
 // NeedChange
 const statusList: Ref<any> = ref([]);
-
+const newsTypeList: Ref<any> = ref([]);
 const searchOther = async () => {
   let res: IQueryResult;
   // 是否使用
   res = await dictDataStore.query({ code: 'isUse', is_use: '0' });
   if ($checkRes(res)) statusList.value = res.data;
+  // 新闻类型
+  res = await dictDataStore.query({ code: 'newsType', is_use: '0' });
+  if ($checkRes(res)) newsTypeList.value = res.data;
 };
 // #endregion
 
@@ -108,6 +117,7 @@ const toChangeUse = async (data) => {
 let fields: Ref<any[]> = ref([
   { label: '标题', model: 'title', isSearch: true },
   { label: '来源', model: 'origin', isSearch: true },
+  { label: '类型', model: 'type', format: (i) => getDict(i, 'type'), isSearch: true, type: 'select' },
   { label: '创建时间', model: 'create_time' },
   { label: '状态', model: 'is_use', format: (i) => getDict(i, 'is_use'), isSearch: true, type: 'select' }
 ]);
@@ -173,6 +183,7 @@ const dialog: Ref<any> = ref({ title: '数据信息', show: false, type: '1' });
 const form: Ref<any> = ref({ img: [] });
 const formFieldsForCreate = [
   { label: '标题', model: 'title' },
+  { label: '类型', model: 'type', type: 'select' },
   { label: '来源', model: 'origin' },
   { label: '创建时间', model: 'create_time', type: 'date' },
   { label: '封面图片', model: 'img', custom: true },
@@ -181,6 +192,7 @@ const formFieldsForCreate = [
 ];
 const formFieldsForUpdate = [
   { label: '标题', model: 'title' },
+  { label: '类型', model: 'type', type: 'select' },
   { label: '来源', model: 'origin' },
   { label: '创建时间', model: 'create_time', type: 'date' },
   { label: '封面图片', model: 'img', custom: true },

+ 1 - 1
vite.config.ts

@@ -20,7 +20,7 @@ export default defineConfig(({ mode }) => {
           changeOrigin: true
         },
         '/st/api': {
-          target: 'http://192.168.1.197:9902', //https://www.ccwit.net
+          target: 'http://192.168.1.197:9901', //https://www.ccwit.net
           changeOrigin: true,
           ws: false
         }