新版交易所前段管理后台
1
PC-20250623MANY\Administrator
2025-07-06 0363875eb333c67529c8b27221a6da45d1a50bfa
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
<template>
  <div class="upload-container">
    <el-tooltip v-if="tinymceUploadType === 'prod'" :content="this.$i18n.t('product.uploadDetailPicTips')" placement="top">
      <el-button :style="{background:color,borderColor:color}" icon="el-icon-upload" size="mini" type="primary" @click="clickUpload()">
        {{ $t('components.uploadImage') }}
      </el-button>
    </el-tooltip>
    <el-button v-else :style="{background:color,borderColor:color}" icon="el-icon-upload" size="mini" type="primary" @click="clickUpload()">
      {{ $t('components.uploadImage') }}
    </el-button>
    <!-- 弹窗, 新增图片 -->
    <elx-imgbox v-if="elxImgboxVisible" ref="elxImgbox" @refreshPic="refreshPic"></elx-imgbox>
  </div>
</template>
 
<script>
import ImgsUpload from '@/components/imgs-upload'
import ElxImgbox from '@/components/elx-imgbox'
export default {
  name: 'EditorSlideUpload',
  props: {
    color: {
      type: String,
      default: '#1890ff'
    },
    tinymceUploadType: {
      default: '',
      type: String
    }
  },
  data () {
    return {
      elxImgboxVisible: false,
      maxNum: 15, // 可选择的最大图片数量
      imgUrls: [],
      resourcesUrl: process.env.VUE_APP_RESOURCES_URL
    }
  },
  components: {
    ImgsUpload,
    ElxImgbox
  },
  methods: {
    /**
     * 打开图片选择窗
     */
    clickUpload () {
      this.imgUrls = ''
      this.elxImgboxVisible = true
      this.$nextTick(() => {
        this.$refs.elxImgbox.init(0, this.maxNum)
      })
    },
    /**
     * 接收回调的图片数据
     */
    refreshPic (imagePath) {
      let imageArray = imagePath.split(',')
      var data = []
      imageArray.forEach(img => {
        data.push(this.resourcesUrl + img)
      })
      this.imgUrls = ''
      this.dialogVisible = false
      this.$emit('successCBK', data)
    }
    // handleSubmit() {
    //   let imageArray = this.imgUrls.split(',')
    //   var data = []
    //   imageArray.forEach(img => {
    //     data.push(this.resourcesUrl + img)
    //   })
    //   this.imgUrls = ''
    //   this.dialogVisible = false
    //   this.$emit('successCBK', data)
    // }
  }
}
</script>
 
<style lang="scss" scoped>
.editor-slide-upload {
  margin-bottom: 20px;
  ::v-deep .el-upload--picture-card {
    width: 100%;
  }
}
</style>