123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354 |
- <template>
- <view>
- <u-navbar :background="background" :border-bottom="false"></u-navbar>
- <view class="jpLogin">
- <view class="jpLogin-title">
- <h2>填写基础信息<span>1</span>/4</h2>
- <p>交友第一步,简单介绍下自己吧~</p>
- </view>
-
- <view class="jpLogin-main">
- <view class="form-tit">
- <span>*</span>
- <p>为必填项,著名保密箱的为不对外公开信息</p>
- </view>
- <view class="jpLogin-sex">
- <view class="jpLogin-sex-item">
- <u-image class="newsList-img" :src="form.sex=='male'?'/static/img/sexMan.png':'/static/img/sexMan2.png'" height="200" width="200" border-radius="10" @click="changeSex('male')"></u-image>
- <!-- <u-image class="newsList-img" src="/static/img/sexMan2.png" height="200" width="200" border-radius="10"></u-image> -->
- </view>
- <view class="jpLogin-sex-item">
- <!-- <u-image class="newsList-img" src="/static/img/sexWoman.png" height="200" width="200" border-radius="10"></u-image> -->
- <u-image class="newsList-img" :src="form.sex=='female'?'/static/img/sexWoman.png':'/static/img/sexWoman2.png'" height="200" width="200" border-radius="10" @click="changeSex('female')"></u-image>
- </view>
- </view>
- <view class="form-tit">
- <p>注册完成,你的性别就不能修改了哦~</p>
- </view>
- <view class="form-tit" style="margin-top: 36px;">
- <p>设置生日、身高和体重</p>
- </view>
- <u-form :model="form" ref="uForm">
- <view class="jpLogin-input">
- <u-form-item required="true"><u-input v-model="form.birthday" type="select" placeholder="请选择生日" @click="birthdayChange"/>
- </u-form-item>
- </view>
- <view class="jpLogin-input">
- <u-form-item required="true">
- <u-input v-model="form.height" type="select" placeholder="请选择身高" @click="show_height = true"/>
- <u-select v-model="show_height" mode="single-column" :list="height_ranges_by_names" @confirm="heightConfirm"></u-select>
- </u-form-item>
- </view>
- <view class="jpLogin-input">
- <u-form-item>
- <u-input v-model="form.weight" type="select" placeholder="请选择填写体重" @click="show_weight = true"/>
- <u-select v-model="show_weight" mode="single-column" :list="weight_ranges_by_names" @confirm="weightConfirm"></u-select>
- </u-form-item>
- </view>
- </u-form>
- </view>
- <view style="margin-top: 60px;">
- <u-button type="error" shape="circle" :custom-style="customStyle" @click="next">下一步</u-button>
- <view class="step-btn" @click="goHome">跳过</view>
- </view>
- </view>
- <mpvue-date-picker themeColor="#007AFF" ref="mpvueDatePicker" :pickerValueDefault="agePickerValueDefault" @onConfirm="onDateConfirm"></mpvue-date-picker>
-
- </view>
- </template>
- <script>
- let _self;
- /**
- * 获取任意时间
- */
- function getDate(date, AddDayCount = 0) {
- if (!date) {
- date = new Date()
- }
- if (typeof date !== 'object') {
- date = date.replace(/-/g, '/')
- }
- const dd = new Date(date)
-
- dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
-
- const y = dd.getFullYear()
- const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0
- const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0
- return {
- fullDate: y + '-' + m + '-' + d,
- year: y,
- month: m,
- date: d,
- day: dd.getDay()
- }
- }
- import mpvueDatePicker from "../../components/mpvue-datepicker/mpvue-datepicker.vue"
- import * as loginApi from '@/apis/login.js'
- export default {
- components:{
- mpvueDatePicker
- },
- data() {
- return {
- personal_info:{},
- form: {
- // name: '',
- sex:'male',
- birthday:"",
- height:'',
- weight:'',
- },
- value:'0',
- customStyle: {
- background: '#FF5E5E'
- },
- showCalendar: false,
- info: {
- lunar: true,
- range: true,
- insert: false,
- selected: []
- },
- show_height : false,
- show_weight : false,
- height_ranges:[],
- weight_ranges:[],
- height_ranges_by_names:[],
- weight_ranges_by_names:[],
- background:{
- background: 'none'
- }
- }
- },
- onReady() {
-
- this.$nextTick(() => {
- this.showCalendar = true
- })
- // TODO 模拟请求异步同步数据
- setTimeout(() => {
- this.info.date = getDate(new Date(),0).fullDate
- this.info.startDate = getDate(new Date(),-36500).fullDate
- this.info.endDate = getDate(new Date(),0).fullDate
- this.info.selected = []
- }, 2000)
- },
- onLoad(){
- _self = this;
- let subject = {subject:'zfqkList'}
- loginApi.getBaseDictionary(subject).then(function(data){
- console.log('基础字典'+JSON.stringify(data));
- },function(err){
- console.log('获取基础字典错误'+JSON.stringify(err))
- })
- for(let i = 130;i<=220;i++)
- {
- this.height_ranges.push(i.toString());
- }
- for(let i = 20;i<=120;i++)
- {
- this.weight_ranges.push(i.toString());
- }
-
- for(let i = 0;i< _self.height_ranges.length;i++)
- {
- let height_range = {value:i, label: _self.height_ranges[i]+"cm"};
- _self.height_ranges_by_names.push(height_range);
- }
- for(let i = 0;i< _self.weight_ranges.length;i++)
- {
- let weight_range = {value:i, label:_self.weight_ranges[i]+"kg"};
- _self.weight_ranges_by_names.push(weight_range);
- }
-
- },
- methods: {
- changeSex(sex){
- this.form.sex = sex;
- },
- birthdayChange(){
- this.$refs.mpvueDatePicker.show()
- },
- onDateConfirm(e) {
- _self.form.birthday = e.label;
- console.log('地址选择'+_self.birthday)
- },
- goHome(){
- uni.switchTab({
- url:'../index/index'
- })
- },
- open() {
- this.$refs.calendar.open()
- },
- heightConfirm(e){
- console.log('e'+JSON.stringify(e))
- this.form.height = '';
- e.map((val, index) => {
- // this.result += this.result == '' ? val.label : '-' + val.label;
- let result = val.label
- this.form.height += result;
- })
- },
- weightConfirm(e){
- console.log('e'+JSON.stringify(e))
- this.form.weight = '';
- e.map((val, index) => {
- // this.result += this.result == '' ? val.label : '-' + val.label;
- let result = val.label
- this.form.weight += result;
- })
- },
- close(){
- this.form.birthday =this.info.date;
- console.log('弹窗关闭'+JSON.stringify(this.info.date));
- },
- change(e) {
- console.log('change 返回:', e)
- this.info.selected = [];
-
- // 模拟动态打卡
- if (this.info.selected.length > 5) return
- this.info.selected.push({
- date: e.fulldate,
- info: '打卡'
- })
-
- },
- confirm(e) {
- this.info.date = e.fulldate;
- console.log('confirm 返回:', JSON.stringify(this.info.date))
- },
- monthSwitch(e) {
- console.log('monthSwitchs 返回:', e)
- },
- next(){
- _self.personal_info.step1 = _self.form;
- uni.navigateTo({
- url:'./step2',
- success:function(res){
- res.eventChannel.emit('acceptDataFromOpenerPage', _self.personal_info);
-
- console.log('send options'+JSON.stringify(_self.personal_info));
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .jpLogin-sex{
- display: flex;
- margin-bottom: 5px;
- .jpLogin-sex-item{
- margin-right: 15px;
- }
- }
- .form-tit{
- display: flex;
- align-items: center;
- span{
- color:#EE3138 ;
-
- }
- p{
- color: #999;
- margin-bottom: 8px;
- }
- }
- .jpLogin {
- background: url(/static/img/loginBg.png) top center no-repeat;
- background-size: 100%;
- min-height: 100vh;
- padding: 50px;
- margin-top: -44px;
- }
- .step-btn{
- text-align: center;
- margin-top: 20px;
- color: #444953 ;
- }
- .jpLogin-title {
- h2 {
- font-size: 24px;
- font-weight: normal;
- }
- span{
- color: #FF5E5E;
- margin-left: 5px;
- }
- p {
- color: #777;
- font-size: 14px;
- margin-top: 3px;
- }
- }
- .jpLogin-main {
- margin-top: 40px;
- }
- .jpLogin-input {
- height: 48px;
- background-color: #fff;
- border: 1px solid #EEDCDC;
- border-radius: 50px;
- display: flex;
- width: 100%;
- padding: 0 20px 0 30px;
- margin-bottom: 20px;
- .u-form-item{
- flex: 1;
- }
- .jpLogin-icon{
- font-size: 20px;
- color:#FFC1C1;
- margin-right: 20px;
- position: relative;
- &:after{
- content: '';
- width: 1px;
- height: 16px;
- background-color:#E6D6D6;
- position: absolute;
- right: -10px;
- top: 15px;
- }
- }
- }
- .jpLogin-link {
- display: flex;
- justify-content: space-between;
- align-items: center;
- font-size: 14px;
- .jpLogin-link-l {
- display: flex;
- align-items: center;
- p {
- color: #4f4646;
- }
- }
- span {
- color: #1677FF;
- }
- }
- .jpLogin-radio{
- margin-top: 16px;
- text-align: center;
- p{
- font-size: 14px;
- color: #a0a4b8;
- }
- span{
- color:#ff5e5e;
- font-size: 14px;
- }
- }
- </style>
|