Merge branch 'game-data'
This commit is contained in:
commit
9d4b41fa57
9
src/api/data.js
Normal file
9
src/api/data.js
Normal file
@ -0,0 +1,9 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getReport(params) {
|
||||
return request({
|
||||
url: '/games/data/report',
|
||||
method: 'get',
|
||||
params,
|
||||
})
|
||||
}
|
24
src/components/Placeholder/index.vue
Normal file
24
src/components/Placeholder/index.vue
Normal file
@ -0,0 +1,24 @@
|
||||
<template>
|
||||
<div class="placeholder">
|
||||
<svg-icon
|
||||
class="icon-empty"
|
||||
icon-class="box-empty"
|
||||
/>
|
||||
<span>暂无数据</span>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.placeholder {
|
||||
padding: 30px;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
font-size: 24px;
|
||||
text-align: center;
|
||||
color: #606266;
|
||||
|
||||
}
|
||||
</style>
|
||||
|
1
src/icons/svg/box-empty.svg
Normal file
1
src/icons/svg/box-empty.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1564391549289" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4284" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><defs><style type="text/css"></style></defs><path d="M490.644111 645.511783c-2.940982-1.000793-6.182816-0.007163-8.072863 2.463098l-52.761668 68.923766c-3.083222 4.019547-7.961322 6.4192-13.047154 6.4192-2.860141 0-5.672186-0.73985-8.144494-2.162246L166.880263 583.199599c-2.240017-1.279133-5.006014-1.269923-7.230682 0.031722-2.240017 1.287319-3.607154 3.678786-3.607154 6.261611l0 107.602693c0 2.589988 1.3743 4.981455 3.615341 6.277984l325.034794 188.047864c1.12052 0.650823 2.376117 0.975211 3.631714 0.975211 1.246387 0 2.494821-0.324388 3.623527-0.967024 2.241041-1.296529 3.623527-3.696182 3.623527-6.277984L495.571331 652.376121C495.570307 649.27141 493.58407 646.511553 490.644111 645.511783z" p-id="4285"></path><path d="M864.338139 583.231321c-2.223644-1.301645-4.981455-1.310855-7.230682-0.031722L615.354438 721.172997c-2.453888 1.404999-5.260817 2.14485-8.120958 2.14485-5.094018 0-9.972119-2.391467-13.047154-6.412037l-52.761668-68.930929c-1.89107-2.470261-5.14109-3.463891-8.080026-2.463098-2.939959 1.000793-4.919033 3.759627-4.919033 6.864338l0 232.776577c0 2.580778 1.375324 4.981455 3.623527 6.277984 1.12052 0.642636 2.366907 0.967024 3.622504 0.967024 1.248434 0 2.503007-0.324388 3.623527-0.975211l325.034794-188.047864c2.241041-1.296529 3.615341-3.687996 3.615341-6.277984L867.945293 589.493955C867.946316 586.910107 866.572016 584.51864 864.338139 583.231321z" p-id="4286"></path><path d="M960.237279 288.992927c-0.38988-2.347464-1.907443-4.358261-4.060479-5.374404L628.980783 129.280412c-2.622734-1.232061-5.728468-0.791016-7.897877 1.128707l-93.516884 82.755796-12.17939-6.460132c-2.122337-1.131777-4.671393-1.131777-6.79373 0l-12.181437 6.464225-93.499487-82.760912c-2.169409-1.918699-5.26798-2.359744-7.889691-1.128707L67.819107 283.617499c-2.15406 1.016143-3.671623 3.02694-4.061502 5.374404-0.381693 2.344395 0.405229 4.735861 2.113127 6.388501l97.639784 94.384647-15.382339 8.169053c-1.216711 0.642636-2.225691 1.62808-2.90926 2.828418l-53.029774 93.649913c-1.962701 3.476171-0.748037 7.886621 2.716878 9.864672l312.042899 178.109514c3.146667 1.804089 7.142677 0.994654 9.344832-1.88186l65.934688-86.11838c1.280156-1.683339 1.772366-3.830235 1.343601-5.895267-0.436952-2.066055-1.747807-3.845585-3.599991-4.862751L170.209078 412.95624l329.984526-175.098947 0.00921 215.297484-81.009012 46.944172c-2.257413 1.307785-3.638877 3.734044-3.616364 6.345522 0.032746 2.613524 1.462305 5.004991 3.751441 6.268774l89.161692 49.14121c2.176572 1.208525 4.814656 1.208525 7.000438 0l89.168856-49.14121c2.288113-1.263783 3.718695-3.65525 3.750417-6.272867 0.023536-2.610454-1.350764-5.03262-3.615341-6.340405l-81.009012-46.944172 0.008186-215.301578 329.984526 175.10304L544.016693 583.629387c-1.853208 1.017166-3.163039 2.796696-3.599991 4.862751-0.429789 2.065032 0.056282 4.211928 1.342578 5.895267l65.936735 86.11838c1.413186 1.843998 3.567245 2.835581 5.760191 2.835581 1.222851 0 2.463098-0.310062 3.583618-0.954745L929.080675 504.278131c3.474125-1.978051 4.689812-6.388501 2.717901-9.864672l-53.038984-93.654007c-0.682545-1.199315-1.691525-2.180666-2.907213-2.824325l-15.359826-8.169053 97.630574-94.384647C959.833073 293.728788 960.626135 291.336298 960.237279 288.992927z" p-id="4287"></path></svg>
|
After Width: | Height: | Size: 3.5 KiB |
@ -56,6 +56,12 @@ const gamesRouter = {
|
||||
name: 'GameDetailsInfo',
|
||||
meta: { title: '详细信息' }
|
||||
},
|
||||
{
|
||||
path: 'data',
|
||||
component: () => import('@/views/games/details/data'),
|
||||
name: 'GameDetailsData',
|
||||
meta: { title: '数据' }
|
||||
},
|
||||
{
|
||||
path: 'settings/index',
|
||||
component: () => import('@/views/games/details/settings/index'),
|
||||
|
246
src/views/games/details/data.vue
Normal file
246
src/views/games/details/data.vue
Normal file
@ -0,0 +1,246 @@
|
||||
<template>
|
||||
<div class="main-content">
|
||||
<!-- filter -->
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="filter"
|
||||
>
|
||||
<el-form-item label="平台">
|
||||
<el-select
|
||||
v-model="platform_id"
|
||||
@change="changePlatform"
|
||||
placeholder="请选择平台"
|
||||
class="w100"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in platformsArr"
|
||||
:key="item.platform.platform_id"
|
||||
:label="item.platform.name"
|
||||
:value="item.platform.platform_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="日期">
|
||||
<el-date-picker
|
||||
v-model="date"
|
||||
align="right"
|
||||
type="date"
|
||||
placeholder="选择日期"
|
||||
style="width: 100%"
|
||||
value-format="yyyy-MM-dd"
|
||||
@change="changeDate"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户类型">
|
||||
<el-select
|
||||
v-model="isNew"
|
||||
@change="changeNew"
|
||||
placeholder="是否当日新用户"
|
||||
class="w100"
|
||||
>
|
||||
<el-option
|
||||
label="非当日新用户"
|
||||
:value="0"
|
||||
/>
|
||||
<el-option
|
||||
label="当日新用户"
|
||||
:value="1"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- filter end -->
|
||||
|
||||
<!-- 占位 -->
|
||||
<placeholder v-if="JSON.stringify(reportData) === '{}'" />
|
||||
<!-- 占位 end -->
|
||||
|
||||
<!-- 数据面板 -->
|
||||
<div class="data-panel">
|
||||
<div
|
||||
class="data-wrap"
|
||||
v-for="(val, key) in reportData"
|
||||
:key="key"
|
||||
>
|
||||
|
||||
<el-divider v-if="val.length > 0">{{key.toUpperCase()}}</el-divider>
|
||||
<el-row :gutter="16">
|
||||
<el-col
|
||||
:span="6"
|
||||
v-for="(item, index) in val"
|
||||
:key="index"
|
||||
>
|
||||
<div class="data-box">
|
||||
<span class="title c-t-3">{{item.explan}}</span>
|
||||
<span class="key c-t-4">{{item.name}}</span>
|
||||
<span class="num">{{item.value}}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 数据面板 end -->
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import { getGame, updateRC } from '@/api/games'
|
||||
import { getReport } from '@/api/data'
|
||||
import getPageTitle from '@/utils/get-page-title'
|
||||
import { reject, Promise } from 'q'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import Placeholder from '@/components/Placeholder'
|
||||
|
||||
export default {
|
||||
name: 'GameDetailsData',
|
||||
data() {
|
||||
return {
|
||||
// common
|
||||
uid: '',
|
||||
token: '',
|
||||
platform_id: '',
|
||||
platformsArr: [],
|
||||
gameInfo: {},
|
||||
permEdit: false,
|
||||
permPublish: false,
|
||||
date: '',
|
||||
isNew: 1,
|
||||
reportData: {}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Placeholder
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userInfo'])
|
||||
},
|
||||
mounted() {
|
||||
this.uid = this.$route.params.uid
|
||||
this.type = this.$route.query.type ? this.$route.query.type : 'normal'
|
||||
this.token = getToken()
|
||||
this.permEdit =
|
||||
this.userInfo.permissions.includes(`${this.uid}-edit`) ||
|
||||
this.userInfo.permissions.includes(`${this.uid}-publish`) ||
|
||||
this.userInfo.permissions.includes(`games-writeable`)
|
||||
this.permPublish =
|
||||
this.userInfo.permissions.includes(`${this.uid}-publish`) ||
|
||||
this.userInfo.permissions.includes(`games-writeable`)
|
||||
|
||||
const now = new Date()
|
||||
const before = new Date(now.getTime() - 24 * 60 * 60 * 1000)
|
||||
|
||||
this.date = `${before.getFullYear()}-${(before.getMonth() + 1)
|
||||
.toString()
|
||||
.padStart(2, '0')}-${before
|
||||
.getDate()
|
||||
.toString()
|
||||
.padStart(2, '0')}`
|
||||
|
||||
this.getGameInfo(this.getData)
|
||||
},
|
||||
methods: {
|
||||
getGameInfo(cb) {
|
||||
const dataType = this.isDev ? 'dev' : 'pro'
|
||||
getGame({ uid: this.uid, data_type: dataType })
|
||||
.then(res => {
|
||||
const { data } = res
|
||||
if (data.errcode === 0) {
|
||||
this.gameInfo = data.gameInfo
|
||||
this.platformsArr = data.gameInfo.platforms
|
||||
this.$route.meta.title = this.gameInfo.game_name
|
||||
document.title = getPageTitle(this.gameInfo.game_name)
|
||||
if (this.$route.query.platform_id) {
|
||||
this.platform_id = this.$route.query.platform_id
|
||||
} else {
|
||||
this.platform_id = this.platformsArr[0]
|
||||
? this.platformsArr[0].platform.platform_id
|
||||
: ''
|
||||
}
|
||||
if (cb && cb instanceof Function) cb()
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
getData() {
|
||||
getReport({
|
||||
uid: this.uid,
|
||||
game_id: 1004, // TODO: this.gameInfo.game_id
|
||||
platform_id: this.platform_id, // TODO: this.platform_id
|
||||
date: this.date, // TODO: this.date
|
||||
isNew: this.isNew
|
||||
})
|
||||
.then(res => {
|
||||
const { data } = res
|
||||
if (data.errcode === 0) {
|
||||
this.reportData = data.result
|
||||
|
||||
console.log(data)
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.reportData = {}
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
changePlatform() {
|
||||
this.getData()
|
||||
},
|
||||
changeDate() {
|
||||
this.getData()
|
||||
},
|
||||
changeNew() {
|
||||
this.getData()
|
||||
},
|
||||
validForm(formName) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.$refs[formName][0].validate(valid => {
|
||||
valid ? resolve() : reject()
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.data-box {
|
||||
box-sizing: border-box;
|
||||
padding: 16px;
|
||||
margin-bottom: 16px;
|
||||
border: 1px solid #dcdfe6;
|
||||
text-align: center;
|
||||
.title,
|
||||
.key,
|
||||
.num {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 16px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.key {
|
||||
font-size: 14px;
|
||||
}
|
||||
.num {
|
||||
font-size: 72px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<style scoped>
|
||||
.btn-group >>> .el-button + .el-button {
|
||||
margin-left: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
>
|
||||
<!-- <el-menu-item v-if="uid !== 'new'" :index="`/games/details/${uid}/profile`">简介</el-menu-item> -->
|
||||
<el-menu-item :index="`/games/details/${uid}/info`">详情</el-menu-item>
|
||||
<el-menu-item :index="`/games/details/${uid}/data`">数据</el-menu-item>
|
||||
<el-submenu :index="`/games/details/${uid}/settings/index`">
|
||||
<template slot="title">配置</template>
|
||||
<el-menu-item
|
||||
|
Loading…
x
Reference in New Issue
Block a user