guhongwei 4 years ago
parent
commit
d62e289c62
2 changed files with 33 additions and 5 deletions
  1. 2 0
      src/store/index.js
  2. 31 5
      src/views/homeIndex.vue

+ 2 - 0
src/store/index.js

@@ -9,6 +9,7 @@ import userMenu from '@f/store/auth/userMenu';
 import login from '@f/store/auth/login';
 import dictionary from '@f/store/system/dictionary';
 import schedule from '@f/store/system/schedule';
+import notice from '@f/store/system/notice';
 import user from '@f/store/personnel/user';
 import driver from '@f/store/personnel/driver';
 import client from '@f/store/client/client';
@@ -49,6 +50,7 @@ export default new Vuex.Store({
     daily,
     order,
     schedule,
+    notice,
     transport,
   },
 });

+ 31 - 5
src/views/homeIndex.vue

@@ -10,10 +10,10 @@
             <el-col :span="24" class="list">
               <el-col :span="24" class="agencyList" v-for="(item, index) in agencyList" :key="index">
                 <el-col :span="20" class="name textOver">
-                  {{ item.name }}
+                  {{ item.message }}
                 </el-col>
                 <el-col :span="4" class="btn">
-                  <el-button type="danger" size="mini">不再提示</el-button>
+                  <el-button type="danger" size="mini" @click="editBtn(item)">不再提示</el-button>
                 </el-col>
               </el-col>
             </el-col>
@@ -26,6 +26,7 @@
 
 <script>
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: notice } = createNamespacedHelpers('notice');
 import bus from '@l/bus';
 export default {
   metaInfo() {
@@ -36,11 +37,36 @@ export default {
   components: {},
   data: function() {
     return {
-      agencyList: [{ name: '你好' }],
+      // 通知列表
+      agencyList: [],
     };
   },
-  created() {},
-  methods: {},
+  async created() {
+    this.search();
+  },
+  methods: {
+    ...notice(['query', 'update']),
+    // 查询列表
+    async search() {
+      let res = await this.query({ user_id: this.user.id, status: '0' });
+      if (this.$checkRes(res)) {
+        const { data, total } = res;
+        this.$set(this, `agencyList`, data);
+      }
+    },
+    // 不再提示
+    async editBtn(data) {
+      data.status = '1';
+      let res = await this.update(data);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '不再提示信息修改成功',
+          type: 'success',
+        });
+        this.search();
+      }
+    },
+  },
   computed: {
     ...mapState(['user']),
   },