first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1 @@
ae5722bb-b5d5-4fb7-bef5-51819d1647bf

View File

@@ -0,0 +1,175 @@
const {
user,
util
} = getApp().globalData
Page({
/**
* 页面的初始数据
*/
data: {
isShowLogin: true,
phone: '', // 手机号
pwd: '', // 密码
confirmPwd: '', // 确认密码
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(user);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
async UserLogin() {
let { phone, pwd } = this.data
if (!util.checkPhone(phone)) {
wx.showToast({
title: '号码错误',
icon: 'none',
duration: 2000
})
return false;
}
if (pwd.length == 0) {
wx.showToast({
title: '密码必填',
icon: 'none',
duration: 2000
})
return false;
}
let res = await user.login({
phone: phone,
pwd: pwd
});
wx.setStorageSync('user', res);
util.showToast({
title: '登录成功',
icon: 'success',
duration: 2000,
close: () => wx.switchTab({ url: '/pages/index/index' })
})
},
async UserRegister() {
let { phone, pwd, confirmPwd } = this.data
if (!util.checkPhone(phone)) {
wx.showToast({
title: '号码错误',
icon: 'none',
duration: 2000
})
return false;
}
if (pwd.length == 0) {
wx.showToast({
title: '密码必填',
icon: 'none',
duration: 2000
})
return false;
}
if (confirmPwd.length == 0 || confirmPwd != pwd) {
wx.showToast({
title: '确认密码必填,且必须和密码一致',
icon: 'none',
duration: 2000
})
return false;
}
let res = await user.add({
phone: phone,
pwd: pwd
});
util.showToast({
title: '注册成功,即将跳转登录!',
icon: 'none',
duration: 2000,
close: () => this.setData({ isShowLogin: true })
})
},
// 手机号
bindPhoneInput(e) {
this.setData({
phone: e.detail.value
})
},
// 确认密码
bindConfirmPwdInput(e) {
this.setData({
confirmPwd: e.detail.value
})
},
// 密码
bindPwdInput(e) {
this.setData({
pwd: e.detail.value
})
},
changeStatus() {
this.setData({
isShowLogin: !this.data.isShowLogin
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@@ -0,0 +1,7 @@
{
"usingComponents": {
"van-icon": "@vant/weapp/icon/index"
},
"navigationBarTitleText": "账户中心",
"navigationStyle": "custom"
}

View File

@@ -0,0 +1,33 @@
<view class="account">
<image class="login_back" src="../../images/img/loginBack.png"></image>
<view class="login" wx:if="{{ isShowLogin }}">
<view class="inpu bottom van-hairline--bottom">
<text class="iconfont icon-shouji"></text>
<input type="text" bindinput="bindPhoneInput" placeholder="输入手机号" />
</view>
<view class="inpu van-hairline--bottom">
<text class="iconfont icon-31mima"></text>
<input type="password" bindinput="bindPwdInput" placeholder="输入密码" />
</view>
<view class="login_submit" bindtap="UserLogin">登 录</view>
</view>
<view class="register" wx:else>
<view class="inpu bottom van-hairline--bottom">
<text class="iconfont icon-shouji"></text>
<input type="text" bindinput="bindPhoneInput" placeholder="输入手机号" />
</view>
<view class="inpu van-hairline--bottom">
<text class="iconfont icon-31mima"></text>
<input type="password" bindinput="bindPwdInput" placeholder="输入密码" />
</view>
<view class="inpu van-hairline--bottom">
<text class="iconfont icon-31mima"></text>
<input type="password" bindinput="bindConfirmPwdInput" placeholder="输入确认密码" />
</view>
<view class="login_submit" bindtap="UserRegister">注 册</view>
</view>
<view class="other" bindtap="changeStatus">{{ isShowLogin ? '注册账号': '立即登录' }}</view>
</view>

View File

@@ -0,0 +1,50 @@
.account {
}
.login_back {
width: 100%;
height: 440rpx;
}
.login,
.register {
padding: 0 50rpx;
margin-top: 60rpx;
}
.inpu {
width: 100%;
display: flex;
align-items: center;
height: 90rpx;
margin-bottom: 22rpx;
}
.inpu .iconfont {
font-size: 45rpx;
}
.inpu input {
flex: 1;
padding-left: 30rpx;
box-sizing: border-box;
}
.login_submit {
width: 70%;
height: 90rpx;
margin: 70rpx auto 0 auto;
text-align: center;
background: -webkit-linear-gradient(90deg, #8817cd , #c63ba2); /* Safari 5.1 - 6.0 */
background: -o-linear-gradient(90deg, #8817cd , #c63ba2); /* Opera 11.1 - 12.0 */
background: -moz-linear-gradient(90deg, #8817cd , #c63ba2); /* Firefox 3.6 - 15 */
background: linear-gradient(90deg, #8817cd , #c63ba2);
line-height: 90rpx;
border-radius: 53rpx;
color: #fff;
font-size: 34rpx;
}
.other {
text-align: center;
margin-top: 20rpx;
font-size: 28rpx;
color: #bdbaba;
}