This commit is contained in:
yulixing 2019-05-31 11:35:39 +08:00
parent 600d922283
commit 9254fe4885
15 changed files with 42 additions and 85 deletions

View File

@ -29,19 +29,22 @@
<script>
import { delGame } from '@/api/games'
import {mapGetters} from 'vuex'
import { mapGetters } from 'vuex'
export default {
name: 'GameCard',
props: ['info'],
data() {
return {
permEdit: false,
permEdit: false
}
},
mounted() {
this.permEdit = this.userInfo.permissions.includes(`${this.info._id}-edit`) || this.userInfo.permissions.includes(`${this.info._id}-publish`)
this.permEdit =
this.userInfo.permissions.includes(`${this.info._id}-edit`) ||
this.userInfo.permissions.includes(`${this.info._id}-publish`) ||
this.userInfo.permissions.includes(`games-writeable`)
},
computed:{
computed: {
...mapGetters(['userInfo'])
},
methods: {

View File

@ -43,7 +43,6 @@ const actions = {
getInfo(state.token)
.then(response => {
const { data } = response
console.log(data)
if (!data || data.errcode !== 0) {
reject('验证失败,请重新登录!')
}

View File

@ -47,7 +47,7 @@ service.interceptors.response.use(
Message({
message: data.errmsg || 'error',
type: 'error',
duration: 5 * 1000
duration: 10 * 1000
})
return Promise.reject(data.errmsg || 'error')
} else {
@ -87,7 +87,7 @@ service.interceptors.response.use(
// }
},
error => {
console.log('err' + error) // for debug
console.log(error) // for debug
Message({
message: error.message,
type: 'error',

View File

@ -112,41 +112,31 @@ export default {
methods: {
// filter
search() {
console.log('搜索')
},
reset(formName) {
this.$refs[formName].resetFields()
console.log('重置')
},
// toolbar
addGame() {
this.$router.push('/games/details/info')
console.log('添加游戏')
},
batchDel() {
console.log('批量删除游戏')
},
batchOpt() {
this.batch.show = !this.batch.show
this.batch.txt = this.batch.show ? '关闭' : '批量操作'
console.log('批量操作')
},
// table
viewGame(row) {
console.log('查看游戏')
},
editGame(row) {
console.log('编辑游戏')
},
delGame(row) {
console.log('删除游戏')
},
// pagination
sizeChange(val) {
console.log(`每页 ${val}`)
},
pageChange(val) {
console.log(`当前页: ${val}`)
}
}
}

View File

@ -112,41 +112,31 @@ export default {
methods: {
// filter
search() {
console.log('搜索')
},
reset(formName) {
this.$refs[formName].resetFields()
console.log('重置')
},
// toolbar
addGame() {
this.$router.push('/games/details/info')
console.log('添加游戏')
},
batchDel() {
console.log('批量删除游戏')
},
batchOpt() {
this.batch.show = !this.batch.show
this.batch.txt = this.batch.show ? '关闭' : '批量操作'
console.log('批量操作')
},
// table
viewGame(row) {
console.log('查看游戏')
},
editGame(row) {
console.log('编辑游戏')
},
delGame(row) {
console.log('删除游戏')
},
// pagination
sizeChange(val) {
console.log(`每页 ${val}`)
},
pageChange(val) {
console.log(`当前页: ${val}`)
}
}
}

View File

@ -229,41 +229,31 @@ export default {
methods: {
// filter
search() {
console.log('搜索')
},
reset(formName) {
this.$refs[formName].resetFields()
console.log('重置')
},
// toolbar
addGame() {
this.$router.push('/games/details/info')
console.log('添加游戏')
},
batchDel() {
console.log('批量删除游戏')
},
batchOpt() {
this.batch.show = !this.batch.show
this.batch.txt = this.batch.show ? '关闭' : '批量操作'
console.log('批量操作')
},
// table
viewGame(row) {
console.log('查看游戏')
},
editGame(row) {
console.log('编辑游戏')
},
delGame(row) {
console.log('删除游戏')
},
// pagination
sizeChange(val) {
console.log(`每页 ${val}`)
},
pageChange(val) {
console.log(`当前页: ${val}`)
}
}
}

View File

@ -189,41 +189,31 @@ export default {
methods: {
// filter
search() {
console.log('搜索')
},
reset(formName) {
this.$refs[formName].resetFields()
console.log('重置')
},
// toolbar
addGame() {
this.$router.push('/games/details/info')
console.log('添加游戏')
},
batchDel() {
console.log('批量删除游戏')
},
batchOpt() {
this.batch.show = !this.batch.show
this.batch.txt = this.batch.show ? '关闭' : '批量操作'
console.log('批量操作')
},
// table
viewGame(row) {
console.log('查看游戏')
},
editGame(row) {
console.log('编辑游戏')
},
delGame(row) {
console.log('删除游戏')
},
// pagination
sizeChange(val) {
console.log(`每页 ${val}`)
},
pageChange(val) {
console.log(`当前页: ${val}`)
}
}
}

View File

@ -267,7 +267,6 @@ export default {
this.$refs[formName].validate(valid => {
if (valid) {
this.saveEdit()
console.log(this.gameForm)
} else {
this.$message.error('请按要求填写游戏信息!')
return false

View File

@ -257,14 +257,11 @@ export default {
mounted() {
this.uid = this.$route.params.uid
this.token = getToken()
if (this.uid && this.uid === 'new') {
this.permEdit =
this.userInfo.permissions.includes(`games-writeable`)
} else {
this.permEdit =
this.userInfo.permissions.includes(`${this.uid}-edit`) ||
this.userInfo.permissions.includes(`${this.uid}-publish`)
}
this.userInfo.permissions.includes(`${this.uid}-publish`) ||
this.userInfo.permissions.includes(`games-writeable`)
getPlatformList()
.then(res => {
@ -443,6 +440,7 @@ export default {
})
},
createFtp(index) {
this.$message.success('请求已发送,请耐心等待!')
createFtp({
uid: this.uid,
game_name_en: this.baseForm.game_name_en,

View File

@ -190,13 +190,13 @@ export default {
},
mounted() {
this.uid = this.$route.params.uid
console.log(this.uid)
this.permissionEdit =
this.userInfo.permissions.includes(`${this.uid}-edit`) ||
this.userInfo.permissions.includes(`${this.uid}-publish`)
this.permissionPublish = this.userInfo.permissions.includes(
`${this.uid}-publish`
)
this.userInfo.permissions.includes(`${this.uid}-publish`) ||
this.userInfo.permissions.includes(`games-writeable`)
this.permissionPublish =
this.userInfo.permissions.includes(`${this.uid}-publish`) ||
this.userInfo.permissions.includes(`games-writeable`)
this.getGameInfo(this.getGameSettings)
this.getSettingsList()
},
@ -205,7 +205,6 @@ export default {
this.$emit('change', changed)
},
// left
getGameInfo(cb) {
getGame({ uid: this.uid })
.then(res => {

View File

@ -161,13 +161,11 @@ export default {
})
}
if (this.filterForm.game_type) {
console.log(this.filterForm.game_type)
result = result.filter(game => {
return game.game_type + '' === this.filterForm.game_type
})
}
this.dataCount = result.length
console.log(result)
return result
},
search() {

View File

@ -126,7 +126,6 @@ export default {
},
editSetting(row) {
this.openModal(false, row)
console.log('查看游戏')
},
// modal
openModal(isNew, data) {

View File

@ -104,7 +104,6 @@ export default {
.dispatch('user/login', this.loginForm)
.then(data => {
if (data.errcode === 0) {
console.log('/登录成功')
this.$router.push({ path: this.redirect || '/' })
} else {
this.$message.error(data.errmsg)

View File

@ -34,8 +34,8 @@
<el-button @click="editPwd" v-if="!editPassword" size="mini">修改密码</el-button>
</el-form-item>
<el-form-item label="角色">
<div class="w100" style="overflow: hidden;" v-if="userForm.roles.length > 0">
<el-tag v-for="item in userForm.roles" :key="item" class="mgr-20">{{item}}</el-tag>
<div class="w100" style="overflow: hidden;" v-if="userInfo.roles.length > 0">
<el-tag v-for="item in userInfo.roles" :key="item" class="mgr-20">{{item}}</el-tag>
</div>
<div class="w100" style="overflow: hidden;" v-else>
<el-tag class="mgr-20">普通用户</el-tag>

View File

@ -19,6 +19,7 @@
class="table mgt-20 mgb-20"
@selection-change="tableSelectionChange"
v-loading="isLoaded"
@row-click="rowClick"
>
<el-table-column v-if="batch.show" type="selection" width="55"/>
<el-table-column prop="name" label="角色" show-overflow-tooltip sortable/>
@ -168,23 +169,23 @@ export default {
permission: {
name: 'permission',
label: '权限管理',
permission: 'readable'
permission: 'hidden'
},
logs: {
name: 'logs',
label: '操作日志',
permission: 'readable'
},
dics: {
name: 'dics',
label: '字典',
permission: 'readable'
},
data: {
name: 'data',
label: '数据查询',
permission: 'readable'
permission: 'hidden'
}
// dics: {
// name: 'dics',
// label: '',
// permission: 'readable'
// },
// data: {
// name: 'data',
// label: '',
// permission: 'readable'
// }
},
basePermissionArr: [],
gamePermissionTable: {},
@ -195,7 +196,9 @@ export default {
mounted() {
this.getData()
this.getGameList()
this.permWriteable = this.userInfo.permissions.includes('permission-writeable')
this.permWriteable = this.userInfo.permissions.includes(
'permission-writeable'
)
},
computed: {
...mapGetters(['userInfo'])
@ -253,6 +256,9 @@ export default {
this.getData()
},
// table
rowClick(row, column, event) {
this.openModal(false, row)
},
getData() {
this.isLoaded = true
request({
@ -267,7 +273,6 @@ export default {
})
return
}
console.log('refresh')
this.tableData = data.roleList
this.isLoaded = false
})
@ -343,7 +348,6 @@ export default {
.then(res => {
const { data } = res
if (data.errcode === 0) {
console.log(data)
const obj = {}
data.gameList.map(game => {
obj[game._id] = {
@ -353,7 +357,6 @@ export default {
permission: 'hidden'
}
})
console.log(obj)
this.gamePermissionTable = obj
}
})