YZProjectCloud/yanzhu-ui-app/pages/information/index.vue

109 lines
3.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view>
<homebar titlenav=""></homebar>
<view class="box">
<view style="line-height: 60rpx;">
<view style="font-size: 18px;font-weight: 600;">
请先完善个人信息
</view>
<view class="">
信息安全保护中请放心填写
</view>
</view>
<view class="" style="margin-top: 40rpx;">
<u--form labelPosition="left" labelWidth="100" :model="formData" :rules="rules" ref="uForm">
<u-form-item label="您的姓名" prop="userInfo.name" borderBottom>
<u--input v-model="formData.name" border="none"></u--input>
</u-form-item>
<u-form-item label="性别" prop="name" borderBottom>
<u-radio-group v-model="radiovalue1" placement="row" @change="groupChange">
<u-radio :customStyle="{marginLeft: '20px'}" v-for="(item, index) in radiolist1"
:key="index" :label="item.name" :name="item.name" @change="radioChange">
</u-radio>
</u-radio-group>
</u-form-item>
<u-form-item label="生日" borderBottom @click="dateShow = true;">
<u--input v-model="formData.time" disabled disabledColor="#ffffff" placeholder="请选择生日"
border="none"></u--input>
<u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>
<u-form-item label="所在城市" prop="userInfo.name" borderBottom>
<u--input v-model="formData.name" border="none"></u--input>
</u-form-item>
</u--form>
</view>
<view style="position: fixed;bottom: 0;left: 0;width: 100%;padding: 40rpx;">
<u-button text="下一步" type="success" @click="toNext('/pages/information/index1')" shape="circle"></u-button>
</view>
<u-datetime-picker @confirm="confirm" @cancel="dateShow = false" :minDate="minDate" :maxDate="maxDate" ref="datetimePicker"
:show="dateShow" mode="date"></u-datetime-picker>
</view>
</view>
</template>
<script>
export default {
data() {
return {
dateShow: false,
minDate: null,
maxDate: null,
formData: {
time: null,
name: null,
},
rules: {
'name': {
type: 'string',
required: true,
message: '请填写姓名',
trigger: ['blur', 'change']
},
},
radiolist1: [{
name: '男',
disabled: false
},
{
name: '女',
disabled: false
}
],
// u-radio-group的v-model绑定的值如果设置为某个radio的name就会被默认选中
radiovalue1: '苹果',
};
},
onLoad() {
this.minDate = Number(new Date('1950-01-01'))
this.maxDate = Number(new Date())
},
methods: {
toNext(url){
uni.navigateTo({
url:'/pages/information/index2'
})
},
confirm(val) {
let date = new Date(val.value)
let Y = date.getFullYear() + '-';
let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
let D = date.getDate()>9?date.getDate() + ' ':'0' + date.getDate() + ' ';
// document.write(Y + M + D + h + m + s);
this.formData.time = Y + M + D
this.dateShow = false
},
groupChange(n) {
console.log('groupChange', n);
},
radioChange(n) {
console.log('radioChange', n);
}
}
}
</script>
<style lang="scss" scoped>
.box {
margin: 40rpx;
}
</style>