广告列表查询优化 编辑优化

This commit is contained in:
yulixing 2019-09-20 13:30:41 +08:00
parent f38a4a279b
commit f6c89dac3a
4 changed files with 110 additions and 51 deletions

View File

@ -5,8 +5,8 @@ source /etc/profile
npm install --prefer-offline --loglevel info --unsafe-perm=true --allow-root >> boundle.log npm install --prefer-offline --loglevel info --unsafe-perm=true --allow-root >> boundle.log
echo 'copy node_modules to /data/publish/node_packages' >> boundle.log echo 'copy node_modules to /data/publish/node_packages' >> boundle.log
npm run build:prod #npm run build:prod
#npm run build:stage npm run build:stage
cd ./dist/ && tar -zcvf pop-sys.tar.gz ./ cd ./dist/ && tar -zcvf pop-sys.tar.gz ./
cd .. cd ..

View File

@ -76,6 +76,16 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item
label="广告特征码"
prop="ad_property.jump_param"
>
<el-input
v-model="adForm.ad_property.jump_param"
class="w100"
:disabled="!writeable"
/>
</el-form-item>
<el-form-item <el-form-item
label="计划周期" label="计划周期"
prop="dateRange" prop="dateRange"
@ -200,17 +210,6 @@
> >
</el-switch> </el-switch>
</el-form-item> </el-form-item>
<el-form-item
label="跳转参数"
prop="ad_property.jump_param"
v-if="adForm.jump_status === 1"
>
<el-input
v-model="adForm.ad_property.jump_param"
class="w100"
:disabled="!writeable"
/>
</el-form-item>
<el-form-item <el-form-item
label="APPID" label="APPID"
prop="ad_property.appid" prop="ad_property.appid"
@ -345,16 +344,6 @@ export default {
...mapGetters(['username']), ...mapGetters(['username']),
}, },
data() { data() {
const validateJumpParams = (rule, value, callback) => {
if (
this.adForm.jump_status === 1 &&
this.adForm.ad_property.jump_param === ''
) {
callback(new Error('请填写跳转参数'))
} else {
callback()
}
}
const validateAppId = (rule, value, callback) => { const validateAppId = (rule, value, callback) => {
if ( if (
this.adForm.jump_status === 1 && this.adForm.jump_status === 1 &&
@ -418,14 +407,11 @@ export default {
ad_image: [ ad_image: [
{required: true, message: '请上传广告头像', trigger: 'blur'}, {required: true, message: '请上传广告头像', trigger: 'blur'},
], ],
jump_param: [
{required: true, validator: validateJumpParams, trigger: 'blur'},
],
ad_num: [ ad_num: [
{type: 'number', message: '计划数必须是数值', trigger: 'blur'}, {type: 'number', message: '计划数必须是数值', trigger: 'blur'},
], ],
'ad_property.jump_param': [ 'ad_property.jump_param': [
{required: true, validator: validateJumpParams, trigger: 'blur'}, {required: true, message: '请填写广告特征码ad_channel', trigger: 'blur'},
], ],
'ad_property.appid': [ 'ad_property.appid': [
{required: true, validator: validateAppId, trigger: 'blur'}, {required: true, validator: validateAppId, trigger: 'blur'},

View File

@ -36,9 +36,29 @@
label="暂停" label="暂停"
:value="3" :value="3"
/> />
<el-option <!-- <el-option
label="已删除" label="已删除"
:value="4" :value="4"
/> -->
</el-select>
</el-form-item>
<el-form-item
label="游戏"
prop="gameid"
>
<el-select
v-model="filterForm.gameid"
placeholder="请选择游戏"
>
<el-option
label="所有"
:value="''"
/>
<el-option
v-for="(val, key) in gameList"
:key="val"
:label="val"
:value="key"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -104,6 +124,19 @@
:formatter="formPlatform" :formatter="formPlatform"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column
prop="ad_image"
label="广告头像"
show-overflow-tooltip
>
<template slot-scope="scope">
<el-image
:src="scope.row.ad_image"
fit="cover"
style="width: 30px; height: 30px; vertical-align: middle;"
></el-image>
</template>
</el-table-column>
<el-table-column <el-table-column
prop="jump_status" prop="jump_status"
label="是否跳转" label="是否跳转"
@ -212,6 +245,7 @@ import {getGameList} from '@/api/game'
import {typeList, modeList} from '@/utils/ad-data' import {typeList, modeList} from '@/utils/ad-data'
import {Promise, reject} from 'q' import {Promise, reject} from 'q'
import moment from 'moment' import moment from 'moment'
import {filter} from 'minimatch'
export default { export default {
name: 'AdminAdList', name: 'AdminAdList',
@ -232,6 +266,7 @@ export default {
// filter // filter
filterForm: { filterForm: {
status: '', status: '',
gameid: ''
}, },
// toolbar // toolbar
batch: { batch: {
@ -254,7 +289,6 @@ export default {
this.modeList = modeList this.modeList = modeList
this.typeList = typeList this.typeList = typeList
const gameListRes = await this.getGameList() const gameListRes = await this.getGameList()
const gameList = gameListRes.gameList const gameList = gameListRes.gameList
@ -366,7 +400,10 @@ export default {
// table // table
async getData() { async getData() {
this.isLoaded = true this.isLoaded = true
const params = this.filterForm.status !== '' ? this.filterForm : {} const params = {}
if (this.filterForm.status !== '') params.status = this.filterForm.status
if (this.filterForm.gameid !== '') params.gameid = parseInt(this.filterForm.gameid)
try { try {
const data = await this.getAd(params) const data = await this.getAd(params)
this.tableData = data.message.sort((a, b) => { this.tableData = data.message.sort((a, b) => {
@ -456,7 +493,7 @@ export default {
this.$confirm(`是否启用【${row.name}】?`, '提示', { this.$confirm(`是否启用【${row.name}】?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning',
}) })
.then(async () => { .then(async () => {
const data = JSON.parse(JSON.stringify(row)) const data = JSON.parse(JSON.stringify(row))

View File

@ -35,9 +35,29 @@
label="暂停" label="暂停"
:value="3" :value="3"
/> />
<el-option <!-- <el-option
label="已删除" label="已删除"
:value="4" :value="4"
/> -->
</el-select>
</el-form-item>
<el-form-item
label="游戏"
prop="gameid"
>
<el-select
v-model="filterForm.gameid"
placeholder="请选择游戏"
>
<el-option
label="所有"
:value="''"
/>
<el-option
v-for="(val, key) in gameList"
:key="val"
:label="val"
:value="key"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -115,6 +135,19 @@
:formatter="formGame" :formatter="formGame"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column
prop="ad_image"
label="广告头像"
show-overflow-tooltip
>
<template slot-scope="scope">
<el-image
:src="scope.row.ad_image"
fit="cover"
style="width: 30px; height: 30px; vertical-align: middle;"
></el-image>
</template>
</el-table-column>
<el-table-column <el-table-column
prop="jump_status" prop="jump_status"
label="跳转" label="跳转"
@ -243,16 +276,17 @@ export default {
'0': '按固定次数推广', '0': '按固定次数推广',
'1': '个性化推荐', '1': '个性化推荐',
'2': '长期推广', '2': '长期推广',
'3': '系统默认推广' '3': '系统默认推广',
}, },
// filter // filter
filterForm: { filterForm: {
status: '' status: '',
gameid: '',
}, },
// toolbar // toolbar
batch: { batch: {
show: false, show: false,
txt: '批量操作' txt: '批量操作',
}, },
// table // table
tableData: [], tableData: [],
@ -262,7 +296,7 @@ export default {
// pagination // pagination
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 10,
total: 0 total: 0,
} }
}, },
async mounted() { async mounted() {
@ -398,7 +432,7 @@ export default {
{ {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning',
} }
) )
.then(async () => { .then(async () => {
@ -429,7 +463,7 @@ export default {
{ {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning',
} }
) )
.then(async () => { .then(async () => {
@ -460,7 +494,7 @@ export default {
{ {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning',
} }
) )
.then(async () => { .then(async () => {
@ -487,7 +521,9 @@ export default {
// table // table
async getData() { async getData() {
this.isLoaded = true this.isLoaded = true
const params = this.filterForm.status !== '' ? this.filterForm : {} const params = {}
if (this.filterForm.status !== '') params.status = this.filterForm.status
if (this.filterForm.gameid !== '') params.gameid = parseInt(this.filterForm.gameid)
try { try {
const data = await this.getAd(params) const data = await this.getAd(params)
this.tableData = data.message.sort((a, b) => { this.tableData = data.message.sort((a, b) => {
@ -533,7 +569,7 @@ export default {
this.$confirm(`是否通过【${row.name}】的审核申请?`, '提示', { this.$confirm(`是否通过【${row.name}】的审核申请?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning',
}) })
.then(async () => { .then(async () => {
const data = JSON.parse(JSON.stringify(row)) const data = JSON.parse(JSON.stringify(row))
@ -556,7 +592,7 @@ export default {
this.$confirm(`是否拒绝【${row.name}】的审核申请?`, '提示', { this.$confirm(`是否拒绝【${row.name}】的审核申请?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning',
}) })
.then(async () => { .then(async () => {
const data = JSON.parse(JSON.stringify(row)) const data = JSON.parse(JSON.stringify(row))
@ -579,7 +615,7 @@ export default {
this.$confirm(`是否暂停广告:【${row.name}】?`, '提示', { this.$confirm(`是否暂停广告:【${row.name}】?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning',
}) })
.then(async () => { .then(async () => {
const data = JSON.parse(JSON.stringify(row)) const data = JSON.parse(JSON.stringify(row))
@ -602,7 +638,7 @@ export default {
this.$confirm(`是否删除【${row.name}】的广告信息?`, '提示', { this.$confirm(`是否删除【${row.name}】的广告信息?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning',
}) })
.then(async () => { .then(async () => {
const data = {id: row.id} const data = {id: row.id}
@ -632,7 +668,7 @@ 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)
} },
} },
} }
</script> </script>