Commit e08b7190 by wangql

a

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