diff --git a/.env.development b/.env.development index f67b802..fa531aa 100644 --- a/.env.development +++ b/.env.development @@ -12,3 +12,6 @@ VUE_APP_BASE_API = '/api' # Detail: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js VUE_CLI_BABEL_TRANSPILE_MODULES = true + +# ops api +VUE_APP_OPS_API = '/ops' diff --git a/.env.production b/.env.production index 07d391e..fad937b 100644 --- a/.env.production +++ b/.env.production @@ -4,3 +4,5 @@ ENV = 'production' # base api VUE_APP_BASE_API = '/api' +# ops api +VUE_APP_OPS_API = 'http://ops.kingsome.cn/api/' \ No newline at end of file diff --git a/src/api/ad.js b/src/api/ad.js index 58f3026..1ba3a45 100644 --- a/src/api/ad.js +++ b/src/api/ad.js @@ -1,8 +1,10 @@ import request from '@/utils/request' +// ---------------------------------------------- // + export function getAdPosList(params) { return request({ - url: '/games/ad/get-pos', + url: '/games/ad/pos', method: 'get', params, }) @@ -10,7 +12,7 @@ export function getAdPosList(params) { export function addAdPos(data) { return request({ - url: '/games/ad/add-pos', + url: '/games/ad/pos', method: 'post', data, }) @@ -18,7 +20,7 @@ export function addAdPos(data) { export function modifyAdPos(data) { return request({ - url: '/games/ad/modify-pos', + url: '/games/ad/pos', method: 'put', data, }) @@ -26,22 +28,25 @@ export function modifyAdPos(data) { export function delAdPos(data) { return request({ - url: '/games/ad/del-pos', + url: '/games/ad/pos', method: 'delete', data, }) } +// ---------------------------------------------- // +// ---------------------------------------------- // + export function getAdAreaList() { return request({ - url: '/games/ad/get-area', + url: '/games/ad/area', method: 'get', }) } export function saveAdArea(data) { return request({ - url: '/games/ad/save-area', + url: '/games/ad/area', method: 'post', data, }) @@ -49,32 +54,34 @@ export function saveAdArea(data) { export function editAdArea(data) { return request({ - url: '/games/ad/edit-area', - method: 'post', + url: '/games/ad/area', + method: 'put', data, }) } export function delAdArea(data) { return request({ - url: '/games/ad/del-area', - method: 'post', + url: '/games/ad/area', + method: 'delete', data, }) } +// ---------------------------------------------- // +// ---------------------------------------------- // export function getAdUidList(params) { return request({ - url: '/games/ad/get-uid', + url: '/games/ad/uid', method: 'get', - params + params, }) } export function saveAdUid(data) { return request({ - url: '/games/ad/save-uid', + url: '/games/ad/uid', method: 'post', data, }) @@ -82,16 +89,18 @@ export function saveAdUid(data) { export function editAdUid(data) { return request({ - url: '/games/ad/edit-uid', - method: 'post', + url: '/games/ad/uid', + method: 'put', data, }) } export function delAdUid(data) { return request({ - url: '/games/ad/del-uid', - method: 'post', + url: '/games/ad/uid', + method: 'delete', data, }) } + +// ---------------------------------------------- // diff --git a/src/api/common.js b/src/api/common.js index 3866583..b4f6c09 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -1,32 +1,36 @@ import request from '@/utils/request' +// ---------------------------------------------- // + export function getRegions(params) { return request({ - url: '/common/loc/china_region/py_list_all', + url: '/common/loc/china_region', method: 'get', - params - }) -} - -export function saveArea(data) { - return request({ - url: '/common/loc/china_area/save', - method: 'post', - data - }) -} - -export function delArea(data) { - return request({ - url: '/common/loc/china_area/delete', - method: 'post', - data + params, }) } export function getAreas() { return request({ - url: '/common/loc/china_area/all', - method: 'get' + url: '/common/loc/china_area', + method: 'get', }) } + +export function saveArea(data) { + return request({ + url: '/common/loc/china_area', + method: 'post', + data, + }) +} + +export function delArea(data) { + return request({ + url: '/common/loc/china_area', + method: 'delete', + data, + }) +} + +// ---------------------------------------------- // diff --git a/src/api/lib.js b/src/api/lib.js index 8be4f39..7025022 100644 --- a/src/api/lib.js +++ b/src/api/lib.js @@ -2,7 +2,7 @@ import request from '@/utils/request' export function getMaterials(params) { return request({ - url: '/games/lib/list', + url: '/games/lib', method: 'get', params }) @@ -10,7 +10,7 @@ export function getMaterials(params) { export function saveMaterials(data) { return request({ - url: '/games/lib/save', + url: '/games/lib', method: 'post', data }) @@ -18,8 +18,8 @@ export function saveMaterials(data) { export function delMaterials(data) { return request({ - url: '/games/lib/del', - method: 'post', + url: '/games/lib', + method: 'delete', data }) } diff --git a/src/api/logs.js b/src/api/logs.js index b8ac74d..0982187 100644 --- a/src/api/logs.js +++ b/src/api/logs.js @@ -2,7 +2,7 @@ import request from '@/utils/request' export function getLogs(params) { return request({ - url: '/sys/logs/list', + url: '/sys/logs', method: 'get', params }) diff --git a/src/api/permission.js b/src/api/permission.js index 058fd9c..7b0b79f 100644 --- a/src/api/permission.js +++ b/src/api/permission.js @@ -2,23 +2,31 @@ import request from '@/utils/request' export function getPermList() { return request({ - url: '/sys/permission/list', - method: 'get' + url: '/sys/permission', + method: 'get', + }) +} + +export function savePerm(data) { + return request({ + url: `/sys/permission`, + method: 'post', + data, + }) +} + +export function updatePerm(data) { + return request({ + url: `/sys/permission`, + method: 'put', + data, }) } export function delPerm(data) { return request({ - url: '/sys/permission/del', - method: 'post', - data - }) -} - -export function savePerm(type, data) { - return request({ - url: `/sys/permission/${type}`, - method: 'post', - data + url: '/sys/permission', + method: 'delete', + data, }) } diff --git a/src/api/platforms.js b/src/api/platforms.js index e1a3c87..8d6516b 100644 --- a/src/api/platforms.js +++ b/src/api/platforms.js @@ -2,14 +2,14 @@ import request from '@/utils/request' export function getPlatformList() { return request({ - url: '/games/platforms/list', + url: '/games/platforms', method: 'get' }) } export function savePlatform(data) { return request({ - url: '/games/platforms/save', + url: '/games/platforms', method: 'post', data }) @@ -17,8 +17,8 @@ export function savePlatform(data) { export function editPlatform(data) { return request({ - url: '/games/platforms/edit', - method: 'post', + url: '/games/platforms', + method: 'put', data }) } diff --git a/src/api/reward.js b/src/api/reward.js index b4bbad0..337f1db 100644 --- a/src/api/reward.js +++ b/src/api/reward.js @@ -1,9 +1,11 @@ import request from '@/utils/request' +// ---------------------------------------------- // + // 获取奖励列表 export function getRewards(params) { return request({ - url: '/games/reward/list', + url: '/games/reward', method: 'get', params }) @@ -12,28 +14,60 @@ export function getRewards(params) { // 保存奖励 export function saveReward(data) { return request({ - url: '/games/reward/save', + url: '/games/reward', method: 'post', data }) } +// 切换状态 +export function updateRewards(data) { + return request({ + url: '/games/reward', + method: 'put', + data + }) +} + // 删除奖励 export function delRewards(data) { return request({ - url: '/games/reward/del', - method: 'post', + url: '/games/reward', + method: 'delete', data }) } -// 切换状态 -export function switchRewardsState(data) { +// ---------------------------------------------- // +// ---------------------------------------------- // + +// 获取客服奖励信息 +export function getKefuCfg(params) { return request({ - url: '/games/reward/switch', + url: '/games/reward/kefu-cfg', + method: 'get', + params + }) +} + +// 保存奖励 +export function saveKefuCfg(data) { + return request({ + url: '/games/reward/kefu-cfg', method: 'post', data }) } +// ---------------------------------------------- // +// ---------------------------------------------- // + +// 获取图片上传token +export function getOpsToken() { + return request({ + url: '/games/reward/ops-token', + method: 'get' + }) +} + diff --git a/src/views/games/details/data.vue b/src/views/games/details/data.vue index bc85a34..ee668a1 100644 --- a/src/views/games/details/data.vue +++ b/src/views/games/details/data.vue @@ -64,7 +64,7 @@ :key="key" > - {{key.toUpperCase()}} +

{{key.toUpperCase()}}

{ const { data } = res @@ -212,8 +219,12 @@ export default { box-sizing: border-box; padding: 16px; margin-bottom: 16px; - border: 1px solid #dcdfe6; + border: 1px solid #ebeef5; text-align: center; + cursor: pointer; + &:hover{ + box-shadow: 0 2px 12px 0 rgba(0,0,0,.1); + } .title, .key, .num { diff --git a/src/views/games/details/reward.vue b/src/views/games/details/reward.vue index 26da8dc..671b291 100644 --- a/src/views/games/details/reward.vue +++ b/src/views/games/details/reward.vue @@ -37,6 +37,9 @@ {{ batch.txt }}
+ + 客服配置 + 确 定
+ + + + + + + + + + + + + + + + 取 消 + 确 定 + + + @@ -290,7 +355,10 @@ import { getRewards, saveReward, delRewards, - switchRewardsState + updateRewards, + getKefuCfg, + saveKefuCfg, + getOpsToken } from '@/api/reward' import moment from 'moment' import { Promise, reject } from 'q' @@ -307,6 +375,7 @@ export default { isNew: false, isNewItem: false, isDev: true, + uploadUrl: '', // toolbar batch: { show: false, @@ -364,7 +433,20 @@ export default { } ] }, - curItem: 0 + curItem: 0, + // modal3 + opsToken: '', + kefuModalVisible: false, + kefuForm: { + msg_key: '', + img_url: '' + }, + kefuFormRules: { + msg_key: [ + { required: true, message: '请输入messageKey', trigger: 'blur' } + ], + img_url: [{ required: true, message: '请上传图片', trigger: 'blur' }] + } } }, computed: { @@ -379,6 +461,7 @@ export default { this.permPublish = this.userInfo.permissions.includes(`${this.uid}-publish`) || this.userInfo.permissions.includes(`games-writeable`) + this.uploadUrl = process.env.VUE_APP_OPS_API + '/upload/' this.getGameInfo(this.getRewards) }, methods: { @@ -391,6 +474,7 @@ export default { this.$route.meta.title = this.gameInfo.game_name document.title = getPageTitle(this.gameInfo.game_name) } + this.getKefuCfg() if (cb && cb instanceof Function) cb() }) .catch(err => { @@ -419,10 +503,39 @@ export default { console.log(err) }) }, + getOpsToken() { + return new Promise((resolve, reject) => { + getOpsToken() + .then(res => { + const data = res.data + data.errcode === 0 ? resolve(data.result) : reject(data.errmsg) + }) + .catch(err => { + reject(err) + }) + }) + }, + getKefuCfg() { + getKefuCfg({ + uid: this.uid, + game_id: this.gameInfo.game_id + }) + .then(res => { + const data = res.data + if (data.errcode === 0) { + if (data.result) { + this.kefuForm = JSON.parse(data.result) + } + } + }) + .catch(err => { + console.log(err) + }) + }, validateForm(formName) { return new Promise((resolve, reject) => { this.$refs[formName].validate(valid => { - valid ? resolve() : reject() + valid ? resolve(valid) : reject(valid) }) }) }, @@ -522,7 +635,7 @@ export default { type: 'warning' }) .then(() => { - switchRewardsState({ + updateRewards({ uid: this.gameInfo._id, ids: [row._id], type: true, @@ -550,7 +663,7 @@ export default { type: 'warning' }) .then(() => { - switchRewardsState({ + updateRewards({ uid: this.gameInfo._id, ids: [row._id], type: false, @@ -616,7 +729,7 @@ export default { } ) .then(() => { - switchRewardsState({ + updateRewards({ uid: this.gameInfo._id, ids: ids, type: true, @@ -655,7 +768,7 @@ export default { } ) .then(() => { - switchRewardsState({ + updateRewards({ uid: this.gameInfo._id, ids: ids, type: false, @@ -849,6 +962,64 @@ export default { .catch(() => { this.$message.error('请按要求填写表单!') }) + }, + openKefuModal() { + this.kefuModalVisible = true + }, + closeKefuModal() { + this.kefuModalVisible = false + this.$refs.kefuForm.clearValidate() + }, + uploadSuccess(res, file) { + this.kefuForm.img_url = res.files + this.$message.success('图片上传成功!') + }, + uploadErr() { + this.$message.error('图片上传失败!') + }, + async beforeUpload(file) { + const isPng = file.type === 'image/png' + + if (!isPng) { + this.$message.error('上传图片只能是 PNG 格式!') + } + + this.opsToken = await this.getOpsToken() + + return isPng && this.opsToken + }, + async saveKefuCfg() { + const valid = await this.validateForm('kefuForm') + if (!valid) { + this.$message.error('请按要求填写表单!') + return + } + let wxPlatInfo = {} + for (let i = 0; i < this.gameInfo.platforms.length; i++) { + const p = this.gameInfo.platforms[i] + if (p.platform.platform_id === '6001') { + wxPlatInfo = p + break + } + } + + saveKefuCfg({ + uid: this.uid, + game_id: this.gameInfo.game_id, + app_id: wxPlatInfo.app_id, + app_secret: wxPlatInfo.app_secret, + msg_key: this.kefuForm.msg_key, + img_url: this.kefuForm.img_url + }) + .then(res => { + const data = res.data + if (data.errcode === 0) { + this.$message.success('客服配置保存成功!') + } + }) + .catch(err => { + console.log(err) + }) } } } diff --git a/src/views/sys/permission.vue b/src/views/sys/permission.vue index a20200f..41e8709 100644 --- a/src/views/sys/permission.vue +++ b/src/views/sys/permission.vue @@ -2,13 +2,26 @@
-
- 创建角色 - 批量删除 +
+ 创建角色 + 批量删除 {{ batch.txt }}
- 刷新 + 刷新
@@ -21,78 +34,189 @@ @selection-change="tableSelectionChange" @row-click="rowClick" > - - - - - - + + + + + + - - - - - - + + + + + + - - + + - - + + - - + + - - - + + + - - - + + + @@ -100,7 +224,10 @@ 取 消 - 确 定 + 确 定
@@ -108,7 +235,7 @@