Explorar el Código

产品发布更新

guhongwei hace 4 años
padre
commit
0797a4cf26

+ 45 - 4
src/views/userCenter/myProduct/detail.vue

@@ -35,21 +35,36 @@ export default {
     // 发布产品
     form: {},
   }),
-  created() {},
+  created() {
+    this.searchInfo();
+  },
   computed: {
     ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
   },
   methods: {
     ...mapMarketproduct({ productFetch: 'fetch', productCreate: 'create', productUpdate: 'update' }),
+    // 详情
+    async searchInfo() {
+      if (this.id) {
+        let res = await this.productFetch(this.id);
+        if (this.$checkRes(res)) {
+          this.$set(this, `form`, res.data);
+        }
+      }
+    },
     // 保存草稿
     async onSubmitDraft({ data }) {
-      if (data.id) {
+      if (this.id) {
         let res = await this.productUpdate(data);
         if (this.$checkRes(res)) {
           this.$message({
             message: '草稿修改成功',
             type: 'success',
           });
+          this.$router.push({ path: '/userCenter/myProduct/index' });
         } else {
           this.$message.error('草稿修改失败');
         }
@@ -62,14 +77,40 @@ export default {
             message: '草稿创建成功',
             type: 'success',
           });
+          this.$router.push({ path: '/userCenter/myProduct/index' });
         } else {
           this.$message.error('草稿创建失败');
         }
       }
     },
     // 信息发布
-    onSubmit({ data }) {
-      console.log(data);
+    async onSubmit({ data }) {
+      if (this.id) {
+        data.status = '0';
+        let res = await this.productUpdate(data);
+        if (this.$checkRes(res)) {
+          this.$message({
+            message: '信息发布成功',
+            type: 'success',
+          });
+          this.$router.push({ path: '/userCenter/myProduct/index' });
+        } else {
+          this.$message.error('信息发布失败');
+        }
+      } else {
+        data.status = '0';
+        data.userid = this.user.uid;
+        let res = await this.productCreate(data);
+        if (this.$checkRes(res)) {
+          this.$message({
+            message: '信息发布成功',
+            type: 'success',
+          });
+          this.$router.push({ path: '/userCenter/myProduct/index' });
+        } else {
+          this.$message.error('信息发布失败');
+        }
+      }
     },
   },
   mounted() {

+ 75 - 45
src/views/userCenter/myProduct/parts/auditList.vue

@@ -3,14 +3,20 @@
     <el-row>
       <el-col :span="24" class="info">
         <el-col :span="24" class="list" v-for="(item, index) in list" :key="index">
-          <p class="textOver">
-            <span @click="$router.push({ path: '/userCenter/myProduct/detailinfo' })">{{ item.name }}</span>
-          </p>
-          <p>
-            <span class="ptwo"><span>产品类型:</span>{{ item.product_type_name || '暂无' }}</span>
-            <span class="ptwo"><span>研发阶段:</span>{{ item.phase == 1 ? '阶段成果' : item.phase == 2 ? '最终成果' : '暂无' }}</span>
-          </p>
-          <p class="textOver"><span>应用领域:</span>{{ item.field || '暂无' }}</p>
+          <el-col :span="19" class="messag">
+            <p>
+              <span class="textOver">{{ item.name }}</span>
+              <span>{{ item.status == '1' ? '审核通过' : '未识别' }}</span>
+            </p>
+            <p>
+              <span class="two"><span>产品类型:</span>{{ item.product_type_name || '暂无' }}</span>
+              <span class="two"><span>研发阶段:</span>{{ item.phase == 1 ? '阶段成果' : item.phase == 2 ? '最终成果' : '暂无' }}</span>
+            </p>
+            <p class="textOver"><span class="three">应用领域:</span>{{ item.field || '暂无' }}</p>
+          </el-col>
+          <el-col :span="5" class="btn">
+            <el-button type="danger" size="mini" @click="deleteBtn(item.id)">删除</el-button>
+          </el-col>
         </el-col>
       </el-col>
     </el-row>
@@ -19,39 +25,37 @@
 
 <script>
 import { mapState, createNamespacedHelpers } from 'vuex';
-const { mapActions: product } = createNamespacedHelpers('marketproduct');
+const { mapActions: mapMarketproduct } = createNamespacedHelpers('marketproduct');
 export default {
   name: 'noauditList',
   props: {},
   components: {},
   data: function() {
     return {
-      list: [
-        {
-          name: '新技术',
-          product_type_name: '技术',
-          phase: '1',
-          field: '最新技术',
-        },
-        {
-          name: '新技术',
-          product_type_name: '技术',
-          phase: '1',
-          field: '最新技术',
-        },
-      ],
+      list: [],
     };
   },
   created() {
     this.searchInfo();
   },
   methods: {
-    ...product(['newquery']),
-    async searchInfo() {
-      // let res = await this.newquery({ skip: 0, limit: 6, totaltype: '0', status: '1' });
-      // if (this.$checkRes(res)) {
-      //   this.$set(this, `list`, res.data);
-      // }
+    ...mapMarketproduct({ productList: 'query', columnInfo: 'fetch', marketcerate: 'create', productdeltet: 'delete', upup: 'update' }),
+    async searchInfo({ skip = 0, limit = 10, ...info } = {}) {
+      let userid = this.user.uid;
+      const res = await this.productList({ skip, limit, status: 1, userid, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+      }
+    },
+    async deleteBtn(id) {
+      const res = await this.productdeltet(id);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '删除信息成功',
+          type: 'success',
+        });
+        this.searchInfo();
+      }
     },
   },
   computed: {
@@ -73,24 +77,50 @@ export default {
     background: #fff;
     padding: 0 10px;
     border-bottom: 1px solid #ccc;
-    p {
-      font-size: 14px;
-      color: #000;
-      padding: 5px 0;
-    }
-    p:first-child {
-      font-size: 16px;
-    }
-    p:nth-child(2) .ptwo {
-      display: inline-block;
-      width: 50%;
+    .messag {
+      padding: 10px 0;
+      p:first-child {
+        font-size: 16px;
+        padding: 0 0 8px 0;
+        span:first-child {
+          display: inline-block;
+          width: 75%;
+        }
+        span:nth-child(2) {
+          display: inline-block;
+          width: 25%;
+          color: #ff0000;
+          font-weight: bold;
+        }
+      }
+      p:nth-child(2) {
+        font-size: 14px;
+        padding: 0 0 10px 0;
+        .two {
+          display: inline-block;
+          width: 50%;
+          span {
+            color: #ccc;
+          }
+        }
+      }
+      p:nth-child(3) {
+        font-size: 14px;
+        padding: 0 0 10px 0;
+        .three {
+          color: #ccc;
+        }
+      }
     }
-    p:nth-child(2) .ptwo span:first-child {
-      color: #ccc;
-    }
-    p:last-child span {
-      color: #ccc;
+    .btn {
+      text-align: center;
     }
   }
 }
+/deep/.el-button + .el-button {
+  margin-left: 0;
+}
+/deep/.el-button {
+  margin: 5px 0;
+}
 </style>

+ 73 - 17
src/views/userCenter/myProduct/parts/caogaoList.vue

@@ -3,30 +3,27 @@
     <el-row>
       <el-col :span="24" class="info">
         <el-col :span="24" class="list" v-for="(item, index) in list" :key="index">
-          <!-- <p class="textOver">
-            <span @click="$router.push({ path: '/userCenter/myProduct/detailinfo' })">{{ item.name }}</span>
-            <span style="float:right"><van-button type="info" size="small" @click="submit">删除</van-button></span>
-          </p>
-          <p>
-            <span class="ptwo"><span>产品类型:</span>{{ item.product_type_name || '暂无' }}</span>
-            <span class="ptwo"><span>研发阶段:</span>{{ item.phase == 1 ? '阶段成果' : item.phase == 2 ? '最终成果' : '暂无' }}</span>
-          </p>
-          <p class="textOver"><span>应用领域:</span>{{ item.field || '暂无' }}</p> -->
           <el-col :span="19" class="messag">
             <p>
-              <span>{{ item.name }}</span>
+              <span class="textOver">{{ item.name }}</span>
               <span>{{ item.status == '2' ? '审核拒绝' : item.status == '3' ? '草稿' : '未识别' }}</span>
             </p>
             <p>
-              <span><span>产品类型:</span>{{ item.product_type_name || '暂无' }}</span>
-              <span><span>研发阶段:</span>{{ item.phase == 1 ? '阶段成果' : item.phase == 2 ? '最终成果' : '暂无' }}</span>
+              <span class="two"><span>产品类型:</span>{{ item.product_type_name || '暂无' }}</span>
+              <span class="two"><span>研发阶段:</span>{{ item.phase == 1 ? '阶段成果' : item.phase == 2 ? '最终成果' : '暂无' }}</span>
             </p>
-            <p class="textOver"><span>应用领域:</span>{{ item.field || '暂无' }}</p>
+            <p class="textOver"><span class="three">应用领域:</span>{{ item.field || '暂无' }}</p>
           </el-col>
           <el-col :span="5" class="btn">
-            <el-button type="primary" size="mini">编辑</el-button>
-            <el-button type="success" size="mini">发布</el-button>
-            <el-button type="danger" size="mini">删除</el-button>
+            <el-button
+              type="primary"
+              size="mini"
+              v-if="item.status == '3'"
+              @click="$router.push({ path: '/userCenter/myProduct/detail', query: { id: item.id } })"
+              >编辑</el-button
+            >
+            <el-button type="success" size="mini" v-if="item.status == '3'" @click="releaseBtn(item)">发布</el-button>
+            <el-button type="danger" size="mini" @click="deleteBtn(item.id)">删除</el-button>
           </el-col>
         </el-col>
       </el-col>
@@ -60,7 +57,27 @@ export default {
         this.$set(this, `list`, newData);
       }
     },
-    submit() {},
+    async releaseBtn(data) {
+      data.status = 0;
+      const res = await this.upup(data);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '信息发布成功',
+          type: 'success',
+        });
+        this.searchInfo();
+      }
+    },
+    async deleteBtn(id) {
+      const res = await this.productdeltet(id);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '删除信息成功',
+          type: 'success',
+        });
+        this.searchInfo();
+      }
+    },
   },
   computed: {
     ...mapState(['user']),
@@ -82,10 +99,49 @@ export default {
     padding: 0 10px;
     border-bottom: 1px solid #ccc;
     .messag {
+      padding: 10px 0;
+      p:first-child {
+        font-size: 16px;
+        padding: 0 0 8px 0;
+        span:first-child {
+          display: inline-block;
+          width: 75%;
+        }
+        span:nth-child(2) {
+          display: inline-block;
+          width: 25%;
+          color: #ff0000;
+          font-weight: bold;
+        }
+      }
+      p:nth-child(2) {
+        font-size: 14px;
+        padding: 0 0 10px 0;
+        .two {
+          display: inline-block;
+          width: 50%;
+          span {
+            color: #ccc;
+          }
+        }
+      }
+      p:nth-child(3) {
+        font-size: 14px;
+        padding: 0 0 10px 0;
+        .three {
+          color: #ccc;
+        }
+      }
     }
     .btn {
       text-align: center;
     }
   }
 }
+/deep/.el-button + .el-button {
+  margin-left: 0;
+}
+/deep/.el-button {
+  margin: 5px 0;
+}
 </style>

+ 75 - 45
src/views/userCenter/myProduct/parts/noauditList.vue

@@ -3,14 +3,20 @@
     <el-row>
       <el-col :span="24" class="info">
         <el-col :span="24" class="list" v-for="(item, index) in list" :key="index">
-          <p class="textOver">
-            <span @click="$router.push({ path: '/userCenter/myProduct/detailinfo' })">{{ item.name }}</span>
-          </p>
-          <p>
-            <span class="ptwo"><span>产品类型:</span>{{ item.product_type_name || '暂无' }}</span>
-            <span class="ptwo"><span>研发阶段:</span>{{ item.phase == 1 ? '阶段成果' : item.phase == 2 ? '最终成果' : '暂无' }}</span>
-          </p>
-          <p class="textOver"><span>应用领域:</span>{{ item.field || '暂无' }}</p>
+          <el-col :span="19" class="messag">
+            <p>
+              <span class="textOver">{{ item.name }}</span>
+              <span>{{ item.status == '0' ? '审核中' : '未识别' }}</span>
+            </p>
+            <p>
+              <span class="two"><span>产品类型:</span>{{ item.product_type_name || '暂无' }}</span>
+              <span class="two"><span>研发阶段:</span>{{ item.phase == 1 ? '阶段成果' : item.phase == 2 ? '最终成果' : '暂无' }}</span>
+            </p>
+            <p class="textOver"><span class="three">应用领域:</span>{{ item.field || '暂无' }}</p>
+          </el-col>
+          <el-col :span="5" class="btn">
+            <el-button type="danger" size="mini" @click="deleteBtn(item.id)">删除</el-button>
+          </el-col>
         </el-col>
       </el-col>
     </el-row>
@@ -19,39 +25,37 @@
 
 <script>
 import { mapState, createNamespacedHelpers } from 'vuex';
-const { mapActions: product } = createNamespacedHelpers('marketproduct');
+const { mapActions: mapMarketproduct } = createNamespacedHelpers('marketproduct');
 export default {
   name: 'noauditList',
   props: {},
   components: {},
   data: function() {
     return {
-      list: [
-        {
-          name: '新技术',
-          product_type_name: '技术',
-          phase: '1',
-          field: '最新技术',
-        },
-        {
-          name: '新技术',
-          product_type_name: '技术',
-          phase: '1',
-          field: '最新技术',
-        },
-      ],
+      list: [],
     };
   },
   created() {
     this.searchInfo();
   },
   methods: {
-    ...product(['newquery']),
-    async searchInfo() {
-      // let res = await this.newquery({ skip: 0, limit: 6, totaltype: '0', status: '1' });
-      // if (this.$checkRes(res)) {
-      //   this.$set(this, `list`, res.data);
-      // }
+    ...mapMarketproduct({ productList: 'query', columnInfo: 'fetch', marketcerate: 'create', productdeltet: 'delete', upup: 'update' }),
+    async searchInfo({ skip = 0, limit = 10, ...info } = {}) {
+      let userid = this.user.uid;
+      const res = await this.productList({ skip, limit, status: 0, userid, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+      }
+    },
+    async deleteBtn(id) {
+      const res = await this.productdeltet(id);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '删除信息成功',
+          type: 'success',
+        });
+        this.searchInfo();
+      }
     },
   },
   computed: {
@@ -73,24 +77,50 @@ export default {
     background: #fff;
     padding: 0 10px;
     border-bottom: 1px solid #ccc;
-    p {
-      font-size: 14px;
-      color: #000;
-      padding: 5px 0;
-    }
-    p:first-child {
-      font-size: 16px;
-    }
-    p:nth-child(2) .ptwo {
-      display: inline-block;
-      width: 50%;
+    .messag {
+      padding: 10px 0;
+      p:first-child {
+        font-size: 16px;
+        padding: 0 0 8px 0;
+        span:first-child {
+          display: inline-block;
+          width: 75%;
+        }
+        span:nth-child(2) {
+          display: inline-block;
+          width: 25%;
+          color: #ff0000;
+          font-weight: bold;
+        }
+      }
+      p:nth-child(2) {
+        font-size: 14px;
+        padding: 0 0 10px 0;
+        .two {
+          display: inline-block;
+          width: 50%;
+          span {
+            color: #ccc;
+          }
+        }
+      }
+      p:nth-child(3) {
+        font-size: 14px;
+        padding: 0 0 10px 0;
+        .three {
+          color: #ccc;
+        }
+      }
     }
-    p:nth-child(2) .ptwo span:first-child {
-      color: #ccc;
-    }
-    p:last-child span {
-      color: #ccc;
+    .btn {
+      text-align: center;
     }
   }
 }
+/deep/.el-button + .el-button {
+  margin-left: 0;
+}
+/deep/.el-button {
+  margin: 5px 0;
+}
 </style>