areaList
This commit is contained in:
parent
2327f9ef5a
commit
c85839e311
@ -13,6 +13,9 @@ VUE_APP_LDAP_PWD = 'hhsxafTuUtVV'
|
|||||||
# upload
|
# upload
|
||||||
VUE_APP_UPLOAD = '/upload/cos'
|
VUE_APP_UPLOAD = '/upload/cos'
|
||||||
|
|
||||||
|
# area api
|
||||||
|
VUE_APP_MP = '/mp'
|
||||||
|
|
||||||
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
|
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
|
||||||
# to control whether the babel-plugin-dynamic-import-node plugin is enabled.
|
# to control whether the babel-plugin-dynamic-import-node plugin is enabled.
|
||||||
# It only does one thing by converting all import() to require().
|
# It only does one thing by converting all import() to require().
|
||||||
|
@ -13,3 +13,6 @@ VUE_APP_LDAP_PWD = 'hhsxafTuUtVV'
|
|||||||
|
|
||||||
# upload
|
# upload
|
||||||
VUE_APP_UPLOAD = 'http://ad.kingsome.cn/interface/cos_upload'
|
VUE_APP_UPLOAD = 'http://ad.kingsome.cn/interface/cos_upload'
|
||||||
|
|
||||||
|
# area api
|
||||||
|
VUE_APP_MP = 'http://mp.kingsome.cn/api/open'
|
@ -1,6 +1,7 @@
|
|||||||
// api文档: http://git.kingsome.cn/ops/promotion
|
// api文档: http://git.kingsome.cn/ops/promotion
|
||||||
|
|
||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
import requestMp from '@/utils/request-mp'
|
||||||
|
|
||||||
// 获取广告位置信息
|
// 获取广告位置信息
|
||||||
export function getAdPos(params) {
|
export function getAdPos(params) {
|
||||||
@ -48,3 +49,10 @@ export function delAd(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function getAdAreaList() {
|
||||||
|
return requestMp({
|
||||||
|
url: '/ad/get-area',
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
74
src/utils/request-mp.js
Normal file
74
src/utils/request-mp.js
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
import axios from 'axios'
|
||||||
|
import {MessageBox, Message} from 'element-ui'
|
||||||
|
import store from '@/store'
|
||||||
|
import {getToken} from '@/utils/auth'
|
||||||
|
import {encoded, decoded} from '@/utils/cryptor'
|
||||||
|
|
||||||
|
// create an axios instance
|
||||||
|
const service = axios.create({
|
||||||
|
baseURL: process.env.VUE_APP_MP, // url = base url + request url
|
||||||
|
// withCredentials: true, // send cookies when cross-domain requests
|
||||||
|
timeout: 5000, // request timeout
|
||||||
|
})
|
||||||
|
|
||||||
|
// request interceptor
|
||||||
|
service.interceptors.request.use(
|
||||||
|
config => {
|
||||||
|
// do something before request is sent
|
||||||
|
const token = store.getters.token
|
||||||
|
const username = store.getters.username
|
||||||
|
|
||||||
|
// if (decoded(token) !== username) {
|
||||||
|
// let each request carry token
|
||||||
|
// ['X-Token'] is a custom headers key
|
||||||
|
// please modify it according to the actual situation
|
||||||
|
// config.headers['X-Token'] = getToken()
|
||||||
|
// return Promise.reject('permission denied!')
|
||||||
|
// }
|
||||||
|
return config
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
// do something with request error
|
||||||
|
console.log(error) // for debug
|
||||||
|
return Promise.reject(error)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// response interceptor
|
||||||
|
service.interceptors.response.use(
|
||||||
|
/**
|
||||||
|
* If you want to get http information such as headers or status
|
||||||
|
* Please return response => response
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the request status by custom code
|
||||||
|
* Here is just an example
|
||||||
|
* You can also judge the status by HTTP Status Code
|
||||||
|
*/
|
||||||
|
response => {
|
||||||
|
const {data} = response
|
||||||
|
|
||||||
|
if (data.errcode !== 0) {
|
||||||
|
Message({
|
||||||
|
message: data.errmsg || 'error',
|
||||||
|
type: 'error',
|
||||||
|
duration: 5 * 1000,
|
||||||
|
})
|
||||||
|
return Promise.reject(data.errmsg || 'error')
|
||||||
|
} else {
|
||||||
|
return response
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
console.log('err' + error) // for debug
|
||||||
|
Message({
|
||||||
|
message: error.message,
|
||||||
|
type: 'error',
|
||||||
|
duration: 5 * 1000,
|
||||||
|
})
|
||||||
|
return Promise.reject(error)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export default service
|
@ -219,9 +219,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getAdPos, getAd, addAd, updateAd } from '@/api/ad'
|
import { getAdPos, getAd, addAd, updateAd, getAdAreaList } from '@/api/ad'
|
||||||
import { getGameList } from '@/api/game'
|
import { getGameList } from '@/api/game'
|
||||||
import { areaList, typeList, modeList } from '@/utils/ad-data'
|
import { typeList, modeList } from '@/utils/ad-data'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -292,10 +292,14 @@ export default {
|
|||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
// 位置相关数据导入
|
// 位置相关数据导入
|
||||||
this.areaList = areaList
|
|
||||||
this.modeList = modeList
|
this.modeList = modeList
|
||||||
this.typeList = typeList
|
this.typeList = typeList
|
||||||
|
|
||||||
|
const areaListRes = await this.getAdAreaList()
|
||||||
|
areaListRes.adAreaList.map(item => {
|
||||||
|
this.areaList[item.area_id] = item.name
|
||||||
|
})
|
||||||
|
|
||||||
// 获取所有可投放游戏
|
// 获取所有可投放游戏
|
||||||
const allGame = await this.getGameList()
|
const allGame = await this.getGameList()
|
||||||
this.allGame = allGame
|
this.allGame = allGame
|
||||||
@ -348,7 +352,6 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// common
|
// common
|
||||||
|
|
||||||
getGameList(params) {
|
getGameList(params) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
getGameList(params)
|
getGameList(params)
|
||||||
@ -362,6 +365,19 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getAdAreaList(params) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
getAdAreaList(params)
|
||||||
|
.then(res => {
|
||||||
|
const data = res.data
|
||||||
|
resolve(data)
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
reject(err)
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
resetForm(formName) {
|
resetForm(formName) {
|
||||||
this.$refs[formName].resetFields()
|
this.$refs[formName].resetFields()
|
||||||
},
|
},
|
||||||
|
@ -190,9 +190,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getAd, updateAd, delAd, getAdPos } from '@/api/ad'
|
import { getAd, updateAd, delAd, getAdPos, getAdAreaList } from '@/api/ad'
|
||||||
import { getGameList } from '@/api/game'
|
import { getGameList } from '@/api/game'
|
||||||
import { areaList, 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'
|
||||||
|
|
||||||
@ -235,10 +235,14 @@ export default {
|
|||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
// 位置相关数据导入
|
// 位置相关数据导入
|
||||||
this.areaList = areaList
|
|
||||||
this.modeList = modeList
|
this.modeList = modeList
|
||||||
this.typeList = typeList
|
this.typeList = typeList
|
||||||
|
|
||||||
|
const areaListRes = await this.getAdAreaList()
|
||||||
|
areaListRes.adAreaList.map(item => {
|
||||||
|
this.areaList[item.area_id] = item.name
|
||||||
|
})
|
||||||
|
|
||||||
const gameList = await this.getGameList()
|
const gameList = await this.getGameList()
|
||||||
gameList.map(item => {
|
gameList.map(item => {
|
||||||
const gameKey = `${item.game_id}`
|
const gameKey = `${item.game_id}`
|
||||||
@ -265,6 +269,19 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getAdAreaList(params) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
getAdAreaList(params)
|
||||||
|
.then(res => {
|
||||||
|
const data = res.data
|
||||||
|
resolve(data)
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
reject(err)
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
getAdPos(params) {
|
getAdPos(params) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
getAdPos(params)
|
getAdPos(params)
|
||||||
@ -364,7 +381,7 @@ export default {
|
|||||||
return cellValue
|
return cellValue
|
||||||
? moment(cellValue)
|
? moment(cellValue)
|
||||||
.utc()
|
.utc()
|
||||||
.zone(+0)
|
.utcOffset(+0)
|
||||||
.format('YYYY-MM-DD HH:mm:ss')
|
.format('YYYY-MM-DD HH:mm:ss')
|
||||||
: '-'
|
: '-'
|
||||||
},
|
},
|
||||||
|
@ -219,7 +219,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getAd, updateAd, delAd, getAdPos } from '@/api/ad'
|
import { getAd, updateAd, delAd, getAdPos, getAdAreaList } from '@/api/ad'
|
||||||
import { getGameList } from '@/api/game'
|
import { getGameList } from '@/api/game'
|
||||||
import { areaList, typeList, modeList } from '@/utils/ad-data'
|
import { areaList, typeList, modeList } from '@/utils/ad-data'
|
||||||
import { Promise, reject } from 'q'
|
import { Promise, reject } from 'q'
|
||||||
@ -264,10 +264,14 @@ export default {
|
|||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
// 位置相关数据导入
|
// 位置相关数据导入
|
||||||
this.areaList = areaList
|
|
||||||
this.modeList = modeList
|
this.modeList = modeList
|
||||||
this.typeList = typeList
|
this.typeList = typeList
|
||||||
|
|
||||||
|
const areaListRes = await this.getAdAreaList()
|
||||||
|
areaListRes.adAreaList.map(item => {
|
||||||
|
this.areaList[item.area_id] = item.name
|
||||||
|
})
|
||||||
|
|
||||||
const gameList = await this.getGameList()
|
const gameList = await this.getGameList()
|
||||||
|
|
||||||
gameList.map(item => {
|
gameList.map(item => {
|
||||||
@ -295,6 +299,19 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getAdAreaList(params) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
getAdAreaList(params)
|
||||||
|
.then(res => {
|
||||||
|
const data = res.data
|
||||||
|
resolve(data)
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
reject(err)
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
getGameList(params) {
|
getGameList(params) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
getGameList(params)
|
getGameList(params)
|
||||||
@ -488,7 +505,7 @@ export default {
|
|||||||
return cellValue
|
return cellValue
|
||||||
? moment(cellValue)
|
? moment(cellValue)
|
||||||
.utc()
|
.utc()
|
||||||
.zone(+0)
|
.utcOffset(+0)
|
||||||
.format('YYYY-MM-DD HH:mm:ss')
|
.format('YYYY-MM-DD HH:mm:ss')
|
||||||
: '-'
|
: '-'
|
||||||
},
|
},
|
||||||
@ -503,8 +520,6 @@ export default {
|
|||||||
},
|
},
|
||||||
formLocation(row, column, cellValue, index) {
|
formLocation(row, column, cellValue, index) {
|
||||||
const area = cellValue.split(',')
|
const area = cellValue.split(',')
|
||||||
|
|
||||||
console.log(this.areaList)
|
|
||||||
return `${this.areaList[area[0]]}-(${area[1]},${area[2]})-${
|
return `${this.areaList[area[0]]}-(${area[1]},${area[2]})-${
|
||||||
this.modeList[row.mode]
|
this.modeList[row.mode]
|
||||||
}`
|
}`
|
||||||
|
@ -60,6 +60,13 @@ module.exports = {
|
|||||||
'/upload': '',
|
'/upload': '',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
[process.env.VUE_APP_MP]: {
|
||||||
|
target: `http://192.168.100.90:2333/api/open`,
|
||||||
|
changeOrigin: true,
|
||||||
|
pathRewrite: {
|
||||||
|
'/mp': '',
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
configureWebpack: {
|
configureWebpack: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user