配置项优化、配置项路由修改等
This commit is contained in:
parent
011cb80733
commit
386e771d29
@ -20,7 +20,7 @@
|
||||
<router-link :to="`/games/details/${info._id}/info`">详情</router-link>
|
||||
</span>
|
||||
<span v-if="permEdit" class="op">
|
||||
<router-link :to="`/games/details/${info._id}/settings`">配置</router-link>
|
||||
<router-link :to="`/games/details/${info._id}/settings/index`">配置</router-link>
|
||||
</span>
|
||||
<span v-if="permEdit" class="op">
|
||||
<router-link :to="`/games/details/${info._id}/share`">分享</router-link>
|
||||
|
@ -57,11 +57,36 @@ const gamesRouter = {
|
||||
meta: { title: '详细信息' }
|
||||
},
|
||||
{
|
||||
path: 'settings',
|
||||
path: 'settings/index',
|
||||
component: () => import('@/views/games/details/settings/index'),
|
||||
name: 'GameDetailsSettings',
|
||||
meta: { title: '配置' }
|
||||
},
|
||||
|
||||
{
|
||||
path: 'settings/achievement',
|
||||
component: () => import('@/views/games/details/settings/achievement'),
|
||||
name: 'GameDetailsAchievement',
|
||||
meta: { title: '成就' }
|
||||
},
|
||||
{
|
||||
path: 'settings/invitation',
|
||||
component: () => import('@/views/games/details/settings/invitation'),
|
||||
name: 'GameDetailsInvitation',
|
||||
meta: { title: '邀请' }
|
||||
},
|
||||
{
|
||||
path: 'settings/red-envelope',
|
||||
component: () => import('@/views/games/details/settings/red-envelope'),
|
||||
name: 'GameDetailsRedEnvelope',
|
||||
meta: { title: '红包' }
|
||||
},
|
||||
{
|
||||
path: 'settings/sign',
|
||||
component: () => import('@/views/games/details/settings/sign'),
|
||||
name: 'GameDetailsSign',
|
||||
meta: { title: '签到' }
|
||||
},
|
||||
{
|
||||
path: 'recommendation',
|
||||
component: () => import('@/views/games/details/recommendation'),
|
||||
@ -74,24 +99,6 @@ const gamesRouter = {
|
||||
name: 'GameDetailsShare',
|
||||
meta: { title: '分享图' }
|
||||
},
|
||||
{
|
||||
path: 'achievement',
|
||||
component: () => import('@/views/games/details/achievement'),
|
||||
name: 'GameDetailsAchievement',
|
||||
meta: { title: '成就' }
|
||||
},
|
||||
{
|
||||
path: 'invitation',
|
||||
component: () => import('@/views/games/details/invitation'),
|
||||
name: 'GameDetailsInvitation',
|
||||
meta: { title: '邀请' }
|
||||
},
|
||||
{
|
||||
path: 'red-envelope',
|
||||
component: () => import('@/views/games/details/red-envelope'),
|
||||
name: 'GameDetailsRedPackage',
|
||||
meta: { title: '红包' }
|
||||
},
|
||||
{
|
||||
path: 'share/edit',
|
||||
component: () => import('@/views/games/details/share/edit'),
|
||||
|
@ -8,24 +8,28 @@
|
||||
>
|
||||
<!-- <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-submenu :index="`/games/details/${uid}/settings`">
|
||||
<el-submenu :index="`/games/details/${uid}/settings/index`">
|
||||
<template slot="title">配置</template>
|
||||
<el-menu-item
|
||||
v-if="uid !== 'new'"
|
||||
:index="`/games/details/${uid}/settings`"
|
||||
:index="`/games/details/${uid}/settings/index`"
|
||||
>所有</el-menu-item>
|
||||
<el-menu-item
|
||||
v-if="uid !== 'new'"
|
||||
:index="`/games/details/${uid}/achievement`"
|
||||
:index="`/games/details/${uid}/settings/achievement`"
|
||||
>成就</el-menu-item>
|
||||
<el-menu-item
|
||||
v-if="uid !== 'new'"
|
||||
:index="`/games/details/${uid}/invitation`"
|
||||
:index="`/games/details/${uid}/settings/invitation`"
|
||||
>邀请</el-menu-item>
|
||||
<el-menu-item
|
||||
v-if="uid !== 'new'"
|
||||
:index="`/games/details/${uid}/red-envelope`"
|
||||
:index="`/games/details/${uid}/settings/red-envelope`"
|
||||
>红包</el-menu-item>
|
||||
<el-menu-item
|
||||
v-if="uid !== 'new'"
|
||||
:index="`/games/details/${uid}/settings/sign`"
|
||||
>签到</el-menu-item>
|
||||
</el-submenu>
|
||||
<!-- <el-menu-item
|
||||
v-if="uid !== 'new'"
|
||||
|
@ -46,7 +46,7 @@
|
||||
>
|
||||
<template slot="title">
|
||||
<svg-icon
|
||||
style="margin-right: 20px;"
|
||||
style="margin-right: 20px;"
|
||||
icon-class="del"
|
||||
@click.stop="delAC(index)"
|
||||
/>
|
||||
@ -70,15 +70,6 @@
|
||||
style="width: 70%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="id"
|
||||
prop="id"
|
||||
>
|
||||
<el-input
|
||||
v-model.number="item.id"
|
||||
style="width: 70%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="提示文字"
|
||||
prop="tip"
|
||||
@ -92,18 +83,26 @@
|
||||
label="奖励类型"
|
||||
prop="reward_type"
|
||||
>
|
||||
<el-radio
|
||||
v-model.number="item.reward_type"
|
||||
:label="1"
|
||||
>称号</el-radio>
|
||||
<el-radio
|
||||
v-model.number="item.reward_type"
|
||||
:label="2"
|
||||
>代币</el-radio>
|
||||
<el-radio
|
||||
v-model.number="item.reward_type"
|
||||
:label="0"
|
||||
>其他</el-radio>
|
||||
<el-select
|
||||
v-model="item.reward_type"
|
||||
filterable
|
||||
allow-create
|
||||
default-first-option
|
||||
placeholder="请选择奖励类型"
|
||||
style="width: 70%"
|
||||
>
|
||||
<el-option
|
||||
label="称号"
|
||||
:value="1"
|
||||
>
|
||||
</el-option>
|
||||
<el-option
|
||||
label="代币"
|
||||
:value="2"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<span class="ipt-tip">若无选项,则直接输入奖励物品ID</span>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="奖励数量"
|
||||
@ -234,10 +233,12 @@ export default {
|
||||
ahievementForm: {},
|
||||
ahievementFormRules: {
|
||||
title: [{ required: true, message: '请填写标题', trigger: 'blur' }],
|
||||
id: [{ required: true, message: '请填写 id', trigger: 'blur' }],
|
||||
reward_type: [
|
||||
{ required: true, message: '请选择奖励类型', trigger: 'blur' }
|
||||
],
|
||||
tip: [
|
||||
{ required: true, message: '请填写提示文字', trigger: 'blur' }
|
||||
],
|
||||
reward_count: [
|
||||
{ required: true, message: '请填写奖励数量', trigger: 'blur' }
|
||||
],
|
||||
@ -268,6 +269,18 @@ export default {
|
||||
computed: {
|
||||
...mapGetters(['userInfo'])
|
||||
},
|
||||
watch: {
|
||||
allAC: {
|
||||
handler: function(nVal) {
|
||||
nVal.map((item, index) => {
|
||||
item.reward_type = parseInt(item.reward_type)
|
||||
item.id = index + 1
|
||||
})
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.uid = this.$route.params.uid
|
||||
this.type = this.$route.query.type ? this.$route.query.type : 'normal'
|
||||
@ -454,9 +467,7 @@ export default {
|
||||
})
|
||||
.then(() => {
|
||||
this.$router.push(
|
||||
`/games/details/${this.uid}/settings?platform_id=${
|
||||
this.platform_id
|
||||
}&type=${this.type}`
|
||||
`/games/details/${this.uid}/settings/index?platform_id=${this.platform_id}&type=${this.type}`
|
||||
)
|
||||
})
|
||||
.catch(() => {
|
@ -45,7 +45,11 @@
|
||||
:key="index"
|
||||
>
|
||||
<template slot="title">
|
||||
<svg-icon style="margin-right: 20px;" icon-class="del" @click.stop="delIV(index)"/>
|
||||
<svg-icon
|
||||
style="margin-right: 20px;"
|
||||
icon-class="del"
|
||||
@click.stop="delIV(index)"
|
||||
/>
|
||||
{{ `配置:${item.id}` || '未命名'}}
|
||||
</template>
|
||||
|
||||
@ -57,32 +61,31 @@
|
||||
label-width="100px"
|
||||
class="mgt-20 mgb-20"
|
||||
>
|
||||
|
||||
<el-form-item
|
||||
label="id"
|
||||
prop="id"
|
||||
>
|
||||
<el-input
|
||||
v-model.number="item.id"
|
||||
style="width: 70%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="奖励类型"
|
||||
prop="reward_type"
|
||||
>
|
||||
<el-radio
|
||||
v-model.number="item.reward_type"
|
||||
:label="3"
|
||||
>红包</el-radio>
|
||||
<el-radio
|
||||
v-model.number="item.reward_type"
|
||||
:label="2"
|
||||
>代币</el-radio>
|
||||
<el-radio
|
||||
v-model.number="item.reward_type"
|
||||
:label="0"
|
||||
>其他</el-radio>
|
||||
|
||||
<el-select
|
||||
v-model="item.reward_type"
|
||||
filterable
|
||||
allow-create
|
||||
default-first-option
|
||||
placeholder="请选择奖励类型"
|
||||
style="width: 70%"
|
||||
>
|
||||
<el-option
|
||||
label="红包"
|
||||
:value="3"
|
||||
>
|
||||
</el-option>
|
||||
<el-option
|
||||
label="代币"
|
||||
:value="2"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<span class="ipt-tip">若无选项,则直接输入奖励物品ID</span>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="奖励数量"
|
||||
@ -201,7 +204,6 @@ export default {
|
||||
// form
|
||||
invitationForm: {},
|
||||
invitationFormRules: {
|
||||
id: [{ required: true, message: '请填写 id', trigger: 'blur' }],
|
||||
reward_type: [
|
||||
{ required: true, message: '请选择奖励类型', trigger: 'blur' }
|
||||
],
|
||||
@ -221,7 +223,7 @@ export default {
|
||||
activeNames: [],
|
||||
defaultSetting: {
|
||||
id: '',
|
||||
reward_type: 0,
|
||||
reward_type: 2,
|
||||
reward_count: 1,
|
||||
need_type: 1,
|
||||
need_count: 1,
|
||||
@ -233,6 +235,18 @@ export default {
|
||||
computed: {
|
||||
...mapGetters(['userInfo'])
|
||||
},
|
||||
watch: {
|
||||
allIV: {
|
||||
handler: function(nVal) {
|
||||
nVal.map((item,index) => {
|
||||
item.reward_type = parseInt(item.reward_type)
|
||||
item.id = index + 1
|
||||
})
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.uid = this.$route.params.uid
|
||||
this.type = this.$route.query.type ? this.$route.query.type : 'normal'
|
||||
@ -417,9 +431,7 @@ export default {
|
||||
})
|
||||
.then(() => {
|
||||
this.$router.push(
|
||||
`/games/details/${this.uid}/settings?platform_id=${
|
||||
this.platform_id
|
||||
}&type=${this.type}`
|
||||
`/games/details/${this.uid}/settings/index?platform_id=${this.platform_id}&type=${this.type}`
|
||||
)
|
||||
})
|
||||
.catch(() => {
|
@ -516,7 +516,7 @@ export default {
|
||||
})
|
||||
.then(() => {
|
||||
this.$router.push(
|
||||
`/games/details/${this.uid}/settings?platform_id=${this.platform_id}&type=${this.type}`
|
||||
`/games/details/${this.uid}/settings/index?platform_id=${this.platform_id}&type=${this.type}`
|
||||
)
|
||||
})
|
||||
.catch(() => {
|
445
src/views/games/details/settings/sign.vue
Normal file
445
src/views/games/details/settings/sign.vue
Normal file
@ -0,0 +1,445 @@
|
||||
<template>
|
||||
<div class="main-content">
|
||||
<div style="width: 60%">
|
||||
<el-alert
|
||||
title="签到-配置提示"
|
||||
type="info"
|
||||
description="该页为配置子项,保存后请前往配置页进行发布!(确保配置列表中有签到奖励配置(sign_list)一项)"
|
||||
show-icon
|
||||
class="mgb-20"
|
||||
>
|
||||
</el-alert>
|
||||
<el-select
|
||||
v-model="type"
|
||||
@change="changeType"
|
||||
class="w100 mgb-20"
|
||||
>
|
||||
<el-option
|
||||
label="普通配置"
|
||||
value="normal"
|
||||
/>
|
||||
<el-option
|
||||
label="私有配置"
|
||||
value="private"
|
||||
/>
|
||||
</el-select>
|
||||
<el-select
|
||||
v-model="platform_id"
|
||||
@change="changePlatform"
|
||||
class="w100 mgb-20"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in platformsArr"
|
||||
:key="item.platform.platform_id"
|
||||
:label="item.platform.name"
|
||||
:value="item.platform.platform_id"
|
||||
/>
|
||||
</el-select>
|
||||
<el-collapse
|
||||
v-model="activeNames"
|
||||
v-if="allSign.length > 0"
|
||||
>
|
||||
<el-collapse-item
|
||||
:name="index"
|
||||
v-for="(item, index) in allSign"
|
||||
:key="index"
|
||||
>
|
||||
<template slot="title">
|
||||
<svg-icon
|
||||
style="margin-right: 20px;"
|
||||
icon-class="del"
|
||||
@click.stop="delSign(index)"
|
||||
/>
|
||||
{{ `签到:${item.title}` || '未命名'}}
|
||||
</template>
|
||||
<el-form
|
||||
:ref="`invitationForm${index}`"
|
||||
:model="item"
|
||||
:rules="invitationFormRules"
|
||||
style="width: 100%"
|
||||
label-width="100px"
|
||||
class="mgt-20 mgb-20"
|
||||
>
|
||||
<el-form-item
|
||||
label="标题"
|
||||
prop="title"
|
||||
>
|
||||
<el-input
|
||||
v-model="item.title"
|
||||
style="width: 70%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="奖励类型"
|
||||
prop="reward_type"
|
||||
>
|
||||
<el-select
|
||||
v-model="item.reward_type"
|
||||
filterable
|
||||
allow-create
|
||||
default-first-option
|
||||
placeholder="请选择奖励类型"
|
||||
style="width: 70%"
|
||||
>
|
||||
<el-option
|
||||
label="红包"
|
||||
:value="3"
|
||||
>
|
||||
</el-option>
|
||||
<el-option
|
||||
label="代币"
|
||||
:value="2"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<span class="ipt-tip">若无选项,则直接输入奖励物品ID</span>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="奖励数量"
|
||||
prop="reward_count"
|
||||
>
|
||||
<el-input
|
||||
v-model.number="item.reward_count"
|
||||
style="width: 70%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="领取条件"
|
||||
prop="need_type"
|
||||
>
|
||||
<el-select
|
||||
v-model.number="item.need_type"
|
||||
placeholder="领取条件"
|
||||
style="width: 70%"
|
||||
>
|
||||
<el-option
|
||||
label="分享"
|
||||
:value="1"
|
||||
/>
|
||||
<el-option
|
||||
label="视频"
|
||||
:value="2"
|
||||
/>
|
||||
<el-option
|
||||
label="正常"
|
||||
:value="0"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="达成数量"
|
||||
prop="need_count"
|
||||
>
|
||||
<el-input
|
||||
v-model.number="item.need_count"
|
||||
style="width: 70%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-collapse-item>
|
||||
|
||||
</el-collapse>
|
||||
|
||||
<div
|
||||
class="tip mgt-20 mgb-20"
|
||||
v-else
|
||||
>
|
||||
暂无签到配置,请添加签到配置
|
||||
</div>
|
||||
|
||||
<div class="btn-group">
|
||||
<el-button
|
||||
class="mgt-20"
|
||||
type="success"
|
||||
@click="addSign"
|
||||
v-if="permEdit"
|
||||
>新增</el-button>
|
||||
<el-button
|
||||
class="mgt-20"
|
||||
type="primary"
|
||||
@click="saveAllSign"
|
||||
v-if="permEdit"
|
||||
>保存</el-button>
|
||||
<el-button
|
||||
class="mgt-20"
|
||||
type="warning"
|
||||
@click="goPublish"
|
||||
v-if="permPublish"
|
||||
>跳转发布</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import { getGame } from '@/api/games'
|
||||
import getPageTitle from '@/utils/get-page-title'
|
||||
import { getGameSettings, saveGameSettings } from '@/api/settings'
|
||||
import { reject, Promise } from 'q'
|
||||
|
||||
export default {
|
||||
name: 'GameDetailsInvitation',
|
||||
data() {
|
||||
return {
|
||||
// common
|
||||
uid: '',
|
||||
type: 'normal',
|
||||
platform_id: '',
|
||||
platformsArr: [],
|
||||
gameInfo: {},
|
||||
cfgs: [],
|
||||
permEdit: false,
|
||||
permPublish: false,
|
||||
hasList: false,
|
||||
|
||||
// form
|
||||
invitationForm: {},
|
||||
invitationFormRules: {
|
||||
title: [{ required: true, message: '请填写标题', trigger: 'blur' }],
|
||||
reward_type: [
|
||||
{ required: true, message: '请选择奖励类型', trigger: 'blur' }
|
||||
],
|
||||
reward_count: [
|
||||
{ required: true, message: '请填写奖励数量', trigger: 'blur' }
|
||||
],
|
||||
need_type: [
|
||||
{ required: true, message: '请选择达成条件', trigger: 'blur' }
|
||||
],
|
||||
need_count: [
|
||||
{ required: true, message: '请填写达成数量', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
activeNames: [],
|
||||
defaultSetting: {
|
||||
id: '',
|
||||
title: '',
|
||||
reward_type: 2,
|
||||
reward_count: 1,
|
||||
need_type: 1,
|
||||
need_count: 1
|
||||
},
|
||||
allSign: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userInfo'])
|
||||
},
|
||||
watch: {
|
||||
allSign: {
|
||||
handler: function(nVal) {
|
||||
nVal.map((item, index) => {
|
||||
item.reward_type = parseInt(item.reward_type)
|
||||
item.id = index + 1
|
||||
})
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.uid = this.$route.params.uid
|
||||
this.type = this.$route.query.type ? this.$route.query.type : 'normal'
|
||||
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`)
|
||||
this.getGameInfo(this.getGameSettings)
|
||||
},
|
||||
methods: {
|
||||
getGameInfo(cb) {
|
||||
getGame({ uid: this.uid })
|
||||
.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)
|
||||
})
|
||||
},
|
||||
getGameSettings() {
|
||||
getGameSettings({
|
||||
uid: this.uid,
|
||||
type: this.type === 'normal' ? 0 : 1,
|
||||
id: this.gameInfo.game_id,
|
||||
pid: this.platform_id
|
||||
}).then(res => {
|
||||
const { data } = res
|
||||
if (data.errcode !== 0) {
|
||||
this.$notify.error({
|
||||
title: '错误',
|
||||
message: data.errmsg
|
||||
})
|
||||
return
|
||||
}
|
||||
this.cfgs = data.records
|
||||
this.hasList = false
|
||||
this.resolveSign(this.cfgs)
|
||||
})
|
||||
},
|
||||
resolveSign(settings) {
|
||||
for (let i = 0; i < settings.length; i++) {
|
||||
const setting = settings[i]
|
||||
if (setting.key === 'sign_list') {
|
||||
this.allSign = JSON.parse(setting.value)
|
||||
this.hasList = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.hasList) this.allSign = []
|
||||
},
|
||||
changePlatform() {
|
||||
this.getGameSettings()
|
||||
},
|
||||
changeType() {
|
||||
this.getGameSettings()
|
||||
},
|
||||
addSign() {
|
||||
const defaultSetting = JSON.parse(JSON.stringify(this.defaultSetting))
|
||||
this.activeNames.push(this.allSign.length)
|
||||
this.allSign.push(defaultSetting)
|
||||
},
|
||||
delSign(index) {
|
||||
this.$confirm('是否要删除该项签到配置?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
this.allSign.splice(index, 1)
|
||||
this.$message.success('删除成功!')
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message.info('已取消删除!')
|
||||
})
|
||||
},
|
||||
updateSignList() {
|
||||
if (!this.hasList) {
|
||||
this.cfgs.push({
|
||||
key: 'sign_list',
|
||||
title: '签到奖励',
|
||||
type: 'string',
|
||||
value: JSON.stringify(this.allSign)
|
||||
})
|
||||
return
|
||||
}
|
||||
for (let i = 0; i < this.cfgs.length; i++) {
|
||||
if (this.cfgs[i].key === 'sign_list') {
|
||||
this.cfgs[i].value = JSON.stringify(this.allSign)
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
saveAllSign() {
|
||||
if (this.allSign.length === 0) {
|
||||
this.$confirm('当前无签到项,是否清空?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
this.updateSignList()
|
||||
this.saveSettings()
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message.info('已取消保存!')
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const validArr = []
|
||||
for (let i = 0; i < this.allSign.length; i++) {
|
||||
validArr.push(this.validForm(`invitationForm${i}`))
|
||||
}
|
||||
Promise.all(validArr)
|
||||
.then(() => {
|
||||
this.updateSignList()
|
||||
this.saveSettings()
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err)
|
||||
this.$message.error('请按要求填写表单')
|
||||
})
|
||||
},
|
||||
validForm(formName) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.$refs[formName][0].validate(valid => {
|
||||
valid ? resolve() : reject()
|
||||
})
|
||||
})
|
||||
},
|
||||
saveSettings() {
|
||||
return new Promise((resolve, reject) => {
|
||||
saveGameSettings({
|
||||
uid: this.uid,
|
||||
cfgs: this.cfgs,
|
||||
gameId: this.gameInfo.game_id,
|
||||
platform: this.platform_id,
|
||||
type: this.type === 'normal' ? 0 : 1
|
||||
})
|
||||
.then(res => {
|
||||
const { data } = res
|
||||
if (data.errcode !== 0) {
|
||||
this.$notify.error({
|
||||
title: '错误',
|
||||
message: data.errmsg
|
||||
})
|
||||
reject(data.errmsg)
|
||||
return
|
||||
}
|
||||
this.$message.success('配置保存成功!')
|
||||
resolve()
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
goPublish() {
|
||||
this.$confirm('配置子项需前往配置页发布,是否跳转?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
this.$router.push(
|
||||
`/games/details/${this.uid}/settings/index?platform_id=${this.platform_id}&type=${this.type}`
|
||||
)
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message.info('已取消发布!')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
.btn-group >>> .el-button + .el-button {
|
||||
margin-left: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
@ -764,6 +764,9 @@ export default {
|
||||
})
|
||||
},
|
||||
changeType(val) {
|
||||
if (val === 4) {
|
||||
return
|
||||
}
|
||||
if (val === 2) {
|
||||
this.onlyShare = true
|
||||
this.onlyAd = false
|
||||
|
@ -31,7 +31,7 @@
|
||||
<el-dialog title="平台编辑" :visible.sync="modalVisible" :before-close="closeModal">
|
||||
<el-form ref="modalForm" :model="modalForm" :rules="modalRules" label-width="80px">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="modalForm.name"/>
|
||||
<el-input v-model="modalForm.name" :disabled="!isNew"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="英文名" prop="name_en">
|
||||
<el-input v-model="modalForm.name_en" :disabled="!isNew"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user