客服设置
This commit is contained in:
parent
294a8d796f
commit
6b6f543354
@ -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
|
# Detail: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js
|
||||||
|
|
||||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||||
|
|
||||||
|
# ops api
|
||||||
|
VUE_APP_OPS_API = '/ops'
|
||||||
|
@ -4,3 +4,5 @@ ENV = 'production'
|
|||||||
# base api
|
# base api
|
||||||
VUE_APP_BASE_API = '/api'
|
VUE_APP_BASE_API = '/api'
|
||||||
|
|
||||||
|
# ops api
|
||||||
|
VUE_APP_OPS_API = 'http://ops.kingsome.cn/api/'
|
@ -1,8 +1,10 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// ---------------------------------------------- //
|
||||||
|
|
||||||
export function getAdPosList(params) {
|
export function getAdPosList(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/ad/get-pos',
|
url: '/games/ad/pos',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params,
|
params,
|
||||||
})
|
})
|
||||||
@ -10,7 +12,7 @@ export function getAdPosList(params) {
|
|||||||
|
|
||||||
export function addAdPos(data) {
|
export function addAdPos(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/ad/add-pos',
|
url: '/games/ad/pos',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
@ -18,7 +20,7 @@ export function addAdPos(data) {
|
|||||||
|
|
||||||
export function modifyAdPos(data) {
|
export function modifyAdPos(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/ad/modify-pos',
|
url: '/games/ad/pos',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
@ -26,22 +28,25 @@ export function modifyAdPos(data) {
|
|||||||
|
|
||||||
export function delAdPos(data) {
|
export function delAdPos(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/ad/del-pos',
|
url: '/games/ad/pos',
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------- //
|
||||||
|
// ---------------------------------------------- //
|
||||||
|
|
||||||
export function getAdAreaList() {
|
export function getAdAreaList() {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/ad/get-area',
|
url: '/games/ad/area',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function saveAdArea(data) {
|
export function saveAdArea(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/ad/save-area',
|
url: '/games/ad/area',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
@ -49,32 +54,34 @@ export function saveAdArea(data) {
|
|||||||
|
|
||||||
export function editAdArea(data) {
|
export function editAdArea(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/ad/edit-area',
|
url: '/games/ad/area',
|
||||||
method: 'post',
|
method: 'put',
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function delAdArea(data) {
|
export function delAdArea(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/ad/del-area',
|
url: '/games/ad/area',
|
||||||
method: 'post',
|
method: 'delete',
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------- //
|
||||||
|
// ---------------------------------------------- //
|
||||||
|
|
||||||
export function getAdUidList(params) {
|
export function getAdUidList(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/ad/get-uid',
|
url: '/games/ad/uid',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params
|
params,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function saveAdUid(data) {
|
export function saveAdUid(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/ad/save-uid',
|
url: '/games/ad/uid',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
@ -82,16 +89,18 @@ export function saveAdUid(data) {
|
|||||||
|
|
||||||
export function editAdUid(data) {
|
export function editAdUid(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/ad/edit-uid',
|
url: '/games/ad/uid',
|
||||||
method: 'post',
|
method: 'put',
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function delAdUid(data) {
|
export function delAdUid(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/ad/del-uid',
|
url: '/games/ad/uid',
|
||||||
method: 'post',
|
method: 'delete',
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------- //
|
||||||
|
@ -1,32 +1,36 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// ---------------------------------------------- //
|
||||||
|
|
||||||
export function getRegions(params) {
|
export function getRegions(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/common/loc/china_region/py_list_all',
|
url: '/common/loc/china_region',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params
|
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
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getAreas() {
|
export function getAreas() {
|
||||||
return request({
|
return request({
|
||||||
url: '/common/loc/china_area/all',
|
url: '/common/loc/china_area',
|
||||||
method: 'get'
|
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,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------- //
|
||||||
|
@ -2,7 +2,7 @@ import request from '@/utils/request'
|
|||||||
|
|
||||||
export function getMaterials(params) {
|
export function getMaterials(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/lib/list',
|
url: '/games/lib',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params
|
params
|
||||||
})
|
})
|
||||||
@ -10,7 +10,7 @@ export function getMaterials(params) {
|
|||||||
|
|
||||||
export function saveMaterials(data) {
|
export function saveMaterials(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/lib/save',
|
url: '/games/lib',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
@ -18,8 +18,8 @@ export function saveMaterials(data) {
|
|||||||
|
|
||||||
export function delMaterials(data) {
|
export function delMaterials(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/lib/del',
|
url: '/games/lib',
|
||||||
method: 'post',
|
method: 'delete',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ import request from '@/utils/request'
|
|||||||
|
|
||||||
export function getLogs(params) {
|
export function getLogs(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/sys/logs/list',
|
url: '/sys/logs',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params
|
params
|
||||||
})
|
})
|
||||||
|
@ -2,23 +2,31 @@ import request from '@/utils/request'
|
|||||||
|
|
||||||
export function getPermList() {
|
export function getPermList() {
|
||||||
return request({
|
return request({
|
||||||
url: '/sys/permission/list',
|
url: '/sys/permission',
|
||||||
method: 'get'
|
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) {
|
export function delPerm(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/sys/permission/del',
|
url: '/sys/permission',
|
||||||
method: 'post',
|
method: 'delete',
|
||||||
data
|
data,
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function savePerm(type, data) {
|
|
||||||
return request({
|
|
||||||
url: `/sys/permission/${type}`,
|
|
||||||
method: 'post',
|
|
||||||
data
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,14 @@ import request from '@/utils/request'
|
|||||||
|
|
||||||
export function getPlatformList() {
|
export function getPlatformList() {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/platforms/list',
|
url: '/games/platforms',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function savePlatform(data) {
|
export function savePlatform(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/platforms/save',
|
url: '/games/platforms',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
@ -17,8 +17,8 @@ export function savePlatform(data) {
|
|||||||
|
|
||||||
export function editPlatform(data) {
|
export function editPlatform(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/platforms/edit',
|
url: '/games/platforms',
|
||||||
method: 'post',
|
method: 'put',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// ---------------------------------------------- //
|
||||||
|
|
||||||
// 获取奖励列表
|
// 获取奖励列表
|
||||||
export function getRewards(params) {
|
export function getRewards(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/reward/list',
|
url: '/games/reward',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params
|
params
|
||||||
})
|
})
|
||||||
@ -12,28 +14,60 @@ export function getRewards(params) {
|
|||||||
// 保存奖励
|
// 保存奖励
|
||||||
export function saveReward(data) {
|
export function saveReward(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/reward/save',
|
url: '/games/reward',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 切换状态
|
||||||
|
export function updateRewards(data) {
|
||||||
|
return request({
|
||||||
|
url: '/games/reward',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 删除奖励
|
// 删除奖励
|
||||||
export function delRewards(data) {
|
export function delRewards(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/reward/del',
|
url: '/games/reward',
|
||||||
method: 'post',
|
method: 'delete',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 切换状态
|
// ---------------------------------------------- //
|
||||||
export function switchRewardsState(data) {
|
// ---------------------------------------------- //
|
||||||
|
|
||||||
|
// 获取客服奖励信息
|
||||||
|
export function getKefuCfg(params) {
|
||||||
return request({
|
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',
|
method: 'post',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------- //
|
||||||
|
// ---------------------------------------------- //
|
||||||
|
|
||||||
|
// 获取图片上传token
|
||||||
|
export function getOpsToken() {
|
||||||
|
return request({
|
||||||
|
url: '/games/reward/ops-token',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
:key="key"
|
:key="key"
|
||||||
>
|
>
|
||||||
|
|
||||||
<el-divider v-if="val.length > 0">{{key.toUpperCase()}}</el-divider>
|
<h2 v-if="val.length > 0">{{key.toUpperCase()}}</h2>
|
||||||
<el-row :gutter="16">
|
<el-row :gutter="16">
|
||||||
<el-col
|
<el-col
|
||||||
:span="6"
|
:span="6"
|
||||||
@ -168,12 +168,19 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getData() {
|
getData() {
|
||||||
getReport({
|
console.log({
|
||||||
uid: this.uid,
|
uid: this.uid,
|
||||||
game_id: 1004, // TODO: this.gameInfo.game_id
|
game_id: 1004, // TODO: this.gameInfo.game_id
|
||||||
platform_id: this.platform_id, // TODO: this.platform_id
|
platform_id: this.platform_id, // TODO: this.platform_id
|
||||||
date: this.date, // TODO: this.date
|
date: this.date, // TODO: this.date
|
||||||
isNew: this.isNew
|
isNew: this.isNew
|
||||||
|
})
|
||||||
|
getReport({
|
||||||
|
uid: this.uid,
|
||||||
|
game_id: 1004, // TODO: this.gameInfo.game_id
|
||||||
|
platform_id: 6001, // TODO: this.platform_id
|
||||||
|
date: this.date, // TODO: this.date
|
||||||
|
isNew: this.isNew
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const { data } = res
|
const { data } = res
|
||||||
@ -212,8 +219,12 @@ export default {
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
border: 1px solid #dcdfe6;
|
border: 1px solid #ebeef5;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover{
|
||||||
|
box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
|
||||||
|
}
|
||||||
.title,
|
.title,
|
||||||
.key,
|
.key,
|
||||||
.num {
|
.num {
|
||||||
|
@ -37,6 +37,9 @@
|
|||||||
<el-button @click="batchOpt"> {{ batch.txt }} </el-button>
|
<el-button @click="batchOpt"> {{ batch.txt }} </el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="r fr">
|
<div class="r fr">
|
||||||
|
<el-button @click="openKefuModal">
|
||||||
|
客服配置
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="refreshData"
|
@click="refreshData"
|
||||||
@ -279,6 +282,68 @@
|
|||||||
>确 定</el-button>
|
>确 定</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<!-- Modal3 -->
|
||||||
|
<el-dialog
|
||||||
|
title="客服配置"
|
||||||
|
:visible.sync="kefuModalVisible"
|
||||||
|
width="40%"
|
||||||
|
:before-close="closeKefuModal"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="kefuForm"
|
||||||
|
:model="kefuForm"
|
||||||
|
:rules="kefuFormRules"
|
||||||
|
label-width="120px"
|
||||||
|
>
|
||||||
|
<el-form-item
|
||||||
|
label="图片"
|
||||||
|
prop="img_url"
|
||||||
|
class="uploader-box"
|
||||||
|
>
|
||||||
|
<el-upload
|
||||||
|
ref="upload"
|
||||||
|
class="uploader"
|
||||||
|
:action="uploadUrl"
|
||||||
|
:show-file-list="false"
|
||||||
|
:on-success="uploadSuccess"
|
||||||
|
:on-error="uploadErr"
|
||||||
|
:before-upload="beforeUpload"
|
||||||
|
:headers="{
|
||||||
|
authorization: 'Bearer ' + opsToken
|
||||||
|
}"
|
||||||
|
name="image-file"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
v-if="kefuForm.img_url"
|
||||||
|
class="uploader-img"
|
||||||
|
:src="kefuForm.img_url[0]"
|
||||||
|
/>
|
||||||
|
<i
|
||||||
|
v-else
|
||||||
|
class="el-icon-plus uploader-icon"
|
||||||
|
/>
|
||||||
|
</el-upload>
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
label="Message Key"
|
||||||
|
prop="msg_key"
|
||||||
|
>
|
||||||
|
<el-input v-model="kefuForm.msg_key" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span
|
||||||
|
slot="footer"
|
||||||
|
class="dialog-footer"
|
||||||
|
>
|
||||||
|
<el-button @click="closeKefuModal">取 消</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="saveKefuCfg"
|
||||||
|
>确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -290,7 +355,10 @@ import {
|
|||||||
getRewards,
|
getRewards,
|
||||||
saveReward,
|
saveReward,
|
||||||
delRewards,
|
delRewards,
|
||||||
switchRewardsState
|
updateRewards,
|
||||||
|
getKefuCfg,
|
||||||
|
saveKefuCfg,
|
||||||
|
getOpsToken
|
||||||
} from '@/api/reward'
|
} from '@/api/reward'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import { Promise, reject } from 'q'
|
import { Promise, reject } from 'q'
|
||||||
@ -307,6 +375,7 @@ export default {
|
|||||||
isNew: false,
|
isNew: false,
|
||||||
isNewItem: false,
|
isNewItem: false,
|
||||||
isDev: true,
|
isDev: true,
|
||||||
|
uploadUrl: '',
|
||||||
// toolbar
|
// toolbar
|
||||||
batch: {
|
batch: {
|
||||||
show: false,
|
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: {
|
computed: {
|
||||||
@ -379,6 +461,7 @@ export default {
|
|||||||
this.permPublish =
|
this.permPublish =
|
||||||
this.userInfo.permissions.includes(`${this.uid}-publish`) ||
|
this.userInfo.permissions.includes(`${this.uid}-publish`) ||
|
||||||
this.userInfo.permissions.includes(`games-writeable`)
|
this.userInfo.permissions.includes(`games-writeable`)
|
||||||
|
this.uploadUrl = process.env.VUE_APP_OPS_API + '/upload/'
|
||||||
this.getGameInfo(this.getRewards)
|
this.getGameInfo(this.getRewards)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -391,6 +474,7 @@ export default {
|
|||||||
this.$route.meta.title = this.gameInfo.game_name
|
this.$route.meta.title = this.gameInfo.game_name
|
||||||
document.title = getPageTitle(this.gameInfo.game_name)
|
document.title = getPageTitle(this.gameInfo.game_name)
|
||||||
}
|
}
|
||||||
|
this.getKefuCfg()
|
||||||
if (cb && cb instanceof Function) cb()
|
if (cb && cb instanceof Function) cb()
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
@ -419,10 +503,39 @@ export default {
|
|||||||
console.log(err)
|
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) {
|
validateForm(formName) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.$refs[formName].validate(valid => {
|
this.$refs[formName].validate(valid => {
|
||||||
valid ? resolve() : reject()
|
valid ? resolve(valid) : reject(valid)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -522,7 +635,7 @@ export default {
|
|||||||
type: 'warning'
|
type: 'warning'
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
switchRewardsState({
|
updateRewards({
|
||||||
uid: this.gameInfo._id,
|
uid: this.gameInfo._id,
|
||||||
ids: [row._id],
|
ids: [row._id],
|
||||||
type: true,
|
type: true,
|
||||||
@ -550,7 +663,7 @@ export default {
|
|||||||
type: 'warning'
|
type: 'warning'
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
switchRewardsState({
|
updateRewards({
|
||||||
uid: this.gameInfo._id,
|
uid: this.gameInfo._id,
|
||||||
ids: [row._id],
|
ids: [row._id],
|
||||||
type: false,
|
type: false,
|
||||||
@ -616,7 +729,7 @@ export default {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
switchRewardsState({
|
updateRewards({
|
||||||
uid: this.gameInfo._id,
|
uid: this.gameInfo._id,
|
||||||
ids: ids,
|
ids: ids,
|
||||||
type: true,
|
type: true,
|
||||||
@ -655,7 +768,7 @@ export default {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
switchRewardsState({
|
updateRewards({
|
||||||
uid: this.gameInfo._id,
|
uid: this.gameInfo._id,
|
||||||
ids: ids,
|
ids: ids,
|
||||||
type: false,
|
type: false,
|
||||||
@ -849,6 +962,64 @@ export default {
|
|||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$message.error('请按要求填写表单!')
|
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)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,26 @@
|
|||||||
<div class="app-container p-sys-permission">
|
<div class="app-container p-sys-permission">
|
||||||
<!-- toolbar -->
|
<!-- toolbar -->
|
||||||
<div class="toolbar clearfix">
|
<div class="toolbar clearfix">
|
||||||
<div v-if="permWriteable" class="l fl">
|
<div
|
||||||
<el-button type="primary" @click="createRole">创建角色</el-button>
|
v-if="permWriteable"
|
||||||
<el-button v-if="batch.show" type="danger" @click="batchDel">批量删除</el-button>
|
class="l fl"
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="createRole"
|
||||||
|
>创建角色</el-button>
|
||||||
|
<el-button
|
||||||
|
v-if="batch.show"
|
||||||
|
type="danger"
|
||||||
|
@click="batchDel"
|
||||||
|
>批量删除</el-button>
|
||||||
<el-button @click="batchOpt">{{ batch.txt }}</el-button>
|
<el-button @click="batchOpt">{{ batch.txt }}</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="r fr">
|
<div class="r fr">
|
||||||
<el-button type="primary" @click="refreshData">刷新</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="refreshData"
|
||||||
|
>刷新</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- table -->
|
<!-- table -->
|
||||||
@ -21,78 +34,189 @@
|
|||||||
@selection-change="tableSelectionChange"
|
@selection-change="tableSelectionChange"
|
||||||
@row-click="rowClick"
|
@row-click="rowClick"
|
||||||
>
|
>
|
||||||
<el-table-column v-if="batch.show" type="selection" width="55"/>
|
<el-table-column
|
||||||
<el-table-column prop="name" label="角色" show-overflow-tooltip sortable/>
|
v-if="batch.show"
|
||||||
<el-table-column prop="rolename" label="英文名" show-overflow-tooltip sortable/>
|
type="selection"
|
||||||
<el-table-column prop="describe" label="描述" show-overflow-tooltip sortable/>
|
width="55"
|
||||||
<el-table-column prop="comment" label="备注" show-overflow-tooltip sortable/>
|
/>
|
||||||
<el-table-column prop="name" label="操作" fixed="right" width="126">
|
<el-table-column
|
||||||
|
prop="name"
|
||||||
|
label="角色"
|
||||||
|
show-overflow-tooltip
|
||||||
|
sortable
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="rolename"
|
||||||
|
label="英文名"
|
||||||
|
show-overflow-tooltip
|
||||||
|
sortable
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="describe"
|
||||||
|
label="描述"
|
||||||
|
show-overflow-tooltip
|
||||||
|
sortable
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="comment"
|
||||||
|
label="备注"
|
||||||
|
show-overflow-tooltip
|
||||||
|
sortable
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="name"
|
||||||
|
label="操作"
|
||||||
|
fixed="right"
|
||||||
|
width="126"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="text" size="small" @click.stop="editRole(scope.row)">编辑</el-button>
|
<el-button
|
||||||
<el-button type="text" size="small" @click.stop="delRole(scope.row)">删除</el-button>
|
type="text"
|
||||||
|
size="small"
|
||||||
|
@click.stop="editRole(scope.row)"
|
||||||
|
>编辑</el-button>
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
@click.stop="delRole(scope.row)"
|
||||||
|
>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- Modal -->
|
<!-- Modal -->
|
||||||
<el-dialog title="编辑角色" :visible.sync="modalVisible" :before-close="closeModal">
|
<el-dialog
|
||||||
<el-tabs v-model="curTab" tab-position="left">
|
title="编辑角色"
|
||||||
<el-tab-pane label="基础信息" name="1">
|
:visible.sync="modalVisible"
|
||||||
<el-form ref="modalForm" :model="modalForm" :rules="modalFormRules" label-width="100px">
|
:before-close="closeModal"
|
||||||
<el-form-item label="角色名" prop="name">
|
>
|
||||||
<el-input v-model="modalForm.name"/>
|
<el-tabs
|
||||||
|
v-model="curTab"
|
||||||
|
tab-position="left"
|
||||||
|
>
|
||||||
|
<el-tab-pane
|
||||||
|
label="基础信息"
|
||||||
|
name="1"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="modalForm"
|
||||||
|
:model="modalForm"
|
||||||
|
:rules="modalFormRules"
|
||||||
|
label-width="100px"
|
||||||
|
>
|
||||||
|
<el-form-item
|
||||||
|
label="角色名"
|
||||||
|
prop="name"
|
||||||
|
>
|
||||||
|
<el-input v-model="modalForm.name" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="角色英文名" prop="rolename">
|
<el-form-item
|
||||||
<el-input v-model="modalForm.rolename" :disabled="!isNew"/>
|
label="角色英文名"
|
||||||
|
prop="rolename"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="modalForm.rolename"
|
||||||
|
:disabled="!isNew"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="角色描述" prop="describe">
|
<el-form-item
|
||||||
<el-input v-model="modalForm.describe"/>
|
label="角色描述"
|
||||||
|
prop="describe"
|
||||||
|
>
|
||||||
|
<el-input v-model="modalForm.describe" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="comment">
|
<el-form-item
|
||||||
<el-input v-model="modalForm.comment" type="textarea"/>
|
label="备注"
|
||||||
|
prop="comment"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="modalForm.comment"
|
||||||
|
type="textarea"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="基础权限" name="2">
|
<el-tab-pane
|
||||||
<el-table :data="basePermissionArr" border style="width: 100%">
|
label="基础权限"
|
||||||
<el-table-column prop="label" label="页面"/>
|
name="2"
|
||||||
|
>
|
||||||
|
<el-table
|
||||||
|
:data="basePermissionArr"
|
||||||
|
border
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
prop="label"
|
||||||
|
label="页面"
|
||||||
|
/>
|
||||||
<el-table-column label="不可见">
|
<el-table-column label="不可见">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-radio v-model="scope.row.permission" label="hidden">不可见</el-radio>
|
<el-radio
|
||||||
|
v-model="scope.row.permission"
|
||||||
|
label="hidden"
|
||||||
|
>不可见</el-radio>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="可读">
|
<el-table-column label="可读">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-radio v-model="scope.row.permission" label="readable">可读</el-radio>
|
<el-radio
|
||||||
|
v-model="scope.row.permission"
|
||||||
|
label="readable"
|
||||||
|
>可读</el-radio>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="可写">
|
<el-table-column label="可写">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-radio v-model="scope.row.permission" label="writeable">可写</el-radio>
|
<el-radio
|
||||||
|
v-model="scope.row.permission"
|
||||||
|
label="writeable"
|
||||||
|
>可写</el-radio>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="游戏管理" name="3">
|
<el-tab-pane
|
||||||
<el-table :data="gamePermissionArr" border style="width: 100%">
|
label="游戏管理"
|
||||||
<el-table-column prop="label" label="游戏"/>
|
name="3"
|
||||||
|
>
|
||||||
|
<el-table
|
||||||
|
:data="gamePermissionArr"
|
||||||
|
border
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
prop="label"
|
||||||
|
label="游戏"
|
||||||
|
/>
|
||||||
<el-table-column label="不可见">
|
<el-table-column label="不可见">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-radio v-model="scope.row.permission" label="hidden">不可见</el-radio>
|
<el-radio
|
||||||
|
v-model="scope.row.permission"
|
||||||
|
label="hidden"
|
||||||
|
>不可见</el-radio>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="可读">
|
<el-table-column label="可读">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-radio v-model="scope.row.permission" label="readable">可读</el-radio>
|
<el-radio
|
||||||
|
v-model="scope.row.permission"
|
||||||
|
label="readable"
|
||||||
|
>可读</el-radio>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="编辑">
|
<el-table-column label="编辑">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-radio v-model="scope.row.permission" label="edit">编辑</el-radio>
|
<el-radio
|
||||||
|
v-model="scope.row.permission"
|
||||||
|
label="edit"
|
||||||
|
>编辑</el-radio>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="发布">
|
<el-table-column label="发布">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-radio v-model="scope.row.permission" label="publish">发布</el-radio>
|
<el-radio
|
||||||
|
v-model="scope.row.permission"
|
||||||
|
label="publish"
|
||||||
|
>发布</el-radio>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -100,7 +224,10 @@
|
|||||||
</el-tabs>
|
</el-tabs>
|
||||||
<span slot="footer">
|
<span slot="footer">
|
||||||
<el-button @click="closeModal">取 消</el-button>
|
<el-button @click="closeModal">取 消</el-button>
|
||||||
<el-button type="primary" @click="saveEdit">确 定</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="saveEdit"
|
||||||
|
>确 定</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
@ -108,7 +235,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getGameList } from '@/api/games'
|
import { getGameList } from '@/api/games'
|
||||||
import { delPerm, getPermList, savePerm } from '@/api/permission'
|
import { delPerm, getPermList, savePerm, updatePerm } from '@/api/permission'
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -385,21 +512,40 @@ export default {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
// 提交
|
// 提交
|
||||||
const method = this.isNew ? 'add' : 'edit'
|
const method = this.isNew ? 'add' : 'edit'
|
||||||
savePerm(method, this.modalForm).then(res => {
|
if (this.isNew) {
|
||||||
const { data } = res
|
savePerm(this.modalForm).then(res => {
|
||||||
if (data.errcode !== 0) {
|
const { data } = res
|
||||||
this.$notify.error({
|
if (data.errcode !== 0) {
|
||||||
title: '错误',
|
this.$notify.error({
|
||||||
message: data.errmsg
|
title: '错误',
|
||||||
|
message: data.errmsg
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$notify.success({
|
||||||
|
title: '成功',
|
||||||
|
message: '已成功添加角色。'
|
||||||
})
|
})
|
||||||
return
|
this.refreshData()
|
||||||
}
|
|
||||||
this.$notify.success({
|
|
||||||
title: '成功',
|
|
||||||
message: this.isNew ? '已成功添加角色。' : '已成功修改角色信息。'
|
|
||||||
})
|
})
|
||||||
this.refreshData()
|
} else {
|
||||||
})
|
updatePerm(this.modalForm).then(res => {
|
||||||
|
const { data } = res
|
||||||
|
if (data.errcode !== 0) {
|
||||||
|
this.$notify.error({
|
||||||
|
title: '错误',
|
||||||
|
message: data.errmsg
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$notify.success({
|
||||||
|
title: '成功',
|
||||||
|
message: '已成功修改角色信息。'
|
||||||
|
})
|
||||||
|
this.refreshData()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
this.closeModal()
|
this.closeModal()
|
||||||
// 并刷新
|
// 并刷新
|
||||||
} else {
|
} else {
|
||||||
|
@ -39,7 +39,15 @@ module.exports = {
|
|||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
['^' + process.env.VUE_APP_BASE_API]: '/api'
|
['^' + process.env.VUE_APP_BASE_API]: '/api'
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
[process.env.VUE_APP_OPS_API]: {
|
||||||
|
target: `http://aa.com:8000/api`,
|
||||||
|
changeOrigin: true,
|
||||||
|
pathRewrite: {
|
||||||
|
['^' + process.env.VUE_APP_OPS_API]: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
configureWebpack: {
|
configureWebpack: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user