|
@@ -0,0 +1,333 @@
|
|
1
|
+<template>
|
|
2
|
+ <div v-loading="loading" class="welcomeGroup-wrap">
|
|
3
|
+ <div class="screenBox">
|
|
4
|
+ <div class="filter-wrap">
|
|
5
|
+ <!-- 标题 -->
|
|
6
|
+ <selfInputV2 v-model="filter.keyword" label_name="标题" placeholder="请输入标题" :labelWidth="true" @change="onChangeKeyword" style="width: auto" />
|
|
7
|
+ <!-- 创建人 -->
|
|
8
|
+ <selfChannelV2 v-model="filter.creator_id" title="创建人" type="circleCreate" placeholder="请选择创建人" :labelWidth="true" @change="onChangeCreatorId" />
|
|
9
|
+ </div>
|
|
10
|
+ <el-button type="primary" size="mini" @click="onClickCreateBtn" >新建入群欢迎语</el-button>
|
|
11
|
+ </div>
|
|
12
|
+ <el-table :height="height" :data="list" tooltip-effect="dark" style="width: 100%; margin-top: 10px">
|
|
13
|
+ <el-table-column label="标题" prop="name" min-width="100" align="center" fixed="left" show-overflow-tooltip />
|
|
14
|
+ <el-table-column label="文本内容" prop="content" align="center" min-width="150" show-overflow-tooltip />
|
|
15
|
+ <el-table-column label="附件内容" align="left" min-width="180">
|
|
16
|
+ <template slot-scope="{ row }">
|
|
17
|
+ <template v-if="row.attachments">
|
|
18
|
+ <!-- 图片 -->
|
|
19
|
+ <template v-if="row.attachments.image">
|
|
20
|
+ <el-image style="width: 40px; height: 40px;" :src="row.attachments.image.media_url" :preview-src-list="[row.attachments.image.media_url]" />
|
|
21
|
+ </template>
|
|
22
|
+
|
|
23
|
+ <!-- 视频 -->
|
|
24
|
+ <template v-else-if="row.attachments.video">
|
|
25
|
+ <div class="flex-align-center">
|
|
26
|
+ <img src="@/assets/img/video_bg.svg" style="width: 50px; height: 40px; margin-left: -4px" />
|
|
27
|
+ <el-button v-if="row.attachments.video.media_url" type="text" size="mini" @click="onClickShowVideo(row.attachments.video.media_url)" >查看视频</el-button>
|
|
28
|
+ </div>
|
|
29
|
+ </template>
|
|
30
|
+
|
|
31
|
+ <!-- 文件 -->
|
|
32
|
+ <template v-else-if="row.attachments.file">
|
|
33
|
+ <div class="flex-align-center">
|
|
34
|
+ <img src="@/assets/img/video_bg.svg" style="width: 50px; height: 40px; margin-left: -4px" />
|
|
35
|
+ <el-button v-if="row.attachments.file.media_url" type="text" size="mini" @click="onClickShowfile(row.attachments.file.media_url)">下载文件</el-button>
|
|
36
|
+ </div>
|
|
37
|
+ </template>
|
|
38
|
+
|
|
39
|
+ <!-- 图文 -->
|
|
40
|
+ <template v-else-if="row.attachments.link">
|
|
41
|
+ <div class="flex-align-center">
|
|
42
|
+ <el-image style="width: 40px; height: 40px;margin-right: 10px;flex-shrink: 0;" :src="row.attachments.link.picurl" :preview-src-list="[row.attachments.link.picurl]" />
|
|
43
|
+ <span style="line-height: 16px; cursor: pointer">
|
|
44
|
+ <a :href="row.attachments.link.url" target="_blank" class="c-676C97">
|
|
45
|
+ <el-tooltip class="disinblock" :content="row.attachments.link.desc" :disabled="row.attachments.link.desc && row.attachments.link.desc.length < 34" placement="top">
|
|
46
|
+ <span class="clampTwo">{{
|
|
47
|
+ row.attachments.link.desc
|
|
48
|
+ ? row.attachments.link.desc
|
|
49
|
+ : "-"
|
|
50
|
+ }}</span>
|
|
51
|
+ </el-tooltip>
|
|
52
|
+ </a>
|
|
53
|
+ </span>
|
|
54
|
+ </div>
|
|
55
|
+ </template>
|
|
56
|
+
|
|
57
|
+ <!-- 推广链接 -->
|
|
58
|
+ <template v-else-if="row.attachments.promote">
|
|
59
|
+ <div class="flex-align-center">
|
|
60
|
+ <el-image style="width: 40px; height: 40px;margin-right: 10px;flex-shrink: 0;" :src="row.attachments.promote.picurl" :preview-src-list="[row.attachments.promote.picurl]" />
|
|
61
|
+ <span style="line-height: 16px; cursor: pointer">
|
|
62
|
+ <a :href="row.attachments.promote.url" target="_blank" class="c-676C97">
|
|
63
|
+ <el-tooltip class="disinblock" :content="row.attachments.promote.desc" :disabled="row.attachments.promote.desc && row.attachments.promote.desc.length < 34" placement="top">
|
|
64
|
+ <span class="clampTwo">{{
|
|
65
|
+ row.attachments.promote.desc
|
|
66
|
+ ? row.attachments.promote.desc
|
|
67
|
+ : "-"
|
|
68
|
+ }}</span>
|
|
69
|
+ </el-tooltip>
|
|
70
|
+ </a>
|
|
71
|
+ </span>
|
|
72
|
+ </div>
|
|
73
|
+ </template>
|
|
74
|
+
|
|
75
|
+ <!-- 小程序 -->
|
|
76
|
+ <template v-else-if="row.attachments.miniprogram">
|
|
77
|
+ <div class="flex-align-center">
|
|
78
|
+ <el-image style="width: 40px; height: 40px;margin-right: 10px;flex-shrink: 0;" :src="row.attachments.miniprogram.pic_media_url" :preview-src-list="[row.attachments.miniprogram.pic_media_url]" />
|
|
79
|
+ <span style="line-height: 16px; cursor: pointer">
|
|
80
|
+ <span target="_blank" class="c-676C97">
|
|
81
|
+ <el-tooltip class="disinblock" :content="row.attachments.miniprogram.title" :disabled="row.attachments.miniprogram.title && row.attachments.miniprogram.title.length < 34" placement="top">
|
|
82
|
+ <span class="clampTwo">{{
|
|
83
|
+ row.attachments.miniprogram.title
|
|
84
|
+ ? row.attachments.miniprogram.title
|
|
85
|
+ : "-"
|
|
86
|
+ }}</span>
|
|
87
|
+ </el-tooltip>
|
|
88
|
+ </span>
|
|
89
|
+ </span>
|
|
90
|
+ </div>
|
|
91
|
+ </template>
|
|
92
|
+ </template>
|
|
93
|
+ </template>
|
|
94
|
+ </el-table-column>
|
|
95
|
+ <el-table-column label="创建人" align="center" min-width="140">
|
|
96
|
+ <template slot-scope="{ row }">
|
|
97
|
+ <div class="customerServiceTagBox">
|
|
98
|
+ <div class="customerServiceTag">
|
|
99
|
+ <i class="el-icon-user-solid" /> {{ row.creator }}
|
|
100
|
+ </div>
|
|
101
|
+ </div>
|
|
102
|
+ </template>
|
|
103
|
+ </el-table-column>
|
|
104
|
+ <el-table-column label="更新时间" prop="update_time" min-width="160" show-overflow-tooltip align="center" />
|
|
105
|
+ <el-table-column label="操作" min-width="160" align="center" fixed="right">
|
|
106
|
+ <template slot-scope="{ row }">
|
|
107
|
+ <span class="btn c-00b38a" @click="onClickEditBtn(row)">编辑</span>
|
|
108
|
+ <span class="btn c-FF604D" @click="onClickDelBtn(row)">删除</span>
|
|
109
|
+ </template>
|
|
110
|
+ </el-table-column>
|
|
111
|
+ </el-table>
|
|
112
|
+ <div class="pagination" v-show="pagination.total > 0">
|
|
113
|
+ <el-pagination background :current-page="pagination.page" @current-change="handleCurrentChange" layout="prev, pager, next" :page-count="Number(pagination.pages)" />
|
|
114
|
+ </div>
|
|
115
|
+
|
|
116
|
+ <!-- S 查看视频 -->
|
|
117
|
+ <videoDialog
|
|
118
|
+ :dialogVisible="videoDialogVisible"
|
|
119
|
+ :link="currentVideoLink"
|
|
120
|
+ @close="onCloseVideo"
|
|
121
|
+ />
|
|
122
|
+ <!-- E 查看视频 -->
|
|
123
|
+
|
|
124
|
+ <!-- 详情 -->
|
|
125
|
+ <el-drawer size="1200px" :visible.sync="detailVisible" :with-header="false">
|
|
126
|
+ <detail ref="detail" v-if="detailVisible" :template_id='crtTemplateId' @close="detailClose" />
|
|
127
|
+ </el-drawer>
|
|
128
|
+ </div>
|
|
129
|
+</template>
|
|
130
|
+
|
|
131
|
+<script>
|
|
132
|
+import selfInputV2 from "@/components/assembly/screen/inputV2.vue";
|
|
133
|
+import selfChannelV2 from "@/components/assembly/screen/channelV2.vue";
|
|
134
|
+import videoDialog from "./videoDialog.vue";
|
|
135
|
+import detail from "./detail.vue";
|
|
136
|
+
|
|
137
|
+export default {
|
|
138
|
+ name: "welcomeGroup",
|
|
139
|
+ components: {
|
|
140
|
+ selfInputV2,
|
|
141
|
+ selfChannelV2,
|
|
142
|
+ videoDialog,
|
|
143
|
+ detail,
|
|
144
|
+ },
|
|
145
|
+ data() {
|
|
146
|
+ return {
|
|
147
|
+ height: "",
|
|
148
|
+ loading: false,
|
|
149
|
+ pagination: {
|
|
150
|
+ page: 1,
|
|
151
|
+ page_size: 20,
|
|
152
|
+ pages: 0,
|
|
153
|
+ total: 0,
|
|
154
|
+ },
|
|
155
|
+ filter: {
|
|
156
|
+ keyword: "",
|
|
157
|
+ creator_id: "",
|
|
158
|
+ },
|
|
159
|
+ list: [],
|
|
160
|
+
|
|
161
|
+ videoDialogVisible: false,
|
|
162
|
+ currentVideoLink: "",
|
|
163
|
+
|
|
164
|
+ detailVisible: false,
|
|
165
|
+ crtTemplateId: '',
|
|
166
|
+
|
|
167
|
+ };
|
|
168
|
+ },
|
|
169
|
+ created() {
|
|
170
|
+ this.height = document.documentElement.clientHeight - 200;
|
|
171
|
+ this.handleGetList();
|
|
172
|
+ },
|
|
173
|
+ methods: {
|
|
174
|
+ // 获取列表数据
|
|
175
|
+ async handleGetList() {
|
|
176
|
+ try {
|
|
177
|
+ this.loading = true;
|
|
178
|
+ const url = `${this.URL.BASEURL}${this.URL.welcomeGroup_list}`;
|
|
179
|
+ const params = {
|
|
180
|
+ keyword: this.filter.keyword,
|
|
181
|
+ creator_id: this.filter.creator_id,
|
|
182
|
+ page: this.pagination.page,
|
|
183
|
+ page_size: this.pagination.page_size,
|
|
184
|
+ };
|
|
185
|
+ const { data: res = {} } = await this.$axios.get(url, { params });
|
|
186
|
+ if (res && res.errno == 0 && Array.isArray(res.rst.data)) {
|
|
187
|
+ this.list = res.rst.data;
|
|
188
|
+ this.pagination.total = res.rst.pageInfo.total;
|
|
189
|
+ this.pagination.pages = res.rst.pageInfo.pages;
|
|
190
|
+ } else if (res.errno != 4002) {
|
|
191
|
+ this.$message.warning(res.err);
|
|
192
|
+ this.list = [];
|
|
193
|
+ this.pagination.total = 0;
|
|
194
|
+ this.pagination.pages = 0;
|
|
195
|
+ }
|
|
196
|
+ } catch (error) {
|
|
197
|
+ console.log(error);
|
|
198
|
+ this.list = [];
|
|
199
|
+ this.pagination.total = 0;
|
|
200
|
+ this.pagination.pages = 0;
|
|
201
|
+ } finally {
|
|
202
|
+ this.loading = false;
|
|
203
|
+ }
|
|
204
|
+ },
|
|
205
|
+ onChangeKeyword(val) {
|
|
206
|
+ this.filter.keyword = val;
|
|
207
|
+ this.pagination.page = 1;
|
|
208
|
+ this.handleGetList();
|
|
209
|
+ },
|
|
210
|
+ onChangeCreatorId(val) {
|
|
211
|
+ this.filter.creator_id = val || "";
|
|
212
|
+ this.pagination.page = 1;
|
|
213
|
+ this.handleGetList();
|
|
214
|
+ },
|
|
215
|
+
|
|
216
|
+ // 监听当前页数变化
|
|
217
|
+ handleCurrentChange(currentPage) {
|
|
218
|
+ this.pagination.page = currentPage;
|
|
219
|
+ this.handleGetList();
|
|
220
|
+ },
|
|
221
|
+
|
|
222
|
+ // 监听点击“新建配置”
|
|
223
|
+ onClickCreateBtn() {
|
|
224
|
+ console.log("onClickCreateBtn => ");
|
|
225
|
+ this.crtTemplateId = ''
|
|
226
|
+ this.detailVisible = true
|
|
227
|
+ },
|
|
228
|
+ // 监听点击“编辑配置”
|
|
229
|
+ onClickEditBtn(row) {
|
|
230
|
+ console.log("onClickEditBtn => row ", JSON.parse(JSON.stringify(row)));
|
|
231
|
+ this.crtTemplateId = row.template_id
|
|
232
|
+ this.detailVisible = true
|
|
233
|
+ },
|
|
234
|
+ detailClose({ isEdit }) {
|
|
235
|
+ console.log('detailClose => ', )
|
|
236
|
+ this.crtTemplateId = ''
|
|
237
|
+ this.detailVisible = false
|
|
238
|
+ if (!isEdit) {
|
|
239
|
+ this.pagination.page = 1;
|
|
240
|
+ }
|
|
241
|
+ this.handleGetList();
|
|
242
|
+ },
|
|
243
|
+
|
|
244
|
+ // 监听点击"删除"
|
|
245
|
+ async onClickDelBtn({ name, template_id }) {
|
|
246
|
+ try {
|
|
247
|
+ await this.$confirm(`确定删除【${name}】?`, '提示', {
|
|
248
|
+ confirmButtonText: '确定',
|
|
249
|
+ cancelButtonText: '取消',
|
|
250
|
+ type: 'warning'
|
|
251
|
+ })
|
|
252
|
+ this.handleDelRule(template_id)
|
|
253
|
+ } catch (error) {
|
|
254
|
+ console.log('error => ', error)
|
|
255
|
+ }
|
|
256
|
+ },
|
|
257
|
+ async handleDelRule(template_id) {
|
|
258
|
+ try {
|
|
259
|
+ const url = `${this.URL.BASEURL}${this.URL.welcomeGroup_del}`
|
|
260
|
+ const params = { template_id }
|
|
261
|
+ const { data: res = {} } = await this.$axios.post(url, params)
|
|
262
|
+ if (res && res.errno == 0) {
|
|
263
|
+ this.$message.success('操作成功')
|
|
264
|
+ this.handleGetList();
|
|
265
|
+ } else if (res.errno != 4002) {
|
|
266
|
+ this.$message.warning(res.err)
|
|
267
|
+ }
|
|
268
|
+ } catch (error) {
|
|
269
|
+ console.log('error => ', error)
|
|
270
|
+ }
|
|
271
|
+ },
|
|
272
|
+
|
|
273
|
+ onClickShowVideo(videoLink) {
|
|
274
|
+ if (!videoLink) return false;
|
|
275
|
+ this.currentVideoLink = videoLink;
|
|
276
|
+ this.videoDialogVisible = true;
|
|
277
|
+ },
|
|
278
|
+ onCloseVideo() {
|
|
279
|
+ this.currentVideoLink = "";
|
|
280
|
+ this.videoDialogVisible = false;
|
|
281
|
+ },
|
|
282
|
+ onClickShowfile(fileLink) {
|
|
283
|
+ window.open(fileLink, '_blank')
|
|
284
|
+ },
|
|
285
|
+ },
|
|
286
|
+};
|
|
287
|
+</script>
|
|
288
|
+
|
|
289
|
+<style lang="scss" scoped>
|
|
290
|
+@import "@/style/list.scss";
|
|
291
|
+.welcomeGroup-wrap {
|
|
292
|
+ /deep/ .el-switch.is-disabled .el-switch__core {
|
|
293
|
+ cursor: pointer;
|
|
294
|
+ }
|
|
295
|
+ /deep/ .el-switch.is-disabled {
|
|
296
|
+ opacity: 1;
|
|
297
|
+ }
|
|
298
|
+ .screenBox {
|
|
299
|
+ background: #fff;
|
|
300
|
+ padding: 5px 20px;
|
|
301
|
+ display: flex;
|
|
302
|
+ justify-content: space-between;
|
|
303
|
+ align-items: center;
|
|
304
|
+ .filter-wrap {
|
|
305
|
+ flex: 1;
|
|
306
|
+ display: flex;
|
|
307
|
+ flex-wrap: wrap;
|
|
308
|
+ }
|
|
309
|
+ }
|
|
310
|
+ .btn {
|
|
311
|
+ cursor: pointer;
|
|
312
|
+ margin-right: 4px;
|
|
313
|
+ &:last-child {
|
|
314
|
+ margin-right: 0;
|
|
315
|
+ }
|
|
316
|
+ }
|
|
317
|
+ .lableBox_dad {
|
|
318
|
+ display: flex;
|
|
319
|
+ align-items: center;
|
|
320
|
+ justify-content: center;
|
|
321
|
+ flex-wrap: wrap;
|
|
322
|
+
|
|
323
|
+ .lableBox {
|
|
324
|
+ font-size: 12px;
|
|
325
|
+ background-color: #f0f0f0;
|
|
326
|
+ padding: 4px 8px;
|
|
327
|
+ margin-top: 5px;
|
|
328
|
+ margin-right: 4px;
|
|
329
|
+ border-radius: 4px;
|
|
330
|
+ }
|
|
331
|
+ }
|
|
332
|
+}
|
|
333
|
+</style>
|