Commit 3b7a15c5 by 胡悦

语音接口及验证的修改

1 parent 130a78c0
......@@ -12,7 +12,7 @@ const __mergeBg = `${path}/background/merge`
const getExpList = {
p: [__expressionList],
req: params => GlAxios.post(__expressionList, params)
req: params => GlAxios.post(__expressionList, params, { headers: { 'Content-Type': 'application/json; charset=utf-8' }, requestType: 'jsonString' })
}
const grayscaleuser = {
......
......@@ -13,12 +13,14 @@
clearable
/>
</gl-form-item>
<Manufacturers
width="200px"
:eventBus="idPassvalue"
:value.sync="manufacturer"
:manufactureOnly="true"
<gl-form-item>
<Manufacturers
width="200px"
:eventBus="idPassvalue"
:value.sync="manufacturer"
:manufactureOnly="true"
/>
</gl-form-item>
<gl-form-item>
<gl-button
type="primary"
......@@ -44,16 +46,16 @@
:table="tableData"
v-loading="tableLoading"
>
<gl-table-column align="center" v-for="(i, index) in tableData.column" :key="index" :label='i.label' :prop='i.prop' :width='i.width' >
<template slot-scope="scope">
<template v-if='i.prop === "ipBackgroundList"'>
<img class="tableImg" :src="tableData.data[scope.scope.$index][i.prop]">
</template>
<template v-else>
{{tableData.data[scope.scope.$index][i.prop]}}
</template>
</template>
</gl-table-column>
<!-- <gl-table-column align="center" v-for="(i, index) in tableData.column" :key="index" :label='i.label' :prop='i.prop' :width='i.width' >
<template slot-scope="scope">
<template v-if='i.prop === "ipBackgroundList"'>
<img class="tableImg" :src="tableData.data[scope.scope.$index][i.prop]">
</template>
<template v-else>
{{tableData.data[scope.scope.$index][i.prop]}}
</template>
</template>
</gl-table-column> -->
</gl-table>
<gl-pagination
background
......@@ -116,22 +118,22 @@ export default {
label: '默认IP表情',
prop: 'packagePath'
},
{
label: '默认IP背景',
prop: 'ipBackgroundList',
formatter: (cellValue) => {
if (cellValue.ipBackgroundList) {
var imgUrl = ''
cellValue.ipBackgroundList.forEach((item, index) => {
if (item.backgroundType === 'DEFAULT') {
imgUrl = item.backgroundPath
return false
}
})
return imgUrl
}
}
},
// {
// label: '默认IP背景',
// prop: 'ipBackgroundList',
// formatter: (cellValue) => {
// if (cellValue.ipBackgroundList) {
// var imgUrl = ''
// cellValue.ipBackgroundList.forEach((item, index) => {
// if (item.backgroundType === 'DEFAULT') {
// imgUrl = item.backgroundPath
// return false
// }
// })
// return imgUrl
// }
// }
// },
{
label: '变更时间',
prop: 'updatedDate',
......
......@@ -4,6 +4,7 @@
<gl-form-item label='品牌厂商:'>
<gl-select
v-model="model.manufacturerId"
filterable
placeholder="请选择品牌厂商"
name="manufacturerId"
data-vv-as="品牌厂商"
......@@ -13,9 +14,13 @@
<gl-option
v-for="item in manufacturer_list"
:key="item.manufacturerName"
:label="item.manufacturerName"
:label="item.merchantName"
:value="item.manufacturer"
/>
>
<span style="float: left">{{ item.merchantName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.manufacturer }}</span>
<!-- <span>{{item.manufacturerName}}[{{item.manufacturer}}]</span> -->
</gl-option>
</gl-select>
<span
v-show="errorBags && errorBags.has('manufacturerId')"
......@@ -34,10 +39,9 @@
v-model="model.merchantId"
placeholder="请选择渠道商"
style="width:100%"
name="merchantId"
data-vv-as="渠道商"
v-validate="'required'"
>
<!-- name="merchantId"
data-vv-as="渠道商" -->
<gl-option
v-for="item in merchant_list"
:key="item.merchantName"
......@@ -45,12 +49,12 @@
:value="item.merchantId"
/>
</gl-select>
<span
<!-- <span
v-show="errorBags && errorBags.has('merchantId')"
class="error"
>
{{ errorBags && errorBags.first('merchantId') }}
</span>
</span> -->
</gl-form-item>
</gl-col>
<gl-col
......@@ -93,7 +97,7 @@
:before-upload="beforeUpload_grayscaleuser"
:on-remove="onRemove_grayscaleuser"
v-model="result.grayscaleUserList"
name="grayscaleUserList"
name="file"
data-vv-as="灰度用户"
v-validate="'required'"
:file-list="model.file_list"
......@@ -110,10 +114,10 @@
>支持格式: .Excel表格,批量上传设备号</div>
</gl-upload>
<span
v-show="errorBags && errorBags.has('grayscaleUserList')"
v-show="errorBags && errorBags.has('file')"
class="error"
>
{{ errorBags && errorBags.first('grayscaleUserList') }}
{{ errorBags && errorBags.first('file') }}
</span>
<a
:href="template_url"
......
......@@ -5,6 +5,7 @@
:title="title"
:visible.sync="updateVisible"
:before-close="handleClose"
:close-on-click-modal="false"
width="900px"
>
<gl-form
......@@ -145,9 +146,6 @@
v-model="editForm.activityForm"
placeholder="请选择活动"
style="width:100%"
name="activityForm"
v-validate="'required'"
data-vv-as="活动内容"
>
<gl-option
v-for="item in contents"
......@@ -156,12 +154,12 @@
:value="item.value"
/>
</gl-select>
<span
<!-- <span
v-show="errorBags.has('activityForm')"
class="error"
>
{{ errorBags.first('activityForm') }}
</span>
</span> -->
</gl-form-item>
</gl-col>
<gl-col :span="14">
......@@ -204,16 +202,13 @@
<gl-table
:table="coupons"
ref="multipleTable"
name="gift"
v-validate="'required'"
data-vv-as="优惠券"
v-model="activityConfig.giftId"
></gl-table>
<span
v-show="errorBags.has('gift')"
v-show="hasGift"
class="error"
>
{{ errorBags.first('gift') }}
优惠券不能为空
</span>
</gl-col>
</gl-row>
......@@ -227,9 +222,7 @@
:on-remove="on_remove_gif"
:accept="gif.accept"
:on-preview="copy_path"
name="dynamicEffectIcon"
v-validate="'required'"
data-vv-as="动效图标"
name="file"
:limit="1"
v-model="activityConfig.dynamicEffectIcon"
:file-list="activityConfig.dynamicEffectIcon?[{name:activityConfig.dynamicEffectIcon,url:activityConfig.dynamicEffectIcon}]:[]"
......@@ -246,10 +239,10 @@
>动效图标必填</div>
</gl-upload>
<span
v-show="errorBags.has('dynamicEffectIcon')"
v-show="hasDynamicEffect"
class="error"
>
{{ errorBags.first('dynamicEffectIcon') }}
动效图标不能为空
</span>
</gl-col>
<gl-col :span="12">
......@@ -362,6 +355,7 @@ export default {
// 编辑活动
const __clone = this.$deep_clone(data) // 拷贝列表传入数据
this.editForm = __clone
console.log(this.editForm)
const {
manufacturerId,
merchantId,
......@@ -479,7 +473,9 @@ export default {
prop: 'giftName'
}
]
}
},
hasGift: false,
hasDynamicEffect: false
}
},
mounted() {
......@@ -489,13 +485,55 @@ export default {
// this.manufacturer_component = this.$refs['m']
},
methods: {
// 活动内容验证
giftValidate() {
if (this.editForm.activityForm === 'GIFT') {
if (this.activityConfig.giftId) {
this.hasGift = false
} else {
this.hasGift = true
}
return !this.hasGift
} else if (this.editForm.activityForm === 'DYNAMIC_EFFECT') {
if (this.activityConfig.dynamicEffectIcon) {
this.hasDynamicEffect = false
} else {
this.hasDynamicEffect = true
}
return !this.hasDynamicEffect
} else {
if (this.activityConfig.giftId && !this.activityConfig.dynamicEffectIcon) {
this.hasGift = false
this.hasDynamicEffect = true
} else if (this.activityConfig.dynamicEffectIcon && !this.activityConfig.giftId) {
this.hasDynamicEffect = false
this.hasGift = true
} else if (this.activityConfig.giftId && this.activityConfig.dynamicEffectIcon) {
this.hasGift = false
this.hasDynamicEffect = false
} else {
this.hasGift = true
this.hasDynamicEffect = true
}
return !this.hasGift && !this.hasDynamicEffect
}
// if (this.editForm.activityForm === 'GIFT' && this.activityConfig.giftId) {
// this.hasGift = false
// } else {
// this.hasGift = true
// }
// return !this.hasGift
},
// 提交数据
handleSubmit() {
console.log(this.com_value)
Promise.all([
this.$validator.validateAll(),
this.$refs['m'].$validator.validateAll()
this.$refs['m'].$validator.validateAll(),
this.giftValidate()
]).then(result => {
if (result[0] && result[1]) {
console.log(result)
if (result[0] && result[1] && result[2]) {
this.fix_params().then(params => {
this.updateLoading = true
;(this.editForm.id ? mergeActivity : addActivity)
......@@ -537,45 +575,51 @@ export default {
delete form.createdBy
delete form.count
delete form.status
console.log(form)
if (!form.manufacturer) {
let beginTime = this.time[0]
let endTime = this.time[1]
if (typeof beginTime === 'number') {
beginTime = new Date(beginTime).format(this.time_format)
endTime = new Date(endTime).format(this.time_format)
} else if (typeof beginTime === 'object') {
beginTime = beginTime.format(this.time_format)
endTime = endTime.format(this.time_format)
}
form.beginTime = beginTime
form.endTime = endTime
const {
manufacturers,
merchants,
influenceScope,
grayscaleUserList
} = this.com_value
let beginTime = this.time[0]
let endTime = this.time[1]
if (typeof beginTime === 'number') {
beginTime = new Date(beginTime).format(this.time_format)
endTime = new Date(endTime).format(this.time_format)
} else if (typeof beginTime === 'object') {
beginTime = beginTime.format(this.time_format)
endTime = endTime.format(this.time_format)
}
form.beginTime = beginTime
form.endTime = endTime
const {
manufacturers,
merchants,
influenceScope,
grayscaleUserList
} = this.com_value
// manufacturer
const { manufacturer } = manufacturers
form.manufacturer = manufacturer
form.manufacturerName = manufacturers.merchantName
form.manufacturerId = manufacturers.merchantId
// manufacturer
const { manufacturer } = manufacturers
form.manufacturer = manufacturer
form.manufacturerName = manufacturers.merchantName
form.manufacturerId = manufacturers.merchantId
// merchants
const {
merchantId,
merchantName
// merchants
const {
merchantId,
merchantName
// merchantStatus,
// merchantType
} = merchants
form.merchantId = merchantId
form.merchantName = merchantName
// influenceScope,,,grayscaleUserList
form.influenceScope = influenceScope
form.grayscaleUserList = grayscaleUserList
form.activityConfig = JSON.stringify(this.activityConfig)
resolve(form)
} = merchants
form.merchantId = merchantId
form.merchantName = merchantName
// influenceScope,,,grayscaleUserList
form.influenceScope = influenceScope
form.grayscaleUserList = grayscaleUserList
form.activityConfig = JSON.stringify(this.activityConfig)
resolve(form)
} else {
form.activityConfig = JSON.stringify(this.activityConfig)
resolve(form)
}
} catch (error) {
console.log(error)
this.error(error)
......@@ -596,20 +640,24 @@ export default {
// )
this.activityConfig = this.$merge(this.activityConfig, data)
this.coupons.data = [this.activityConfig]
// this.giftValidate()
this.eventBus.$emit('checked_gift', data)
},
// 上传动态图片
upload_gif_success(res) {
console.log(res)
// let __cfg = this.editForm.activityConfig
// if (typeof __cfg === 'string') {
// __cfg = JSON.parse(__cfg)
// }
// __cfg.dynamicEffectIcon=res.fileUrl
// this.editForm.activityConfig = JSON.stringify(__cfg)
this.activityConfig.dynamicEffectIcon = res.fileUrl
this.activityConfig.dynamicEffectIcon = res.data.fileUrl
console.log(this.activityConfig.dynamicEffectIcon)
},
before_upload_gif(file) {
// console.log(file)
const { size } = this.gif
const isSize = file.size / 1024 / 1024 < size
!isSize && this.$message.error(`上传图标文件大小不能超过${size}MB`)
......@@ -621,6 +669,7 @@ export default {
// 上传灰度用户成功后调接口解析Excel
upload_voice_success(res) {
console.log(res)
// let __cfg = this.editForm.activityConfig
// if (typeof __cfg === 'string') {
// __cfg = JSON.parse(__cfg)
......
......@@ -5,6 +5,7 @@
title="选择活动礼品"
:visible.sync="giftVisible"
:before-close="handleClose"
:close-on-click-modal="false"
width='800px '
>
<gl-row>
......
......@@ -108,7 +108,7 @@ export default {
tableData: {
border: true,
align: 'center',
// height: parseInt(this.$client_height() - 140),
height: parseInt(this.$client_height() - 140),
data: [],
column: [
{
......@@ -170,30 +170,31 @@ export default {
show: true,
label: '操作',
prop: 'options',
width: '200px',
button: [
{
label: '上架',
type: 'text',
formatter: rows =>
rows.status === { ON: '上架', OF: '下架' }[rows.status],
callback: (index, rows) => {
const { id, status } = rows[index]
this.$confirm(
`确定${{ ON: '下架', OF: '上架' }[status]}该活动?`,
'',
{
type: 'warning'
}
)
.then(() => {
this.updateActivity({
id,
status: { ON: 'OF', OF: 'ON' }[status]
})
})
.catch(err => console.log(err))
}
},
// {
// label: '上架',
// type: 'text',
// formatter: rows =>
// rows.status === { ON: '上架', OF: '下架' }[rows.status],
// callback: (index, rows) => {
// const { id, status } = rows[index]
// this.$confirm(
// `确定${{ ON: '下架', OF: '上架' }[status]}该活动?`,
// '',
// {
// type: 'warning'
// }
// )
// .then(() => {
// this.updateActivity({
// id,
// status: { ON: 'OF', OF: 'ON' }[status]
// })
// })
// .catch(err => console.log(err))
// }
// },
{
type: '',
icon: 'el-icon-edit',
......@@ -207,9 +208,10 @@ export default {
type: 'warning'
})
.then(() => {
console.log(rows[index].id)
this.updateActivity({
id: rows[index].id,
deletedFlag: 'true'
deletedFlag: 'D'
})
})
.catch(err => this.error(err))
......@@ -269,6 +271,7 @@ export default {
})
},
updateActivity(param) {
console.log(param)
this.tableLoading = true
mergeActivity
.req(param)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!