小程序提交

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

View File

@ -0,0 +1,211 @@
const { baseUrl } = require('../../../request');
const { validate } = require('../../../utils/validate');
Page({
data: {
name: '',
phone: '',
code: '', // 验证码
idcard: '', // 身份证号
codeSent: false,
countdown: 0, // 剩余秒数
codeButtonText: '获取验证码',
_timer: null,
isUploading: false,
resumeUploaded: false,
resumeFilePath: '',
fileCode: '', // 上传文件后端返回的码
credential: '', // 用户申请后的唯一凭证,用于查询用户是否审核通过
},
onInput(e) {
const field = e.currentTarget.dataset.field;
this.setData({
[field]: e.detail.value
});
},
// 获取验证码(仅校验手机号)
getSmsCode() {
const { phone } = this.data;
// 1. 非空校验
if (!validate(this.data, { phone: '请输入手机号' })) {
return;
}
// 2. 格式校验
if (!/^1\d{10}$/.test(phone)) {
return wx.showToast({ title: '手机号格式不正确', icon: 'none' });
}
// 3. 发送验证码请求
wx.request({
url: baseUrl + '/userInfo/code/pwd',
method: 'POST',
data: { templateString: phone },
success: (res) => {
console.log('验证码发送--->',res.data);
if (res.data.code === 1) {
wx.showToast({ title: '验证码已发送', icon: 'none' });
this._startCountdown(60);
} else {
wx.showToast({ title: res.data.message, icon: 'none' });
}
},
fail: () => {
wx.showToast({ title: '发送失败,请重试', icon: 'none' });
}
});
},
// 开始倒计时
_startCountdown(seconds) {
this.setData({
countdown: seconds,
codeButtonText: `${seconds}s后重试`
});
// 如果已有定时器,不重复创建
if (this.data._timer) return;
this.data._timer = setInterval(() => {
const cd = this.data.countdown - 1;
if (cd <= 0) {
this._clearTimer();
this.setData({
countdown: 0,
codeButtonText: '获取验证码'
});
} else {
this.setData({
countdown: cd,
codeButtonText: `${cd}s后重试`
});
}
}, 1000);
},
// 清除倒计时定时器
_clearTimer() {
if (this.data._timer) {
clearInterval(this.data._timer);
this.data._timer = null;
}
},
// 选择并上传简历
chooseResume() {
if (this.data.resumeUploaded) return;
wx.chooseMessageFile({
count: 1,
type: 'file',
success: res => {
const file = res.tempFiles[0];
this.uploadResume(file);
}
});
},
// 上传简历
uploadResume(file) {
this.setData({ isUploading: true });
wx.uploadFile({
url: baseUrl + '/file/upload',
method: 'POST',
name: 'file',
header : {
Authorization: wx.getStorageSync('token'),
},
formData: {
biz: 'default', // 传 biz 文本字段
},
filePath: file.path,
success: res => {
console.log('简历上传后端返回--->',JSON.parse(res.data));
const data = JSON.parse(res.data);
console.log('后端返回文件码--->',data.data);
if (data.code === 1) {
wx.showToast({ title: '上传成功', icon: 'success' });
this.setData({
isUploading: false,
resumeUploaded: true,
resumeFilePath: file.path,
fileCode: data.data
});
} else {
wx.showToast({ title: data.message || '上传失败', icon: 'none' });
this.setData({ isUploading: false });
}
},
fail: () => {
wx.showToast({ title: '上传失败,请重试', icon: 'none' });
this.setData({ isUploading: false });
}
});
},
// 提交表单
handleSubmit() {
const { name, phone, code, idcard, fileCode } = this.data;
// 校验用户是否填写所有必要信息
if (!name || !phone || !code || !idcard || !fileCode) {
wx.showToast({ title: '请填写所有信息', icon: 'none' });
return;
}
// 姓名只能中文或英文
if (!/^[\u4e00-\u9fa5A-Za-z]+$/.test(name)) {
wx.showToast({ title: '姓名只能为中英文', icon: 'none' });
return;
}
// 提交表单数据到后端
wx.request({
url: baseUrl + '/advancementApply/add',
method: 'POST',
header: {
Authorization: wx.getStorageSync('token')
},
data: {
name: name,
phone: phone,
verificationCode: code,
idCard: idcard,
resume: fileCode
},
success: res => {
console.log('后端返回的申请---->', res);
if (res.data.code === 1) {
wx.showToast({ title: '验证通过,提交成功', icon: 'success' });
// 清空表单内容
this.setData({
name: '',
phone: '',
code: '',
idcard: '',
fileCode: '',
resumeUploaded: false, // 重置简历上传状态
resumeFilePath: '', // 清空简历文件路径
credential: '' // 清空凭证
});
} else {
wx.showToast({ title: '系统错误', icon: 'error' });
}
}
});
},
// 跳转申请须知
gotoNotice() {
wx.navigateTo({
url: '/pages/loginModule/employeeAccountNotice/employeeAccountNotice',
})
},
// 跳转我的申请记录
gotoQuery() {
wx.navigateTo({
url: '/pages/loginModule/employeeApplyQuery/employeeApplyQuery',
})
},
});

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,103 @@
<view class="flex-col page">
<!-- 遮罩层(上传时显示) -->
<view wx:if="{{isUploading}}" class="mask">
<text class="loading-text">上传中...</text>
</view>
<image
class="self-center image"
src="./images/logo.png"
/>
<text class="self-center text">欢迎登陆—青橙校园</text>
<view class="flex-col self-stretch group">
<view class="flex-col">
<view class="flex-row justify-between group_1">
<text class="font text_2">员工账号申请</text>
<view class="flex-row items-center group_2" bind:tap="gotoNotice">
<image
class="shrink-0 image_2 image_3"
src="./images/right.png"
/>
<text class="font_2 text_3">员工账号申请须知</text>
</view>
</view>
<view class="flex-col mt-15">
<!-- 姓名输入 -->
<view class="flex-col justify-start section">
<input
class="flex-col justify-start items-start text-wrapper view input"
placeholder="请输入姓名"
maxlength="8"
bindinput="onInput"
data-field="name"
value="{{name}}"
/>
</view>
<!-- 手机号输入 -->
<view class="flex-col justify-start section_1 mt-21">
<input
class="flex-col justify-start items-start text-wrapper text-wrapper_1 input_1"
placeholder="请输入手机号"
maxlength="11"
type="number"
bindinput="onInput"
data-field="phone"
value="{{phone}}"
/>
</view>
<!-- 验证码输入 + 发送按钮 -->
<view class="flex-row items-center section_3 mt-21">
<input
class="flex-col justify-start items-start text-wrapper_2 view_3 input_2"
placeholder="请输入验证码"
type="number"
bindinput="onInput"
data-field="code"
value="{{code}}"
/>
<view
class="flex-col justify-start items-center shrink-0 text-wrapper_3 ml-16"
bindtap="getSmsCode"
>
<text class="text_8">
{{ codeButtonText }}
</text>
</view>
</view>
<!-- 身份证号输入 -->
<view class="flex-col justify-start items-start section_2 mt-21">
<input
class="flex-col justify-start items-start text-wrapper_4 view_4 input_3"
placeholder="请输入身份证号"
type="idcard"
bindinput="onInput"
data-field="idcard"
maxlength="18"
value="{{idcard}}"
/>
</view>
<!-- 上传简历 -->
<view class="flex-col items-center section_4 mt-21" bindtap="chooseResume">
<image
class="image_4"
src="./images/resume.png"
/>
<text class="{{resumeUploaded?'upload-success-text':'font_2 text_10 mt-12'}}">
{{ resumeUploaded ? '简历上传成功!' : '点击上传简历' }}
</text>
</view>
<!-- 提交按钮 -->
<view class="flex-col justify-start items-center text-wrapper_5 mt-21" bindtap="handleSubmit">
<text class="text_11">提交申请</text>
</view>
</view>
</view>
<view class="flex-row justify-center items-center relative group_4 mt-28" bind:tap="gotoQuery">
<image
class="image_2 pos"
src="./images/right.png"
/>
<text class="font_2 text_12">我的申请记录</text>
</view>
</view>
</view>

View File

@ -0,0 +1,203 @@
/* pages/loginModule/employeeAccountApply/employeeAccountApply.wxss */
.mt-15 {
margin-top: 28.13rpx;
}
.mt-21 {
margin-top: 39.38rpx;
}
.page {
padding: 67.5rpx 49.69rpx 84.38rpx 51.56rpx;
background-color: #ffffff;
width: 100%;
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: 62.77rpx;
}
.group_1 {
padding-left: 2.77rpx;
}
.font {
font-size: 30rpx;
font-family: SourceHanSansCN;
line-height: 27.79rpx;
color: #b3b3b3;
}
.text_2 {
color: #1c2023;
line-height: 28.01rpx;
}
.group_2 {
width: 236.4rpx;
}
.image_2 {
width: 30rpx;
height: 30rpx;
}
.image_3 {
margin-left: 206.4rpx;
}
.font_2 {
font-size: 26.25rpx;
font-family: SourceHanSansCN;
line-height: 24.3rpx;
color: #ff8d1a;
}
.text_3 {
margin-left: -236.4rpx;
}
.section {
padding: 20.63rpx 0 18.75rpx;
background-color: #ffffff;
border-radius: 9.38rpx;
box-shadow: 0rpx 3.75rpx 11.25rpx #00000040;
}
.text-wrapper {
margin-left: 16.88rpx;
margin-right: 16.88rpx;
}
.view {
padding: 15.92rpx 0 12.67rpx;
background-color: #ffffff00;
}
.section_1 {
padding: 20.16rpx 0 19.22rpx;
background-color: #ffffff;
border-radius: 9.38rpx;
box-shadow: 0rpx 3.75rpx 7.5rpx #00000040;
}
.text-wrapper_1 {
padding: 12.64rpx 0 15.92rpx;
background-color: #ffffff00;
}
.section_3 {
padding: 19.69rpx 16.88rpx;
background-color: #ffffff;
border-radius: 9.38rpx;
box-shadow: 0rpx 3.75rpx 7.5rpx #00000040;
}
.text-wrapper_2 {
flex: 1 1 0;
}
.view_3 {
padding: 16.73rpx 0 11.74rpx;
background-color: #ffffff00;
height: 56.25rpx;
}
.text-wrapper_3 {
margin-right: 15rpx;
/* padding: 13.16rpx 0 10.93rpx; */
background-color: #ff8d1a;
border-radius: 9.38rpx;
width: 157.5rpx;
height: 45rpx;
}
.text_8 {
color: #ffffff;
font-size: 22.5rpx;
font-family: AlibabaPuHuiTi;
line-height: 15.91rpx;
}
.section_2 {
padding: 19.69rpx 0;
background-color: #ffffff;
border-radius: 9.38rpx;
box-shadow: 0rpx 3.75rpx 7.5rpx #00000040;
}
.text-wrapper_4 {
margin-left: 16.88rpx;
}
.view_4 {
padding: 16.86rpx 0 11.46rpx;
background-color: #ffffff00;
width: 510.63rpx;
}
.section_4 {
padding: 30.81rpx 0 38.16rpx;
background-color: #ff8d1a1a;
border-radius: 9.38rpx;
border: dotted 1.88rpx #ff8d1a;
}
.image_4 {
width: 127.5rpx;
height: 127.5rpx;
}
.text_10 {
color: #000000;
line-height: 24.23rpx;
}
.text-wrapper_5 {
padding: 36.43rpx 0 33.58rpx;
background-color: #ff8d1a;
border-radius: 9.38rpx;
}
.text_11 {
color: #ffffff;
font-size: 30rpx;
font-family: AlibabaPuHuiTi;
line-height: 27.49rpx;
}
.group_4 {
padding: 2.66rpx 0 3rpx;
}
.pos {
position: absolute;
left: 402.19rpx;
top: 50%;
transform: translateY(-50%);
}
.text_12 {
line-height: 24.34rpx;
}
.input {
padding: 15rpx 16.26rpx 13.13rpx 16.26rpx;
}
.input_1 {
padding: 13.13rpx 16.26rpx 15rpx 16.26rpx;
}
.input_2 {
padding: 16.88rpx 16.26rpx 11.25rpx 16.26rpx;
}
.input_3 {
padding: 16.88rpx 16.26rpx 11.25rpx 16.26rpx;
}
/* 遮罩层 */
.mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 9999;
display: flex;
justify-content: center;
align-items: center;
}
/* 加载中文本 */
.loading-text {
color: #ffffff;
font-size: 34rpx;
font-family: AlibabaPuHuiTi;
}
/* 上传成功文字样式 */
.upload-success-text {
font-size: 30rpx;
font-weight: bold;
color: #ff8d1a;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

View File

@ -0,0 +1,66 @@
// pages/loginModule/employeeAccountNotice/employeeAccountNotice.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,5 @@
<!--pages/loginModule/employeeAccountNotice/employeeAccountNotice.wxml-->
<view class="flex-col page">
<text class="self-center text">员工账号申请须知</text>
<rich-text class="section view mt-20"></rich-text>
</view>

View File

@ -0,0 +1,23 @@
/* pages/loginModule/employeeAccountNotice/employeeAccountNotice.wxss */
.page {
padding: 65.08rpx 42.19rpx 145.31rpx 44.06rpx;
background-color: #ffffff;
width: 100%;
overflow-y: auto;
overflow-x: hidden;
height: 100%;
}
.text {
color: #000000;
font-size: 33.75rpx;
font-family: SourceHanSansCN;
line-height: 31.26rpx;
}
.section {
align-self: stretch;
}
.view {
background-color: #ffffff;
height: 1301.25rpx;
border: solid 1.88rpx #000000;
}

View File

@ -0,0 +1,146 @@
import { baseUrl } from "../../../request";
Page({
data: {
status: '', // 审核状态: 审核中、审核通过、审核失败
result: {} // 查询结果数据
},
// 输入框事件
onInput(e) {
this.setData({
inputIdCard: e.detail.value // 获取身份证输入
});
},
// 查询操作
onSearch() {
const inputIdCard = this.data.inputIdCard;
if (!inputIdCard) {
wx.showToast({
title: '请输入身份证',
icon: 'none'
});
return;
}
// 查询的接口
wx.request({
url: baseUrl + '/advancementApply/query/credential', // 替换为你的后端查询接口
method: 'POST',
data: { templateString: inputIdCard },
success: (res) => {
console.log('后端返回---->',res.data);
if (res.data.code === 1) {
// 假设返回的查询结果是以下格式
const result = res.data.data; // 获取返回的数据
// 更新审核状态和查询结果
this.setData({
status: result.reviewStatus, // 审核状态
result: {
name: result.name, // 姓名
phone: result.phone, // 手机号
idCard: result.idCard, // 身份证号
failureReason: result.rejectReason, // 失败原因
password: result.userPassword, // 密码(如果有的话)
userRole: result.userRole, // 用户级别
id: result.id
}
});
} else {
wx.showToast({
title: res.data.message,
icon: 'none'
});
}
},
fail: () => {
wx.showToast({
title: '请求失败,请重试',
icon: 'none'
});
}
});
},
// 重新申请操作
onReapply() {
wx.showToast({
title: '重新申请中...',
icon: 'none'
});
},
// 用户撤销申请
revokeApplication() {
const { id } = this.data.result
console.log('id--->',id);
wx.showModal({
title: '确认',
content: '是否撤销申请',
complete: (res) => {
if (res.cancel) {
}
if (res.confirm) {
wx.request({
url: baseUrl + '/advancementApply/modify/status',
method: 'POST',
header: {
Authorization: wx.getStorageSync('token')
},
data: {
id: id
},
success: res => {
console.log('后端返回11---->',res.data);
if (res.data.code === 1 ) {
this.setData({
status: ''
})
} else {
wx.showToast({
title: '系统错误',
})
}
}
})
}
}
})
},
// 用户去登录
gotoLogin() {
wx.navigateBack({
delta: 2
})
},
// 用户重新申请
reapply() {
wx.navigateBack({
delta: 1
})
},
copyPassword() {
const { password } = this.data.result
wx.setClipboardData({
data: password, // 要复制的内容
success(res) {
wx.showToast({
title: '已复制到剪贴板',
icon: 'success'
});
},
fail() {
wx.showToast({
title: '复制失败',
icon: 'none'
});
}
});
}
});

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,98 @@
<view class="flex-col page">
<!-- 身份证输入框 -->
<view class="flex-row items-center section">
<image class="image" src="./images/find.png" />
<input class="font text ml-5" maxlength="18" placeholder="请输入身份证查询凭证" bindinput="onInput" bindconfirm="onSearch" />
</view>
<!-- 显示查询结果 -->
<view class="flex-col mt-18">
<!-- 审核失败 -->
<view wx:if="{{status === '审核失败'}}" class="flex-col section_2">
<view class="flex-row justify-center self-start section_3">
<image class="image_2" src="./images/flase.png" />
<text class="font text_2 ml-8">审核失败</text>
</view>
<text class="self-start font_2 text_3">姓名</text>
<text class="self-start font_3 text_4">{{result.name}}</text>
<text class="self-start font_2 text_5">手机号</text>
<text class="self-start font_4 text_6">{{result.phone}}</text>
<view class="flex-col self-stretch relative group">
<view class="self-start section_4"></view>
<view class="flex-col justify-start items-center self-stretch text-wrapper" bind:tap="reapply">
<text class="font text_9">重新申请</text>
</view>
<view class="flex-col items-start section_5 pos">
<text class="font_5 text_7">原因:</text>
<text class="font_5 text_8 mt-11">{{result.failureReason}}</text>
</view>
</view>
</view>
<!-- 审核通过 -->
<view wx:if="{{status === '已通过'}}" class="flex-col section_6 mt-18">
<view class="flex-col group_2">
<view class="flex-row justify-between group_3">
<view class="flex-row items-center section_7">
<image class="shrink-0 image_3" src="./images/current.png" />
<text class="font text_11 ml-6">审核通过</text>
</view>
<view class="flex-col justify-start items-center self-start text-wrapper_2">
<text class="text_10">员工</text>
</view>
</view>
<view class="flex-col relative mt-21">
<view class="flex-row self-stretch section_8">
<text class="font_2 text_12">姓名</text>
<text class="font_3 ml-39">{{result.name}}</text>
</view>
<view class="flex-row self-stretch section_9">
<text class="font_2">手机号</text>
<text class="font_4 text_13 ml-23">{{result.phone}}</text>
</view>
<view class="self-start section_10"></view>
<view class="flex-row justify-between items-center section_11 pos_2">
<view class="flex-row items-center">
<text class="font_2 text_14">密码</text>
<text class="font_3 text_15 ml-37">{{result.password}}</text>
</view>
<text class="font_2 text_16" bind:tap="copyPassword">复制</text>
</view>
</view>
<view class="group_4 mt-21">
<text class="font_6 text_17">温馨提示:</text>
<text class="font_6">恭喜成为本公司的推广员工,请保存以上账号密码,用于登录员工端小程序。</text>
</view>
</view>
<view class="flex-col justify-start items-center text-wrapper_3" bind:tap="gotoLogin"><text class="font text_18">去登录</text></view>
</view>
<!-- 审核中 -->
<view wx:if="{{status === '待审核'}}" class="flex-col section_12 mt-18">
<view class="flex-row justify-center items-center self-start section_13">
<image class="image" src="./images/wait.png" />
<text class="font text_19 ml-6">审核中</text>
</view>
<text class="self-start font_2 text_20">姓名</text>
<text class="self-start font_3 text_21">{{result.name}}</text>
<text class="self-start font_2 text_22">手机号</text>
<text class="self-start font_4 text_23">{{result.phone}}</text>
<!-- <text class="self-start font_2 text_24">身份证号</text>
<view class="flex-row self-stretch group_5">
<view class="shrink-0 section_14"></view>
<view class="flex-col justify-start items-start flex-1 text-wrapper_4">
<text class="text_25">{{result.idCard}}</text>
</view>
</view> -->
<view class="flex-col self-stretch group_6">
<view class="group_7">
<text class="font_6 text_26">注:</text>
<text class="font_6">每次必须通过身份证来查看申请状态。</text>
</view>
<view class="flex-col justify-start items-center text-wrapper_5 mt-14" bind:tap="revokeApplication">
<text class="font text_27">撤销申请</text>
</view>
</view>
</view>
</view>
</view>

View File

@ -0,0 +1,329 @@
.ml-5 {
margin-left: 9.38rpx;
}
.mt-11 {
margin-top: 20.63rpx;
}
.ml-39 {
margin-left: 73.13rpx;
}
.ml-23 {
margin-left: 43.13rpx;
}
.ml-37 {
margin-left: 69.38rpx;
}
.mt-21 {
margin-top: 39.38rpx;
}
.page {
padding: 45.94rpx 38.44rpx 140.91rpx;
background-color: #fafafa;
width: 100%;
overflow-y: auto;
overflow-x: hidden;
height: 100%;
}
.section {
padding: 15.81rpx 13.93rpx 14.19rpx;
background-color: #ffffff;
border-radius: 93.75rpx;
border: solid 1.88rpx #e0e0e0;
}
.image {
width: 33.75rpx;
height: 33.75rpx;
}
.font {
font-size: 30rpx;
font-family: SourceHanSansCN;
line-height: 27.84rpx;
color: #ffffff;
}
.text {
color: #919191;
line-height: 27.75rpx;
}
.section_2 {
padding: 33.75rpx 28.13rpx 35.63rpx;
background-color: #ffffff;
border-radius: 18.43rpx;
box-shadow: 0rpx 3.75rpx 7.5rpx #00000040;
}
.section_3 {
padding: 15rpx 0 13.13rpx;
background-color: #e53935;
border-radius: 18.75rpx;
width: 211.88rpx;
}
.image_2 {
width: 30rpx;
height: 30rpx;
}
.text_2 {
margin-right: 3.28rpx;
line-height: 28.16rpx;
}
.font_2 {
font-size: 26.25rpx;
font-family: SourceHanSansCN;
line-height: 24.15rpx;
color: #999999;
}
.text_3 {
margin-left: 2.81rpx;
margin-top: 39rpx;
line-height: 24.21rpx;
}
.font_3 {
font-size: 30rpx;
font-family: SourceHanSansCN;
line-height: 27.84rpx;
color: #333333;
}
.text_4 {
margin-left: 4.24rpx;
margin-top: 21rpx;
}
.text_5 {
margin-left: 3.19rpx;
margin-top: 41.4rpx;
}
.font_4 {
font-size: 30rpx;
font-family: SourceHanSansCN;
line-height: 24.15rpx;
color: #333333;
}
.text_6 {
margin-left: 4.52rpx;
margin-top: 24.04rpx;
line-height: 22.76rpx;
}
.group {
margin-top: 43.73rpx;
}
.section_4 {
background-color: #d32f2f;
border-radius: 9.38rpx 0rpx 0rpx 9.38rpx;
width: 13.13rpx;
height: 120rpx;
}
.text-wrapper {
margin-top: 35.63rpx;
padding: 35.57rpx 0 30.49rpx;
background-color: #e53935;
border-radius: 9.38rpx;
}
.text_9 {
line-height: 27.69rpx;
}
.section_5 {
padding: 27.81rpx 21.47rpx 24.26rpx;
background-color: #fdecea;
border-radius: 8.01rpx;
}
.pos {
position: absolute;
left: 7.5rpx;
right: 0;
top: 0;
}
.font_5 {
font-size: 26.25rpx;
font-family: AlibabaPuHuiTi;
line-height: 24.15rpx;
}
.text_7 {
color: #d32f2f;
line-height: 23.25rpx;
}
.text_8 {
color: #555555;
line-height: 24.26rpx;
}
.section_6 {
padding: 0 28.13rpx 56.25rpx;
background-color: #ffffff;
border-radius: 22.24rpx;
box-shadow: 0rpx 3.75rpx 7.5rpx #00000040;
}
.group_2 {
padding: 31.88rpx 0 54.17rpx;
}
.group_3 {
padding-left: 7.5rpx;
}
.section_7 {
padding: 11.25rpx 18.75rpx 9.38rpx;
background-color: #66bb6a;
border-radius: 18.75rpx;
height: 58.13rpx;
}
.image_3 {
width: 37.5rpx;
height: 37.5rpx;
}
.text_11 {
margin-right: 3.28rpx;
line-height: 28.16rpx;
}
.text-wrapper_2 {
padding: 11.47rpx 0 9.73rpx;
background-color: #66bb6a;
border-radius: 29.46rpx;
width: 99.38rpx;
height: 41.25rpx;
}
.text_10 {
color: #ffffff;
font-size: 22.5rpx;
font-family: SourceHanSansCN;
line-height: 20.04rpx;
}
.section_8 {
padding: 33.58rpx 27.19rpx 30.45rpx;
background-color: #f8f9fa;
border-radius: 9.38rpx;
}
.text_12 {
line-height: 24.21rpx;
}
.section_9 {
margin-top: 28.74rpx;
padding: 35.33rpx 27.56rpx 32.4rpx;
background-color: #f8f9fa;
border-radius: 9.38rpx;
}
.text_13 {
line-height: 22.76rpx;
}
.section_10 {
margin-top: 31.26rpx;
background-color: #66bb6a;
border-radius: 9.38rpx 0rpx 0rpx 9.38rpx;
width: 13.13rpx;
height: 91.88rpx;
}
.section_11 {
padding: 34.74rpx 21.62rpx 25.59rpx;
background-color: #e8f5e9;
border-radius: 9.38rpx;
}
.pos_2 {
position: absolute;
left: 5.63rpx;
right: 0;
top: 235.75rpx;
}
.text_14 {
line-height: 24.36rpx;
}
.text_15 {
line-height: 31.54rpx;
}
.text_16 {
margin-right: 7.52rpx;
color: #66bb6a;
}
.group_4 {
line-height: 31.88rpx;
}
.font_6 {
font-size: 26.25rpx;
font-family: SourceHanSansCN;
line-height: 31.88rpx;
color: #999999;
}
.text_17 {
color: #66bb6a;
}
.text-wrapper_3 {
padding: 35.66rpx 0 30.39rpx;
background-color: #66bb6a;
border-radius: 9.38rpx;
}
.text_18 {
line-height: 27.69rpx;
}
.section_12 {
padding: 33.75rpx 28.13rpx 54.38rpx;
background-color: #ffffff;
border-radius: 22.24rpx;
box-shadow: 0rpx 3.75rpx 7.5rpx #00000040;
}
.section_13 {
margin-left: 7.5rpx;
padding: 13.13rpx 0 11.25rpx;
background-color: #ff8d1a;
border-radius: 18.75rpx;
width: 183.75rpx;
}
.text_19 {
line-height: 28.16rpx;
}
.text_20 {
margin-left: 2.81rpx;
margin-top: 39rpx;
line-height: 24.21rpx;
}
.text_21 {
margin-left: 4.24rpx;
margin-top: 21rpx;
}
.text_22 {
margin-left: 3.19rpx;
margin-top: 41.4rpx;
}
.text_23 {
margin-left: 4.52rpx;
margin-top: 24.04rpx;
line-height: 22.76rpx;
}
.text_24 {
margin-left: 2.98rpx;
margin-top: 39.6rpx;
line-height: 24.43rpx;
}
.group_5 {
margin-top: 20.94rpx;
}
.section_14 {
background-color: #ff8d1a;
border-radius: 9.38rpx 0rpx 0rpx 9.38rpx;
width: 13.13rpx;
height: 91.88rpx;
}
.text-wrapper_4 {
margin-left: -7.5rpx;
padding: 38.04rpx 0 32.04rpx;
background-color: #fff4e5;
border-radius: 9.19rpx;
height: 91.88rpx;
}
.text_25 {
margin-left: 25.71rpx;
color: #ff8d1a;
font-size: 30rpx;
font-family: AlimamaShuHeiTi;
line-height: 21.79rpx;
}
.group_6 {
margin-top: 40.97rpx;
}
.group_7 {
margin-left: 2.74rpx;
margin-right: 10.33rpx;
line-height: 31.88rpx;
}
.text_26 {
color: #ff8d1a;
}
.text-wrapper_5 {
padding: 35.48rpx 0 30.41rpx;
background-color: #ff8d1a;
border-radius: 9.38rpx;
}
.text_27 {
line-height: 27.86rpx;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

View File

@ -139,7 +139,7 @@ Page({
// 点击“登录账号”回登录页
gotoLogin() {
wx.navigateTo({ url: '/pages/loginModule/pwdLogin/pwdLogin' });
wx.navigateBack();
},
onUnload() {

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;
}

View File

@ -5,10 +5,28 @@ import { validate } from "../../../utils/validate";
// pages/loginModule/register/register.js
Page({
data: {
role: '', // 用户角色
placeholder: '', // 输入框显示文本
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log('options--->',options);
this.setData({
role: options.role
})
if (options.role === 'supervisor') {
this.setData({
placeholder: '请输入学校名称'
})
} else {
this.setData({
placeholder : '请输入昵称'
})
}
const scene = decodeURIComponent(options.scene)
let [key, value] = scene.split('=');
this.setData({inviteCode: value})
@ -136,6 +154,9 @@ Page({
title: '加载中',
mask: true
})
const { role } = this.data;
const res = await requestAsync({
url: baseUrl + '/userInfo/register',
method: 'POST',
@ -145,7 +166,8 @@ Page({
phoneNumber: phone,
verificationCode: captcha,
invitationCode: inviteCode,
userPassword: password
userPassword: password,
userRole: role
}
});
console.log('注册信息---->',res.data);
@ -157,8 +179,8 @@ Page({
});
wx.hideLoading()
setTimeout(() => {
wx.navigateTo({
url: '/pages/loginModule/pwdLogin/pwdLogin',
wx.navigateBack()({
// url: '/pages/loginModule/pwdLogin/pwdLogin',
success: () => {
this.setData({ nickname:'', phone:'', captcha:'', inviteCode:'', password:'', agree:false });
}

View File

@ -11,8 +11,8 @@
<view class="flex-col">
<view class="flex-col justify-start relative section">
<input class="flex-col justify-start items-start text-wrapper_5 view input"
placeholder="请输入昵称"
maxlength="6"
placeholder="{{ placeholder }}"
maxlength="18"
bindinput="onInput" data-field="nickname" value="{{nickname}}"
/>
</view>