小程序提交

This commit is contained in:
2025-07-20 18:22:59 +08:00
parent a1d21c67b8
commit fa2a7b3499
61 changed files with 2505 additions and 944 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -1,6 +1,12 @@
// pages/login/login.js
const { baseUrl } = require('../../../request');
const { validate } = require('../../../utils/validate');
const roleMap = new Map([
['manager', '经理'],
['supervisor', '主管'],
['staff', '员工'],
['user', '用户'],
]);
Page({
data: {
@ -12,7 +18,15 @@ Page({
codeButtonText: '获取验证码',
_timer: null,
defaultType: true, //
passwordType: true
passwordType: true,
role: '', // 登录角色
showRole: '',
},
onLoad(options) {
const role = options.role || ''
const showRole = roleMap.get(role) || ''
this.setData({ role, showRole })
},
// 切换到“密码登录”,只清空表单字段
@ -69,6 +83,7 @@ Page({
method: 'POST',
data: { templateString: phone },
success: (res) => {
console.log('验证码发送--->',res.data);
if (res.data.code === 1) {
wx.showToast({ title: '验证码已发送', icon: 'none' });
this._startCountdown(60);
@ -139,12 +154,13 @@ Page({
return;
}
const { role } = this.data
// 组装请求
const url = loginType === 'password'
? baseUrl + '/userInfo/mini/pwd/login'
: baseUrl + '/userInfo/mini/vcd/login';
const payload = loginType === 'password'
? { phoneNumber: phone, userPassword: credential }
? { phoneNumber: phone, userPassword: credential, userRole: role }
: { phoneNumber: phone, verificationCode: credential };
wx.request({
@ -183,15 +199,20 @@ Page({
});
},
// 跳转忘记密码
gotoForgetPwd() {
wx.navigateTo({
url: '/pages/loginModule/forgetPwd/forgetPwd',
})
},
// 去注册
gotoRegister() {
const { role } = this.data;
wx.navigateTo({
url: '/pages/loginModule/register/register',
url: `/pages/loginModule/register/register?role=${ role }`,
})
},
@ -200,15 +221,25 @@ Page({
this._clearTimer();
},
// 跳转用户协议
gotoAgreement() {
wx.navigateTo({
url: '/pages/loginModule/agreement/agreement',
})
},
// 跳转隐私协议
gotoPolicy() {
wx.navigateTo({
url: '/pages/loginModule/privacyPolicy/privacyPolicy',
})
},
// 跳转职工账号页面
joinUs() {
wx.navigateTo({
url: '/pages/loginModule/employeeAccountApply/employeeAccountApply',
})
},
});

View File

@ -1,88 +1,106 @@
<view class="flex-col page">
<image
class="self-center image"
src="./images/logo.png"
/>
<text class="self-center text">欢迎登陆—青橙校园</text>
<view class="flex-col self-stretch group">
<image class="self-center image" src="./images/logo.png" />
<!-- 切换登录方式 -->
<view class="flex-col items-center self-stretch group">
<!-- 加上 bold-text -->
<text class="font text bold-text">欢迎登陆—青橙校园</text>
<text class="font mt-12">{{ showRole }}端)</text>
</view>
<view class="flex-col self-stretch group_2">
<view class="flex-row">
<!-- 密码登录 -->
<text
class="font switch {{loginType==='password'?'active':'inactive'}} text_2"
class="font_2 toggle-text {{loginType==='password'?'active':''}}"
bindtap="switchToPassword"
>密码登录</text>
<!-- 验证码登录 -->
<text
class="font switch {{loginType==='sms'?'active':'inactive'}} text_3 ml-8"
bindtap="switchToSms"
class="font_2 ml-8 toggle-text {{loginType==='sms'?'active':''}}"
bindtap="switchToSms" wx:if="{{ role === 'user' }}"
>验证码登录</text>
</view>
<view class="flex-col group_1 mt-20">
<!-- 手机号输入 -->
<!-- 手机号 输入框,保持原 .text-wrapper 样式 -->
<view class="flex-col self-stretch">
<view class="flex-col justify-start relative section">
<input
class="flex-col justify-start items-start text-wrapper view input"
class="text-wrapper"
placeholder="请输入手机号"
value="{{phone}}"
bindinput="onPhoneInput"
maxlength="11"
type="number"
model:value="{{phone}}"
bindinput="onPhoneInput"
/>
</view>
<!-- 密码 / 验证码 输入 + 获取验证码按钮 -->
<view class="flex-row items-center section_2 mt-21">
<input
class="flex-col justify-start items-start text-wrapper_2 view_2 input_1"
placeholder="{{ loginType==='password' ? '请输入密码' : '请输入验证码' }}"
password="{{ loginType==='password' }}"
model:value="{{credential}}"
bindinput="onCredentialInput"
/>
<text
wx:if="{{loginType==='sms'}}"
class="text_6 ml-10 get-code {{ countdown>0 ? 'disabled' : '' }}"
bindtap="{{ countdown>0 ? '' : 'getSmsCode' }}"
>{{ codeButtonText }}</text>
</view>
</view>
<text class="self-end font_3 text_7" bindtap="gotoForgetPwd">忘记密码</text>
<!-- 密码/验证码 输入框,保持原 .text-wrapper_2 样式 -->
<view class="flex-row items-center section_2 mt-21">
<input
class="text-wrapper"
placeholder="{{ loginType==='password' ? '请输入密码' : '请输入验证码' }}"
value="{{credential}}"
bindinput="onCredentialInput"
password="{{ loginType==='password' }}"
type="{{ loginType==='sms' ? 'number' : 'text' }}"
/>
<!-- 仅验证码登录时显示倒计时按钮 -->
<view
class="flex-col justify-start items-center shrink-0 text-wrapper_3 ml-2"
bindtap="getSmsCode"
wx:if="{{ loginType==='sms' }}"
>
<text class="text_6">{{ codeButtonText }}</text>
</view>
</view>
<!-- 忘记密码,仅密码登录时显示 -->
<text
class="self-end font_4 text_7"
bindtap="gotoForgetPwd"
wx:if="{{ loginType==='password' }}"
>忘记密码</text>
<!-- 登录按钮 -->
<view
class="flex-col justify-start items-center self-stretch text-wrapper_3 login-button"
<view
class="flex-col justify-start items-center self-stretch text-wrapper_4"
bindtap="onLogin"
>
<text class="text_8">登录</text>
</view>
<!-- 用户协议勾选 -->
<view class="flex-row items-center self-stretch group_2">
<checkbox-group bindchange="onAgreeChange">
<checkbox
class="checkbox"
value="agree"
checked="{{isAgree}}"
bindchange="onAgreeChange"
color="#FF8D1A"
/>
<!-- 协议勾选 -->
<view class="flex-row items-center self-stretch group_3">
<checkbox-group bindchange="onAgreeChange">
<checkbox
class="checkbox"
value="agree"
checked="{{ isAgree }}"
color="#FF8D1A"
/>
</checkbox-group>
<view class="group_3 ml-12">
<text class="font_4 text_9">登录代表您已同意</text>
<text class="font_4" bind:tap="gotoAgreement">《用户协议》</text>
<view class="group_4 ml-12">
<text class="font_5 text_9">登录代表您已同意</text>
<text class="font_5" bindtap="gotoAgreement">《用户协议》</text>
<text class="text_10">&</text>
<text class="font_4" bind:tap="gotoPolicy">《隐私协议》</text>
<text class="font_5" bindtap="gotoPolicy">《隐私协议》</text>
</view>
</view>
<view class="self-center group_4">
<text class="font_3 text_11">没有账号?</text>
<text class="font_4 text_12" bindtap="gotoRegister">去注册→</text>
<!-- 去注册 -->
<view class="self-center group_5">
<text class="font_4 text_11">没有账号?</text>
<text class="font_5 text_12" bindtap="gotoRegister">去注册→</text>
</view>
</view>
</view>
<view class="flex-row justify-evenly items-center self-end section_3" bind:tap="joinUs" wx:if="{{ role === 'user' }}">
<text class="font_2 text_13">加入我们</text>
<image class="image_3" src="./images/joinus.png" />
</view>
</view>

View File

@ -1,43 +1,34 @@
/* 切换按钮样式 */
.switch {
font-size: 30rpx; /* 基础字体大小 */
font-family: SourceHanSansCN;
}
.switch.active {
font-size: 36rpx; /* 激活时更大 */
font-weight: bold; /* 加粗 */
color: #1c2023;
}
.switch.inactive {
color: #888888; /* 不活跃时灰色 */
}
/* 其它原来样式保持不变 */
.mt-21 {
.mt-21 {
margin-top: 39.38rpx;
}
.page {
padding: 105rpx 45.69rpx 381.68rpx 49.76rpx;
padding: 105rpx 36.56rpx 40.31rpx 49.76rpx;
background-color: #ffffff;
width: 100%;
overflow: hidden;
overflow-y: auto;
overflow-x: hidden;
height: 100%;
}
.image {
width: 232.5rpx;
height: 232.5rpx;
}
.text {
margin-top: 35.14rpx;
color: #1c2023;
font-size: 37.5rpx;
font-family: AlibabaPuHuiTi;
line-height: 35.21rpx;
}
.group {
margin-top: 145.01rpx;
margin-top: 35.14rpx;
}
.font {
font-size: 37.5rpx;
font-family: AlibabaPuHuiTi;
line-height: 34.73rpx;
color: #1c2023;
}
.text {
line-height: 35.21rpx;
}
.group_2 {
margin-top: 87.15rpx;
}
.font_2 {
font-size: 30rpx;
font-family: SourceHanSansCN;
line-height: 27.69rpx;
@ -51,10 +42,11 @@
}
.group_1 {
padding-left: 2.74rpx;
padding-right: 2.74rpx;
}
.section {
margin-right: 4.93rpx;
padding: 20.63rpx 0 18.75rpx;
margin-right: 11.32rpx;
padding: 20.63rpx 16.88rpx 18.75rpx;
background-color: #ffffff;
border-radius: 9.38rpx;
box-shadow: 0rpx 3.75rpx 11.25rpx #00000040;
@ -62,48 +54,57 @@
.text-wrapper {
margin-left: 16.88rpx;
margin-right: 16.88rpx;
}
.view {
padding: 15.92rpx 0 12.64rpx;
background-color: #ffffff00;
margin-right: 100rpx;
}
.font_3 {
font-size: 30rpx;
font-family: SourceHanSansCN;
line-height: 27.69rpx;
color: #b3b3b3;
}
.text_4 {
margin-left: 16.26rpx;
}
.section_2 {
margin-right: 4.93rpx;
margin-right: 11.32rpx;
padding: 20.63rpx 16.88rpx 18.75rpx;
background-color: #ffffff;
border-radius: 9.38rpx;
box-shadow: 0rpx 3.75rpx 7.5rpx #00000040;
}
.text-wrapper_2 {
flex: 1 1 0;
.text_5 {
margin-left: 16.26rpx;
line-height: 27.86rpx;
}
.view_2 {
padding: 11.96rpx 0 16.43rpx;
background-color: #ffffff00;
height: 76.25rpx;
.text-wrapper_3 {
margin-right: 5.63rpx;
padding: 13.16rpx 0 10.93rpx;
background-color: #ff8d1a;
border-radius: 9.38rpx;
width: 157.5rpx;
height: 45rpx;
}
.text_6 {
margin-right: 14.72rpx;
color: #f7810a;
font-size: 26.25rpx;
color: #ffffff;
font-size: 22.5rpx;
font-family: AlibabaPuHuiTi;
line-height: 23.94rpx;
line-height: 20.91rpx;
}
.get-code {
/* 可根据需求再调样式 */
}
.font_3 {
.font_4 {
font-size: 26.25rpx;
font-family: SourceHanSansCN;
line-height: 24.49rpx;
color: #383838;
}
.text_7 {
margin-right: 6.39rpx;
margin-top: 28.76rpx;
line-height: 24.36rpx;
}
.text-wrapper_3 {
margin-right: 4.93rpx;
.text-wrapper_4 {
margin-right: 11.32rpx;
margin-top: 46.26rpx;
padding: 36.73rpx 0 34.16rpx;
background-color: #ff8d1a;
@ -115,14 +116,21 @@
font-family: AlibabaPuHuiTi;
line-height: 26.61rpx;
}
.group_2 {
.group_3 {
margin-top: 48.75rpx;
}
.group_3 {
.image_2 {
flex-shrink: 0;
}
.image_1 {
width: 37.5rpx;
height: 37.5rpx;
}
.group_4 {
line-height: 24.49rpx;
height: 24.56rpx;
}
.font_4 {
.font_5 {
font-size: 26.25rpx;
font-family: SourceHanSansCN;
line-height: 24.49rpx;
@ -138,7 +146,7 @@
font-family: SourceHanSansCN;
line-height: 19.93rpx;
}
.group_4 {
.group_5 {
margin-top: 43.91rpx;
line-height: 24.41rpx;
}
@ -148,16 +156,35 @@
.text_12 {
line-height: 24.41rpx;
}
.input {
padding: 15rpx 16.26rpx 13.13rpx 16.26rpx;
.section_3 {
margin-top: 100.11rpx;
padding: 12.06rpx 21.69rpx 12.32rpx 24.15rpx;
background-color: #ffffff;
border-radius: 9.38rpx;
width: 215.63rpx;
border: solid 1.88rpx #ff8d1a;
}
.input_1 {
padding: 15rpx 16.26rpx 13.13rpx 16.26rpx;
.text_13 {
color: #ff8d1a;
line-height: 27.66rpx;
}
.checkbox {
flex-shrink: 0;
.image_3 {
width: 41.25rpx;
height: 41.25rpx;
}
/* 欢迎文本加粗 */
.bold-text {
font-weight: bold;
}
/* 切换按钮默认样式,保持原 font_2 大小active 时放大加粗 */
.toggle-text {
font-size: 28rpx;
font-weight: normal;
transition: font-size 0.2s;
}
.toggle-text.active {
font-size: 36rpx;
font-weight: bold;
}
.checkbox .wx-checkbox-input {
width: 37.5rpx;
height: 37.5rpx;
}