Browse Source

始宁农业管理后台:农产品管理-农产品管理

panyong 2 years ago
parent
commit
409bc829bd

+ 11 - 1
htmldev/shiningManage/src/store/modules/common.js

@@ -110,7 +110,17 @@ const state = {
     }
   ],
   arrCategoryList: [],
-  arrBrandList: []
+  arrBrandList: [],
+  arrMsgStatus: [
+    {
+      name: '未发布',
+      value: 0
+    },
+    {
+      name: '已发布',
+      value: 1
+    }
+  ]
 }
 
 const mutations = {

+ 7 - 29
htmldev/shiningManage/src/views/contentManage/notify/details.vue

@@ -12,39 +12,23 @@
         :rules="formRules"
         label-width="120px">
         <el-form-item
-          prop="lunbo_name"
+          prop="msg_title"
           :rules="formRules.required"
           label="标题:">
           <el-input
-            v-model="form.lunbo_name"
+            v-model="form.msg_title"
             placeholder="请输入标题"
             clearable></el-input>
         </el-form-item>
         <el-form-item
+          prop="msg_content"
           :rules="formRules.required"
           label="内容:">
           <tinymce
             :height="300"
-            v-model="form.content"
+            v-model="form.msg_content"
             id='tinymce'></tinymce>
         </el-form-item>
-        <el-form-item
-          prop="lunbo_status"
-          :rules="formRules.select"
-          label="状态:">
-          <el-select
-            style="width: 100%;"
-            v-model="form.lunbo_status"
-            filterable
-            clearable
-            placeholder="请选择是否显示">
-            <el-option
-              :label="item.name"
-              :value="item.value"
-              v-for="item in arrLunboStatus"
-              :key="item.value"></el-option>
-          </el-select>
-        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer text-center">
         <el-button @click="dialog = false">取 消</el-button>
@@ -77,21 +61,15 @@ export default {
     return {
       dialog: !!this.value,
       form: {
-        'lunbo_name': '', // 轮播图名称
-        'content': '',
-        'lunbo_status': '' // 状态(0下架1上架)
+        'msg_title': '', // 消息标题
+        'msg_content': '' // 通知内容
       },
       booLock: false
     }
   },
-  computed: {
-    arrLunboStatus() {
-      return this.$store.state.common.arrLunboStatus
-    }
-  },
   methods: {
     handleSubmit() {
-      const url = this.exData.id ? '/api/admin/tlunbo/modify' : '/api/admin/tlunbo/add'
+      const url = this.exData.id ? '/api/admin/msg/modify' : '/api/admin/msg/add'
       this.$refs.form.validate(async valid => {
         if (valid) {
           const formData = JSON.parse(JSON.stringify(this.form))

+ 36 - 28
htmldev/shiningManage/src/views/contentManage/notify/index.vue

@@ -8,16 +8,16 @@
         clearable
         class="mt-10">
         <el-form-item label="标题:">
-          <el-input v-model="searchForm.lunbo_name" placeholder="请输入标题" clearable></el-input>
+          <el-input v-model="searchForm.msg_title" placeholder="请输入标题" clearable></el-input>
         </el-form-item>
         <el-form-item label="状态:">
           <el-select
-            v-model="searchForm.lunbo_status"
+            v-model="searchForm.msg_status"
             filterable
             clearable
             placeholder="请选择状态">
             <el-option
-              v-for="item in arrLunboStatus"
+              v-for="item in arrMsgStatus"
               :key="item.value"
               :label="item.name"
               :value="item.value">
@@ -54,19 +54,25 @@
       class="marginT-10 order-table"
       border
       :max-height="vheight">
-      <el-table-column label="标题" prop="lunbo_name" show-overflow-tooltip></el-table-column>
-      <el-table-column label="内容" prop="lunbo_img_url" min-width="200" show-overflow-tooltip></el-table-column>
-      <el-table-column label="状态" prop="lunbo_status">
+      <el-table-column label="标题" prop="msg_title" show-overflow-tooltip></el-table-column>
+      <el-table-column label="内容" prop="msg_content" min-width="200" show-overflow-tooltip>
         <template slot-scope="scope">
-          <p>{{ getLunboStatusText(scope.row.lunbo_status) }}</p>
+          <p v-html="scope.row.msg_content"></p>
         </template>
       </el-table-column>
-      <el-table-column label="发布时间" prop="created_at" min-width="160"></el-table-column>
-      <el-table-column label="操作" width="240">
+      <el-table-column label="状态" prop="msg_status">
+        <template slot-scope="scope">
+          <p>{{ getMsgStatusText(scope.row.msg_status) }}</p>
+        </template>
+      </el-table-column>
+      <el-table-column label="置顶" prop="msg_top">
+        <template slot-scope="scope">{{ scope.row.msg_top === 1 ? '是' : '否' }}</template>
+      </el-table-column>
+      <el-table-column label="创建时间" prop="created_at" min-width="160"></el-table-column>
+      <el-table-column label="操作" width="150">
         <template slot-scope="scope">
           <el-button type="text" @click="edit(scope.row)">编辑</el-button>
-          <el-button type="text" @click="edit(scope.row)">发布通知</el-button>
-          <el-button type="text" @click="edit(scope.row)">置顶推荐</el-button>
+          <el-button type="text" @click="msgTop(scope.row)" v-if="scope.row.msg_top === 0">置顶</el-button>
           <el-button type="text" @click="del(scope.row)">删除</el-button>
         </template>
       </el-table-column>
@@ -92,7 +98,7 @@
 <script>
 import page from '@/mixin/page'
 import detail from './details'
-// TODO 缺列表、发布、编辑(含置顶)、删除接口
+
 export default {
   mixins: [page],
   components: {
@@ -107,15 +113,12 @@ export default {
       time: [],
       searchForm: {},
       tableData: [],
-      tableUrl: '/api/admin/tlunbo/list'
+      tableUrl: '/api/admin/msg/list'
     }
   },
   computed: {
-    arrLunboStatus() {
-      return this.$store.state.common.arrLunboStatus
-    },
-    arrLunboLinkType() {
-      return this.$store.state.common.arrLunboLinkType
+    arrMsgStatus() {
+      return this.$store.state.common.arrMsgStatus
     }
   },
   methods: {
@@ -127,11 +130,23 @@ export default {
       this.detailsDialog.exData = row
       this.detailsDialog.show = true
     },
+    msgTop(row) {
+      this.$confirm('确定要置顶吗', '确认', {
+        type: 'warning'
+      }).then(async () => {
+        const data = await this.$fetch('/api/admin/msg/top', { id: row.id })
+        if (data.code === 200) {
+          this.$message.success('置顶成功')
+          this.init()
+        }
+      }).catch(() => {
+      })
+    },
     del(row) {
       this.$confirm('确定要删除吗', '确认', {
         type: 'warning'
       }).then(async () => {
-        const data = await this.$fetch('/api/admin/tlunbo/delete', { id: row.id })
+        const data = await this.$fetch('/api/admin/msg/delete', { id: row.id })
         if (data.code === 200) {
           this.$message.success('删除成功')
           this.init()
@@ -139,15 +154,8 @@ export default {
       }).catch(() => {
       })
     },
-    getLunboStatusText(value) {
-      const temp = this.arrLunboStatus.filter(item => item.value === value)
-      if (temp.length > 0) {
-        return temp[0].name
-      }
-      return ''
-    },
-    getLunboLinkTypeText(value) {
-      const temp = this.arrLunboLinkType.filter(item => item.value === value)
+    getMsgStatusText(value) {
+      const temp = this.arrMsgStatus.filter(item => item.value === value)
       if (temp.length > 0) {
         return temp[0].name
       }