Commit e08b7190 by wangql

a

1 parent 44a94b84
......@@ -13,7 +13,7 @@
:model="addParams"
label-width="120px"
>
<gl-form-item label="品牌厂商" prop="brandName">
<gl-form-item label="品牌厂商">
<gl-select
name="brandName"
v-validate="'required'"
......@@ -28,11 +28,9 @@
:value="item.value">
</gl-option>
</gl-select>
<!-- <span v-show="errorBags.has('brandName')" class="error">
{{ errorBags.first('brandName') }}
</span> -->
<span v-show="errorBags.has('brandName')" class="error">{{ errorBags.first('brandName') }}</span>
</gl-form-item>
<gl-form-item label="渠道商" prop="channel">
<gl-form-item label="渠道商">
<gl-select
name="channel"
v-validate="'required'"
......@@ -47,13 +45,13 @@
:value="item.value">
</gl-option>
</gl-select>
<!-- <span v-show="errorBags.has('channel')" class="error">
{{ errorBags.first('channel') }}
</span> -->
<span v-show="errorBags.has('channel')" class="error">{{ errorBags.first('channel') }}</span>
</gl-form-item>
<gl-form-item label="用户标签" prop="userTags">
<gl-select
name="userTags"
v-validate="'required'"
data-vv-as="渠道商"
v-model="addParams.influenceScope"
placeholder="选择用户"
>
......@@ -64,9 +62,7 @@
:value="item.value">
</gl-option>
</gl-select>
<!-- <span v-show="errorBags.has('userTags')" class="error">
{{ errorBags.first('userTags') }}
</span> -->
<span v-show="errorBags.has('userTags')" class="error">{{ errorBags.first('userTags') }}</span>
</gl-form-item>
<gl-form-item label="灰度用户" prop="uploadGrayscaleuser" v-show="addParams.influenceScope === 'LIST'">
<gl-upload
......@@ -80,7 +76,7 @@
data-vv-as="灰度用户">
<gl-button size="small" type="primary">上传灰度用户</gl-button>
<div slot="tip" class="el-upload__tip">支持格式:Excel表格,批量上传设备号</div>
<!-- <span v-show="errorBags.has('moduleIcon')" class="error">{{ errorBags.first('moduleIcon') }}</span> -->
<span class="error">{{ grayscaleuserFileErr }}</span>
</gl-upload>
<a href="http://qcimg01.glsx.net:7060/ddh-ai-m/AI管家-灰度用户导入模板.XLSX">灰度用户导入模板下载</a>
</gl-form-item>
......@@ -96,7 +92,7 @@
data-vv-as="表情文件">
<gl-button size="small" type="primary">选择表情包文件</gl-button>
<div slot="tip" class="el-upload__tip">支持格式:.zip</div>
<!-- <span v-show="errorBags.has('moduleIcon')" class="error">{{ errorBags.first('moduleIcon') }}</span> -->
<span class="error">{{ expressionFileErr }}</span>
</gl-upload>
</gl-form-item>
<gl-form-item label="表情背景">
......@@ -142,7 +138,7 @@
<gl-button
type="primary"
:loading="updateLoading"
@click="handleSubmit"
@click="editExpValidate"
>提交</gl-button>
<gl-button @click="handleClose">取消</gl-button>
</div>
......@@ -180,7 +176,7 @@ export default {
},
watch: {
updateVisible(val) {
// this.$validator.errors.clear()
this.$validator.errors.clear()
},
idPassvalue(val) {
if (val) {
......@@ -343,10 +339,12 @@ export default {
!isSize && this.$message.error('上传表情包文件大小不能超过1MB')
return isFileType && isSize
},
// 表情包上传成功
success_expression(res) {
const { fileUrl } = res.data
this.addParams.packagePath = fileUrl
},
// 删除表情包
onRemove_expression() {
this.addParams.packagePath = ''
},
......@@ -379,6 +377,7 @@ export default {
})
.catch(err => console.log(err))
},
// 打开活动表情弹出框
addOrEditBgWindow(obj, idx) {
this.isShowBackground = !this.isShowBackground
if (obj) {
......@@ -386,6 +385,20 @@ export default {
this.idPassvalue.$emit('transferData', obj)
}
},
// 关闭活动表情弹出框
closeBack(backgroundInfo) {
this.isShowBackground = !this.isShowBackground
console.log(backgroundInfo)
if (backgroundInfo) {
if (backgroundInfo.idx || backgroundInfo.idx === 0) {
const copeInfo = this.$deep_clone(backgroundInfo)
this.bgList[backgroundInfo.idx] = copeInfo
} else {
this.bgList.push(this.$deep_clone(backgroundInfo))
}
}
},
// 询问删除活动表情
deleteBg(obj, idx) {
this.$confirm('确定要删除该表情背景?', '', {
confirmButtonText: '确定',
......@@ -397,6 +410,7 @@ export default {
console.log(err)
})
},
// 删除活动表情
deleteBg_sure(obj, idx) {
if (obj && obj.id) {
mergeBg
......@@ -409,21 +423,7 @@ export default {
this.bgList.splice(idx, 1)
}
},
closeBack(backgroundInfo) {
this.isShowBackground = !this.isShowBackground
console.log(backgroundInfo)
if (backgroundInfo) {
if (backgroundInfo.idx || backgroundInfo.idx === 0) {
const copeInfo = this.$deep_clone(backgroundInfo)
this.bgList[backgroundInfo.idx] = copeInfo
} else {
this.bgList.push(this.$deep_clone(backgroundInfo))
}
}
},
handleSubmit() {
this.editExpressionInfo()
},
// 关闭表情信息弹出框
handleClose() {
this.$emit('updateClose')
},
......@@ -450,6 +450,20 @@ export default {
})
return this.addParams
},
// 新增或编辑表情信息表单验证
editExpValidate() {
this.$validator.validateAll().then(result => {
console.log('result:' + result)
if (!this.addParams.grayscaleUserList) {
this.fileErr = '请上传灰度用户'
result = false
}
if (result) {
this.editExpressionInfo()
}
})
},
// 新增或编辑表情信息
editExpressionInfo() {
const params = this.getParams()
if (!this.expressionId) { // 新增表情时,不调用新增或编辑表情背景接口,直接将全部数据打包带过去
......
......@@ -17,14 +17,13 @@
class="avatar-uploader"
:action="uploadAction"
name="file"
v-validate="'fileRequired'"
:show-file-list="false"
:on-success="success_pic"
:before-upload="beforeUpload">
<img v-if="updateBackgroundForm.backgroundPath" :src="updateBackgroundForm.backgroundPath" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</gl-upload>
<span v-show="errorBags.has('file')" class="error">{{ errorBags.first('file') }}</span>
<span class="error">{{ fileErr }}</span>
</gl-form-item>
<gl-form-item label="有效期">
<gl-date-picker
......@@ -60,24 +59,13 @@ export default {
},
watch: {
backgroundVisible(val) {
if (val) {
this.$validator.extend('fileRequired', {
messages: {
en: field => field + '请上传图片'
},
validate: value => {
console.log(value)
return this.updateBackgroundForm.backgroundPath
}
})
} else {
this.$validator.errors.clear()
}
this.$validator.errors.clear()
}
},
data() {
return {
backgroundDialogTitle: '添加活动背景',
fileErr: '',
times: [],
updateBackgroundForm: {
id: '',
......@@ -89,8 +77,7 @@ export default {
backgroundType: ''
},
rules: {
backgroundName: [{ required: true }],
file: [{ required: true }]
backgroundName: [{ required: true }]
},
uploadAction: '',
updateBackgroundDate: {}
......@@ -119,18 +106,18 @@ export default {
},
success_pic(res) {
this.updateBackgroundForm.backgroundPath = res.data.fileUrl
this.fileErr = ''// 清空图片验证信息
},
validateParams() {
this.$validator.validateAll().then(result => {
console.log('result:' + result)
// this.$validator.validate('imgPath', this.updateBackgroundForm.backgroundPath)
// if ((this.errorBags.count() === 1) && this.errorBags.has('imgPath')) {
// this.updateBackgroundForm.backgroundPath && (result = true)
// console.log(this.updateBackgroundForm.backgroundPath && (result = true))
// }
// if (result) {
// this.submit()
// }
if (!this.updateBackgroundForm.backgroundPath) {
this.fileErr = '请选择背景图片'
result = false
}
if (result) {
this.submit()
}
})
},
submit() {
......
......@@ -293,8 +293,7 @@ export default {
},
dialog(index) {
this.updateVisible = !this.updateVisible
this.idPassvalue.$emit('expressionId', 6)
// this.$emit('expressionId', this.expressionId)
// this.idPassvalue.$emit('expressionId', 6)
},
updateDialogClose(updateData) {
// this.updateLoading = true
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!