index.vue 2.6 KB

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