|
|
@@ -15,14 +15,27 @@
|
|
|
</van-cell-group>
|
|
|
<van-cell-group :border="false">
|
|
|
<van-field
|
|
|
- v-model="form.map"
|
|
|
+ v-model="form.mode"
|
|
|
+ is-link
|
|
|
+ readonly
|
|
|
+ :border="false"
|
|
|
+ name="对战模式"
|
|
|
+ label="对战模式"
|
|
|
+ placeholder="点击选择对战模式"
|
|
|
+ @click="picker('modeId')"
|
|
|
+ >
|
|
|
+ </van-field>
|
|
|
+ </van-cell-group>
|
|
|
+ <van-cell-group :border="false">
|
|
|
+ <van-field
|
|
|
+ v-model="form.gameMap"
|
|
|
is-link
|
|
|
readonly
|
|
|
:border="false"
|
|
|
name="赛事地图"
|
|
|
label="赛事地图"
|
|
|
placeholder="点击选择赛事地图"
|
|
|
- @click="showPicker = true"
|
|
|
+ @click="picker('gameMapId')"
|
|
|
/>
|
|
|
<van-field :border="false" name="是否使用密码" label="是否使用密码">
|
|
|
<template #input>
|
|
|
@@ -32,12 +45,21 @@
|
|
|
</van-radio-group>
|
|
|
</template>
|
|
|
</van-field>
|
|
|
+ <van-field
|
|
|
+ v-model="form.psd"
|
|
|
+ is-link
|
|
|
+ :border="false"
|
|
|
+ v-if="form.password"
|
|
|
+ name="房间密码"
|
|
|
+ label="房间密码"
|
|
|
+ placeholder="请输入房间密码"
|
|
|
+ />
|
|
|
</van-cell-group>
|
|
|
|
|
|
<van-cell-group :border="false">
|
|
|
<van-cell title="填写游戏地址" :border="false" is-link value="查看建房说明" />
|
|
|
<van-field
|
|
|
- v-model="form.message"
|
|
|
+ v-model="form.url"
|
|
|
name="游戏地址"
|
|
|
rows="4"
|
|
|
autosize
|
|
|
@@ -58,9 +80,17 @@
|
|
|
</van-form>
|
|
|
<van-overlay :show="showPicker" @click="showPicker = false">
|
|
|
<div class="picker" @click.stop>
|
|
|
- <div class="picker-title">选择赛事地图</div>
|
|
|
- <div class="selects">
|
|
|
- <div class="select" v-for="(item, index) in mapOptions" :key="index">{{ item.label }}</div>
|
|
|
+ <div class="picker-title">{{ pickerTitle }}</div>
|
|
|
+ <div class="selects" :class="{ selectOnly: pickerOptions.length === 1 }">
|
|
|
+ <div
|
|
|
+ class="select"
|
|
|
+ :class="{ prim: pickerValue === item.value }"
|
|
|
+ v-for="(item, index) in pickerOptions"
|
|
|
+ :key="index"
|
|
|
+ @click="choosePicker(item.value)"
|
|
|
+ >
|
|
|
+ {{ item.label }}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</van-overlay>
|
|
|
@@ -75,31 +105,100 @@ export default {
|
|
|
type: 'QQ',
|
|
|
usedPsd: false,
|
|
|
map: '王者荣耀',
|
|
|
- message: ''
|
|
|
+ message: '',
|
|
|
+ modeId: '',
|
|
|
+ mode: '',
|
|
|
+ gameMapId: '',
|
|
|
+ gameMap: '',
|
|
|
+ password: ''
|
|
|
},
|
|
|
showPicker: false,
|
|
|
- mapOptions: [
|
|
|
- {
|
|
|
- label: '王者峡谷',
|
|
|
- value: '王者峡谷'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '长平攻防战',
|
|
|
- value: '长平攻防战'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '梦境大乱斗',
|
|
|
- value: '梦境大乱斗'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '无限乱斗',
|
|
|
- value: '无限乱斗'
|
|
|
- }
|
|
|
- ]
|
|
|
+ pickerType: 'modeId',
|
|
|
+ modeIdOptions: [],
|
|
|
+ gameMapIdOptions: []
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ pickerOptions() {
|
|
|
+ if (this.pickerType === 'modeId') {
|
|
|
+ return [...this.modeIdOptions];
|
|
|
+ }
|
|
|
+ if (this.pickerType === 'gameMapId') {
|
|
|
+ return [...this.gameMapIdOptions];
|
|
|
+ }
|
|
|
+ return [];
|
|
|
+ },
|
|
|
+ pickerValue() {
|
|
|
+ if (this.pickerType === 'gameMapId') {
|
|
|
+ return Number(this.form.gameMapId || 0);
|
|
|
+ }
|
|
|
+ return Number(this.form.modeId || 0);
|
|
|
+ },
|
|
|
+ pickerTitle() {
|
|
|
+ if (this.pickerType === 'gameMapId') {
|
|
|
+ return '选择赛事地图';
|
|
|
+ }
|
|
|
+ return '选择对战模式';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.$http
|
|
|
+ .post('/gameMode/all', { size: 1000, query: { del: false } }, { body: 'json' })
|
|
|
+ .then(res => {
|
|
|
+ this.modeIdOptions = res.content.map(item => {
|
|
|
+ return {
|
|
|
+ label: item.name,
|
|
|
+ value: item.id
|
|
|
+ };
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ console.log(e);
|
|
|
+ this.$toast(e.error);
|
|
|
+ });
|
|
|
+ },
|
|
|
methods: {
|
|
|
- submit() {}
|
|
|
+ submit() {},
|
|
|
+ picker(type = 'modeId') {
|
|
|
+ if (type === 'gameMapId') {
|
|
|
+ if (!this.form.modeId) {
|
|
|
+ this.$toast('请选择对战模式');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.pickerType = type;
|
|
|
+ this.showPicker = true;
|
|
|
+ },
|
|
|
+ getMap() {
|
|
|
+ this.$http
|
|
|
+ .post('/gameMap/all', { size: 1000, query: { del: false, modeId: this.form.modeId } }, { body: 'json' })
|
|
|
+ .then(res => {
|
|
|
+ this.gameMapIdOptions = res.content.map(item => {
|
|
|
+ return {
|
|
|
+ label: item.name,
|
|
|
+ value: item.id
|
|
|
+ };
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ console.log(e);
|
|
|
+ this.$toast(e.error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ choosePicker(id) {
|
|
|
+ if (this.pickerType == 'modeId') {
|
|
|
+ this.form.modeId = id;
|
|
|
+ this.form.mode = this.getLabelName(this.form.modeId, this.modeIdOptions);
|
|
|
+ this.form.gameMapId = '';
|
|
|
+ this.form.gameMap = '';
|
|
|
+ this.getMap();
|
|
|
+ }
|
|
|
+ if (this.pickerType == 'gameMapId') {
|
|
|
+ this.form.gameMapId = id;
|
|
|
+ this.form.gameMap = this.getLabelName(this.form.gameMapId, this.gameMapIdOptions);
|
|
|
+ }
|
|
|
+ this.showPicker = false;
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
@@ -166,6 +265,13 @@ export default {
|
|
|
text-align: center;
|
|
|
line-height: 32px;
|
|
|
border-radius: 4px;
|
|
|
+ &.prim {
|
|
|
+ background: linear-gradient(225deg, #f6abf0 0%, #10f7ee 100%);
|
|
|
+ color: #1a1c2b;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ &.selectOnly {
|
|
|
+ justify-content: center;
|
|
|
}
|
|
|
}
|
|
|
}
|