index.vue
2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<script>
import { getList } from '@/api/customer/tag'
import list from './list'
export default {
components: { list },
props: {
// 添加标签显隐
visible: {
type: Boolean,
default: false
},
// title: {
// type: String,
// default: '',
// },
type: {
type: String | Number,
default: '4'
},
// 显示哪些素材类型标签
showArr: {
type: Array,
default: () => []
}
},
data() {
return {
text: {},
image: {},
file: {}
}
},
watch: {},
computed: {
title() {
const titleMap = {
4: '文本',
0: '图片',
8: '图文',
9: '小程序'
}
return titleMap[this.type] || '素材'
},
Pvisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
},
Ptype: {
get() {
return this.type
},
set(val) {
this.$emit('update:type', val)
}
}
},
created() {},
mounted() {},
methods: {
submit() {
this.Pvisible = false
this.$emit('success', this.selectedData)
},
onChange(data) {
this.selectedData = data
}
}
}
</script>
<template>
<el-dialog
:title="`选择${title}`"
:visible.sync="Pvisible"
width="680px"
append-to-body
destroy-on-close
>
<div>
<list v-if="showArr.length <= 1" :type="showArr[0] || type" @change="onChange"> </list>
<el-tabs v-else-if="showArr.length > 1" v-model="Ptype">
<!-- <el-tab-pane name="0" v-if="showArr.includes(0)">
<span slot="label"> <i class="el-icon-date"></i> 文本 </span>
<list type="4" @change="onChange"> </list>
</el-tab-pane>
<el-tab-pane name="1" v-if="showArr.includes(1)">
<span slot="label"> <i class="el-icon-date"></i> 图片 </span>
<list type="0" @change="onChange"> </list>
</el-tab-pane> -->
</el-tabs>
</div>
<div slot="footer">
<el-button @click="Pvisible = false">取 消</el-button>
<el-button type="primary" @click="submit">确 定</el-button>
</div>
</el-dialog>
</template>
<style lang="scss" scoped>
.user-list {
.el-row {
line-height: 26px;
}
}
.mr30 {
margin-right: 30px;
}
::v-deep.el-dialog__body {
padding: 5px 20px;
height: 76vh;
overflow: auto;
}
</style>