lushuncheng il y a 5 ans
Parent
commit
008044c13b
1 fichiers modifiés avec 25 ajouts et 24 suppressions
  1. 25 24
      components/sign/works.vue

+ 25 - 24
components/sign/works.vue

@@ -57,20 +57,20 @@ export default {
         duty: "",
         description: "",
         url: "",
-        image_list: []
+        image_list: [],
       },
       works: [],
       current: null,
       originWorks: [],
       industries: [],
-      functions: []
+      functions: [],
     };
   },
   components: {
-    workForm
+    workForm,
   },
   computed: {
-    ...mapState(["userinfo"])
+    ...mapState(["userinfo"]),
   },
   watch: {},
   async mounted() {
@@ -89,7 +89,7 @@ export default {
         function_ops: work.function_ops.join(","), //是多个ID,用英文逗号分割,关键功能
         industry_id: parseInt(work.industry_id[1]), //id,是int类型啊,不是文字
         // url: "https://a.com",
-        image_list: work.image_list.map(it => it.url).join(",") //是图片地址,多个图片用逗号分割,
+        image_list: work.image_list.map((it) => it.url).join(","), //是图片地址,多个图片用逗号分割,
       };
       const res = await this.$axios.$post(`/api/user_works/save`, queryParams);
       if (res.status === 1) {
@@ -101,7 +101,7 @@ export default {
           duty: "",
           description: "",
           url: "",
-          image_list: []
+          image_list: [],
         };
         this.editingItem = [];
         this.getData();
@@ -110,13 +110,13 @@ export default {
     async getData() {
       const res = await this.$axios.$post("/api/user_works/get_list");
       const data = !res.data ? [] : res.data;
-      this.works = data.map(it => {
+      this.works = data.map((it) => {
         const image_list = it.image_list
-          ? it.image_list.split(",").map(it => ({ name: it, url: it }))
+          ? it.image_list.split(",").map((it) => ({ name: it, url: it }))
           : [];
         let industry_id;
-        this.industries.map(item1 => {
-          return item1.children.map(item2 => {
+        this.industries.map((item1) => {
+          return item1.children.map((item2) => {
             if (item2.value == it.industry_id) {
               industry_id = [item1.value, item2.value];
             }
@@ -127,29 +127,29 @@ export default {
           ...it,
           industry_id,
           function_ops: it.function_ops ? it.function_ops.split(",") : [],
-          image_list
+          image_list,
         };
       });
     },
     async getIndustry() {
       const res = await this.$axios.$post("/api/user_works/get_industry");
       const data = !res.data ? [] : res.data;
-      this.industries = data.map(it => ({
+      this.industries = data.map((it) => ({
         label: it.name,
         value: it.id,
-        children: it.child.map(it => ({
+        children: it.child.map((it) => ({
           label: it.name,
-          value: it.id
-        }))
+          value: it.id,
+        })),
       }));
       return this.industries;
     },
     async getFunction() {
       const res = await this.$axios.$post("/api/user_works/get_function");
       const data = !res.data ? [] : res.data;
-      this.functions = data.map(it => ({
+      this.functions = data.map((it) => ({
         label: it.outsourcefunc_name,
-        value: it.outsourcefunc_id
+        value: it.outsourcefunc_id,
       }));
     },
     async fetchWork(keyword) {
@@ -178,7 +178,7 @@ export default {
       const deleteComplete = () => {
         this.$message({
           type: "success",
-          message: "删除成功!"
+          message: "删除成功!",
         });
         this.works.splice(idx, 1);
         this.editingItem = [];
@@ -186,12 +186,12 @@ export default {
       this.$confirm("确认删除该作品?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning"
+        type: "warning",
       })
         .then(async () => {
           if (work.wid) {
             const res = await this.$axios.$post(`/api/user_works/delete`, {
-              id: work.wid
+              id: work.wid,
             });
             if (res.status === 1) {
               deleteComplete();
@@ -202,11 +202,11 @@ export default {
             deleteComplete();
           }
         })
-        .catch(err => {
+        .catch((err) => {
           console.log(err);
           this.$message({
             type: "info",
-            message: "已取消删除"
+            message: "已取消删除",
           });
         });
     },
@@ -218,8 +218,8 @@ export default {
     },
     editItem(idx) {
       this.editingItem = [idx];
-    }
-  }
+    },
+  },
 };
 </script>
 
@@ -253,6 +253,7 @@ export default {
       margin-right: 10px;
       width: 100px;
       height: 100px;
+      overflow: hidden;
     }
     .des {
       flex: 1;