配送时段适配,若干细节调整

This commit is contained in:
2025-03-05 19:46:10 +08:00
parent 58a98c9403
commit 42f5eda659
28 changed files with 313 additions and 176 deletions

5
api/common.js Normal file
View File

@ -0,0 +1,5 @@
import request from './request';
export default {
getConfig:()=>request.get('/api/config')
}

21
app.js
View File

@ -1,7 +1,7 @@
import userApi from './api/user'; import userApi from './api/user';
import commonApi from './api/common';
const token = wx.getStorageSync('accessToken'); const token = wx.getStorageSync('accessToken');
// console.log() console.log(1)
const date = new Date();
App({ App({
verifyCodeWaitingTime:60, verifyCodeWaitingTime:60,
onLaunch() { onLaunch() {
@ -14,9 +14,6 @@ App({
}) })
} }
}, },
onHide(){
console.log('app on hide');
},
resetUserInfoUpdateTag(){ resetUserInfoUpdateTag(){
this.globalData.userInfoGetTime = null; this.globalData.userInfoGetTime = null;
}, },
@ -36,6 +33,16 @@ App({
return data; return data;
}, },
async getAppConfig(){
if(!this.globalData.appConfig){
const data = await commonApi.getConfig();
this.globalData.appConfig = {};
data.map((item)=>{
this.globalData.appConfig[item.key] = item.value;
})
}
return this.globalData.appConfig;
},
forceGetSummary(){ forceGetSummary(){
this.globalData.summaryGetTime = null; this.globalData.summaryGetTime = null;
@ -57,7 +64,7 @@ App({
for(var key in rules){ for(var key in rules){
((rules[key] instanceof Array)?rules[key]:[rules[key]]).map((item)=>{ ((rules[key] instanceof Array)?rules[key]:[rules[key]]).map((item)=>{
let valid = true; let valid = true;
let value = page.data[key].trim(); let value = (page.data[key]||'').trim();
//非空 //非空
if(item.required){ if(item.required){
if(value==''){ if(value==''){
@ -82,9 +89,11 @@ App({
[`${key}Message`]:'' [`${key}Message`]:''
}); });
}else{ }else{
if(item.message){
page.setData({ page.setData({
[`${key}Message`]:item.message [`${key}Message`]:item.message
}); });
}
result.push({ result.push({
[key]:item.message,autoFocus:item.autoFocus,key:key,shake:item.shake [key]:item.message,autoFocus:item.autoFocus,key:key,shake:item.shake
}) })

View File

@ -1,8 +1,8 @@
{ {
"pages": [ "pages": [
"pages/index/index", "pages/index/index",
"pages/order-detail/index",
"pages/login/index", "pages/login/index",
"pages/order-detail/index",
"pages/user/info/index", "pages/user/info/index",
"pages/withdraw/index/index", "pages/withdraw/index/index",
"pages/withdraw/success/index", "pages/withdraw/success/index",
@ -11,11 +11,12 @@
"pages/user/bank/index/index", "pages/user/bank/index/index",
"pages/user/bank/editor/index", "pages/user/bank/editor/index",
"pages/user/password/index", "pages/user/password/index",
"pages/withdraw/list/index" "pages/withdraw/list/index",
"pages/browser/index"
], ],
"window": { "window": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "Weixin", "navigationBarTitleText": "",
"navigationBarBackgroundColor": "#ffffff" "navigationBarBackgroundColor": "#ffffff"
}, },
"style": "v2", "style": "v2",

BIN
assets/icon/eyes-close.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
assets/icon/eyes-open.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
assets/icon/fengkuai.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

BIN
assets/icon/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -27,7 +27,7 @@ Component({
this.bgam = wx.getBackgroundAudioManager(); this.bgam = wx.getBackgroundAudioManager();
this.bgam.title = '后台通知'; this.bgam.title = '后台通知';
this.bgam.audioType = 'music'; this.bgam.audioType = 'music';
this.bgam.coverImgUrl = 'https://dman-1311994147.cos.ap-chengdu.myqcloud.com/20250227/DoADoEhKi4U4ab75d180b27fa14b7c34ae7969762809_d7ee9018-828e-43c7-8b2b-29d4352c0277.jpg?imageMogr2/thumbnail/800x800/format/webp'; this.bgam.coverImgUrl = 'https://dman-1311994147.cos.ap-chengdu.myqcloud.com/static/logo_large.jpg';
this.bgam.onEnded(()=>{ this.bgam.onEnded(()=>{
this.bgam.src = this.data.emptyAudio; this.bgam.src = this.data.emptyAudio;
}); });

View File

@ -5,14 +5,14 @@ Component({
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
"bindrefresherrefresh":{ refresherTriggered:{
type:Function
},
"refresherTriggered":{
type:Boolean, type:Boolean,
value:false value:false
}, },
height:0, height:{
type:Number,
value:0
},
loadMoreText:{ loadMoreText:{
type:String, type:String,
value:'已经到底了' value:'已经到底了'

View File

@ -34,7 +34,10 @@ Component({
type:String, type:String,
value:'请输入内容' value:'请输入内容'
}, },
isShowCancel:true, isShowCancel:{
type:Boolean,
value:true
},
cancelButtonText:{ cancelButtonText:{
type:String, type:String,
value:'取消' value:'取消'

View File

@ -9,7 +9,7 @@
<view class="text" wx:else>{{content}}</view> <view class="text" wx:else>{{content}}</view>
<view class="btns"> <view class="btns">
<button class="button cancel" plain vx:if="{{isShowCancel}}" bind:tap="cancelButtonTap">{{cancelButtonText}}</button> <button class="button cancel" plain wx:if="{{isShowCancel}}" bind:tap="cancelButtonTap">{{cancelButtonText}}</button>
<button class="button confirm" type="primary" bind:tap="okButtonTap">{{okButtonText}}</button> <button class="button confirm" type="primary" bind:tap="okButtonTap">{{okButtonText}}</button>
</view> </view>
</view> </view>

75
pages/browser/index.js Normal file
View File

@ -0,0 +1,75 @@
// pages/browser/index.js
Page({
/**
* 页面的初始数据
*/
data: {
webUrl:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let url = decodeURIComponent(options.url);
if(url.indexOf('?')>-1){
url = `${url}&random=${Math.random()}`
}else{
url = `${url}?random=${Math.random()}`
}
console.log(url);
this.setData({
webUrl:decodeURIComponent(options.url)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

1
pages/browser/index.wxml Normal file
View File

@ -0,0 +1 @@
<web-view src="{{webUrl}}"></web-view>

1
pages/browser/index.wxss Normal file
View File

@ -0,0 +1 @@
/* pages/browser/index.wxss */

View File

@ -72,17 +72,17 @@ Page({
}); });
this.getUserInfo().then(()=>{ this.getUserInfo().then(()=>{
app.getSummary().then((data)=>{
this.setData({
summary:data
});
});
return this.loadStatusDetail(); return this.loadStatusDetail();
}).then((data)=>{ }).then((data)=>{
return this.loadBuilding(); return this.loadBuilding();
}).then((data)=>{ }).then((data)=>{
this.loadList(); this.loadList();
}); });
app.getSummary().then((data)=>{
this.setData({
summary:data
});
});
}, },
findNewOrder(){ findNewOrder(){
// app.forceGetUserInfo().then((data)=>{ // app.forceGetUserInfo().then((data)=>{

View File

@ -39,7 +39,13 @@
loading="{{pager.loading}}" load-all="{{pager.loadAll}}"> loading="{{pager.loading}}" load-all="{{pager.loadAll}}">
<view wx:for="{{list}}" wx:key="index" bind:tap="navToOrderDetail" <view wx:for="{{list}}" wx:key="index" bind:tap="navToOrderDetail"
data-id="{{item.orderid}}" data-id="{{item.orderid}}"
class="item {{item.status==orderStatus.unpaid||item.status==orderStatus.completed?'no-btns':''}} {{item.is_first_order?'is-new-order':''}}" > class="item {{item.status==orderStatus.unpaid||item.status==orderStatus.completed?'no-btns':''}} {{item.is_first_order?'is-new-order':''}}">
<view class="item-head">
<view class="tag">代取快递</view>
<view class="deliver-time" wx:if="{{item.time_period_name}}">
送达时间(<label class="time">{{item.time_period_name}}</label>
</view>
</view>
<view class="station-list"> <view class="station-list">
<view class="sl-item" wx:for="{{item.packages}}" wx:key="index" wx:for-item="pItem" wx:for-index="pIndex"> <view class="sl-item" wx:for="{{item.packages}}" wx:key="index" wx:for-item="pItem" wx:for-index="pIndex">
<view class="name">{{pItem.station_name}} {{pItem.pickup_codes.length}} 件</view> <view class="name">{{pItem.station_name}} {{pItem.pickup_codes.length}} 件</view>

View File

@ -42,11 +42,12 @@
gap: 14rpx; gap: 14rpx;
font-size: 28rpx; font-size: 28rpx;
} }
.nav-bar .loop-order-switch .switch{
width:84rpx;
}
.nav-bar .loop-order-switch .switch .wx-switch-input{ .nav-bar .loop-order-switch .switch .wx-switch-input{
width:84rpx; width:84rpx;
height: 48rpx; height: 48rpx;
--switch-checked-color:red;
--switch-node-size: 16rpx;
} }
.head{ .head{
display: flex; display: flex;
@ -112,16 +113,34 @@
} }
.package-list{
}
.package-list .item{ .package-list .item{
margin:30rpx 16rpx; margin:30rpx 16rpx;
background-color: #ffffff; background-color: #ffffff;
border-radius: 18rpx; border-radius: 18rpx;
color: #555555; color: #555555;
padding:56rpx 20rpx 20rpx; padding:20rpx;
position: relative; position: relative;
} }
.package-list .item .item-head{
display: flex;
align-items: center;
justify-content: space-between;
padding-bottom:50rpx;
}
.package-list .item .item-head .tag{
background-color: rgba(153, 153, 153, 0.1);
border-radius: 12rpx;
padding:16rpx 20rpx;
font-weight: 500;
color:#555555;
}
.package-list .item .item-head .deliver-time{
color:#222222;
}
.package-list .item .item-head .time{
color:#ff0000;
font-weight: 500;
}
.package-list .item:first-child{ .package-list .item:first-child{
margin-top:0; margin-top:0;
} }
@ -130,27 +149,9 @@
position: absolute; position: absolute;
width:1.2rpx; width:1.2rpx;
background-color: rgba(85, 85, 85, 0.5); background-color: rgba(85, 85, 85, 0.5);
left:38.5rpx;top:90rpx; left:38.5rpx;top:160rpx;
bottom:250rpx; bottom:250rpx;
} }
.package-list .item.is-new-order::before{
top:145rpx;
}
.package-list .item.is-new-order{
padding-top:110rpx;
}
.package-list .item.is-new-order::after{
content:'新';
position: absolute;
right:24rpx;top:0;
width:58rpx;height:58rpx;
line-height: 52rpx;
background-color: #FF0000;
border-radius: 0px 0px 40rpx 40rpx;
text-align: center;
color: #fff;
font-weight: 500;
}
.package-list .item.no-btns::before{ .package-list .item.no-btns::before{
bottom:100rpx; bottom:100rpx;
} }
@ -228,7 +229,18 @@
} }
.package-list .item .address .sub-title{ .package-list .item .address .sub-title{
font-size: 32rpx; font-size: 32rpx;
margin-top:24rpx margin-top:24rpx;
display:flex;
align-items: center;
}
.package-list .item.is-new-order .address .sub-title::before{
content:'新';
background-color:#ff0000;
color:#fff;
font-size: 24rpx;
margin-right: 12rpx;
border-radius: 8rpx;
padding:6rpx 8rpx;
} }
.package-list .item .btns{ .package-list .item .btns{

View File

@ -9,7 +9,10 @@ Page({
data: { data: {
phone:'', phone:'',
password:'', password:'',
isAgree:false logining:false,
isAgree:false,
isEyesOpen:false,
appConfig:{}
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
@ -17,15 +20,26 @@ Page({
onLoad(options) { onLoad(options) {
this.validator = { this.validator = {
phone:{type:'phone',message:'请输入正确的手机号',shake:true,autoFocus:true}, phone:{type:'phone',message:'请输入正确的手机号',shake:true,autoFocus:true},
password:{required:true,message:'请输入密码',shake:true,autoFocus:true} password:{minLength:6,message:'请输入 6 位数密码',shake:true,autoFocus:true}
} }
app.getAppConfig().then((data)=>{
this.setData({
appConfig:data
})
})
}, },
login(){ login(){
if(this.data.isAgree){ if(this.data.isAgree){
const valid = app.validateForm(this.validator,this); const valid = app.validateForm(this.validator,this);
console.log(valid,this.validator); console.log(valid,this.validator);
if(valid.length==0){ if(valid.length==0){
this.setData({
logining:true
})
userApi.login(this.data.phone,this.data.password).then((data)=>{ userApi.login(this.data.phone,this.data.password).then((data)=>{
this.setData({
logining:false
})
app.globalData.userInfo = data.user; app.globalData.userInfo = data.user;
app.globalData.accessToken = data.access_token; app.globalData.accessToken = data.access_token;
wx.setStorage({ wx.setStorage({
@ -37,10 +51,17 @@ Page({
}) })
} }
}) })
}).catch(()=>{
console.log('catch');
this.setData({
logining:false
})
}) })
} }
}else{ }else{
app.validateForm({
shake:{required:true,shake:true}
},this);
} }
}, },
handleAgreeChange(event){ handleAgreeChange(event){
@ -48,6 +69,21 @@ Page({
isAgree:!!event.detail isAgree:!!event.detail
}) })
}, },
toggleEyes(){
this.setData({
isEyesOpen:!this.data.isEyesOpen
})
},
navToAgreement(){
wx.navigateTo({
url: `/pages/browser/index?url=${this.data.appConfig.url_user_agreement}`,
})
},
navToPrivacy(){
wx.navigateTo({
url: `/pages/browser/index?url=${this.data.appConfig.url_user_privacy}`,
})
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */

View File

@ -1,19 +1,35 @@
<view class="login"> <view class="login">
<view class="head"> <view class="head">
<image src="/assets/img/login-bg.png" class="bg"/> <image src="/assets/img/login-bg.png" class="bg"/>
<view class="title">欢迎使用蜂快到家</view> <image src="/assets/icon/logo.png" class="logo"/>
<view class="title">
欢迎使用
<image src="/assets/icon/fengkuai.png" class="t-logo" mode="heightFix"/>
</view>
</view> </view>
<view class="input-area"> <view class="input-area">
<input class="input" model:value="{{phone}}" placeholder="请输入手机号" animation="{{phoneAnimation}}" focus="{{phoneFocus}}"/> <view class="input-container">
<input class="input" model:value="{{password}}" type="password" animation="{{passwordAnimation}}" focus="{{passwordFocus}}" placeholder="请输入密码"/> <input class="input" model:value="{{phone}}" placeholder="请输入手机号"
<button bind:tap="login" type="primary" class="button">登录</button> animation="{{phoneAnimation}}" focus="{{phoneFocus}}" placeholder-class="ph-class"/>
</view>
<view class="input-container">
<input class="input" model:value="{{password}}" placeholder="请输入密码"
animation="{{passwordAnimation}}" focus="{{passwordFocus}}"
placeholder-class="ph-class" password="{{!isEyesOpen}}"/>
<image src="{{isEyesOpen?'/assets/icon/eyes-open.png':'/assets/icon/eyes-close.png'}}" class="icon" bind:tap="toggleEyes"/>
</view>
<view class="forgot-pwd">
<navigator url="/pages/user/password/index" class="forgot">忘记密码</navigator>
</view>
<button bind:tap="login" type="primary" class="button" loading="{{logining}}"
disabled="{{logining}}">登录</button>
<radio-group bindchange="handleAgreeChange" class="agree"> <radio-group bindchange="handleAgreeChange" class="agree" animation="{{shakeAnimation}}">
<label class="policy"> <label class="policy">
<radio class="radio" value="agree"></radio> <radio class="radio" value="agree"></radio>
<label>我已阅读并同意</label> <label>我已阅读并同意</label>
<label class="yellow">《用户协议》</label>与 <label capture-catch:tap="navToAgreement" class="yellow">《用户协议》</label>与
<label class="yellow">《隐私政策》</label> <label capture-catch:tap="navToPrivacy" class="yellow">《隐私政策》</label>
</label> </label>
</radio-group> </radio-group>
</view> </view>

View File

@ -13,36 +13,76 @@
right:-40rpx;top:204rpx; right:-40rpx;top:204rpx;
} }
.login .head .title{ .login .head .title{
font-size: 46rpx; font-size: 40rpx;
position: absolute; position: absolute;
left:40rpx; left:40rpx;
bottom:144rpx; font-weight: 500;
bottom:140rpx;
display: flex;
align-items: center;
}
.login .head .title .t-logo{
height: 36rpx;
margin-left: 10rpx;
}
.login .head .logo{
position: absolute;
width: 136rpx;height: 136rpx;
bottom:218rpx;left:54rpx;
} }
.login .input-area{ .login .input-area{
border-radius: 30rpx 30rpx 0px 0px; border-radius: 30rpx 30rpx 0px 0px;
margin-top:-80rpx; margin-top:-80rpx;
background-color: #fff; background-color: #fff;
position: relative; position: relative;
padding:40rpx 50rpx; padding:16rpx 50rpx 40rpx 50rpx;
} }
.login .input-area .input{ .input-container{
display: flex;
align-items: center;
background-color:#F7F7F7; background-color:#F7F7F7;
border-radius: 18rpx; border-radius: 18rpx;
margin-top:24rpx;
padding-left:30rpx;
}
.login .input-area .input{
height: 100rpx; height: 100rpx;
padding:0 30rpx; font-weight: 500;
margin-bottom:24rpx; font-size: 36rpx;
}
.login .input-area .ph-class{
font-weight: normal;
font-size: 32rpx;
}
.input-container .input{
flex: 1;
}
.input-container .icon{
width:44rpx;height:44rpx;
padding:20rpx;
} }
.login .input-area .input.error{ .login .input-area .input.error{
background-color: rgb(252, 198, 198); background-color: rgb(252, 198, 198);
} }
.login .input-area .forgot-pwd{
display:flex;
justify-content: flex-end;
}
.login .input-area .forgot{
color:#888888;
font-size:24rpx;
padding:30rpx 0 30rpx 30rpx;
}
.login .input-area .button{ .login .input-area .button{
margin-top:50rpx;
border-radius: 20rpx; border-radius: 20rpx;
} }
.agree{ .agree{
font-size: 26rpx; font-size: 28rpx;
margin-top:50rpx; margin-top:50rpx;
text-align: center;
} }
.agree .yellow{ .agree .yellow{
color:var(--main-color); color:var(--main-color);

View File

@ -1,5 +1,5 @@
<scroll-view refresher-triggered="{{refreshTrigger}}" bindrefresherrefresh="getOrderDetail" <scroll-view refresher-triggered="{{refreshTrigger}}" bindrefresherrefresh="getOrderDetail"
refresher-enabled scroll-y class="order-detail"> refresher-enabled scroll-y class="order-detail {{orderDetail.is_first_order?'is-new-order':''}}">
<view class="content"> <view class="content">
<view class="page-container address-info"> <view class="page-container address-info">
<view class="title"> <view class="title">
@ -8,8 +8,10 @@
{{orderDetail.address_detail}} {{orderDetail.address_detail}}
</view> </view>
<view class="sub-title"> <view class="sub-title">
{{orderDetail.address_name}} {{orderDetail.address_name}}{{genderKV[orderDetail.address_gender]}}{{orderDetail.address_phone}}丨{{deliverStatusKV[orderDetail.delivery_method]}}
{{genderKV[orderDetail.address_gender]}}{{orderDetail.address_phone}}丨{{deliverStatusKV[orderDetail.delivery_method]}} </view>
<view class="deliver-time">
送达时间:<label class="time">{{orderDetail.time_period_name}}</label>
</view> </view>
</view> </view>
<view class="page-container station-info" wx:for="{{orderDetail.packages}}" wx:key="index"> <view class="page-container station-info" wx:for="{{orderDetail.packages}}" wx:key="index">

View File

@ -11,7 +11,26 @@
.address-info .sub-title{ .address-info .sub-title{
font-size: 32rpx; font-size: 32rpx;
margin-top:36rpx; margin-top:36rpx;
display:flex;
align-items: center;
} }
.is-new-order .address-info .sub-title::before{
content:'新';
background-color:#ff0000;
color:#fff;
font-size: 24rpx;
margin-right: 12rpx;
border-radius: 8rpx;
padding:6rpx 8rpx;
}
.address-info .deliver-time{
margin-top:30rpx;
}
.address-info .deliver-time .time{
color: #ff0000;
font-weight: 500;
}
.station-info{ .station-info{
padding-bottom:0; padding-bottom:0;
} }
@ -123,6 +142,7 @@
margin: 0 auto; margin: 0 auto;
text-align: center; text-align: center;
position: relative; position: relative;
overflow:visible;
} }
.steps .item .name{ .steps .item .name{
font-size: 28rpx; font-size: 28rpx;

View File

@ -1,94 +0,0 @@
// pages/test/audio.js
Page({
/**
* 页面的初始数据
*/
data: {
time:0
},
gbam:null,
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.bgam = wx.getBackgroundAudioManager();
this.bgam.src = 'https://dman-1311994147.cos.ap-chengdu.myqcloud.com/static/empty.mp3';
this.bgam.title = '后台通知';
this.bgam.audioType = 'music';
this.bgam.coverImgUrl = 'https://dman-1311994147.cos.ap-chengdu.myqcloud.com/20250227/DoADoEhKi4U4ab75d180b27fa14b7c34ae7969762809_d7ee9018-828e-43c7-8b2b-29d4352c0277.jpg?imageMogr2/thumbnail/800x800/format/webp';
this.bgam.play();
this.bgam.onPlay();
this.bgam.onEnded(()=>{
console.log('end');
// this.bgam.src = 'https://dman-1311994147.cos.ap-chengdu.myqcloud.com/static/empty.mp3';
// this.bgam.play();
})
// const innerAudioContext = wx.createInnerAudioContext({
// useWebAudioImplement:true
// })
// innerAudioContext.src = '/assets/audio/order_complete.wav';
// innerAudioContext.play();
},
playAudio(){
setInterval(()=>{
this.setData({
time:this.data.time+1
});
},1000);
setInterval(()=>{
this.bgam.src = 'https://dman-1311994147.cos.ap-chengdu.myqcloud.com/static/new_order.mp3';
this.bgam.play();
},10000)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1 +0,0 @@
<button bind:tap="playAudio" type="primary">play({{time}})</button>

View File

@ -1 +0,0 @@
/* pages/test/audio.wxss */

View File

@ -8,6 +8,7 @@ Page({
*/ */
data: { data: {
phone:'', phone:'',
isLogin:false,
verifyCode:'', verifyCode:'',
password:'', password:'',
rePassword:'', rePassword:'',
@ -17,9 +18,12 @@ Page({
modifyLoading:false modifyLoading:false
}, },
validator:{ validator:{
phone:{
type:'phone',autoFocus:true,shake:true,message:'请输入正确的手机号码'
},
verifyCode:[ verifyCode:[
{required:true,message:'请输入验证码',shake:true,autoFocus:true}, {required:true,message:'请输入验证码',shake:true,autoFocus:true},
{length:6,message:'请输入 6 位数验证码',shake:true,autoFocus:true} // {length:6,message:'请输入 6 位数验证码',shake:true,autoFocus:true}
], ],
password:{minLength:6,message:'请输入至少 6 位新密码',shake:true,autoFocus:true}, password:{minLength:6,message:'请输入至少 6 位新密码',shake:true,autoFocus:true},
rePassword:{minLength:true,message:'请输入确认新密码',shake:true,autoFocus:true}, rePassword:{minLength:true,message:'请输入确认新密码',shake:true,autoFocus:true},
@ -29,11 +33,10 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
app.getUserInfo().then((data)=>{
this.setData({ this.setData({
phone:data.phone phone:app.globalData.userInfo?.phone||'',
isLogin:!!app.globalData.userInfo?.phone
}) })
});
let time = wx.getStorageSync('password-verify-code-time'); let time = wx.getStorageSync('password-verify-code-time');
if(time){ if(time){
let remainTime = app.verifyCodeWaitingTime*1000 - ((new Date()).getTime() - time); let remainTime = app.verifyCodeWaitingTime*1000 - ((new Date()).getTime() - time);
@ -64,7 +67,6 @@ Page({
}) })
}, },
startTimer(){ startTimer(){
console.log(this.data.waitingTime);
if(this.data.waitingTime<=0){ if(this.data.waitingTime<=0){
this.setData({ this.setData({
codeLoading:false, codeLoading:false,

View File

@ -1,7 +1,11 @@
<view class="cells"> <view class="cells">
<view class="cell"> <view class="cell">
<view class="cell-hd">手机号码</view> <view class="cell-hd">手机号码</view>
<view class="cell-bd">{{phone}}</view> <view class="cell-bd">
<input placeholder="请输入手机号码" model:value="{{phone}}" disabled="{{isLogin}}"
animation="{{phoneAnimation}}" focus="{{phoneFocus}}"/>
<view class="error">{{phoneMessage}}</view>
</view>
</view> </view>
<view class="cell"> <view class="cell">
<view class="cell-hd">验证码</view> <view class="cell-hd">验证码</view>