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

dev-新需求
1、到添加项目作品页面完成-添加提交事件

bruce 5 лет назад
Родитель
Сommit
cd08e28dcd
1 измененных файлов с 22 добавлено и 22 удалено
  1. 22 22
      components/works/editor.vue

+ 22 - 22
components/works/editor.vue

@@ -32,7 +32,7 @@
     <!--作品链接-->
     <div class="app__dp_f app__f_r app__alig_c app__mt_20">
       <h5 class="app__f_s_0">作品链接</h5>
-      <el-input show-word-limit v-model="title" class="title _title" placeholder="例如:https://www.proginn.com 若无法添加作品有效链接,请添加作品截图" :maxlength="50"></el-input>
+      <el-input show-word-limit v-model="workUrl" class="title _title" placeholder="例如:https://www.proginn.com 若无法添加作品有效链接,请添加作品截图" :maxlength="50"></el-input>
     </div>
 
 
@@ -75,7 +75,8 @@
           }
         ],
         fileList: [],
-        uploading: false
+        uploading: false,
+        workUrl: ""
       };
     },
     computed: {},
@@ -127,42 +128,41 @@
       },
       publish() {
         this.needVerify();
-        if (!this.title) {
-          this.$message.error("请输入文章标题");
+        if (!this.workName) {
+          this.$message.error("请输入项目名称");
           return;
         }
-        if (this.title.length < 2) {
-          this.$message.error("文章标题不可少于2字符");
+        if (this.workName.length < 2) {
+          this.$message.error("项目名称不可少于2字符");
           return;
         }
-        if (this.title.length > 64) {
-          this.$message.error("文章标题不可超过64字符,请删减");
+        if (this.title.length > 50) {
+          this.$message.error("文章标题不可超过50字符,请删减");
           return;
         }
 
         if (!this.content) {
-          this.$message.error("请输入文章正文");
+          this.$message.error("请输入项目正文");
           return;
         }
-        if (this.content.length < 100) {
-          this.$message.error("文章正文不可少于100字符");
+        if (this.content.length < 60) {
+          this.$message.error("项目正文不可少于60字符");
           return;
         }
-        if (this.content.length > 100000) {
-          this.$message.error("文章正文不可超过1万字符,请删减");
+        if (this.content.length > 10000) {
+          this.$message.error("项目正文不可大于10000字符,请删减");
           return;
         }
         const data = {
-          title: this.title,
-          intro: this.subTitle,
-          body: this.content,
-          provider_id: this.collectionId,
-          cover_url: this.cover_url
+          name: this.workName,
+          description: this.content,
+          url: this.workUrl,
+          image_list: this.cover_url,
         };
         if (this.topicId) {
           data.topic_id = this.topicId;
           this.$axios
-            .$post(`/api/community/topic/update_topic`, data)
+            .$post(`/api/user_works/add`, data)
             .then(res => {
               console.log(res);
               if (res.status === -99) {
@@ -201,8 +201,8 @@
       },
       handleFileChange(file) {
         console.log(file);
-        if (file.size / 1024 > 500) {
-          this.$message.error("图片大小不得超过500k,请重新选择");
+        if (file.size / 1024 > 2048) {
+          this.$message.error("图片大小不得超过2M,请重新选择");
           return false;
         }
         const formData = new FormData();
@@ -231,7 +231,7 @@
         this.workName = this.workName.replace(/[&|\*|#|\\]/g, "");
 
       },
-      handleChange(e){
+      handleChange(e) {
         console.log(e);
       }
     }