master
dongmu 11 months ago
parent 3a2ccd4a4c
commit c5eb65922b

@ -1,73 +1,90 @@
{
//
"easycom": {
"autoscan": true,
"custom": {
// uni-ui
"^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue",
// Xtx,@srccomponents $1
"^Xtx(.*)": "@/components/Xtx$1.vue"
}
},
"pages": [
//pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "抢单"
}
},
{
"path": "pages/category/category",
"style": {
"navigationBarTitleText": "运单"
}
},
{
"path": "pages/my/my",
"style": {
"navigationBarTitleText": "我的"
}
},
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
// TabBar
"tabBar": {
"color": "#333",
"selectedColor": "#27ba9b",
"backgroundColor": "#fff",
"borderStyle": "white",
"list": [
{
"text": "抢单",
"pagePath": "pages/index/index",
"iconPath": "static/tabs/home_default.png",
"selectedIconPath": "static/tabs/home_selected.png"
},
{
"text": "运单",
"pagePath": "pages/category/category",
"iconPath": "static/tabs/category_default.png",
"selectedIconPath": "static/tabs/category_selected.png"
},
{
"text": "我的",
"pagePath": "pages/my/my",
"iconPath": "static/tabs/user_default.png",
"selectedIconPath": "static/tabs/user_selected.png"
}
]
}
}
//
"easycom": {
"autoscan": true,
"custom": {
// uni-ui
"^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue",
// Xtx,@srccomponents $1
"^Xtx(.*)": "@/components/Xtx$1.vue"
}
},
"pages": [
//pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "抢单"
}
},
{
"path": "pages/category/category",
"style": {
"navigationBarTitleText": "运单"
}
},
{
"path": "pages/my/my",
"style": {
"navigationBarTitleText": "我的"
}
},
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录"
}
},
{
"path": "pages/login/loginPassword/loginPassword",
"style": {
"navigationBarTitleText": "忘记密码"
}
},
{
"path": "pages/login/loginPassword/loginPasswordItem/loginPasswordItem",
"style": {
"navigationBarTitleText": "忘记密码填写"
}
},
{
"path": "pages/login/appleId/appleId",
"style": {
"navigationBarTitleText": "注册账号"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
// TabBar
"tabBar": {
"color": "#333",
"selectedColor": "#27ba9b",
"backgroundColor": "#fff",
"borderStyle": "white",
"list": [
{
"text": "抢单",
"pagePath": "pages/index/index",
"iconPath": "static/tabs/home_default.png",
"selectedIconPath": "static/tabs/home_selected.png"
},
{
"text": "运单",
"pagePath": "pages/category/category",
"iconPath": "static/tabs/category_default.png",
"selectedIconPath": "static/tabs/category_selected.png"
},
{
"text": "我的",
"pagePath": "pages/my/my",
"iconPath": "static/tabs/user_default.png",
"selectedIconPath": "static/tabs/user_selected.png"
}
]
}
}

@ -0,0 +1,379 @@
<template>
<!-- 注册账号 -->
<view
class="normal-login-container"
:style="{ height: searchHeight + 'px;', 'padding-top': '1px' }"
>
<HeadTabbar tabbarName="注册账号"></HeadTabbar>
<view class="logo-content align-center justify-center flex">
<text class="title">注册账号</text>
</view>
<view class="login-form-content">
<view class="input-item flex align-center">
<view class="iconfont icon-user icon"></view>
<input
v-model="loginForm.phone"
class="input"
type="number"
placeholder="请输入手机号"
:maxlength="11"
/>
</view>
<view class="input-item flex align-center">
<view class="iconfont icon-password icon"></view>
<input
v-model="loginForm.password"
:password="true"
class="input"
placeholder="请输入密码"
:maxlength="11"
/>
</view>
<view class="input-item flex align-center">
<view class="iconfont icon-password icon"></view>
<input
v-model="loginForm.confirmPassword"
:password="true"
class="input"
placeholder="请输入确认密码"
:maxlength="11"
/>
</view>
<!-- 验证码 -->
<view>
<uni-row>
<uni-col :span="16">
<view class="input-item flex align-center" v-if="captchaEnabled">
<view class="iconfont icon-code icon"></view>
<input
v-model="loginForm.smsCode"
type="number"
class="input"
placeholder="请输入验证码"
:maxlength="6"
/>
</view>
</uni-col>
<uni-col :span="8">
<view class="login-code">
<button
:class="{ 'login-code-verification': canclick, disabled: !canclick }"
plain
@click="countdown"
>
{{ content }}
</button>
</view>
</uni-col>
</uni-row>
</view>
<view class="reading">
<view class="action-btn">
<button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">
立即注册
</button>
</view>
<!-- ---------------用户协议---------------- -->
<view style="display: flex; justify-content: center">
<view style="margin: 20rpx 0 10rpx 30rpx; display: flex; align-items: center">
<view>
<uni-data-checkbox
v-model="agreementSearch"
multiple
:localdata="agreement"
></uni-data-checkbox>
</view>
<view @click="clickNativeRule" style="margin-left: -25px">鸿森通用户服务协议</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { loginRegistered, loginSmsCode } from '@/services/home'
import { onMounted, ref } from 'vue'
const agreementSearch = ref([]) //
const agreement = ref([
{
value: 1,
},
]) //
//
const resend = ref()
const checkbox1 = ref([2])
const checkboxReading = ref([
{
text: '阅读并接受《鸿森通货运平台协议》',
value: 1,
},
])
const codeUrl = ref()
const captchaEnabled = ref(true)
const searchHeight = ref()
const clock = ref()
const loginForm = ref({
phone: '',
password: '',
confirmPassword: '',
smsCode: '',
})
const content = ref('获取验证码') //
const totaltime = ref(60) //
const canclick = ref(true) //canclick
onMounted(() => {
//
searchHeight.value = getHeight()
})
//
const clickNativeRule = () => {
uni.navigateTo({
url: '/pageOthers/pageLoginAccent/pageLoginAccent',
})
}
//
const changeCheckbox = (e: any) => {
if (e.detail.value[0]) {
console.log(e.detail.value[0])
}
}
//
const getHeight = () => {
return uni.getWindowInfo().windowHeight
}
//
const handleLogin = async () => {
let phoneTest = /0?(13|14|15|17|18|19)[0-9]{9}/
if (!agreementSearch.value[0]) {
uni.showToast({
title: '请先阅读协议',
icon: 'error',
})
return
}
if (loginForm.value.phone === '') {
uni.showToast({
title: '请输入您的账号',
icon: 'error',
})
return
} else if (!phoneTest.test(loginForm.value.phone)) {
uni.showToast({
title: '请正确输入手机号',
icon: 'error',
})
return
} else if (loginForm.value.password === '') {
uni.showToast({
title: '请输入您的密码',
icon: 'error',
})
return
} else if (loginForm.value.confirmPassword === '') {
uni.showToast({
title: '请输入确认密码',
icon: 'error',
})
return
} else if (loginForm.value.smsCode === '') {
uni.showToast({
title: '请输入验证码',
icon: 'error',
})
return
} else {
//
loginRegistered(loginForm.value).then((res: any) => {
if (res.code == 200) {
uni.showToast({
title: '注册成功',
icon: 'success',
})
uni.navigateBack({
delta: 2,
})
}
})
// pwdLogin()
}
}
//
const countdown = async () => {
let phoneTest = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
if (loginForm.value.phone === '') {
uni.showToast({
title: '请输入您的手机号',
icon: 'error',
})
return
}
if (!phoneTest.test(loginForm.value.phone)) {
uni.showToast({
title: '请正确输入手机号',
icon: 'error',
})
return
}
//false
if (!canclick.value) {
return
}
smsVerif()
}
//
const smsVerif = () => {
//
// SmsVerificationCode( loginForm.username)
loginSmsCode(loginForm.value.phone, 3)
.then((res: any) => {
uni.showToast({
title: '发送验证码成功',
icon: 'success',
})
canclick.value = false
resend.value = true
content.value = totaltime.value + 's后重新发送'
clock.value = setInterval(() => {
totaltime.value--
content.value = totaltime.value + 's后重新发送'
if (totaltime.value < 0) {
clearInterval(clock.value)
content.value = '重新发送验证码'
totaltime.value = 60
canclick.value = true //
}
}, 1000)
console.log(res, '验证码')
})
.catch((err: any) => {
clearInterval(clock.value)
canclick.value = true
content.value = '重新发送验证码'
totaltime.value = 60
resend.value = true
// console.log(err);
})
}
</script>
<style lang="scss">
page {
background-color: #b6dcff;
}
.reading {
margin-top: 20px;
// padding-left: 21px;
}
.border_class {
display: inline-block;
width: 1px;
height: 20px;
background-color: #eee;
margin: 0px 40rpx -8rpx 40rpx;
}
.normal-login-container {
width: 100%;
.logo-content {
width: 100%;
font-size: 21px;
text-align: center;
padding-top: 15%;
image {
border-radius: 4px;
}
.title {
margin-left: 10px;
font-size: 25px;
}
}
.login-form-content {
text-align: center;
margin: 20px auto;
margin-top: 15%;
width: 80%;
.input-item {
margin: 20px auto 0;
background-color: #f5f6f7;
height: 45px;
border-radius: 20px;
.icon {
font-size: 38rpx;
margin-left: 10px;
color: #999;
}
.input {
width: 100%;
font-size: 14px;
line-height: 20px;
text-align: left;
padding-left: 15px;
}
}
.login-btn {
margin-top: 10px;
height: 45px;
// border-radius: 50px;
}
.login-code {
height: 45px;
.login-code-verification {
margin-top: 20px;
height: 45px;
line-height: 45px;
border: 1px #8bd70f solid;
border-radius: 20px;
color: black;
font-size: 0.9rem;
background-color: #96e811;
}
}
}
}
.text-blue {
color: #7f7f7f;
}
.disabled {
margin-top: 20px;
height: 45px;
line-height: 45px;
border: 1px #b9b9b9 solid !important;
border-radius: 20px;
color: black;
font-size: 0.75rem;
background-color: #d0d0d0 !important;
color: #57a3f3;
cursor: not-allowed;
}
</style>

@ -28,7 +28,7 @@
<view class="iconfont icon-password icon"></view>
<input
v-model="loginForm.password"
type="password"
:password="true"
class="input"
placeholder="请输入密码"
:maxlength="15"
@ -186,7 +186,7 @@ const handleLogin = async () => {
return
} else {
//
// loginForm.value.jsCode = UniCode.value
loginForm.value.jsCode = UniCode.value
let URL = '/pages/index/index'
loginUser(loginForm.value)
.then((res: any) => {
@ -245,25 +245,27 @@ const smsVerif = () => {
//
// SmsVerificationCode( loginForm.username)
loginSmsCode(loginForm.value.account, 1, loginForm.value.password)
.then((res) => {
uni.showToast({
title: '发送验证码成功',
icon: 'success',
})
canclick.value = false
content.value = totaltime.value + 's后重新发送'
clock.value = setInterval(() => {
totaltime.value--
.then((res: any) => {
if (res.code == 200) {
uni.showToast({
title: '发送验证码成功',
icon: 'success',
})
canclick.value = false
content.value = totaltime.value + 's后重新发送'
if (totaltime.value < 0) {
//
// resend = true
clearInterval(clock.value)
content.value = '重新发送验证码'
totaltime.value = 60
canclick.value = true
}
}, 1000)
clock.value = setInterval(() => {
totaltime.value--
content.value = totaltime.value + 's后重新发送'
if (totaltime.value < 0) {
//
// resend = true
clearInterval(clock.value)
content.value = '重新发送验证码'
totaltime.value = 60
canclick.value = true
}
}, 1000)
}
})
.catch((err) => {
canclick.value = true //

@ -0,0 +1,266 @@
<template>
<!-- 忘记密码 -->
<view class="normal-login-container" :style="{ height: searchHeight + 'px' }">
<!--鸿森通货运 标题 -->
<HeadTabbar tabbarName="忘记密码"></HeadTabbar>
<view class="logo-content align-center justify-center flex">
<text class="title">忘记密码</text>
</view>
<view class="login-form-content">
<view class="input-item flex align-center">
<view class="iconfont icon-user icon"></view>
<input
v-model="loginForm.account"
class="input"
type="number"
placeholder="请输入手机号"
:maxlength="11"
/>
</view>
<!-- 验证码 -->
<view>
<uni-row>
<uni-col :span="16">
<view class="input-item flex align-center" v-if="captchaEnabled">
<view class="iconfont icon-code icon"></view>
<input
v-model="loginForm.smsCode"
type="number"
class="input"
placeholder="请输入验证码"
:maxlength="6"
/>
</view>
</uni-col>
<uni-col :span="8">
<view class="login-code">
<button
:class="{ 'login-code-verification': canclick, disabled: !canclick }"
plain
@click="countdown"
>
{{ content }}
</button>
</view>
</uni-col>
</uni-row>
</view>
<view class="action-btn">
<button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">下一步</button>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { loginSmsCode, recoverPasswordVerify } from '@/services/home'
import { onMounted } from 'vue'
import { ref } from 'vue'
const resend = ref() //
const isBTn = ref(false) //
const codeUrl = ref()
const captchaEnabled = ref(true)
const searchHeight = ref()
const clock = ref()
const loginForm = ref({
account: '',
smsCode: '',
})
const content = ref('获取验证码') //
const totaltime = ref(60) //
const canclick = ref(true) //canclick
onMounted(() => {
searchHeight.value = getHeight()
})
//
const getHeight = () => {
return uni.getWindowInfo().windowHeight
}
//
const countdown = () => {
if (loginForm.value.account === '') {
uni.showToast({
title: '请输入您的手机号',
icon: 'error',
})
return
}
//false
if (!canclick.value) {
return
}
smsVerif()
}
//
const smsVerif = () => {
//
loginSmsCode(loginForm.value.account, 2)
.then((res: any) => {
isBTn.value = true
if (res.code == 200) {
uni.showToast({
title: '发送验证码成功',
icon: 'success',
})
canclick.value = false
resend.value = true
content.value = totaltime.value + 's后重新发送'
clock.value = setInterval(() => {
totaltime.value--
content.value = totaltime.value + 's后重新发送'
if (totaltime.value < 0) {
clearInterval(clock.value)
content.value = '重新发送验证码'
totaltime.value = 60
canclick.value = true
}
}, 1000)
}
})
.catch((err: any) => {
canclick.value = true
clearInterval(clock.value)
resend.value = true
content.value = '重新发送验证码'
totaltime.value = 60
// console.log(err);
isBTn.value = false
})
}
//
const handleLogin = () => {
if (isBTn.value) {
recoverPasswordVerify(loginForm.value).then((res: any) => {
if (res.code == 200) {
let Obj = {
account: loginForm.value.account,
registerLogotype: res.data,
}
uni.navigateTo({
url:
`/pages/login/loginPassword/loginPasswordItem/loginPasswordItem?value=` +
JSON.stringify(Obj),
})
}
})
} else if (loginForm.value.account == '') {
uni.showToast({
title: '手机号不能为空',
icon: 'error',
})
} else {
uni.showToast({
title: '请获取验证码',
icon: 'error',
})
}
}
</script>
<style lang="scss">
page {
background-color: #b6dcff;
}
.border_class {
display: inline-block;
width: 1px;
height: 20px;
background-color: #eee;
margin: 0px 40rpx -8rpx 40rpx;
}
.normal-login-container {
width: 100%;
.logo-content {
width: 100%;
font-size: 21px;
text-align: center;
padding-top: 15%;
image {
border-radius: 4px;
}
.title {
margin-left: 10px;
font-size: 25px;
}
}
.login-form-content {
text-align: center;
margin: 20px auto;
margin-top: 15%;
width: 80%;
.input-item {
margin: 20px auto 0;
background-color: #f5f6f7;
height: 45px;
border-radius: 20px;
.icon {
font-size: 38rpx;
margin-left: 10px;
color: #999;
}
.input {
width: 100%;
font-size: 14px;
line-height: 20px;
text-align: left;
padding-left: 15px;
}
}
.login-btn {
margin-top: 20px;
height: 45px;
// border-radius: 50px;
}
.disabled {
margin-top: 20px;
height: 45px;
line-height: 45px;
border: 1px #b9b9b9 solid !important;
border-radius: 20px;
color: black;
font-size: 0.75rem;
background-color: #d0d0d0 !important;
color: #57a3f3;
cursor: not-allowed;
}
.login-code {
height: 45px;
.login-code-verification {
margin-top: 20px;
height: 45px;
line-height: 45px;
border: 1px #8bd70f solid;
border-radius: 20px;
color: black;
font-size: 0.9rem;
background-color: #96e811;
}
}
}
}
.text-blue {
color: #7f7f7f;
}
</style>

@ -0,0 +1,219 @@
<template>
<!-- 忘记密码 -->
<view
class="normal-login-container"
:style="{ height: searchHeight + 'px', backgroundColor: '#b6dcff', 'padding-top': '1px' }"
>
<HeadTabbar :isShowIcon="true" :backNumber="2" tabbarName="忘记密码"></HeadTabbar>
<!--鸿森通货运 标题 -->
<view class="logo-content align-center justify-center flex">
<text class="title">忘记密码</text>
</view>
<view class="login-form-content">
<view class="input-item flex align-center" style="background-color: #eee">
<view class="iconfont icon-user icon"></view>
<input
v-model="loginForm.account"
:disabled="true"
class="input"
type="text"
placeholder="请输入手机号"
:maxlength="11"
/>
</view>
<view class="input-item flex align-center">
<view class="iconfont icon-password icon"></view>
<input
v-model="loginForm.password"
:password="true"
class="input"
placeholder="请输入新密码"
:maxlength="20"
/>
</view>
<view class="input-item flex align-center">
<view class="iconfont icon-password icon"></view>
<input
v-model="loginForm.confirmPassword"
:password="true"
class="input"
placeholder="请输入确认密码"
:maxlength="20"
/>
</view>
<view class="action-btn">
<button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">
确认修改
</button>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { recoverPassword } from '@/services/home'
const codeUrl = ref()
const captchaEnabled = ref(true)
const searchHeight = ref()
const loginForm = ref({
account: '',
password: '',
registerLogotype: '',
confirmPassword: '',
})
const content = ref('获取验证码') //
const totaltime = ref(60) //
const canclick = ref(true) //canclick
onLoad((option) => {
if (option?.value) {
let res = JSON.parse(option.value)
loginForm.value.account = res.account
loginForm.value.registerLogotype = res.registerLogotype
}
})
onMounted(() => {
//
searchHeight.value = getHeight()
})
//
const getHeight = () => {
return uni.getWindowInfo().windowHeight
}
//
const handleLogin = async () => {
if (loginForm.value.password === '') {
uni.showToast({
title: '请输入您的密码',
icon: 'error',
})
return
} else if (loginForm.value.confirmPassword === '') {
uni.showToast({
title: '请输入确认密码',
icon: 'error',
})
return
} else {
//
recoverPassword(loginForm.value).then((res: any) => {
if (res.code == 200) {
uni.showToast({
title: '修改成功',
icon: 'success',
})
uni.navigateBack({
delta: 2,
})
}
})
}
}
</script>
<style lang="scss">
page {
background-color: #ffffff;
}
.border_class {
display: inline-block;
width: 1px;
height: 20px;
background-color: #eee;
margin: 0px 40rpx -8rpx 40rpx;
}
.normal-login-container {
width: 100%;
.logo-content {
width: 100%;
font-size: 21px;
text-align: center;
padding-top: 20%;
image {
border-radius: 4px;
}
.title {
margin-left: 10px;
font-size: 25px;
}
}
.login-form-content {
text-align: center;
margin: 20px auto;
margin-top: 15%;
width: 80%;
.input-item {
margin: 20px auto;
background-color: #f5f6f7;
height: 45px;
border-radius: 20px;
.icon {
font-size: 38rpx;
margin-left: 10px;
color: #999;
}
.input {
width: 100%;
font-size: 14px;
line-height: 20px;
text-align: left;
padding-left: 15px;
}
}
.login-btn {
margin-top: 20px;
height: 45px;
// border-radius: 50px;
}
.login-code {
height: 38px;
float: right;
.login-code-verification {
height: 43px;
// width: 200px;
position: absolute;
margin-left: 10px;
margin-top: -1px;
// width: 200rpx;
line-height: 38px;
// padding: 2px;
border: 1px #96e811 solid;
border-radius: 20px;
color: black;
font-size: 15px;
background-color: #96e811;
}
}
}
}
.text-blue {
color: #7f7f7f;
}
.disabled {
background-color: #ddd;
border-color: #ddd;
color: #57a3f3;
cursor: not-allowed; //
}
</style>

@ -83,7 +83,7 @@ export const loginUser = (data: any) => {
}
// 获取验证码
export const loginSmsCode = (username: any, index: any, password: any) => {
export const loginSmsCode = (username: any, index: any, password?: any) => {
// 如果index是1 就是登录/找回密码
return http({
method: 'GET',
@ -95,3 +95,29 @@ export const loginSmsCode = (username: any, index: any, password: any) => {
},
})
}
// 修改密码-找回密码
export const recoverPassword = (data: any) => {
return http({
method: 'POST',
url: '/auth/mobile/recoverPassword',
data,
})
}
// 修改密码-找回密码 验证码请求
export const recoverPasswordVerify = (data: any) => {
return http({
method: 'GET',
url: '/auth/mobile/recoverPasswordVerify',
data,
})
}
// 注册账号 type 3
export const loginRegistered = (data: any) => {
return http({
method: 'POST',
url: '/auth/mobile/register',
data,
})
}

@ -58,18 +58,49 @@ export const http = <T>(options: UniApp.RequestOptions) => {
uni.request({
...options,
// 响应成功
success(res) {
success(res: any) {
console.log('500请求错误', res)
// 状态码 2xx参考 axios 的设计
if (res.statusCode >= 200 && res.statusCode < 300) {
// 2.1 提取核心数据 res.data
resolve(res.data as Data<T>)
// ---------------响应是200 但数据内部是500|400----------------------------
const resList = res.data
if (resList.code === 401) {
// 401错误 -> 清理用户信息,跳转到登录页
uni.showToast({
title: resList?.msg || '请求错误',
icon: 'error',
})
const memberStore = useMemberStore()
memberStore.clearProfile()
uni.navigateTo({ url: '/pages/login/login' })
reject(resList)
} else {
console.log('500请求错误', res.data)
// 其他错误 -> 根据后端错误信息轻提示
uni.showToast({
icon: 'none',
title: resList?.msg || '请求错误',
})
reject(resList)
}
// -------------------------------外部响应除200外---------------------------------------------------------------
} else if (res.statusCode === 401) {
// 401错误 -> 清理用户信息,跳转到登录页
uni.showToast({
title: (res.data as Data<T>).msg || '请求错误',
icon: 'error',
})
const memberStore = useMemberStore()
memberStore.clearProfile()
uni.navigateTo({ url: '/pages/login/login' })
reject(res)
} else {
console.log('500请求错误', res.data)
// 其他错误 -> 根据后端错误信息轻提示
uni.showToast({
icon: 'none',

Loading…
Cancel
Save