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

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
echo 'copy node_modules to /data/publish/node_packages' >> boundle.log
npm run build:prod
#npm run build:stage
#npm run build:prod
npm run build:stage
cd ./dist/ && tar -zcvf pop-sys.tar.gz ./
cd ..

View File

@ -76,6 +76,16 @@
/>
</el-select>
</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
label="计划周期"
prop="dateRange"
@ -200,17 +210,6 @@
>
</el-switch>
</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
label="APPID"
prop="ad_property.appid"
@ -345,16 +344,6 @@ export default {
...mapGetters(['username']),
},
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) => {
if (
this.adForm.jump_status === 1 &&
@ -418,14 +407,11 @@ export default {
ad_image: [
{required: true, message: '请上传广告头像', trigger: 'blur'},
],
jump_param: [
{required: true, validator: validateJumpParams, trigger: 'blur'},
],
ad_num: [
{type: 'number', message: '计划数必须是数值', trigger: 'blur'},
],
'ad_property.jump_param': [
{required: true, validator: validateJumpParams, trigger: 'blur'},
{required: true, message: '请填写广告特征码ad_channel', trigger: 'blur'},
],
'ad_property.appid': [
{required: true, validator: validateAppId, trigger: 'blur'},

View File

@ -36,9 +36,29 @@
label="暂停"
:value="3"
/>
<el-option
<!-- <el-option
label="已删除"
: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-form-item>
@ -104,6 +124,19 @@
:formatter="formPlatform"
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
prop="jump_status"
label="是否跳转"
@ -212,6 +245,7 @@ import {getGameList} from '@/api/game'
import {typeList, modeList} from '@/utils/ad-data'
import {Promise, reject} from 'q'
import moment from 'moment'
import {filter} from 'minimatch'
export default {
name: 'AdminAdList',
@ -232,6 +266,7 @@ export default {
// filter
filterForm: {
status: '',
gameid: ''
},
// toolbar
batch: {
@ -254,7 +289,6 @@ export default {
this.modeList = modeList
this.typeList = typeList
const gameListRes = await this.getGameList()
const gameList = gameListRes.gameList
@ -366,7 +400,10 @@ export default {
// table
async getData() {
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 {
const data = await this.getAd(params)
this.tableData = data.message.sort((a, b) => {
@ -456,7 +493,7 @@ export default {
this.$confirm(`是否启用【${row.name}】?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
type: 'warning',
})
.then(async () => {
const data = JSON.parse(JSON.stringify(row))

View File

@ -35,9 +35,29 @@
label="暂停"
:value="3"
/>
<el-option
<!-- <el-option
label="已删除"
: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-form-item>
@ -115,6 +135,19 @@
:formatter="formGame"
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
prop="jump_status"
label="跳转"
@ -223,10 +256,10 @@
</template>
<script>
import { getAd, updateAd, delAd, getAdPos, getAdAreaList } from '@/api/ad'
import { getGameList } from '@/api/game'
import { typeList, modeList } from '@/utils/ad-data'
import { Promise, reject } from 'q'
import {getAd, updateAd, delAd, getAdPos, getAdAreaList} from '@/api/ad'
import {getGameList} from '@/api/game'
import {typeList, modeList} from '@/utils/ad-data'
import {Promise, reject} from 'q'
import moment from 'moment'
export default {
@ -243,16 +276,17 @@ export default {
'0': '按固定次数推广',
'1': '个性化推荐',
'2': '长期推广',
'3': '系统默认推广'
'3': '系统默认推广',
},
// filter
filterForm: {
status: ''
status: '',
gameid: '',
},
// toolbar
batch: {
show: false,
txt: '批量操作'
txt: '批量操作',
},
// table
tableData: [],
@ -262,7 +296,7 @@ export default {
// pagination
currentPage: 1,
pageSize: 10,
total: 0
total: 0,
}
},
async mounted() {
@ -398,7 +432,7 @@ export default {
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
type: 'warning',
}
)
.then(async () => {
@ -429,7 +463,7 @@ export default {
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
type: 'warning',
}
)
.then(async () => {
@ -460,7 +494,7 @@ export default {
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
type: 'warning',
}
)
.then(async () => {
@ -487,7 +521,9 @@ export default {
// table
async getData() {
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 {
const data = await this.getAd(params)
this.tableData = data.message.sort((a, b) => {
@ -533,7 +569,7 @@ export default {
this.$confirm(`是否通过【${row.name}】的审核申请?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
type: 'warning',
})
.then(async () => {
const data = JSON.parse(JSON.stringify(row))
@ -556,7 +592,7 @@ export default {
this.$confirm(`是否拒绝【${row.name}】的审核申请?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
type: 'warning',
})
.then(async () => {
const data = JSON.parse(JSON.stringify(row))
@ -579,7 +615,7 @@ export default {
this.$confirm(`是否暂停广告:【${row.name}】?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
type: 'warning',
})
.then(async () => {
const data = JSON.parse(JSON.stringify(row))
@ -602,10 +638,10 @@ export default {
this.$confirm(`是否删除【${row.name}】的广告信息?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
type: 'warning',
})
.then(async () => {
const data = { id: row.id }
const data = {id: row.id}
try {
const result = await this.delAd(data)
@ -632,7 +668,7 @@ export default {
const start = this.pageSize * (this.currentPage - 1)
const end = this.pageSize * this.currentPage
this.showData = this.tableData.slice(start, end)
}
}
},
},
}
</script>