百富门答题小程序
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.
 
 
 

242 lines
4.6 KiB

<template>
<view class="home">
<image src="/static/image/bg/1.png"
class="page-bg"
mode="aspectFill"></image>
<!-- next1 -->
<view class="content_now" v-if="stop == 1">
<view class=""
v-if="probleme[index]"
v-html="$utils.stringFormatHtml(probleme[index].title)">
</view>
<!-- <view class="mian-btn"
:class="{active:isActive === '是'}"
@click="setActive('是')">是</view>
<view class="mian-btn"
:class="{active:isActive === '否'}"
@click="setActive('否')">否</view> -->
<view class="mian-btn"
v-for="(item, index) in probleme[index] && probleme[index].danan && probleme[index].danan.split(',')"
:class="{active:isActive === item}"
:key="index"
@click="setActive(item)">{{ item }}</view>
</view>
<!-- next2 -->
<view class="content_now" v-if="stop == 2">
<text class="font-bold mb-60">请选择您所在的区域</text>
<view class="">
<picker
mode="region"
:value="date"
class="u-w-440"
@change="bindTimeChange">
<view class="region">
<view class="">
{{ address.province}}
</view>
<view class="">
{{ address.city}}
</view>
<view class="">
{{ address.district}}
</view>
</view>
</picker>
</view>
</view>
<view class="an">
<!-- <view style="display: flex;width: 600rpx;"
v-if="stop == 1">
<view class="next-btn"
v-if="index > 0"
@click="index--">
上一题
</view>
<view class="next-btn"
@click="next">
下一题
</view>
</view> -->
<view class="next-btn"
v-if="stop == 1"
@click="next">
下一题
</view>
<view class="next-btn"
v-if="stop == 2"
@click="next">
提交
</view>
<text class="second-color">{{ configList.bg_title }}</text>
</view>
</view>
</template>
<script>
import { mapState } from 'vuex'
export default {
data() {
return {
isActive : null,
stop : 1,
index : 0,
address : {
province : '',
city : '',
district : '',
}
}
},
computed : {
...mapState(['problemList', 'configList', 'queryMyLog']),
probleme(){
let ids = []
for(let i = 0;i < this.queryMyLog.length;i++){
ids.push(this.queryMyLog[i].topId)
}
return this.problemList.filter(n => {
return !ids.includes(n.id)
})
},
},
onLoad() {
if(this.probleme.length == 0){
this.stop++
}
let address = uni.getStorageSync('user_address')
if(address){
this.address = JSON.parse(address)
}
},
onShow() {
},
methods: {
setActive(value){
this.isActive = value
},
next(){
this['next' + this.stop]()
},
next1(){
if(this.isActive){
this.$api('submitLog', {
topId : this.probleme[this.index].id,
context : this.isActive,
}, res => {
this.isActive = null
if(this.index == this.probleme.length - 1){
this.stop = 2
}else{
this.index++
}
})
}else{
uni.showToast({
title:'请选择后进行下一题',
icon: 'none'
})
}
},
next2(){
// this.stop = 3
if(!this.address.province){
uni.showToast({
title:'请选择地址后进行下一题',
icon: 'none'
})
return
}
uni.redirectTo({
url: '/pages_order/info/fillInfo'
})
},
// 获取省市区
bindTimeChange(e) {
this.address.province = e.detail.value[0];
this.address.city = e.detail.value[1];
this.address.district = e.detail.value[2];
this.address.provinceName = e.detail.value[0] + e.detail.value[1] + e.detail.value[2];
uni.setStorageSync('user_address', JSON.stringify(this.address))
},
}
}
</script>
<style lang="scss" scoped>
.region{
display: flex;
align-items: center;
&>view{
width: 140rpx;
height: 50rpx;
border-radius: 10rpx;
border: 1px solid #e6bf7f;
margin: 0 10rpx;
line-height: 50rpx;
text-align: center;
}
}
.b-btn{
width: 86%;
display: flex;
justify-content: center;
padding-top: 130rpx;
.pre-btn{
border: 4rpx solid #f1e0c6;
padding: 16rpx 90rpx;
border-radius: 66rpx;
color: #e6bf7f;
}
}
.next-btn{
background-image: url('../../static/image/home/btn.png');
background-size: contain;
background-repeat: no-repeat;
background-position: center;
width: 280rpx;
display: flex;
align-items: center;
justify-content: center;
color: white;
padding: 16rpx 90rpx;
}
.an{
position: fixed;
bottom: 300rpx;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
}
</style>