广告详情页修改
This commit is contained in:
parent
2a3658f756
commit
d7cdb1a889
@ -1,6 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<h2>投放设置<span style="font-size: 12px;" v-if="this.adForm.companyid && !writeable">(公司ID: {{this.adForm.companyid}})</span></h2>
|
<h2>投放设置<span
|
||||||
|
style="font-size: 12px;"
|
||||||
|
v-if="this.adForm.companyid && !writeable"
|
||||||
|
>(公司ID: {{this.adForm.companyid}})</span></h2>
|
||||||
|
|
||||||
<el-form
|
<el-form
|
||||||
ref="adForm"
|
ref="adForm"
|
||||||
@ -115,6 +118,8 @@
|
|||||||
:on-success="uploadSuccess"
|
:on-success="uploadSuccess"
|
||||||
:on-error="uploadErr"
|
:on-error="uploadErr"
|
||||||
:disabled="!writeable"
|
:disabled="!writeable"
|
||||||
|
:show-file-list="false"
|
||||||
|
:before-upload="beforeUpload"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
v-if="adForm.ad_image"
|
v-if="adForm.ad_image"
|
||||||
@ -126,6 +131,7 @@
|
|||||||
class="el-icon-plus uploader-icon"
|
class="el-icon-plus uploader-icon"
|
||||||
/>
|
/>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
|
<span class="ipt-tip" style="margin-top: 6px;">只能上传小于 600k 的图片</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
label="跳转链接"
|
label="跳转链接"
|
||||||
@ -225,33 +231,41 @@ export default {
|
|||||||
companyid: 0
|
companyid: 0
|
||||||
},
|
},
|
||||||
adFormRules: {
|
adFormRules: {
|
||||||
name: [{ required: true, message: '请输入公司名', trigger: 'blur' }],
|
name: [{ required: true, message: '请输入广告名称', trigger: 'blur' }],
|
||||||
gameid: [
|
gameid: [
|
||||||
{ required: true, message: '请输入联系人', trigger: 'blur' },
|
{ required: true, message: '请选择投放游戏', trigger: 'blur' }
|
||||||
{ type: 'number', message: '状态必须是数值', trigger: 'blur' }
|
|
||||||
],
|
],
|
||||||
locationid: [
|
locationid: [
|
||||||
{ required: true, message: '请输入联系人', trigger: 'blur' },
|
{ required: true, message: '请选择投放位置', trigger: 'blur' },
|
||||||
{ type: 'number', message: '状态必须是数值', trigger: 'blur' }
|
{ type: 'number', message: '投放位置必须是数值', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
ad_title: [
|
ad_title: [
|
||||||
{ required: true, message: '请输入联系人', trigger: 'blur' }
|
{ required: true, message: '请输入广告标题', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
ad_body: [
|
||||||
|
{ required: true, message: '请输入广告正文', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
ad_body: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
|
|
||||||
ad_image: [
|
ad_image: [
|
||||||
{ required: true, message: '请输入联系人', trigger: 'blur' }
|
{ required: true, message: '请上传广告头像', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
ad_url: [
|
||||||
|
{ required: true, message: '请输入跳转链接', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
ad_url: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
|
|
||||||
ad_num: [
|
ad_num: [
|
||||||
{ type: 'number', message: '状态必须是数值', trigger: 'blur' }
|
{ type: 'number', message: '计划书必须是数值', trigger: 'blur' }
|
||||||
],
|
]
|
||||||
status: [{ type: 'number', message: '状态必须是数值', trigger: 'blur' }]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
const gameList = await this.getGameList()
|
const gameList = await this.getGameList()
|
||||||
this.gameList = gameList
|
|
||||||
|
this.gameList = gameList.map(item => {
|
||||||
|
return {
|
||||||
|
game: `${item.game}(${item.platform_name})`,
|
||||||
|
game_id: `${item.game_id}:${item.platform_id}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const pos = await this.getAdPos()
|
const pos = await this.getAdPos()
|
||||||
this.locationList = pos.message.map(item => {
|
this.locationList = pos.message.map(item => {
|
||||||
@ -261,11 +275,15 @@ export default {
|
|||||||
return item
|
return item
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const roles = this.$store.getters.roles
|
||||||
|
const isAdmin = roles.includes('admin')
|
||||||
const username = this.$store.getters.username
|
const username = this.$store.getters.username
|
||||||
const companyResult = await this.getComList({ user: username })
|
const companyResult = await this.getComList({ user: username })
|
||||||
const company = companyResult.message[0]
|
const company = companyResult.message[0]
|
||||||
if (company && company.status === 1) {
|
if (company && company.status === 1) {
|
||||||
this.companyid = parseInt(company.id)
|
this.companyid = parseInt(company.id)
|
||||||
|
} else if (isAdmin) {
|
||||||
|
this.companyid = 0
|
||||||
} else {
|
} else {
|
||||||
this.$message.error('公司未通过审核,请先认证!')
|
this.$message.error('公司未通过审核,请先认证!')
|
||||||
this.$router.push('/company')
|
this.$router.push('/company')
|
||||||
@ -275,22 +293,17 @@ export default {
|
|||||||
if (ad_id) {
|
if (ad_id) {
|
||||||
const ad = await this.getAd({ id: ad_id })
|
const ad = await this.getAd({ id: ad_id })
|
||||||
const adData = JSON.parse(JSON.stringify(ad.message[0]))
|
const adData = JSON.parse(JSON.stringify(ad.message[0]))
|
||||||
console.log(adData)
|
|
||||||
adData.dateRange = [
|
adData.dateRange = [
|
||||||
this.formDate(adData.begin_time),
|
this.formDate(adData.begin_time),
|
||||||
this.formDate(adData.end_time)
|
this.formDate(adData.end_time)
|
||||||
]
|
]
|
||||||
|
|
||||||
this.adForm = adData
|
this.adForm = adData
|
||||||
|
|
||||||
console.log(this.adForm)
|
|
||||||
} else {
|
} else {
|
||||||
this.adForm.companyid = company ? parseInt(company.id) : 0
|
this.adForm.companyid = company ? parseInt(company.id) : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.writeable = this.companyid === this.adForm.companyid ? true : false
|
this.writeable = this.companyid === this.adForm.companyid ? true : false
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// common
|
// common
|
||||||
@ -389,9 +402,21 @@ export default {
|
|||||||
this.$router.go(-1)
|
this.$router.go(-1)
|
||||||
},
|
},
|
||||||
formDate(date) {
|
formDate(date) {
|
||||||
return moment(date).utc().zone(+0).format('YYYY-MM-DD HH:mm:ss')
|
return moment(date)
|
||||||
|
.utc()
|
||||||
|
.zone(+0)
|
||||||
|
.format('YYYY-MM-DD HH:mm:ss')
|
||||||
},
|
},
|
||||||
// form
|
// form
|
||||||
|
beforeUpload(file) {
|
||||||
|
|
||||||
|
const isLt600k = file.size / 1024 / 1024 < 0.6
|
||||||
|
|
||||||
|
if (!isLt600k) {
|
||||||
|
this.$message.error('广告头像不可超过 600k!')
|
||||||
|
}
|
||||||
|
return isLt600k
|
||||||
|
},
|
||||||
uploadSuccess(res, file) {
|
uploadSuccess(res, file) {
|
||||||
this.adForm.ad_image = res.message.url
|
this.adForm.ad_image = res.message.url
|
||||||
this.$message.success('图片上传成功!')
|
this.$message.success('图片上传成功!')
|
||||||
@ -409,7 +434,6 @@ export default {
|
|||||||
this.adForm.begin_time = this.adForm.dateRange[0]
|
this.adForm.begin_time = this.adForm.dateRange[0]
|
||||||
this.adForm.end_time = this.adForm.dateRange[1]
|
this.adForm.end_time = this.adForm.dateRange[1]
|
||||||
// delete this.adForm.dateRange
|
// delete this.adForm.dateRange
|
||||||
console.log('submit', this.adForm)
|
|
||||||
if (this.adForm.id) {
|
if (this.adForm.id) {
|
||||||
this.adForm.status = 0
|
this.adForm.status = 0
|
||||||
const result = await this.updateAd(this.adForm)
|
const result = await this.updateAd(this.adForm)
|
||||||
|
@ -167,6 +167,11 @@
|
|||||||
fixed="right"
|
fixed="right"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
@click.stop="view(scope.row)"
|
||||||
|
>详情</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="text"
|
type="text"
|
||||||
size="small"
|
size="small"
|
||||||
@ -249,7 +254,8 @@ export default {
|
|||||||
async mounted() {
|
async mounted() {
|
||||||
const gameList = await this.getGameList()
|
const gameList = await this.getGameList()
|
||||||
gameList.map(item => {
|
gameList.map(item => {
|
||||||
this.gameList[item.game_id] = item.game
|
const key = `${item.game_id}:${item.platform_id}`
|
||||||
|
this.gameList[key] = `${item.game}(${item.platform_name})`
|
||||||
})
|
})
|
||||||
|
|
||||||
const pos = await this.getAdPos()
|
const pos = await this.getAdPos()
|
||||||
@ -397,7 +403,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
formDate(row, column, cellValue, index) {
|
formDate(row, column, cellValue, index) {
|
||||||
return cellValue ? moment(cellValue).utc().zone(+0).format('YYYY-MM-DD HH:mm:ss') : '-'
|
return cellValue
|
||||||
|
? moment(cellValue)
|
||||||
|
.utc()
|
||||||
|
.zone(+0)
|
||||||
|
.format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
: '-'
|
||||||
},
|
},
|
||||||
formGame(row, column, cellValue, index) {
|
formGame(row, column, cellValue, index) {
|
||||||
return `${this.gameList[cellValue]}`
|
return `${this.gameList[cellValue]}`
|
||||||
@ -417,7 +428,6 @@ export default {
|
|||||||
view(row) {
|
view(row) {
|
||||||
this.$router.push(`/ad/edit?ad_id=${row.id}`)
|
this.$router.push(`/ad/edit?ad_id=${row.id}`)
|
||||||
},
|
},
|
||||||
|
|
||||||
del(row) {
|
del(row) {
|
||||||
this.$confirm(`是否删除【${row.name}】的广告信息?`, '提示', {
|
this.$confirm(`是否删除【${row.name}】的广告信息?`, '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
|
@ -259,8 +259,10 @@ export default {
|
|||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
const gameList = await this.getGameList()
|
const gameList = await this.getGameList()
|
||||||
|
|
||||||
gameList.map(item => {
|
gameList.map(item => {
|
||||||
this.gameList[item.game_id] = item.game
|
const key = `${item.game_id}:${item.platform_id}`
|
||||||
|
this.gameList[key] = `${item.game}(${item.platform_name})`
|
||||||
})
|
})
|
||||||
|
|
||||||
const pos = await this.getAdPos()
|
const pos = await this.getAdPos()
|
||||||
@ -474,7 +476,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
formDate(row, column, cellValue, index) {
|
formDate(row, column, cellValue, index) {
|
||||||
return cellValue ? moment(cellValue).utc().zone(+0).format('YYYY-MM-DD HH:mm:ss') : '-'
|
return cellValue
|
||||||
|
? moment(cellValue)
|
||||||
|
.utc()
|
||||||
|
.zone(+0)
|
||||||
|
.format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
: '-'
|
||||||
},
|
},
|
||||||
formGame(row, column, cellValue, index) {
|
formGame(row, column, cellValue, index) {
|
||||||
return `${this.gameList[cellValue]}`
|
return `${this.gameList[cellValue]}`
|
||||||
@ -492,8 +499,7 @@ export default {
|
|||||||
this.multipleSelection = val
|
this.multipleSelection = val
|
||||||
},
|
},
|
||||||
view(row) {
|
view(row) {
|
||||||
this.modalForm = JSON.parse(JSON.stringify(row))
|
this.$router.push(`/ad/edit?ad_id=${row.id}`)
|
||||||
this.openModal()
|
|
||||||
},
|
},
|
||||||
approve(row) {
|
approve(row) {
|
||||||
this.$confirm(`是否通过【${row.name}】的审核申请?`, '提示', {
|
this.$confirm(`是否通过【${row.name}】的审核申请?`, '提示', {
|
||||||
@ -598,27 +604,6 @@ export default {
|
|||||||
const start = this.pageSize * (this.currentPage - 1)
|
const start = this.pageSize * (this.currentPage - 1)
|
||||||
const end = this.pageSize * this.currentPage
|
const end = this.pageSize * this.currentPage
|
||||||
this.showData = this.tableData.slice(start, end)
|
this.showData = this.tableData.slice(start, end)
|
||||||
},
|
|
||||||
// modal
|
|
||||||
openModal() {
|
|
||||||
this.modalVisible = true
|
|
||||||
},
|
|
||||||
closeModal() {
|
|
||||||
this.modalVisible = false
|
|
||||||
this.clearValidate('modalForm')
|
|
||||||
},
|
|
||||||
async save() {
|
|
||||||
try {
|
|
||||||
const valid = await this.validate('modalForm')
|
|
||||||
if (valid) {
|
|
||||||
const result = await this.updateAd(this.modalForm)
|
|
||||||
this.closeModal()
|
|
||||||
this.refreshData()
|
|
||||||
this.$message.success('保存成功!')
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ module.exports = {
|
|||||||
// change xxx-api/login => mock/login
|
// change xxx-api/login => mock/login
|
||||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||||
[process.env.VUE_APP_BASE_API]: {
|
[process.env.VUE_APP_BASE_API]: {
|
||||||
target: `http://ad.kingsome.cn/`,
|
target: `http://154.8.214.202:5015/interface`,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
['^' + process.env.VUE_APP_BASE_API]: '',
|
['^' + process.env.VUE_APP_BASE_API]: '',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user