Parcourir la Source

feat: 企微工具 - 平台管理 - "列表"前端页面

zhengxy il y a 2 ans
Parent
commit
319639ea91

+ 128 - 0
project/src/components/manage/platformManage/platformManage.vue

@@ -0,0 +1,128 @@
1
+<template>
2
+  <div v-loading="loading" class="platformManage-wrap">
3
+    <div class="screenBox flex">
4
+      <div></div><!-- 占位 -->
5
+      <div class="right">
6
+        <el-button type="primary" size="mini">添加平台</el-button>
7
+      </div>
8
+    </div>
9
+    <el-table :height="height" :data="platformList" tooltip-effect="dark" style="width: 100%;margin-top:10px">
10
+      <el-table-column label="平台" prop="name" min-width="160" align="center" />
11
+      <el-table-column label="描述" prop="name" min-width="160" align="center" />
12
+      <el-table-column label="账号" min-width="300" align="center">
13
+        <template slot-scope="{ row }">
14
+          <div class="account-wrap">
15
+            <span>123123123</span>
16
+            <i class="el-icon-delete" />
17
+          </div>
18
+          <div class="account-add-btn">
19
+            <i class="el-icon-plus" />
20
+            <span>添加账号</span>
21
+          </div>
22
+        </template>
23
+      </el-table-column>
24
+      <el-table-column label="状态" min-width="160" align="center">
25
+        <template slot-scope="{ row }">
26
+          <span v-if="row.enable == 1" class="c-448AFF">启用</span>
27
+          <span v-else class="c-F03F5C">禁用</span>
28
+        </template>
29
+      </el-table-column>
30
+      <el-table-column label="操作" min-width="160" align="center">
31
+        <template slot-scope="{ row }">
32
+          <el-button type="primary" size="mini">编辑</el-button>
33
+          <el-button type="danger" size="mini" v-if="row.enable == 1">禁用</el-button>
34
+          <el-button type="primary" size="mini" v-else>启用</el-button>
35
+        </template>
36
+      </el-table-column>
37
+    </el-table>
38
+    <div class="pagination" v-show="pagination.total > 0">
39
+      <el-pagination background :current-page="pagination.page" @current-change="handleCurrentChange" layout="prev, pager, next" :page-count="Number(pagination.pages)">
40
+      </el-pagination>
41
+    </div>
42
+  </div>
43
+</template>
44
+<script>
45
+export default {
46
+  name: 'platformManage',
47
+  data () {
48
+    return {
49
+      height: '',
50
+      loading: false,
51
+      pagination: {
52
+        page: 1,
53
+        page_size: 20,
54
+        pages: 0,
55
+        total: 0,
56
+      },
57
+      platformList: [],
58
+    }
59
+  },
60
+  created () {
61
+    this.height = document.documentElement.clientHeight - 200 > 400 ? document.documentElement.clientHeight - 200 : 400
62
+    this.handleGetPlatform()
63
+  },
64
+  methods: {
65
+    // 获取列表数据
66
+    async handleGetPlatform() {
67
+      try {
68
+        this.loading = true
69
+        const url = `${this.URL.BASEURL}${this.URL.pitcher_dramaList}`
70
+        const params = {
71
+          is_select: 0,
72
+          page: this.pagination.page,
73
+          page_size: this.pagination.page_size,
74
+        }
75
+        const { data: res = {} } = await this.$axios.get(url, { params })
76
+        if (res && res.errno == 0 && Array.isArray(res.rst.data)) {
77
+          this.platformList = res.rst.data;
78
+          this.pagination.total = res.rst.pageInfo.total;
79
+          this.pagination.pages = res.rst.pageInfo.pages;
80
+        } else if (res.errno != 4002) {
81
+          this.$message.warning(res.err)
82
+          this.platformList = [];
83
+          this.pagination.total = 0;
84
+          this.pagination.pages = 0;
85
+        }
86
+      } catch (error) {
87
+        console.log(error)
88
+        this.platformList = [];
89
+        this.pagination.total = 0;
90
+        this.pagination.pages = 0;
91
+      } finally {
92
+        this.loading = false
93
+      }
94
+    },
95
+    handleCurrentChange (val) {
96
+      this.handleGetPlatform(val)
97
+    },
98
+  }
99
+}
100
+</script>
101
+<style lang="scss" scoped>
102
+.screenBox {
103
+  background: #fff;
104
+  padding: 5px 20px;
105
+}
106
+.platformManage-wrap {
107
+  .account-wrap {
108
+    display: flex;
109
+    align-items: center;
110
+    justify-content: center;
111
+    i {
112
+      color: #F46C6C;
113
+      cursor: pointer;
114
+      margin-left: 4px;
115
+    }
116
+  }
117
+  .account-add-btn {
118
+    display: flex;
119
+    align-items: center;
120
+    justify-content: center;
121
+    color: #32B38A;
122
+    cursor: pointer;
123
+    i {
124
+      margin-right: 4px;
125
+    }
126
+  }
127
+}
128
+</style>

+ 13 - 0
project/src/router/allRouter.js

@@ -62,6 +62,9 @@ const fansActiveTrends = () => import(/* webpackChunkName: 'fansActiveTrends' */
62 62
 // 数据看板 - 用户流失趋势
63 63
 const loseUserTrends = () => import(/* webpackChunkName: 'loseUserTrends' */ '@/components/dataBoard/loseUserTrends.vue')
64 64
 
65
+// 平台管理
66
+const platformManage = () => import(/* webpackChunkName: 'platformManage' */ '@/components/manage/platformManage/platformManage.vue')
67
+
65 68
 // name与菜单配置的页面路由一致
66 69
 // meta下isData:true为数据看板,否则为助手
67 70
 export var allRouter = [
@@ -313,6 +316,16 @@ export var allRouter = [
313 316
         }
314 317
       },
315 318
       {
319
+        path: 'platformManage',
320
+        name: 'platformManage',
321
+        component: platformManage,
322
+        meta: {
323
+          keepAlive: false,
324
+          isLogin: true,
325
+          title: '平台管理'
326
+        }
327
+      },
328
+      {
316 329
         path: 'memberManage',
317 330
         name: 'memberManage',
318 331
         component: memberManage,