Commit 23b79d7f by 李伟康

--no commit message

1 parent 7d77ca1f
// packageMine/pages/questionnaire/components/Cascader/Cascader.js // packageMine/pages/questionnaire/components/Cascader/Cascader.js
const options = [{
text: '浙江省',
value: '330000',
children: [{
text: '杭州市',
value: '330100'
}],
},
{
text: '江苏省',
value: '320000',
children: [{
text: '南京市',
value: '320100'
}],
},
];
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
title: String,
data: Array
}, },
/** /**
...@@ -30,7 +14,6 @@ Component({ ...@@ -30,7 +14,6 @@ Component({
*/ */
data: { data: {
show: false, show: false,
options,
fieldValue: '', fieldValue: '',
cascaderValue: '', cascaderValue: '',
}, },
......
<view class="select {{!fieldValue?'default':''}}" bindtap="onClick"> <view class="select {{!fieldValue?'default':''}} {{show?'focus':''}}" bindtap="onClick">
<view class="value"> <view class="value">
{{fieldValue||'请选择'}} {{fieldValue||'请选择'}}
</view> </view>
</view> </view>
<van-popup show="{{ show }}" round position="bottom" bind:click-overlay="onClose"> <van-popup show="{{ show }}" round position="bottom" bind:click-overlay="onClose">
<van-cascader title="请选择所在地区" value="{{ cascaderValue }}" active-color="#3772EC" options="{{ options }}" bindclose="onClose" bindfinish="onFinish" /> <van-cascader title="{{title}}" value="{{ cascaderValue }}" active-color="#3772EC" options="{{ data }}" bindclose="onClose" bindfinish="onFinish">
</van-cascader>
</van-popup> </van-popup>
\ No newline at end of file \ No newline at end of file
...@@ -12,7 +12,7 @@ Component({ ...@@ -12,7 +12,7 @@ Component({
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
raidoIndex: 0 raidoIndex: -1
}, },
/** /**
......
...@@ -6,6 +6,7 @@ Component({ ...@@ -6,6 +6,7 @@ Component({
*/ */
properties: { properties: {
data: Array, data: Array,
title: String
}, },
/** /**
...@@ -13,7 +14,7 @@ Component({ ...@@ -13,7 +14,7 @@ Component({
*/ */
data: { data: {
value: '', value: '',
show:false show: false
}, },
/** /**
...@@ -31,9 +32,14 @@ Component({ ...@@ -31,9 +32,14 @@ Component({
show: false show: false
}) })
}, },
choose(e) { onConfirm(e) {
const {value} = e.detail const {
this.setData({value}) value
} = e.detail
this.setData({
value
})
this.onClose()
} }
} }
}) })
\ No newline at end of file \ No newline at end of file
...@@ -8,10 +8,11 @@ ...@@ -8,10 +8,11 @@
box-sizing: border-box; box-sizing: border-box;
padding: 16rpx 20rpx; padding: 16rpx 20rpx;
font-size: 28rpx; font-size: 28rpx;
color: #333333;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
&::after{ color: #333;
&::after {
position: absolute; position: absolute;
content: ''; content: '';
border: 2rpx solid #999; border: 2rpx solid #999;
...@@ -23,12 +24,27 @@ ...@@ -23,12 +24,27 @@
box-sizing: border-box; box-sizing: border-box;
width: 16.14rpx; width: 16.14rpx;
height: 16.14rpx; height: 16.14rpx;
transform-origin: top; transition: all .25s;
} }
.value{
.value {
width: calc(100% - 44rpx); width: calc(100% - 44rpx);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.focus {
&::after {
transform: translateY(-20%) rotate(225deg);
} }
} }
.default{
.default {
color: #999999; color: #999999;
} }
.active {
color: var(--themeColor);
}
\ No newline at end of file \ No newline at end of file
<view class="select {{!value?'default':''}}" bindtap="onClick"> <view class="select {{!value?'default':''}} {{show?'focus':''}}" bindtap="onClick">
<view class="value"> <view class="value">
{{value||'请选择'}} {{value||'请选择'}}
</view> </view>
</view> </view>
<van-popup show="{{ show }}" round position="bottom" bind:click-overlay="onClose"> <van-popup show="{{ show }}" round position="bottom" bind:click-overlay="onClose">
<van-picker show-toolbar columns="{{ data }}" bind:change="onChange" bind:cancel="onClose" bind:confirm="onConfirm" /> <van-picker show-toolbar title="{{title}}" columns="{{ data }}" bind:cancel="onClose" bind:confirm="onConfirm" active-class="active" />
</van-popup> </van-popup>
\ No newline at end of file \ No newline at end of file
...@@ -5,9 +5,76 @@ Page({ ...@@ -5,9 +5,76 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
tips:'亲爱的住户,你好。\n为了给你提供更好的居住环境和服务,由中海物业发起的调查问卷,邀请您填写,十分感谢!',
//type 1.单选框,2.复选框,3.多行文本框,4.下拉选择器,5.集联选择器
test: [{
title: '您的年龄',
type: 1,
data: ['20岁以下', '20~35岁', '35~45岁', '45岁以上'],
required: true
},
{
title: '假期闲暇时最常做的事情',
type: 2,
data: ['上网', '睡觉', '看电视', '打游戏', '逛街', '看书', '学习'],
required: true
},
{
title: '请问做兼职的主要目的',
type: 4,
data: ['锻炼自己', '获得工作报酬', '减轻家庭负担', '提前专业实习', '充实漫长假期', '没有做兼职的打算'],
required: true
},
{
title: '请问做兼职的主要目的请问做兼职的主要目的请问做兼职的主要目的请问做兼职的主要目的请问做兼职的主要目的',
type: 1,
data: ['锻炼自己', '获得工作报酬', '减轻家庭负担', '提前专业实习', '充实漫长假期', '没有做兼职的打算'],
required: true
},
{
title: '家在哪里?',
type: 5,
data: [{
text: '浙江省',
value: '330000',
children: [{
text: '杭州市',
value: '330100',
children: [{
text: '嚯嚯嚯',
value: '3301001',
}]
}],
},
{
text: '江苏省',
value: '320000',
children: [{
text: '南京市',
value: '320100',
children: [{
text: '恒河猴',
value: '3301001',
}]
}],
},
],
required: true
},
{
title: '如果校园内开展禁烟活动你会',
type: 3
}
],
obj:{
}
}, },
blur(e){
const {value} = e.detail
console.log(value)
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"gl-checkbox":"./components/Checkbox/Checkbox", "gl-checkbox":"./components/Checkbox/Checkbox",
"gl-select":"./components/Select/Select", "gl-select":"./components/Select/Select",
"gl-cascader":"./components/Cascader/Cascader", "gl-cascader":"./components/Cascader/Cascader",
"gl-textarea":"/components/GlTextarea/GlTextarea" "van-field": "@vant/weapp/field/index"
}, },
"navigationBarTitleText": "调查问卷" "navigationBarTitleText": "调查问卷"
} }
\ No newline at end of file \ No newline at end of file
/* packageMine/pages/questionnaire/questionnaire.wxss */ /* packageMine/pages/questionnaire/questionnaire.wxss */
.layout { .layout {
padding: 30rpx 40rpx calc(178rpx + var(--constantSafeAreaInsetBottom)); // padding: 30rpx 40rpx calc(198rpx + var(--constantSafeAreaInsetBottom)) 0;
padding: 30rpx 40rpx calc(178rpx + var(--envSafeAreaInsetBottom)); // padding: 30rpx 40rpx calc(198rpx + var(--envSafeAreaInsetBottom)) 0;
padding: 30rpx 40rpx 44rpx 0;
padding: 30rpx 40rpx 44rpx 0;
background-color: #fff; background-color: #fff;
.tips { .tips {
font-size: 28rpx; font-size: 28rpx;
color: #999999; color: #999999;
line-height: 40rpx; line-height: 40rpx;
display: block;
padding-left: 40rpx;
} }
.form-box { .form-box {
margin-top: 28rpx; margin-top: 28rpx;
&::before {
content: '';
width: calc(100% - 40rpx);
height: 0;
margin-left: 40rpx;
display: block;
border-top: 2rpx dotted #e6e6e6; border-top: 2rpx dotted #e6e6e6;
border-bottom: 2rpx dotted #e6e6e6; }
padding-bottom: 38rpx;
.title { .title {
padding: 40rpx 0 30rpx; padding: 40rpx 0 30rpx;
...@@ -22,27 +34,38 @@ ...@@ -22,27 +34,38 @@
color: #333333; color: #333333;
letter-spacing: 0; letter-spacing: 0;
line-height: 48rpx; line-height: 48rpx;
margin-left: 20rpx; display: flex;
display: felx; justify-content: flex-end;
align-items: center;
.num {
flex-shrink: 0;
padding-right: 10rpx;
}
.text {
width: calc(100% - 100rpx);
}
} }
.required { .required {
.num {
position: relative; position: relative;
&::before { &::before {
position: absolute; position: absolute;
left: -14rpx; left: -16rpx;
top: 46rpx; top: 6rpx;
content: '*'; content: '*';
color: #F24724; color: #F24724;
font-weight: normal; font-weight: normal;
} }
} }
}
.item { .item {
width: calc(100% - 60rpx); width: calc(100% - 100rpx);
margin-left: 60rpx; margin: 0 0 20rpx 100rpx;
} }
.textarea { .textarea {
...@@ -55,17 +78,25 @@ ...@@ -55,17 +78,25 @@
} }
} }
} }
.fixed-btn{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 148rpx;
background-color: #F8F8F8 ;
.default-btn{ .fixed-btn {
width: 690rpx; // position: fixed;
// bottom: 0;
// left: 0;
width: calc(100% - 60rpx);
background-color: #F8F8F8;
padding: 32rpx 30rpx calc(32rpx + var(--constantSafeAreaInsetBottom));
padding: 32rpx 30rpx calc(32rpx + var(--envSafeAreaInsetBottom));
.default-btn {
width: 100%;
border-radius: 48rpx; border-radius: 48rpx;
background-color: var(--themeColor); background-color: var(--themeColor);
} }
} }
.van-cell {
padding: 0 !important;
height: 100%;
overflow-y: scroll;
}
\ No newline at end of file \ No newline at end of file
<view class="layout"> <view class="layout">
<text class="tips">亲爱的住户,你好。 <text class="tips">{{tips}}</text>
为了给你提供更好的居住环境和服务,由中海物业发起的调查问卷,邀请您填写,十分感谢!</text>
<view class="form-box"> <view class="form-box">
<view class="title required">1. 单选题单选题单选题是单选题单选题单选题是单选题单选题单选题是单选题单选题单选题是单选题单选题单选题是</view> <block wx:for="{{test}}" wx:key="index">
<view class="item"> <view class="title {{item.required?'required':''}}">
<gl-radio data="{{[1,2,3,4]}}"></gl-radio> <view class="num">{{index + 1}}.</view>
<view class="text">{{item.title}}</view>
</view> </view>
<view class="title">2. 多选题</view> <view class="item {{item.type == 3?'textarea':''}}">
<view class="item"> <block wx:if="{{item.type == 1}}">
<gl-checkbox data="{{[1,2,3,4]}}"></gl-checkbox> <gl-radio data="{{item.data}}" />
</view> </block>
<view class="title">3. 选择题</view> <block wx:elif="{{item.type == 2}}">
<view class="item"> <gl-checkbox data="{{item.data}}" />
<gl-select data="{{[1,2,3,4,5]}}"></gl-select> </block>
</view> <block wx:elif="{{item.type == 3}}">
<view class="title">4. 多层级选择题</view> <van-field type="textarea" autosize placeholder="请输入" border="{{ false }}" bindblur="blur" maxlength="{{item.maxlength}}" />
<view class="item"> </block>
<gl-cascader></gl-cascader> <block wx:elif="{{item.type == 4}}">
</view> <gl-select data="{{item.data}}" title="{{item.title}}" />
<view class="title">5. 填空题</view> </block>
<view class="textarea item"> <block wx:else>
<gl-textarea></gl-textarea> <gl-cascader data="{{item.data}}" title="{{item.title}}" />
</block>
</view> </view>
</block>
</view> </view>
</view> </view>
<view class="fixed-btn text-center isFullSucreen"> <view class="fixed-btn text-center">
<button class="default-btn">提交</button> <button class="default-btn">提交</button>
</view> </view>
\ No newline at end of file \ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
</view> </view>
<!-- <view class="save-money-box"> --> <!-- <view class="save-money-box"> -->
<view class="save-money-box-content" style="{{user_box_style}}"> <view class="save-money-box-content" style="{{user_box_style}}">
<glsx-image webp src="home/homelife_bg.png" class="save-money-img"></glsx-image> <glsx-image webp src="home/save_money_bg.png" class="save-money-img"></glsx-image>
<view class="save-money-order-box"> <view class="save-money-order-box">
<glsx-image webp src="savemoney/save_order.png" class="save-money-order-img" bind:tap="toPluginPage"></glsx-image> <glsx-image webp src="savemoney/save_order.png" class="save-money-order-img" bind:tap="toPluginPage"></glsx-image>
<view bind:tap="toPluginPage" class="save-money-order-text-box">去下单</view> <view bind:tap="toPluginPage" class="save-money-order-text-box">去下单</view>
......
...@@ -168,3 +168,12 @@ ...@@ -168,3 +168,12 @@
opacity: 1; opacity: 1;
} }
} }
/* van组件样式 */
.van-cascader__title{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.van-picker__confirm {
color: var(--themeColor) !important;
}
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!