You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
3.4 KiB
95 lines
3.4 KiB
<template>
|
|
<RefreshView ref="mescrollRef" text="报名条件" :useDownScroll="false" :useUpScroll="false" :useTitleLeftBtn="1" titleLeftBtnSource="设置" @leftBtn='setup'>
|
|
<view class="row">
|
|
<text class="field">性别限制</text>
|
|
<radio-group @change="radioSexChange($event)">
|
|
<radio :checked="data.activityItemCondition.sex==0" :value="0" >不限</radio>
|
|
<radio :checked="data.activityItemCondition.sex==1" :value="1" style="margin-left: 80rpx;">男</radio>
|
|
<radio :checked="data.activityItemCondition.sex==2" :value="2" style="margin-left: 80rpx;">女</radio>
|
|
</radio-group>
|
|
</view>
|
|
<view class="line-thin"></view>
|
|
<picker mode="multiSelector" :range="page.age" @change="bindAgeChange($event,index)">
|
|
<view class="row">
|
|
<text class="field">年龄段</text>
|
|
<text class="explain">{{page.ageRangeText}}</text>
|
|
<image class = "more" src="../../static/img/public/more.png" ></image>
|
|
</view>
|
|
</picker>
|
|
</RefreshView>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
data:{
|
|
activityItemCondition:{
|
|
sex:0,
|
|
minAge:0,
|
|
maxAge:0
|
|
}
|
|
},
|
|
page:{
|
|
age:[
|
|
[],
|
|
[]
|
|
]
|
|
},
|
|
ageRangeText:""
|
|
}
|
|
},
|
|
onLoad(options){
|
|
let activityItemCondition = JSON.parse(options.activityItemCondition)
|
|
let _this = this
|
|
if (activityItemCondition != undefined){
|
|
_this.data.activityItemCondition.sex = activityItemCondition.sex == undefined ?0 :activityItemCondition.sex;
|
|
_this.data.activityItemCondition.minAge = activityItemCondition.minAge == undefined ?0:activityItemCondition.minAge;
|
|
_this.data.activityItemCondition.maxAge = activityItemCondition.maxAge == undefined ?0:activityItemCondition.maxAge;
|
|
}
|
|
// 设置10岁到100岁的数组
|
|
_this.page.age[0].push("不限")
|
|
_this.page.age[1].push("不限")
|
|
for(let i =10; i<=100; i++){
|
|
_this.page.age[0].push(i + "岁");
|
|
_this.page.age[1].push(i + "岁");
|
|
}
|
|
// 年龄段范围文字赋值
|
|
this.page.ageRangeText = this.convertAgeRangeText(this.data.activityItemCondition.minAge,this.data.activityItemCondition.maxAge)
|
|
},
|
|
methods:{
|
|
radioSexChange(e) {
|
|
let _this = this
|
|
_this.data.activityItemCondition.sex = e.detail.value
|
|
},
|
|
bindAgeChange(e,index){
|
|
console.log("--------------------------",JSON.stringify(e.detail.value[0]))
|
|
if (e.detail.value[0] == 0){this.data.activityItemCondition.minAge = 0}else{this.data.activityItemCondition.minAge = e.detail.value[0] + 9}
|
|
if (e.detail.value[1] == 0){this.data.activityItemCondition.maxAge = 0}else{this.data.activityItemCondition.maxAge = e.detail.value[1] + 9}
|
|
// this.page.ageRange = this.page.age[0][e.detail.value[0]] + " 到 " + this.page.age[1][e.detail.value[1]]
|
|
this.page.ageRangeText = this.convertAgeRangeText(this.data.activityItemCondition.minAge,this.data.activityItemCondition.maxAge)
|
|
},
|
|
setup(){
|
|
this.data.activityItemCondition = JSON.stringify(this.data.activityItemCondition)
|
|
this.SetResult(this.data)
|
|
},
|
|
convertAgeRangeText(minAge,maxAge){
|
|
if(minAge == 0 && maxAge == 0 ){
|
|
return "不限年龄"
|
|
}
|
|
if(minAge == 0 && maxAge > 0 ){
|
|
return maxAge + "岁以下"
|
|
}
|
|
if(minAge > 0 && maxAge == 0 ){
|
|
return minAge + "岁以上"
|
|
}
|
|
if(minAge > 0 && maxAge > 0 ){
|
|
return minAge + "岁 至 " + maxAge +"岁"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style>
|
|
@import url("../../static/master.css");
|
|
</style>
|