fuliqi
2024-01-24 29c1e7eb5ac16e90d8991a86c1c071bc312ec8d9
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<template>
  <div>
    <h4>页面展示</h4>
    <hr />
    <el-form size="mini" ref="pageDisplayForm" :disabled="$route.name==='blindBoxActInfo'"
             label-width="120px" :rules="formRules" :model="pageDisplayForm">
      <el-form-item label="主背景色:" prop="bgColor">
        <el-input class="blindBoxInputC" v-model="pageDisplayForm.bgColor" type="color">
        </el-input>
      </el-form-item>
      <el-form-item label="背景图片:" prop="backgroundFileId">
        <custom-upload-img :limitNumber="1"
                           @handle-success="(file)=>handleSuccess(bgfileList,file,'backgroundFileId')"
                           @handle-remove="(file)=>handleRemove('bgfileList',file,'backgroundFileId')"
                           :isHideDelete="$route.name!=='blindBoxActInfo'" :fileList="bgfileList"
                           fileTip="建议尺寸750*3560像素,支持JPG、PNG、JPEG格式"></custom-upload-img>
      </el-form-item>
      <el-form-item label="展现形式:" required prop="showType">
        <el-select :popper-append-to-body="false" disabled class="custom-selet-style"
                   v-model="pageDisplayForm.showType">
          <el-option label="宫格图" value="1"></el-option>
          <el-option label="整图" value="2"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="盲盒数量:" v-if="pageDisplayForm.showType==='1'" prop="blindBoxNum">
        <el-select :popper-append-to-body="false" disabled class="custom-selet-style"
                   v-model="pageDisplayForm.blindBoxNum">
          <el-option label="3个" value="1"></el-option>
          <el-option label="6个" value="2"></el-option>
          <el-option label="9个" value="3"></el-option>
          <el-option label="12个" value="4"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="盲盒静态图" prop="blindBoxFileId"
                    :rules="{required:true,message:'请上传盲盒静态图片'}">
        <custom-upload-img :limitNumber="1"
                           @handle-success="(file)=>handleSuccess(blindBoxFileList,file,'blindBoxFileId')"
                           @handle-remove="(file)=>handleRemove('blindBoxFileList',file,'blindBoxFileId')"
                           :isHideDelete="$route.name!=='blindBoxActInfo'"
                           thumbnailImageWidth="328px" thumbnailImageHeight="104px"
                           :fileList="blindBoxFileList" :fileTip="getFileTip(1,'JPG、PNG、JPEG')">
        </custom-upload-img>
      </el-form-item>
      <el-form-item label="盲盒动态图" prop="blindBoxGifFileId"
                    :rules="{required:true,message:'请上传盲盒动态图片'}">
        <custom-upload-img :limitNumber="1"
                           @handle-success="(file)=>handleSuccess(blindBoxGifFileList,file,'blindBoxGifFileId')"
                           @handle-remove="(file)=>handleRemove('blindBoxGifFileList',file,'blindBoxGifFileId')"
                           :isHideDelete="$route.name!=='blindBoxActInfo'" accept=".gif"
                           thumbnailImageWidth="328px" thumbnailImageHeight="104px"
                           :fileList="blindBoxGifFileList" :fileTip="getFileTip(2,'GIF')">
        </custom-upload-img>
      </el-form-item>
      <el-form-item label="中奖播报:" prop="broadcast">
        <el-radio-group v-model="pageDisplayForm.broadcast">
          <el-radio label="1">展示</el-radio>
          <el-radio label="2">不展示</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="活动规则:" prop="promotionRuledesc">
        <el-input class="blindBoxActivityInput" v-model="pageDisplayForm.promotionRuledesc"
                  type="textarea" :autosize="{minRows:2,maxRows:4}" placeholder="请输入活动规则" clearable
                  maxlength="300" show-word-limit></el-input>
      </el-form-item>
      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="规则背景色:" prop="promotionRuleStyle.ruleBgColor">
            <el-input class="blindBoxInputC"
                      v-model="pageDisplayForm.promotionRuleStyle.ruleBgColor" type="color">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="规则文字颜色:" prop="promotionRuleStyle.ruleTextColor">
            <el-input class="blindBoxInputC"
                      v-model="pageDisplayForm.promotionRuleStyle.ruleTextColor" type="color">
            </el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="规则文字大小:" prop="promotionRuleStyle.ruleTextSize">
            <el-input-number v-model="pageDisplayForm.promotionRuleStyle.ruleTextSize" :min="12">
            </el-input-number>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="规则圆角大小:" prop="promotionRuleStyle.ruleRadiusSize">
            <el-input-number v-model="pageDisplayForm.promotionRuleStyle.ruleRadiusSize" :min="0">
            </el-input-number>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
 
<script>
import { handleSuccess, handleRemove } from '../index'
export default {
  data() {
    return {
      pageDisplayForm: {
        backgroundFileId: null,
        bgColor: '#d9915b',
        showType: '1',
        broadcast: '1',
        blindBoxFileId: null,
        blindBoxGifFileId: null,
        blindBoxNum: '1',
        promotionRuledesc: null,
        promotionRuleStyle: {
          ruleBgColor: '#fdeed3',
          ruleTextColor: '#d9915b',
          ruleTextSize: 12,
          ruleRadiusSize: 12,
        }
      },
      isDisabled: false,
      bgfileList: [], // 背景图片
      blindBoxFileList: [], // 盲盒静态图片
      blindBoxGifFileList: [], // 盲盒动态图片
      formRules: {
        bgColor: [{ required: true, message: '请选择主背景色' }],
        backgroundFileId: [{ required: true, message: '请选择背景图片' }],
        promotionRuledesc: [{ required: true, message: '请输入活动规则' }],
        blindBoxNum: [{ required: true, message: '请选择盲盒数量' }]
      },
      blindBoxImgTip: null
    }
  },
  created() {
    if (this.$route.name === 'proPublicityInfo') {
      this.isDisabled = true
    }
  },
  methods: {
    getFileTip(num, format) {
      const _text = num === 1 ? '静态' : '动画';
      let str = '<p>提示:</p>'
      str += `<p>1、建议尺寸746*171像素,支持${format}格式</p>`
      str += `<p>2、用于盲盒活动页盲盒抽奖区${_text}展示</p>`
      return str
    },
    /**
     * 获取上传成功的图片
     */
    handleSuccess(arr, data, key) {
      handleSuccess(this, this.pageDisplayForm, 'pageDisplayForm', arr, data, key)
    },
    /**
     * 移除图片
     */
    handleRemove(arrKey, data, key) {
      this[arrKey] = handleRemove(this.pageDisplayForm, this[arrKey], data, key)
    }
  }
}
</script>
 
<style lang="scss">
.blindBoxInputC {
  .el-input__inner {
    width: 50px !important;
    padding: 0px !important;
    border-radius: 0;
    border-color: #dcdfe6;
  }
}
</style>