Commit 0fd2e333 authored by 张伯涛's avatar 张伯涛

bug修改

parent b6ddaf4e
...@@ -184,7 +184,17 @@ ...@@ -184,7 +184,17 @@
</el-form-item> </el-form-item>
<el-form-item label="链接地址:" prop="linkUrl"> <el-form-item label="链接地址:" prop="linkUrl">
<el-input v-model.trim="form.linkUrl" show-word-limit :maxlength="255" placeholder="请输入链接地址" /> <div style="display: flex">
<el-select v-model="addressType" style="width: 20%">
<el-option
v-for="(item,index) in addressTypeOptions"
:key="index"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-input v-model.trim="form.linkUrl" show-word-limit :maxlength="255" placeholder="请输入链接地址" @blur="linkUrlBlur" />
</div>
</el-form-item> </el-form-item>
<el-form-item label="排序:" prop="weight"> <el-form-item label="排序:" prop="weight">
<el-input-number v-model.trim="form.weight" style="width: 100%" controls-position="right" :min="0" /> <el-input-number v-model.trim="form.weight" style="width: 100%" controls-position="right" :min="0" />
...@@ -294,8 +304,20 @@ export default { ...@@ -294,8 +304,20 @@ export default {
}, },
showImg: false, showImg: false,
imagUrl: '', imagUrl: '',
addressType: '1',
// 表单参数 // 表单参数
form: {}, form: {
bannerName: '',
bannerPicture: '',
linkUrl: '',
weight: '',
flag: '1',
type: '1'
},
addressTypeOptions: [
{ value: '1', label: 'http://' },
{ value: '2', label: 'https://' }
],
ruleForm: { ruleForm: {
shops: [], shops: [],
row: '' row: ''
...@@ -472,14 +494,14 @@ export default { ...@@ -472,14 +494,14 @@ export default {
reset() { reset() {
this.form = { this.form = {
businessId: undefined, businessId: undefined,
bannerPicture: undefined, bannerName: '',
bannerName: undefined, bannerPicture: '',
type: undefined, linkUrl: '',
weight: undefined, weight: '',
remarks: undefined, flag: '1',
linkUrl: undefined, type: '1'
flag: '1'
} }
this.addressType = '1',
this.resetForm('form') this.resetForm('form')
}, },
/** 查询按钮操作 */ /** 查询按钮操作 */
...@@ -509,7 +531,14 @@ export default { ...@@ -509,7 +531,14 @@ export default {
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset() this.reset()
this.form = { ...row } this.form = JSON.parse(JSON.stringify(row))
if (this.form.linkUrl && (this.form.linkUrl.indexOf('http://') !== -1 || this.form.linkUrl.indexOf('https://') !== -1)) {
this.addressType = this.form.linkUrl.split('//')[0] === 'http:' ? '1' : '2'
this.form.linkUrl = this.form.linkUrl.split('//')[1]
} else {
this.addressType = '1'
this.form.linkUrl = ''
}
this.imageUrl = row.url this.imageUrl = row.url
this.open = true this.open = true
this.title = '修改banner' this.title = '修改banner'
...@@ -532,6 +561,12 @@ export default { ...@@ -532,6 +561,12 @@ export default {
row.flag = row.flag === '0' ? '1' : '0' row.flag = row.flag === '0' ? '1' : '0'
}) })
}, },
/** 链接地址blur事件*/
linkUrlBlur() {
if (this.form.linkUrl.indexOf('http://') !== -1 || this.form.linkUrl.indexOf('https://') !== -1) {
this.form.linkUrl = this.form.linkUrl.split('//')[1]
}
},
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
...@@ -542,9 +577,16 @@ export default { ...@@ -542,9 +577,16 @@ export default {
this.form.unitId = unitId this.form.unitId = unitId
} }
if (this.form.businessId !== undefined) { if (this.form.businessId !== undefined) {
const typeName = this.addressType === '1' ? 'http://' : 'https://'
const temp = { const temp = {
bannerId: this.form.businessId, businessId: this.form.businessId,
...this.form // ...this.form
bannerName: this.form.bannerName,
bannerPicture: this.form.bannerPicture,
linkUrl: this.form.linkUrl ? typeName + this.form.linkUrl : '',
weight: this.form.weight,
flag: this.form.flag,
type: this.form.type
} }
updateCmsBanner(temp).then(response => { updateCmsBanner(temp).then(response => {
this.msgSuccess('修改成功') this.msgSuccess('修改成功')
...@@ -552,7 +594,16 @@ export default { ...@@ -552,7 +594,16 @@ export default {
this.getList() this.getList()
}) })
} else { } else {
addCmsBanner(this.form).then(response => { const typeName = this.addressType === '1' ? 'http://' : 'https://'
const params = {
bannerName: this.form.bannerName,
bannerPicture: this.form.bannerPicture,
linkUrl: this.form.linkUrl ? typeName + this.form.linkUrl : '',
weight: this.form.weight,
flag: this.form.flag,
type: this.form.type
}
addCmsBanner(params).then(response => {
this.msgSuccess('新增成功') this.msgSuccess('新增成功')
this.open = false this.open = false
this.getList() this.getList()
......
...@@ -833,7 +833,9 @@ ...@@ -833,7 +833,9 @@
drag drag
:show-file-list="true" :show-file-list="true"
:file-list="files" :file-list="files"
:limit="1"
:http-request="handleUploadAddFile" :http-request="handleUploadAddFile"
:on-exceed="handleExceed"
:on-remove="handleRemoveAddFile" :on-remove="handleRemoveAddFile"
> >
<i class="el-icon-upload" /> <i class="el-icon-upload" />
...@@ -1151,6 +1153,10 @@ export default { ...@@ -1151,6 +1153,10 @@ export default {
this.saveFile = file.file this.saveFile = file.file
this.$refs.formModel.clearValidate('file') this.$refs.formModel.clearValidate('file')
}, },
/** 超出数量限制的回调*/
handleExceed() {
this.$message.warning('只能上传一个文件!')
},
/** 新增的附件上传删除*/ /** 新增的附件上传删除*/
handleRemoveAddFile() { handleRemoveAddFile() {
console.log('remove') console.log('remove')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment