app-手机验证码登录
This commit is contained in:
parent
3fa5f7177f
commit
c8cee60f31
|
|
@ -3,9 +3,11 @@
|
|||
// @ts-nocheck
|
||||
// Generated by unplugin-vue-components
|
||||
// Read more: https://github.com/vuejs/core/pull/3399
|
||||
import '@vue/runtime-core'
|
||||
|
||||
export {}
|
||||
|
||||
declare module 'vue' {
|
||||
declare module '@vue/runtime-core' {
|
||||
export interface GlobalComponents {
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
|
|
@ -15,7 +17,6 @@ declare module 'vue' {
|
|||
VanDatePicker: typeof import('vant/es')['DatePicker']
|
||||
VanField: typeof import('vant/es')['Field']
|
||||
VanForm: typeof import('vant/es')['Form']
|
||||
VanIcon: typeof import('vant/es')['Icon']
|
||||
VanNavBar: typeof import('vant/es')['NavBar']
|
||||
VanOverlay: typeof import('vant/es')['Overlay']
|
||||
VanPicker: typeof import('vant/es')['Picker']
|
||||
|
|
|
|||
|
|
@ -116,6 +116,38 @@ export default class Crypoto implements CrypotoType {
|
|||
return ciphertext
|
||||
}
|
||||
|
||||
decrypt: any;
|
||||
// decrypt: any;
|
||||
|
||||
decrypt(cipherText: string) {
|
||||
if (!cipherText) {
|
||||
console.error("密文为空或未定义");
|
||||
return "";
|
||||
}
|
||||
|
||||
const key = this.key;
|
||||
const iv = this.iv;
|
||||
|
||||
// 如果后端传来的密文是 Base64URL 格式,需要先转成 Base64 标准格式
|
||||
const base64Str = cipherText.replace(/-/g, '+').replace(/_/g, '/');
|
||||
|
||||
// 创建包含 ciphertext 的 CipherParams 对象
|
||||
const cipherParams = CryptoJS.lib.CipherParams.create({
|
||||
ciphertext: CryptoJS.enc.Base64.parse(base64Str)
|
||||
});
|
||||
|
||||
const decryptResult = CryptoJS.AES.decrypt(cipherParams, key, {
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
});
|
||||
|
||||
const decryptedStr = decryptResult.toString(CryptoJS.enc.Utf8);
|
||||
|
||||
if (!decryptedStr) {
|
||||
console.error("解密结果为空,请检查密钥/IV是否匹配 或 密文是否正确");
|
||||
}
|
||||
|
||||
return decryptedStr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@
|
|||
console.log(res.status)
|
||||
showSuccessToast('登录成功!')
|
||||
localStorage.setItem('token', res.data.token)
|
||||
localStorage.setItem('phoneNumber', username.value)
|
||||
localStorage.setItem('phoneNumber', cry.encrypt(username.value))
|
||||
localStorage.setItem('avatarUrl', 'https://img.zcool.cn/community/0104c958b69c23a801219c77ba5da2.png?x-oss-process=image/auto-orient,1/resize,m_lfit,w_1280,limit_1/sharpen,100')
|
||||
// 设置登录状态码持续时间为3h
|
||||
const overDate = new Date().getTime() - 8 * 60 * 60 * 1000 + 3 * 60 * 60 * 1000
|
||||
|
|
|
|||
|
|
@ -33,20 +33,20 @@
|
|||
@cancel="showHospitalPicker = false"
|
||||
/>
|
||||
</van-popup>
|
||||
<h2 style="font-size: 18px; font-weight: bold; margin-bottom: 0.3rem;">检查类型</h2>
|
||||
<h2 style="font-size: 18px; font-weight: bold; margin-bottom: 0.3rem;">选择套餐</h2>
|
||||
<van-field
|
||||
v-model="result2"
|
||||
is-link
|
||||
readonly
|
||||
name="checkId"
|
||||
placeholder="点击选择检查类型"
|
||||
placeholder="点击选择套餐"
|
||||
@click="showTypePicker = true"
|
||||
style="margin-bottom: 0.3rem"
|
||||
autocomplete="off"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '请选择一个检查类型!'
|
||||
message: '请选择一个套餐!'
|
||||
}
|
||||
]"
|
||||
/>
|
||||
|
|
@ -61,7 +61,7 @@
|
|||
@close="cascaderClose"
|
||||
@change="onChange"
|
||||
/>
|
||||
<div class="inner-package" v-if="showTotalTc">
|
||||
<!-- <div class="inner-package" v-if="showTotalTc">
|
||||
<h2 class="inner-tit">
|
||||
{{ personalPackageName }}
|
||||
<span style="display: flex; align-items: center;" v-if="pushBtn" @click="flodTc"> 展开 <van-icon name="arrow-down" size="26"/></span>
|
||||
|
|
@ -81,7 +81,7 @@
|
|||
<div class="cfm-btn">
|
||||
<van-button class="confirm-package" type="primary" @click="closePopup">确认套餐</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
</van-popup>
|
||||
<h2 style="font-size: 18px; font-weight: bold; margin-bottom: 0.3rem;">体检时间</h2>
|
||||
|
|
@ -425,10 +425,14 @@
|
|||
|
||||
// 级联选择器变化
|
||||
const onChange = (res: any) => {
|
||||
console.log(res)
|
||||
console.log("孙亮",res)
|
||||
result2.value = res.selectedOptions[0]?.text;
|
||||
examType.value = res.selectedOptions[0]?.value
|
||||
getPackageDetail({
|
||||
examType.value = res.selectedOptions[0]?.value;
|
||||
|
||||
|
||||
personalPackageName.value =res.selectedOptions[0]?.text;
|
||||
packageId.value = res.selectedOptions[0]?.value;
|
||||
/* getPackageDetail({
|
||||
checkId: JSON.stringify(res.selectedOptions[0].value),
|
||||
token: localStorage.getItem('token'),
|
||||
combType: 2
|
||||
|
|
@ -459,7 +463,7 @@
|
|||
}
|
||||
}).catch((err: any) => {
|
||||
console.log(err)
|
||||
})
|
||||
}) */
|
||||
}
|
||||
|
||||
// 级联选择器点击关闭按钮
|
||||
|
|
|
|||
|
|
@ -112,6 +112,9 @@
|
|||
import { editNewPwd, sendVeriCode } from '../../api/ForgetPassword'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import './scss/index.scss'
|
||||
import Crypoto from '../../api/AesCbc'
|
||||
|
||||
const cry: any = new Crypoto()
|
||||
|
||||
const phoneNumPlaceHolder = ref<string>('请输入手机号')
|
||||
const pwdPlaceHolder = ref<string>('请输入新密码')
|
||||
|
|
@ -316,7 +319,7 @@
|
|||
onMounted(() => {
|
||||
console.log(route.query.phoneNum)
|
||||
if (route.query) {
|
||||
phoneNumber.value = route.query.phoneNum
|
||||
phoneNumber.value = cry.decrypt(route.query.phoneNum)
|
||||
} else {
|
||||
phoneNumber.value = ''
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
</div>
|
||||
<h2 class="tit">体检服务</h2>
|
||||
<div class="services">
|
||||
<div v-if="personnelType !== '0'" class="services-item" @click="judgePreOrdered()">
|
||||
<div class="services-item" @click="judgePreOrdered()">
|
||||
<img :src="preOrderImg" alt=""/>
|
||||
<span>体检预约</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -205,7 +205,9 @@
|
|||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}else{
|
||||
showFailToast('登录失败!没有找到这个号码')
|
||||
}
|
||||
}).catch(() => {
|
||||
showFailToast('登录失败!')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<h1>体检单据</h1>
|
||||
<h2>套餐名称:</h2>
|
||||
<span>{{ packageName }}</span>
|
||||
<h2>体检项目:</h2>
|
||||
<!-- <h2>体检项目:</h2>
|
||||
<span v-for="(item, index) in receiptInfo" :key="index">
|
||||
{{ item.mealName + ' ' }}
|
||||
</span>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
<div class="content">{{ item.mealName }}:{{ item.mealContent }}</div>
|
||||
<div class="meal-price">{{ item.mealPrice }}元</div>
|
||||
</div>
|
||||
<h2 style="color: red;">体检总价:{{ totalPrice }}元</h2>
|
||||
<h2 style="color: red;">体检总价:{{ totalPrice }}元</h2> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,9 @@
|
|||
import { ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { showConfirmDialog } from 'vant';
|
||||
import Crypoto from '../../api/AesCbc'
|
||||
|
||||
const cry: any = new Crypoto()
|
||||
const router = useRouter()
|
||||
const userInfo = ref<any>({})
|
||||
// 设置默认头像
|
||||
|
|
@ -93,12 +95,13 @@
|
|||
getUserInfo({
|
||||
token: localStorage.getItem('token')
|
||||
}).then((res: any) => {
|
||||
userInfo.value = res.data.obj[0]
|
||||
userInfo.value = res.data.obj[0]
|
||||
userInfo.value.phyName= cry.decrypt(userInfo.value.phyName)
|
||||
const data = res.data.obj[0]
|
||||
localStorage.setItem('phyName', data.phyName)
|
||||
localStorage.setItem('idcard', data.idcard)
|
||||
localStorage.setItem('idcard', cry.decrypt(data.idcard))
|
||||
localStorage.setItem('age', data.age)
|
||||
localStorage.setItem('telepNumber', data.telepNumber)
|
||||
localStorage.setItem('telepNumber', cry.decrypt(data.telepNumber))
|
||||
localStorage.setItem('departName', data.departName)
|
||||
localStorage.setItem('id', data.id)
|
||||
if (Number(data.sex) === 1) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue