yufan há 1 ano atrás
pai
commit
dcb36fe252

+ 1 - 1
.env.production

@@ -1,4 +1,4 @@
-VITE_APP_BASE_URL = 'https://www.sqjyy.cn/gateway'
+VITE_APP_BASE_URL = 'https://sqjyy.cn/gateway'
 VITE_APP_FDFS_WEB_SERVER_URL = 'https://zjzl-test.oss-cn-hangzhou.aliyuncs.com'
 
 # 图书商城token AES加密的秘钥

+ 6 - 1
src/api/bookManage.ts

@@ -17,6 +17,7 @@ const bookpackge = {
   releaseBook: '/fighter-library/book/releaseBook',
   backBook: '/fighter-library/book/backBook',
   listCategory: '/fighter-library/CateRelation/listChildCategory',
+  listTree: '/fighter-library/CateRelation/listTree',
 };
 
 //  分页查询套餐参数
@@ -49,7 +50,11 @@ class packagebook {
       method: 'post',
     });
   }
-
+  static async listTree(): Promise<HttpResponse> {
+    return Axios(bookpackge.listTree, {
+      method: 'post',
+    });
+  }
   // 图书类型下拉选
   static async listTopCategory(): Promise<HttpResponse> {
     return Axios(bookpackge.listTopCategory, {

+ 8 - 6
src/plugins/antd.ts

@@ -35,10 +35,11 @@ import {
   Steps,
   Upload,
   message,
-  Checkbox ,
+  Checkbox,
   Popconfirm,
   Radio,
-  Spin  
+  Spin,
+  TreeSelect,
 } from 'ant-design-vue';
 
 /**
@@ -77,8 +78,9 @@ export default function loadComponent(app: any) {
   app.use(Steps);
   app.use(Upload);
   app.use(message);
-  app.use(Checkbox );
-  app.use(Popconfirm)
-  app.use(Radio)
-  app.use(Spin)
+  app.use(Checkbox);
+  app.use(Popconfirm);
+  app.use(Radio);
+  app.use(Spin);
+  app.use(TreeSelect);
 }

+ 65 - 30
src/views/bookManage/addDialog.vue

@@ -22,7 +22,7 @@
         </a-form-item>
         <a-form-item label="类型" name="type">
           <a-select
-            v-model:value="formState.type"
+            v-model:value="formState.currentTypeId"
             placeholder="请选择图书类型"
             :allowClear="true"
             :options="typeObj.typeList"
@@ -30,11 +30,26 @@
           />
         </a-form-item>
         <a-form-item has-feedback label="分类" name="subType">
-          <a-select v-model:value="formState.subType" placeholder="请选择分类" allow-clear>
+          <!-- <a-select v-model:value="formState.currentCateId" placeholder="请选择分类" allow-clear>
             <a-select-option v-for="item in subTypeList" :key="item.id" :value="item.id">{{
               item.name
             }}</a-select-option>
-          </a-select>
+          </a-select> -->
+          <a-tree-select
+            v-model:value="formState.currentCateId"
+            show-search
+            style="width: 100%"
+            :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
+            placeholder="请选择分类"
+            allow-clear
+            :tree-data="subTypeList"
+            :replaceFields="{
+              children: 'children',
+              title: 'name',
+              value: 'id',
+              key: 'id',
+            }"
+          />
         </a-form-item>
         <a-form-item v-if="showIsbn" label="ISBN" name="isbn">
           <a-input v-model:value="formState.isbn" placeholder="请输入13位编码" :allowClear="true" />
@@ -112,11 +127,13 @@
 
 <script setup lang="ts">
   import { ref, reactive, toRaw } from 'vue';
+  import { SessionStorageService, LocalStorageService } from '@/utils/storage';
   import { message } from 'ant-design-vue';
   import { PlusOutlined } from '@ant-design/icons-vue';
   import alertBook from '@/api/manageBookAlert';
   import { clearPending } from '@/api/axios';
   import packagebook from '@/api/bookManage';
+  import { map } from 'lodash';
   const title = ref<string>('');
 
   const visible = ref<boolean>(false);
@@ -135,8 +152,8 @@
   interface FormState {
     name: string;
     author: string;
-    type: number | undefined;
-    subType: number | undefined;
+    currentTypeId: number | undefined;
+    currentCateId: number | undefined;
     isbn?: string;
     brief: string;
     contentSource: number;
@@ -147,18 +164,19 @@
   const formState: FormState = reactive({
     name: '',
     author: '',
-    type: undefined,
+    currentTypeId: undefined,
     isbn: '',
     brief: '',
-    contentSource: 1,
+    contentSource: 2,
     linkAddress: '',
     releaseNow: false,
-    subType: undefined,
+    currentCateId: undefined,
   });
 
   const showIsbn = ref<boolean>(false);
   const subTypeList = ref([]);
   const changeType = (v) => {
+    formState.currentCateId = undefined;
     if (v == 1) {
       showIsbn.value = true;
     } else {
@@ -168,32 +186,46 @@
       getSbuType(v);
     }
   };
-  const getSbuType = (e) => {
-    packagebook.listCategory({ type: e }).then((res) => {
-      const { code, data } = res.data;
-      if (code === 200) {
-        subTypeList.value = data;
-      }
-    });
+
+  const getSbuType = (v) => {
+    //  dataCache.set("userInfo",res);
+
+    let arr = LocalStorageService.get('subType' + v);
+    subTypeList.value = arr;
+    // if (arr) {
+    //   subTypeList.value = arr;
+    // } else {
+    //   packagebook.listTree().then((res) => {
+    //     const { code, data } = res.data;
+    //     if (code === 200) {
+    //       // subTypeList.value = data;
+    //       data.forEach((e) => {
+    //         dataCache.set(e.id, e.children);
+    //       });
+    //       subTypeList.value = data[0]?.children;
+    //       console.log(subTypeList.value, '===========');
+    //     }
+    //   });
+    // }
   };
   let isType = async (value) => {
-    if (!formState.type) {
+    if (!formState.currentTypeId) {
       return Promise.reject('请选择图书类型');
     }
   };
   let isSubType = async (val) => {
-    if (!formState.subType) {
+    if (!formState.currentCateId) {
       return Promise.reject('请选择图书分类');
     }
   };
 
-  let isbnRule = async (value) => {
-    let a = /[0-9]{13,16}/;
-    let txt = toRaw(formState).isbn;
-    if (txt.length > 13) {
-      return Promise.reject('编码位数不能超过13位');
-    } else if (!a.test(txt)) return Promise.reject('请输入正确的编码');
-  };
+  // let isbnRule = async (value) => {
+  //   let a = /[0-9]{13,16}/;
+  //   let txt = toRaw(formState).isbn;
+  //   if (txt.length > 13) {
+  //     return Promise.reject('编码位数不能超过13位');
+  //   } else if (!a.test(txt)) return Promise.reject('请输入正确的编码');
+  // };
 
   let validatorImg = async () => {
     if (allFile.imgList.length < 1) return Promise.reject('请上传图书封面');
@@ -217,7 +249,7 @@
     name: [{ required: true, message: '请输入图书名称', trigger: 'blur' }],
     type: [{ required: true, validator: isType, trigger: 'blur' }],
     subType: [{ required: true, validator: isSubType, trigger: 'blur' }],
-    isbn: [{ required: true, validator: isbnRule, trigger: 'blur' }],
+    // isbn: [{ required: true, validator: isbnRule, trigger: 'blur' }],
     author: [{ required: true, message: '请输入作者名称', trigger: 'blur' }],
     upImg: [{ required: true, validator: validatorImg, trigger: 'change' }],
     brief: [{ required: true, message: '请输入图书简介', trigger: 'blur' }],
@@ -337,7 +369,8 @@
   const editAlert = (obj) => {
     formState.name = obj.name;
     formState.author = obj.author;
-    formState.type = obj.type;
+    formState.currentTypeId = obj.currentTypeId[0];
+    formState.currentCateId = obj.currentCateId[0];
     formState.isbn = obj.isbn;
     formState.brief = obj.brief;
     formState.contentSource = obj.contentSource;
@@ -358,8 +391,9 @@
     };
     allFile.imgList.push(img);
     allFile.fileList.push(files);
-    getSbuType(obj.type);
-    formState.subType = obj.subType;
+    // debugger;
+    getSbuType(1);
+    formState.currentCateId = obj.currentCateId[0];
     visible.value = true;
   };
 
@@ -376,6 +410,7 @@
         } else {
           obj.status = 2;
         }
+
         obj.cover = cover.value;
         obj.uploadFile = fileUrl.value;
         obj.fileName = fileName.value;
@@ -425,10 +460,10 @@
     formRef.value.resetFields();
     formState.name = '';
     formState.author = '';
-    formState.type = undefined;
+    formState.currentTypeId = undefined;
     formState.isbn = '';
     formState.brief = '';
-    formState.contentSource = 1;
+    formState.contentSource = 2;
     formState.linkAddress = '';
     formState.releaseNow = false;
   };

+ 38 - 1
src/views/bookManage/audit.vue

@@ -36,7 +36,12 @@
           <a-input v-model:value="formState.reviewer" placeholder="请输入" />
         </a-form-item>
         <a-form-item label="不通过原因" name="audit" v-if="formState.auditStatus == 99">
-          <a-textarea v-model:value="formState.remark" showCount :maxlength="500" />
+          <!-- <a-textarea v-model:value="formState.remark" showCount :maxlength="500" /> -->
+          <a-select v-model:value="formState.remark" placeholder="请选择不通过原因">
+            <a-select-option v-for="(item, index) in NotThrough" :value="item" :key="index">{{
+              item
+            }}</a-select-option>
+          </a-select>
         </a-form-item>
       </a-form>
     </a-modal>
@@ -107,6 +112,38 @@
     fileList: [],
   });
 
+  const NotThrough = ref([
+    '全英文,未翻译',
+    '内容过与陈旧,不适合',
+    '涉黄',
+    '有白版页',
+    '打不开',
+    '文件损坏',
+    '图文错乱',
+    '文章不全',
+    '乱码',
+    '排版不友好',
+    '字迹不清,字迹重叠等',
+    '无出版社',
+    '无封面页',
+    '无目录',
+    '目录错误',
+    '目录缺少文字',
+    '目录链接不对',
+    '目录无法跳转',
+    '重复',
+    '页底有不该出现的字',
+    '内容不适宜',
+    '不符合社会主义核心价值观',
+    '简介过于暴力',
+    '标题敏感',
+    '标题与内容不符合',
+    '涉及性教育',
+    '插画过多',
+    '连环画',
+    '印度文',
+    '内容多字幕、数字代替',
+  ]);
   const spinning = ref<boolean>(false);
 
   const beforeFile = (file, list) => {

+ 13 - 1
src/views/bookManage/index.vue

@@ -161,6 +161,7 @@
 <script setup lang="ts">
   import { ConfigProvider, message } from 'ant-design-vue';
   import { reactive, ref, onMounted } from 'vue';
+  import { SessionStorageService, LocalStorageService } from '@/utils/storage';
   import { useRouter } from 'vue-router';
   // import { Moment } from 'moment';
   import addDialog from './addDialog.vue';
@@ -597,11 +598,22 @@
         console.log(err);
       });
   };
-
+  const getSubType = () => {
+    packagebook.listTree().then((res) => {
+      const { code, data } = res.data;
+      if (code === 200) {
+        // subTypeList.value = data;
+        data.forEach((e) => {
+          LocalStorageService.set('subType' + e.id, e?.children);
+        });
+      }
+    });
+  };
   onMounted(() => {
     getBookStatusDropDown();
     getBookTypeDropDown();
     queryList();
+    getSubType();
   });
 </script>