|
@@ -3,21 +3,22 @@
|
3
|
3
|
<div class="screenBox flex">
|
4
|
4
|
<div></div><!-- 占位 -->
|
5
|
5
|
<div class="right">
|
6
|
|
- <el-button type="primary" size="mini" @click="onClickAddPlatform">添加平台</el-button>
|
|
6
|
+ <el-button type="primary" size="mini" @click="onClickAddAccount">添加账号</el-button>
|
7
|
7
|
</div>
|
8
|
8
|
</div>
|
9
|
|
- <el-table :height="height" :data="platformList" tooltip-effect="dark" style="width: 100%;margin-top:10px">
|
|
9
|
+ <el-table :height="height" :data="accountList" tooltip-effect="dark" style="width: 100%;margin-top:10px">
|
|
10
|
+ <el-table-column label="账号" min-width="200" align="center">
|
|
11
|
+ <template slot-scope="{ row }">
|
|
12
|
+ <span>{{ row.name }}</span>
|
|
13
|
+ <el-tooltip content="账号未激活,请联系开发人员激活账号" placement="top">
|
|
14
|
+ <span><i class="el-icon-warning-outline" style="color: red;" /></span>
|
|
15
|
+ </el-tooltip>
|
|
16
|
+ </template>
|
|
17
|
+ </el-table-column>
|
10
|
18
|
<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">
|
|
19
|
+ <el-table-column label="描述" prop="name" min-width="160" align="center">
|
13
|
20
|
<template slot-scope="{ row }">
|
14
|
|
- <div v-for="item in 3" :key="item" class="account-wrap">
|
15
|
|
- <span>{{ item }}<i class="del-btn el-icon-delete" @click="onClickDelAccount({ platform: row, delItem: item })" /></span>
|
16
|
|
- </div>
|
17
|
|
- <div class="account-add-btn" @click="onClickAddAccount(row)">
|
18
|
|
- <i class="el-icon-plus" />
|
19
|
|
- <span>添加账号</span>
|
20
|
|
- </div>
|
|
21
|
+ <span>{{ row.name || '-' }}</span>
|
21
|
22
|
</template>
|
22
|
23
|
</el-table-column>
|
23
|
24
|
<el-table-column label="状态" min-width="160" align="center">
|
|
@@ -26,6 +27,11 @@
|
26
|
27
|
<span v-else class="c-F03F5C">禁用</span>
|
27
|
28
|
</template>
|
28
|
29
|
</el-table-column>
|
|
30
|
+ <el-table-column label="关联短剧数量" min-width="160" align="center">
|
|
31
|
+ <template slot-scope="{ row }">
|
|
32
|
+ <span class="playlet-num">{{ row.name }}</span>
|
|
33
|
+ </template>
|
|
34
|
+ </el-table-column>
|
29
|
35
|
<el-table-column label="操作" min-width="160" align="center">
|
30
|
36
|
<template slot-scope="{ row }">
|
31
|
37
|
<el-button type="primary" size="mini" @click="onClickEditPlatform(row)">编辑</el-button>
|
|
@@ -39,32 +45,21 @@
|
39
|
45
|
</el-pagination>
|
40
|
46
|
</div>
|
41
|
47
|
|
42
|
|
- <!-- S 添加平台 & 编辑平台 -->
|
43
|
|
- <addPlatformDialog
|
44
|
|
- :dialogVisible="addPlatformDialogVisible"
|
45
|
|
- :platformInfo="currentPlatformInfo"
|
46
|
|
- @confirm="handleAddPlatformConfirm"
|
47
|
|
- @cancel="handleAddPlatformCancel"
|
48
|
|
- />
|
49
|
|
- <!-- E 添加平台 & 编辑平台 -->
|
50
|
|
-
|
51
|
|
- <!-- S 添加账号 -->
|
|
48
|
+ <!-- S 添加账号 & 编辑账号 -->
|
52
|
49
|
<addAccountDialog
|
53
|
50
|
:dialogVisible="addAccountDialogVisible"
|
54
|
|
- :platformId="currentAccountPlatformId"
|
55
|
|
- @confirm="handleAddAccountConfirm"
|
56
|
|
- @cancel="handleAddAccountCancel"
|
|
51
|
+ :accountInfo="currentAccountInfo"
|
|
52
|
+ @confirm="handleAddPlatformConfirm"
|
|
53
|
+ @cancel="handleAddPlatformCancel"
|
57
|
54
|
/>
|
58
|
|
- <!-- E 添加账号 -->
|
|
55
|
+ <!-- E 添加账号 & 编辑账号 -->
|
59
|
56
|
</div>
|
60
|
57
|
</template>
|
61
|
58
|
<script>
|
62
|
|
-import addPlatformDialog from './dialog/addPlatformDialog.vue'
|
63
|
59
|
import addAccountDialog from './dialog/addAccountDialog.vue'
|
64
|
60
|
export default {
|
65
|
61
|
name: 'platformManage',
|
66
|
62
|
components: {
|
67
|
|
- addPlatformDialog,
|
68
|
63
|
addAccountDialog,
|
69
|
64
|
},
|
70
|
65
|
data () {
|
|
@@ -77,13 +72,10 @@ export default {
|
77
|
72
|
pages: 0,
|
78
|
73
|
total: 0,
|
79
|
74
|
},
|
80
|
|
- platformList: [],
|
81
|
|
-
|
82
|
|
- addPlatformDialogVisible: false, // 控制"添加平台"弹框显示
|
83
|
|
- currentPlatformInfo: {}, // 当前编辑的平台信息
|
|
75
|
+ accountList: [],
|
84
|
76
|
|
85
|
77
|
addAccountDialogVisible: false, // 控制"添加账号"弹框显示
|
86
|
|
- currentAccountPlatformId: '', // 当前需要添加账号的平台id
|
|
78
|
+ currentAccountInfo: {}, // 当前编辑的账号信息
|
87
|
79
|
}
|
88
|
80
|
},
|
89
|
81
|
created () {
|
|
@@ -103,18 +95,18 @@ export default {
|
103
|
95
|
}
|
104
|
96
|
const { data: res = {} } = await this.$axios.get(url, { params })
|
105
|
97
|
if (res && res.errno == 0 && Array.isArray(res.rst.data)) {
|
106
|
|
- this.platformList = res.rst.data;
|
|
98
|
+ this.accountList = res.rst.data;
|
107
|
99
|
this.pagination.total = res.rst.pageInfo.total;
|
108
|
100
|
this.pagination.pages = res.rst.pageInfo.pages;
|
109
|
101
|
} else if (res.errno != 4002) {
|
110
|
102
|
this.$message.warning(res.err)
|
111
|
|
- this.platformList = [];
|
|
103
|
+ this.accountList = [];
|
112
|
104
|
this.pagination.total = 0;
|
113
|
105
|
this.pagination.pages = 0;
|
114
|
106
|
}
|
115
|
107
|
} catch (error) {
|
116
|
108
|
console.log(error)
|
117
|
|
- this.platformList = [];
|
|
109
|
+ this.accountList = [];
|
118
|
110
|
this.pagination.total = 0;
|
119
|
111
|
this.pagination.pages = 0;
|
120
|
112
|
} finally {
|
|
@@ -127,72 +119,55 @@ export default {
|
127
|
119
|
this.handleGetPlatform()
|
128
|
120
|
},
|
129
|
121
|
|
130
|
|
- // S 添加 & 编辑平台
|
131
|
|
- // 监听点击"添加平台"
|
132
|
|
- onClickAddPlatform() {
|
133
|
|
- this.currentPlatformInfo = {}
|
134
|
|
- this.addPlatformDialogVisible = true
|
135
|
|
- },
|
136
|
|
- // 监听点击"编辑平台"
|
137
|
|
- onClickEditPlatform(platformInfo) {
|
138
|
|
- this.currentPlatformInfo = platformInfo
|
139
|
|
- this.addPlatformDialogVisible = true
|
140
|
|
- },
|
141
|
|
- // 添加平台 & 编辑平台 => 确定
|
142
|
|
- handleAddPlatformConfirm() {
|
143
|
|
- this.addPlatformDialogVisible = false
|
144
|
|
- this.pagination.page = 1
|
145
|
|
- this.handleGetPlatform()
|
146
|
|
- },
|
147
|
|
- // 添加平台 & 编辑平台 => 取消
|
148
|
|
- handleAddPlatformCancel() {
|
149
|
|
- this.addPlatformDialogVisible = false
|
150
|
|
- },
|
151
|
|
- // E 添加 & 编辑平台
|
152
|
|
-
|
153
|
|
- // S 添加账号
|
|
122
|
+ // S 添加 & 编辑账号
|
154
|
123
|
// 监听点击"添加账号"
|
155
|
|
- onClickAddAccount(currentPlatform) {
|
156
|
|
- this.currentAccountPlatformId = currentPlatform.id
|
|
124
|
+ onClickAddAccount() {
|
|
125
|
+ this.currentAccountInfo = {}
|
|
126
|
+ this.addAccountDialogVisible = true
|
|
127
|
+ },
|
|
128
|
+ // 监听点击"编辑账号"
|
|
129
|
+ onClickEditPlatform(accountInfo) {
|
|
130
|
+ this.currentAccountInfo = accountInfo
|
157
|
131
|
this.addAccountDialogVisible = true
|
158
|
132
|
},
|
159
|
|
- // 添加账号账号 => 确定
|
160
|
|
- handleAddAccountConfirm() {
|
|
133
|
+ // 添加账号 & 编辑账号 => 确定
|
|
134
|
+ handleAddPlatformConfirm({ isEdit }) {
|
161
|
135
|
this.addAccountDialogVisible = false
|
|
136
|
+ if (!isEdit) this.pagination.page = 1
|
162
|
137
|
this.handleGetPlatform()
|
163
|
138
|
},
|
164
|
|
- // 添加账号账号 => 取消
|
165
|
|
- handleAddAccountCancel() {
|
|
139
|
+ // 添加账号 & 编辑账号 => 取消
|
|
140
|
+ handleAddPlatformCancel() {
|
166
|
141
|
this.addAccountDialogVisible = false
|
167
|
142
|
},
|
168
|
|
- // E 添加账号
|
|
143
|
+ // E 添加 & 编辑账号
|
169
|
144
|
|
170
|
145
|
// S 禁用、启用平台
|
171
|
146
|
// 监听点击"禁用"、"启用"按钮
|
172
|
|
- async onClickEnable(currentPlatform, eventCode) {
|
|
147
|
+ async onClickEnable(currentAccount, eventCode) {
|
173
|
148
|
try {
|
174
|
149
|
const h = this.$createElement
|
175
|
150
|
await this.$confirm('', {
|
176
|
151
|
message:h('div', null, [
|
177
|
152
|
h('span', null, `确定${eventCode === 0 ? '禁用' : '启用'}`),
|
178
|
|
- h('span', { style:'color: #32B38A;' }, `${currentPlatform.name}`),
|
|
153
|
+ h('span', { style:'color: #32B38A;' }, `${currentAccount.name}`),
|
179
|
154
|
h('span', null, '吗?'),
|
180
|
155
|
]),
|
181
|
156
|
confirmButtonText: '确定',
|
182
|
157
|
cancelButtonText: '取消',
|
183
|
158
|
type: 'warning',
|
184
|
159
|
})
|
185
|
|
- this.handleEnable(currentPlatform, eventCode)
|
|
160
|
+ this.handleEnable(currentAccount, eventCode)
|
186
|
161
|
} catch (error) {
|
187
|
162
|
console.log(error)
|
188
|
163
|
}
|
189
|
164
|
},
|
190
|
165
|
// 执行"禁用"、"启用"
|
191
|
|
- async handleEnable(currentPlatform, eventCode) {
|
|
166
|
+ async handleEnable(currentAccount, eventCode) {
|
192
|
167
|
try {
|
193
|
168
|
let url = `${this.URL.BASEURL}${this.URL.xxx}`
|
194
|
169
|
const params = {
|
195
|
|
- id: currentPlatform.id,
|
|
170
|
+ id: currentAccount.id,
|
196
|
171
|
enable: eventCode,
|
197
|
172
|
}
|
198
|
173
|
console.log('url => ', url)
|
|
@@ -213,57 +188,6 @@ export default {
|
213
|
188
|
}
|
214
|
189
|
},
|
215
|
190
|
// E 禁用、启用平台
|
216
|
|
-
|
217
|
|
- // S 删除账号
|
218
|
|
- // 监听点击"删除"账号按钮
|
219
|
|
- async onClickDelAccount({ platform, delItem }) {
|
220
|
|
- console.log('platform => ', platform)
|
221
|
|
- console.log('delItem => ', delItem)
|
222
|
|
- try {
|
223
|
|
- const h = this.$createElement
|
224
|
|
- await this.$confirm('', {
|
225
|
|
- message:h('div', null, [
|
226
|
|
- h('span', null, `确定删除`),
|
227
|
|
- h('span', { style:'color: #32B38A;' }, `${platform.name}`),
|
228
|
|
- h('span', null, '平台的'),
|
229
|
|
- h('span', { style:'color: #32B38A;' }, `${delItem}`),
|
230
|
|
- h('span', null, '账号吗?'),
|
231
|
|
- ]),
|
232
|
|
- confirmButtonText: '确定',
|
233
|
|
- cancelButtonText: '取消',
|
234
|
|
- type: 'warning',
|
235
|
|
- })
|
236
|
|
- this.handleDelAccount({ platform, delItem })
|
237
|
|
- } catch (error) {
|
238
|
|
- console.log(error)
|
239
|
|
- }
|
240
|
|
- },
|
241
|
|
- async handleDelAccount({ platform, delItem }) {
|
242
|
|
- try {
|
243
|
|
- let url = `${this.URL.BASEURL}${this.URL.xxx}`
|
244
|
|
- const params = {
|
245
|
|
- id: platform.id,
|
246
|
|
- delItem: delItem,
|
247
|
|
- }
|
248
|
|
- console.log('url => ', url)
|
249
|
|
- console.log('params => ', params)
|
250
|
|
- return // mock
|
251
|
|
- this.loading = true
|
252
|
|
- const { data: res = {} } = await this.$axios.post(url, params)
|
253
|
|
- if (res && res.errno == 0) {
|
254
|
|
- this.$message.success('操作成功')
|
255
|
|
- this.handleGetPlatform()
|
256
|
|
- } else if (res.errno != 4002) {
|
257
|
|
- this.$message.warning(res.err || '操作失败')
|
258
|
|
- }
|
259
|
|
- } catch (error) {
|
260
|
|
- console.log('error => ', error)
|
261
|
|
- } finally {
|
262
|
|
- this.loading = false
|
263
|
|
- }
|
264
|
|
- },
|
265
|
|
- // E 删除账号
|
266
|
|
-
|
267
|
191
|
}
|
268
|
192
|
}
|
269
|
193
|
</script>
|
|
@@ -273,33 +197,9 @@ export default {
|
273
|
197
|
padding: 5px 20px;
|
274
|
198
|
}
|
275
|
199
|
.platformManage-wrap {
|
276
|
|
- .account-wrap {
|
277
|
|
- span {
|
278
|
|
- position: relative;
|
279
|
|
- i {
|
280
|
|
- position: absolute;
|
281
|
|
- right: -14px;
|
282
|
|
- top: 3px;
|
283
|
|
- display: none;
|
284
|
|
- color: #F46C6C;
|
285
|
|
- cursor: pointer;
|
286
|
|
- }
|
287
|
|
- }
|
288
|
|
- &:hover {
|
289
|
|
- i {
|
290
|
|
- display: inline-block;
|
291
|
|
- }
|
292
|
|
- }
|
293
|
|
- }
|
294
|
|
- .account-add-btn {
|
295
|
|
- display: flex;
|
296
|
|
- align-items: center;
|
297
|
|
- justify-content: center;
|
298
|
|
- color: #32B38A;
|
|
200
|
+ .playlet-num {
|
299
|
201
|
cursor: pointer;
|
300
|
|
- i {
|
301
|
|
- margin-right: 4px;
|
302
|
|
- }
|
|
202
|
+ color: #32B38A;
|
303
|
203
|
}
|
304
|
204
|
}
|
305
|
205
|
</style>
|