Browse Source

始宁农业后台:

panyong 2 years ago
parent
commit
eae1703a32

+ 0 - 5
htmldev/shiningManage/README.md

@@ -239,14 +239,9 @@ yarn build
   * 列表
     - 状态(隐藏/显示)是怎么控制的
 
-* 内容管理-村长说农事
-  * 新增/编辑
-    - 缺获取类别列表接口
-
 * 内容管理-VR看菜园
   * 缺列表、新增、编辑、删除接口
 
 * 农产品管理-农产品管理
   * 编辑
     - 缺编辑接口
-    - 缺获取单位列表接口(单位是本地写死么)'件', '只', '个'

+ 32 - 0
htmldev/shiningManage/src/store/modules/common.js

@@ -120,6 +120,21 @@ const state = {
       name: '已发布',
       value: 1
     }
+  ],
+  arrVideoType: [],
+  arrProductUnit: [
+    {
+      name: '件',
+      value: '1'
+    },
+    {
+      name: '只',
+      value: '2'
+    },
+    {
+      name: '个',
+      value: '3'
+    }
   ]
 }
 
@@ -141,6 +156,9 @@ const mutations = {
   },
   SET_ARRBRANDLIST(state, val) {
     state.arrBrandList = val
+  },
+  SET_ARRVIDEOTYPE(state, val) {
+    state.arrVideoType = val
   }
 }
 
@@ -191,6 +209,20 @@ const actions = {
       })
       commit('SET_ARRBRANDLIST', temp)
     }
+  },
+  // 视频类型接口
+  async setVideoType({ commit }) {
+    const data = await fetch('/api/shop/video/type/list', {})
+    if (data.code === 200) {
+      const temp = data.data.map(item => {
+        return {
+          ...item,
+          name: item.type_name,
+          value: item.id
+        }
+      })
+      commit('SET_ARRVIDEOTYPE', temp)
+    }
   }
 }
 

+ 27 - 3
htmldev/shiningManage/src/views/contentManage/video/details.vue

@@ -88,6 +88,23 @@
             </template>
           </el-upload>
         </el-form-item>
+        <el-form-item
+          prop="video_type_id"
+          :rules="formRules.select"
+          label="类别:">
+          <el-select
+            style="width: 100%;"
+            v-model="form.video_type_id"
+            filterable
+            clearable
+            placeholder="请选择类别">
+            <el-option
+              :label="item.name"
+              :value="item.value"
+              v-for="item in arrVideoType"
+              :key="item.value"></el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item
           prop="video_auther"
           :rules="formRules.required"
@@ -180,8 +197,8 @@ export default {
         'video_introduce': '', // 视频简介
         'video_cover_url': [], // 封面地址
         'video_url': [], // 视频地址
-        'video_type_id': 1, // 类别ID todo
-        'video_type_name': 'sd', // 类别名称 todo 分类名称哪里来的
+        'video_type_id': '', // 类别ID
+        'video_type_name': '', // 类别名称
         'video_auther': '', // 出境人
         'lunbo_status': '0', // 置顶推荐(0否1是)
         'video_status': '0' // 视频状态 0隐藏 1显示
@@ -191,6 +208,11 @@ export default {
       booLock: false
     }
   },
+  computed: {
+    arrVideoType() {
+      return this.$store.state.common.arrVideoType
+    }
+  },
   methods: {
     beforeAvatarUpload(file) {
       const isLt2M = file.size / 1024 / 1024 < 5
@@ -225,10 +247,12 @@ export default {
       this.$refs.form.validate(async valid => {
         if (valid) {
           const formData = JSON.parse(JSON.stringify(this.form))
+          const videoTypeIdIndex = this.arrVideoType.findIndex(item => item.value === formData.video_type_id)
           const postData = {
             ...formData,
             video_cover_url: formData.video_cover_url[0],
-            video_url: formData.video_url[0]
+            video_url: formData.video_url[0],
+            video_type_name: videoTypeIdIndex > -1 ? this.arrVideoType[videoTypeIdIndex].name : ''
           }
           this.booLock = true
           const data = await this.$fetch(url, postData)

+ 8 - 0
htmldev/shiningManage/src/views/contentManage/video/index.vue

@@ -162,6 +162,11 @@ export default {
       ]
     }
   },
+  computed: {
+    arrVideoType() {
+      return this.$store.state.common.arrVideoType
+    }
+  },
   methods: {
     add() {
       this.detailsDialog.exData = {}
@@ -196,6 +201,9 @@ export default {
     }
   },
   mounted() {
+    if (this.arrVideoType.length < 1) {
+      this.$store.dispatch('common/setVideoType')
+    }
     this.init()
   }
 }

+ 4 - 1
htmldev/shiningManage/src/views/productManage/products/details.vue

@@ -147,7 +147,7 @@
             <el-option
               :label="item.name"
               :value="item.value"
-              v-for="item in []"
+              v-for="item in arrProductUnit"
               :key="item.value"></el-option>
           </el-select>
         </el-form-item>
@@ -310,6 +310,9 @@ export default {
     },
     arrBrandList() {
       return this.$store.state.common.arrBrandList
+    },
+    arrProductUnit() {
+      return this.$store.state.common.arrProductUnit
     }
   },
   methods: {