zhouzenghui 2 years ago
parent
commit
e43fd3a127
2 changed files with 40 additions and 32 deletions
  1. 1 0
      src/main.js
  2. 39 32
      src/views/notice/noticeList.vue

+ 1 - 0
src/main.js

@@ -1,5 +1,6 @@
 import Vue from 'vue'
 
+
 import Cookies from 'js-cookie'
 
 import Element from 'element-ui'

+ 39 - 32
src/views/notice/noticeList.vue

@@ -46,13 +46,20 @@
         <el-table-column prop="id" label="ID"> </el-table-column>
         <el-table-column prop="title" label="公告标题"> </el-table-column>
         <el-table-column prop="publishTime" label="发布时间"> </el-table-column>
-        <el-table-column prop="operation" label="操作"> </el-table-column>
+        <el-table-column prop="operation" label="操作">
+          <el-button size="mini" type="text" icon="el-icon-edit"
+            >修改</el-button
+          >
+          <el-button size="mini" type="text" icon="el-icon-delete"
+            >删除</el-button
+          >
+        </el-table-column>
       </el-table>
     </div>
     <!-- 分页 -->
     <div class="pageMenu">
       <div id="dataNum">共0条</div>
-      <el-pagination background layout="prev, pager, next" :total="1">
+      <el-pagination background layout="prev, pager, next" :total="1" >
       </el-pagination>
     </div>
   </div>
@@ -134,13 +141,13 @@
 .data-table {
   margin: 0 auto;
 }
-.pageMenu{
-  width: 1351px;
+.pageMenu {
+  width: 1283px;
   display: flex;
   justify-content: flex-end;
   margin-top: 30px;
 }
-#dataNum{
+#dataNum {
   font-size: 13px;
   font-family: PingFang SC;
   margin-top: 7px;
@@ -155,33 +162,33 @@ export default {
     return {
       input: "",
       value1: "",
-      // tableData: [
-      //   {
-      //     id: "20206115",
-      //     title: "开始",
-      //     publishTime: "2023-01-14",
-      //     operation: "运行",
-      //   },
-      //   {
-      //     id: "20206115",
-      //     title: "开始",
-      //     publishTime: "2023-01-14",
-      //     operation: "运行",
-      //   },
-      //   {
-      //     id: "20206115",
-      //     title: "开始",
-      //     publishTime: "2023-01-14",
-      //     operation: "运行",
-      //   },
-      //   {
-      //     id: "20206115",
-      //     title: "开始",
-      //     publishTime: "2023-01-14",
-      //     operation: "运行",
-      //   },
-      // ],
+      tableData: [],
+      mockNoticeList: [],
     };
   },
+  mounted() {
+    this.getMockNoticeList();
+    this.getTableList();
+  },
+
+  methods: {
+    getMockNoticeList() {
+      var Mock = require("mockjs");
+      var data = Mock.mock({
+        "list|1-10": [
+          {
+            "id|+1": 1,
+            title: "@cword(3, 5)",
+            publishTime: "@date()",
+            // 'operation|1-10': "★",
+          },
+        ],
+      });
+      this.mockNoticeList = data;
+    },
+    getTableList() {
+      this.tableData = this.mockNoticeList.list;
+    },
+  },
 };
-</script>
+</script>