Commit 23b79d7f by 李伟康

--no commit message

1 parent 7d77ca1f
// packageMine/pages/questionnaire/components/Cascader/Cascader.js
const options = [{
text: '浙江省',
value: '330000',
children: [{
text: '杭州市',
value: '330100'
}],
},
{
text: '江苏省',
value: '320000',
children: [{
text: '南京市',
value: '320100'
}],
},
];
Component({
/**
* 组件的属性列表
*/
properties: {
title: String,
data: Array
},
/**
......@@ -30,7 +14,6 @@ Component({
*/
data: {
show: false,
options,
fieldValue: '',
cascaderValue: '',
},
......
/* packageMine/pages/questionnaire/components/Cascader/Cascader.wxss */
@import '../Select/Select.scss';
\ No newline at end of file
@import '../Select/Select.scss';
<view class="select {{!fieldValue?'default':''}}" bindtap="onClick">
<view class="select {{!fieldValue?'default':''}} {{show?'focus':''}}" bindtap="onClick">
<view class="value">
{{fieldValue||'请选择'}}
</view>
</view>
<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>
\ No newline at end of file
......@@ -12,7 +12,7 @@ Component({
* 组件的初始数据
*/
data: {
raidoIndex: 0
raidoIndex: -1
},
/**
......
......@@ -6,6 +6,7 @@ Component({
*/
properties: {
data: Array,
title: String
},
/**
......@@ -13,7 +14,7 @@ Component({
*/
data: {
value: '',
show:false
show: false
},
/**
......@@ -31,9 +32,14 @@ Component({
show: false
})
},
choose(e) {
const {value} = e.detail
this.setData({value})
onConfirm(e) {
const {
value
} = e.detail
this.setData({
value
})
this.onClose()
}
}
})
\ No newline at end of file
......@@ -8,10 +8,11 @@
box-sizing: border-box;
padding: 16rpx 20rpx;
font-size: 28rpx;
color: #333333;
position: relative;
overflow: hidden;
&::after{
color: #333;
&::after {
position: absolute;
content: '';
border: 2rpx solid #999;
......@@ -23,12 +24,27 @@
box-sizing: border-box;
width: 16.14rpx;
height: 16.14rpx;
transform-origin: top;
transition: all .25s;
}
.value{
.value {
width: calc(100% - 44rpx);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.default{
.focus {
&::after {
transform: translateY(-20%) rotate(225deg);
}
}
.default {
color: #999999;
}
.active {
color: var(--themeColor);
}
\ 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">
{{value||'请选择'}}
</view>
</view>
<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>
\ No newline at end of file
......@@ -5,9 +5,76 @@ Page({
* 页面的初始数据
*/
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 @@
"gl-checkbox":"./components/Checkbox/Checkbox",
"gl-select":"./components/Select/Select",
"gl-cascader":"./components/Cascader/Cascader",
"gl-textarea":"/components/GlTextarea/GlTextarea"
"van-field": "@vant/weapp/field/index"
},
"navigationBarTitleText": "调查问卷"
}
\ No newline at end of file
/* packageMine/pages/questionnaire/questionnaire.wxss */
.layout {
padding: 30rpx 40rpx calc(178rpx + var(--constantSafeAreaInsetBottom));
padding: 30rpx 40rpx calc(178rpx + var(--envSafeAreaInsetBottom));
// padding: 30rpx 40rpx calc(198rpx + var(--constantSafeAreaInsetBottom)) 0;
// padding: 30rpx 40rpx calc(198rpx + var(--envSafeAreaInsetBottom)) 0;
padding: 30rpx 40rpx 44rpx 0;
padding: 30rpx 40rpx 44rpx 0;
background-color: #fff;
.tips {
font-size: 28rpx;
color: #999999;
line-height: 40rpx;
display: block;
padding-left: 40rpx;
}
.form-box {
margin-top: 28rpx;
border-top: 2rpx dotted #e6e6e6;
border-bottom: 2rpx dotted #e6e6e6;
padding-bottom: 38rpx;
&::before {
content: '';
width: calc(100% - 40rpx);
height: 0;
margin-left: 40rpx;
display: block;
border-top: 2rpx dotted #e6e6e6;
}
.title {
padding: 40rpx 0 30rpx;
......@@ -22,27 +34,38 @@
color: #333333;
letter-spacing: 0;
line-height: 48rpx;
margin-left: 20rpx;
display: felx;
align-items: center;
display: flex;
justify-content: flex-end;
.num {
flex-shrink: 0;
padding-right: 10rpx;
}
.text {
width: calc(100% - 100rpx);
}
}
.required {
position: relative;
.num {
position: relative;
&::before {
position: absolute;
left: -14rpx;
top: 46rpx;
content: '*';
color: #F24724;
font-weight: normal;
&::before {
position: absolute;
left: -16rpx;
top: 6rpx;
content: '*';
color: #F24724;
font-weight: normal;
}
}
}
.item {
width: calc(100% - 60rpx);
margin-left: 60rpx;
width: calc(100% - 100rpx);
margin: 0 0 20rpx 100rpx;
}
.textarea {
......@@ -55,17 +78,25 @@
}
}
}
.fixed-btn{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 148rpx;
background-color: #F8F8F8 ;
.default-btn{
width: 690rpx;
.fixed-btn {
// 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;
background-color: var(--themeColor);
}
}
.van-cell {
padding: 0 !important;
height: 100%;
overflow-y: scroll;
}
\ No newline at end of file
<view class="layout">
<text class="tips">亲爱的住户,你好。
为了给你提供更好的居住环境和服务,由中海物业发起的调查问卷,邀请您填写,十分感谢!</text>
<text class="tips">{{tips}}</text>
<view class="form-box">
<view class="title required">1. 单选题单选题单选题是单选题单选题单选题是单选题单选题单选题是单选题单选题单选题是单选题单选题单选题是</view>
<view class="item">
<gl-radio data="{{[1,2,3,4]}}"></gl-radio>
</view>
<view class="title">2. 多选题</view>
<view class="item">
<gl-checkbox data="{{[1,2,3,4]}}"></gl-checkbox>
</view>
<view class="title">3. 选择题</view>
<view class="item">
<gl-select data="{{[1,2,3,4,5]}}"></gl-select>
</view>
<view class="title">4. 多层级选择题</view>
<view class="item">
<gl-cascader></gl-cascader>
</view>
<view class="title">5. 填空题</view>
<view class="textarea item">
<gl-textarea></gl-textarea>
</view>
<block wx:for="{{test}}" wx:key="index">
<view class="title {{item.required?'required':''}}">
<view class="num">{{index + 1}}.</view>
<view class="text">{{item.title}}</view>
</view>
<view class="item {{item.type == 3?'textarea':''}}">
<block wx:if="{{item.type == 1}}">
<gl-radio data="{{item.data}}" />
</block>
<block wx:elif="{{item.type == 2}}">
<gl-checkbox data="{{item.data}}" />
</block>
<block wx:elif="{{item.type == 3}}">
<van-field type="textarea" autosize placeholder="请输入" border="{{ false }}" bindblur="blur" maxlength="{{item.maxlength}}" />
</block>
<block wx:elif="{{item.type == 4}}">
<gl-select data="{{item.data}}" title="{{item.title}}" />
</block>
<block wx:else>
<gl-cascader data="{{item.data}}" title="{{item.title}}" />
</block>
</view>
</block>
</view>
</view>
<view class="fixed-btn text-center isFullSucreen">
<view class="fixed-btn text-center">
<button class="default-btn">提交</button>
</view>
\ No newline at end of file
......@@ -3,7 +3,7 @@
</view>
<!-- <view class="save-money-box"> -->
<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">
<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>
......
......@@ -167,4 +167,13 @@
100% {
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
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!