fix: 注册登录功能开发,测试问题修改

dev_531
xiangcongshuai 1 year ago
parent 03d6e2209e
commit 1af1bae4d2

@ -33,3 +33,19 @@ export const getLogin = (data?: object) => {
export const refreshTokenApi = (data?: object) => { export const refreshTokenApi = (data?: object) => {
return http.request<RefreshTokenResult>("post", "/refreshToken", { data }); return http.request<RefreshTokenResult>("post", "/refreshToken", { data });
}; };
/** 用户注册 */
export const getRegister = (data?: object) => {
return http.request<UserResult>("post", "/virtual-patient/user/register", {
data
});
};
/** 修改密码 */
export const changePassWord = (data?: object) => {
return http.request<UserResult>(
"post",
"/virtual-patient/user/changePassWord",
{
data
}
);
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

@ -37,9 +37,13 @@ export const useConsultationStore = defineStore({
exhalationFlag: false, //呼出服务 exhalationFlag: false, //呼出服务
voiceFlag: true, voiceFlag: true,
planTypeFlag: "", // 处置计划类型 planTypeFlag: "", // 处置计划类型
supportActionId: [] // 呼出辅助检查 supportActionId: [], // 呼出辅助检查
voiceStartFlag: false //是否开始语音问诊
}), }),
actions: { actions: {
changeVoiceFlag(data) {
this.voiceStartFlag = data;
},
changeActivedKey(data) { changeActivedKey(data) {
this.activedKey = data; this.activedKey = data;
if (data !== 1) { if (data !== 1) {

@ -101,6 +101,7 @@ const selectItem = item => {
formData.drugRoute = ""; formData.drugRoute = "";
formData.intervalDay = ""; formData.intervalDay = "";
formData.intervalHour = ""; formData.intervalHour = "";
formData.treatmentPlanId = "";
}; };
const clearData = () => { const clearData = () => {
formData.firstMeasures = ""; formData.firstMeasures = "";

@ -350,7 +350,7 @@ const selectPostion = val => {
flex: 1; flex: 1;
// align-items: center; // align-items: center;
justify-content: center; justify-content: center;
height: calc(100vh - 290px); height: calc(100vh - 250px);
margin-left: 24px; margin-left: 24px;
overflow-y: auto; overflow-y: auto;
@ -548,12 +548,12 @@ const selectPostion = val => {
} }
.result_card { .result_card {
position: fixed; position: absolute;
bottom: 40px; bottom: 10px;
left: 600px; left: 0;
z-index: 1; z-index: 999999;
display: flex; display: flex;
width: calc(100vw - 1220px); width: 98%;
min-height: 105px; min-height: 105px;
padding: 24px; padding: 24px;
font-size: 16px; font-size: 16px;

@ -21,6 +21,7 @@ defineOptions({
flex-direction: row-reverse; flex-direction: row-reverse;
.voice_consultation { .voice_consultation {
position: relative;
width: 500px; width: 500px;
margin-left: 16px; margin-left: 16px;
} }

@ -17,6 +17,7 @@ defineOptions({
}); });
const route = useRoute(); const route = useRoute();
const cardType = ref(0); const cardType = ref(0);
const isStartFlag = ref(false);
watch( watch(
() => useConsultationStoreHooks().voiceFlag, () => useConsultationStoreHooks().voiceFlag,
val => { val => {
@ -25,12 +26,19 @@ watch(
} }
} }
); );
watch(
() => useConsultationStoreHooks().voiceStartFlag,
val => {
isStartFlag.value = val;
}
);
const dialogVisible = ref(false); const dialogVisible = ref(false);
const bodyDialogRef = ref(null); const bodyDialogRef = ref(null);
const suppertDialogRef = ref(null); const suppertDialogRef = ref(null);
const question = ref(""); const question = ref("");
const changeType = (val: number) => { const changeType = (val: number) => {
if (isStartFlag.value) return;
if (val === 2) { if (val === 2) {
cardType.value = val; cardType.value = val;
} else { } else {
@ -70,6 +78,7 @@ const submit = async (val: string) => {
processId: route.query.processId, processId: route.query.processId,
text: val text: val
}; };
useConsultationStoreHooks().changeVoiceFlag(true);
const { data } = await talkByVideo(params); const { data } = await talkByVideo(params);
if (data.type === 2) { if (data.type === 2) {
openBodyDialog(data); openBodyDialog(data);
@ -143,8 +152,8 @@ onMounted(() => {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.text_footer { .text_footer {
position: fixed; position: absolute;
bottom: 66px; bottom: 24px;
display: flex; display: flex;
width: 500px; width: 500px;
height: 66px; height: 66px;
@ -169,8 +178,9 @@ onMounted(() => {
} }
.main_footer { .main_footer {
position: fixed; position: absolute;
bottom: 66px; right: 0;
bottom: 24px;
display: flex; display: flex;
width: 500px; width: 500px;
height: 66px; height: 66px;

@ -3,6 +3,7 @@ import { ref } from "vue";
import { downLoadUrl } from "@/utils/auth"; import { downLoadUrl } from "@/utils/auth";
import { onMounted } from "vue"; import { onMounted } from "vue";
import { loadFileBase64 } from "@/api/utils"; import { loadFileBase64 } from "@/api/utils";
import { useConsultationStoreHooks } from "@/store/modules/consultation";
defineOptions({ defineOptions({
name: "PeopleVideo" name: "PeopleVideo"
@ -65,6 +66,7 @@ const changeVideo = async url => {
}); });
myAuto.addEventListener("ended", function () { myAuto.addEventListener("ended", function () {
useConsultationStoreHooks().changeVoiceFlag(false);
videoFlag.value = false; videoFlag.value = false;
status.value = false; status.value = false;
video.remove(); video.remove();

@ -108,8 +108,10 @@ onBeforeUnmount(() => {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.voiceInquiry { .voiceInquiry {
position: fixed; position: absolute;
bottom: 66px; right: 0;
bottom: 24px;
z-index: 99999;
display: flex; display: flex;
justify-content: center; justify-content: center;
width: 500px; width: 500px;

@ -7,6 +7,7 @@ import ConfirmDiagnosis from "./ConfirmDiagnosis/index.vue";
import ConsultationReview from "./ConsultationReview/index.vue"; import ConsultationReview from "./ConsultationReview/index.vue";
import ConsultationEvaluation from "./ConsultationEvaluation/index.vue"; import ConsultationEvaluation from "./ConsultationEvaluation/index.vue";
import ConsultationRecords from "./ConsultationRecords/index.vue"; import ConsultationRecords from "./ConsultationRecords/index.vue";
import TipIcon from "@/assets/tip.png";
// import Evaluate from "./Evaluate/index.vue"; // import Evaluate from "./Evaluate/index.vue";
import { useConsultationStoreHooks } from "@/store/modules/consultation"; import { useConsultationStoreHooks } from "@/store/modules/consultation";
import KnowledgeGraph from "./KnowledgeGraph/index.vue"; import KnowledgeGraph from "./KnowledgeGraph/index.vue";
@ -84,15 +85,7 @@ onMounted(async () => {
<div class="first_item card_item_img" /> <div class="first_item card_item_img" />
<span>问诊回顾 </span> <span>问诊回顾 </span>
</div> </div>
<div
@click="changeIndex(6)"
v-if="inspectSatus === '1'"
:class="[activedIndex === 6 ? 'actived' : '']"
class="card_item"
>
<div class="record_item card_item_img" />
<span>问诊记录</span>
</div>
<div <div
v-if="inspectSatus === '0'" v-if="inspectSatus === '0'"
class="card_item" class="card_item"
@ -130,8 +123,18 @@ onMounted(async () => {
<div class="knowledge_graph card_item_img" /> <div class="knowledge_graph card_item_img" />
<span>知识图谱</span> <span>知识图谱</span>
</div> </div>
<div
@click="changeIndex(6)"
v-if="inspectSatus === '2'"
:class="[activedIndex === 6 ? 'actived' : '']"
class="card_item record"
>
<div class="record_item card_item_img" />
<span>问诊反馈</span>
<img :src="TipIcon" alt="" />
</div>
</div> </div>
<div class="main_content"> <div :class="[activedIndex === 0 ? 'first_content' : 'main_content']">
<FirstConsultation <FirstConsultation
v-if="inspectSatus === '0'" v-if="inspectSatus === '0'"
v-show="activedIndex === 0" v-show="activedIndex === 0"
@ -260,6 +263,26 @@ onMounted(async () => {
background-image: url("../../assets/newInquiry/main_bg.png"); background-image: url("../../assets/newInquiry/main_bg.png");
background-size: 100% 100%; background-size: 100% 100%;
} }
.first_content {
flex: 1;
// min-width: 1760px;
margin-bottom: 24px;
background-image: url("../../assets/newInquiry/main_bg.png");
background-size: 100% 100%;
}
}
.record {
position: relative;
img {
position: absolute;
top: -14px;
right: -13px;
width: 50px;
height: 50px;
}
} }
} }
</style> </style>

@ -13,10 +13,14 @@ import bg from "../../assets/login/login_bg.png";
import { useRenderIcon } from "@/components/ReIcon/src/hooks"; import { useRenderIcon } from "@/components/ReIcon/src/hooks";
// import update from "./components/update.vue"; // import update from "./components/update.vue";
import { ref, reactive, onMounted, onBeforeUnmount, nextTick } from "vue"; import { ref, reactive, onMounted, onBeforeUnmount, nextTick } from "vue";
import registerIcon from "@/assets/login/register.png";
import { getRegister, changePassWord } from "@/api/user";
import Lock from "@iconify-icons/icon-park-outline/lock"; import Lock from "@iconify-icons/icon-park-outline/lock";
import User from "@iconify-icons/icon-park-outline/user"; import User from "@iconify-icons/icon-park-outline/user";
import PreviewClose from "@iconify-icons/icon-park-outline/preview-close"; import PreviewClose from "@iconify-icons/icon-park-outline/preview-close";
import PreviewOpen from "@iconify-icons/icon-park-outline/preview-open"; import PreviewOpen from "@iconify-icons/icon-park-outline/preview-open";
import IdCard from "@iconify-icons/icon-park-outline/id-card";
// import InviteCode from "@iconify-icons/icon-park-outline/user-to-user-transmission";
defineOptions({ defineOptions({
name: "Login" name: "Login"
@ -24,11 +28,11 @@ defineOptions({
const router = useRouter(); const router = useRouter();
const loading = ref(false); const loading = ref(false);
const ruleFormRef = ref<FormInstance>(); const ruleFormRef = ref<FormInstance>();
const registerFormRef = ref<FormInstance>();
const modifyFormRef = ref<FormInstance>();
const checked = ref(false); const checked = ref(false);
// const currentPage = computed(() => {
// return useUserStoreHook().currentPage;
// });
const cardType = ref(1);
const { initStorage } = useLayout(); const { initStorage } = useLayout();
initStorage(); initStorage();
@ -40,7 +44,18 @@ const ruleForm = reactive({
username: "", username: "",
password: "" password: ""
}); });
const registerForm = reactive({
account: "",
name: "",
password: "",
newPassword: ""
});
const modifyForm = reactive({
account: "",
name: "",
password: "",
newPassword: ""
});
const onLogin = async (formEl: FormInstance | undefined) => { const onLogin = async (formEl: FormInstance | undefined) => {
loading.value = true; loading.value = true;
if (!formEl) return; if (!formEl) return;
@ -78,6 +93,46 @@ const onLogin = async (formEl: FormInstance | undefined) => {
} }
}); });
}; };
const register = async (formEl: FormInstance | undefined) => {
loading.value = true;
if (!formEl) return;
await formEl.validate(async (valid, fields) => {
if (valid) {
const res: any = await getRegister({
account: registerForm.account,
name: registerForm.name,
password: registerForm.password
});
loading.value = false;
if (res.code === 200) {
changeCardType(4);
}
} else {
loading.value = false;
return fields;
}
});
};
const onModify = async (formEl: FormInstance | undefined) => {
loading.value = true;
if (!formEl) return;
await formEl.validate(async (valid, fields) => {
if (valid) {
const res: any = await changePassWord({
account: modifyForm.account,
name: modifyForm.name,
password: modifyForm.password
});
loading.value = false;
if (res.code === 200) {
changeCardType(5);
}
} else {
loading.value = false;
return fields;
}
});
};
const passwordType = ref("password"); const passwordType = ref("password");
const refInput = ref(); const refInput = ref();
/** 使用公共函数,避免`removeEventListener`失效 */ /** 使用公共函数,避免`removeEventListener`失效 */
@ -98,6 +153,23 @@ function showPass() {
}); });
} }
const changeCardType = val => {
cardType.value = val;
};
const validateConfirmPassword = (rule, value, callback) => {
if (value !== registerForm.password) {
callback(new Error("请再次输入密码以确保一致,不能留空"));
} else {
callback();
}
};
const validatePassword = (rule, value, callback) => {
if (value !== modifyForm.password) {
callback(new Error("请再次输入密码以确保一致,不能留空"));
} else {
callback();
}
};
onMounted(() => { onMounted(() => {
window.document.addEventListener("keypress", onkeypress); window.document.addEventListener("keypress", onkeypress);
}); });
@ -116,7 +188,7 @@ onBeforeUnmount(() => {
<span class="systeam-name">虚拟病人系统</span> <span class="systeam-name">虚拟病人系统</span>
<span class="desc">Welcome to the Virtual Patient System</span> <span class="desc">Welcome to the Virtual Patient System</span>
</div> </div>
<div class="login-box"> <div v-if="cardType === 1" class="login-box">
<div class="login-form"> <div class="login-form">
<div class="top"> <div class="top">
<p class="title">欢迎登录虚拟病人系统</p> <p class="title">欢迎登录虚拟病人系统</p>
@ -193,6 +265,7 @@ onBeforeUnmount(() => {
> >
{{ "忘记密码?" }} {{ "忘记密码?" }}
</el-button> --> </el-button> -->
<div class="btn-color" @click="changeCardType(3)"></div>
</div> </div>
<el-button <el-button
class="w-full mt-9 login-btn" class="w-full mt-9 login-btn"
@ -206,8 +279,273 @@ onBeforeUnmount(() => {
</el-button> </el-button>
</Motion> </Motion>
</el-form> </el-form>
<!-- 忘记密码 --> <div @click="changeCardType(2)" class="desc">还没账号去注册</div>
<!-- <update v-if="currentPage === 4" /> --> </div>
</div>
<div v-if="cardType === 2" class="register-box">
<div class="login-form">
<div class="top">
<p class="title">注册账号</p>
<p class="top_desc">Sign up for an to account</p>
</div>
<el-form ref="registerFormRef" :model="registerForm" size="large">
<Motion :delay="100">
<el-form-item
:rules="[
{
required: true,
message: '请使用中文填写您的姓名6字以内',
trigger: 'blur'
},
{
pattern: /^[\u4e00-\u9fa5]+$/,
message: '请使用中文填写您的姓名6字以内',
trigger: 'change'
}
]"
prop="name"
>
<el-input
maxlength="6"
style="height: 60px; font-size: 16px"
v-model="registerForm.name"
placeholder="请输入姓名"
:prefix-icon="useRenderIcon(IdCard)"
/>
</el-form-item>
</Motion>
<Motion :delay="100">
<el-form-item
:rules="[
{
required: true,
message: '请输入账号',
trigger: 'blur'
},
{
pattern: /^[a-zA-Z0-9]{6,18}$/,
message: '使用6至18个英文字母或数字',
trigger: 'change'
}
]"
prop="account"
>
<el-input
autocomplete="off"
style="height: 60px; font-size: 16px"
v-model="registerForm.account"
placeholder="请输入账号"
:prefix-icon="useRenderIcon(User)"
/>
</el-form-item>
</Motion>
<Motion :delay="150">
<el-form-item
prop="password"
:rules="[
{
required: true,
message: '请输入密码',
trigger: 'blur'
},
{
pattern: /^(?![\u4e00-\u9fa5\s])[\x21-\x7e]{6,18}$/,
message: '密码6-18位 不包含中文特殊字符和空格',
trigger: 'change'
}
]"
>
<el-input
type="password"
autocomplete="new-password"
style="height: 60px; font-size: 16px"
v-model="registerForm.password"
placeholder="请输入密码"
:prefix-icon="useRenderIcon(Lock)"
/>
</el-form-item>
</Motion>
<Motion :delay="150">
<el-form-item
prop="newPassword"
:rules="[
{
required: true,
message: '请再次输入密码',
trigger: 'blur'
},
{
pattern: /^(?![\u4e00-\u9fa5\s])[\x21-\x7e]{6,18}$/,
message: '密码6-18位 不包含中文特殊字符和空格',
trigger: 'change'
},
{ validator: validateConfirmPassword, trigger: 'blur' }
]"
>
<el-input
style="height: 60px; font-size: 16px"
type="password"
autocomplete="new-password"
v-model="registerForm.newPassword"
placeholder="请再次输入密码"
:prefix-icon="useRenderIcon(Lock)"
/>
</el-form-item>
</Motion>
<Motion :delay="250">
<el-button
class="w-full mt-9 login-btn"
size="large"
type="primary"
color="rgba(66, 135, 255, 1)"
:loading="loading"
@click="register(registerFormRef)"
>
确定
</el-button>
</Motion>
</el-form>
<div @click="changeCardType(1)" class="desc">已有账号去登录</div>
</div>
</div>
<div v-if="cardType === 3" class="login-box" style="height: 560px">
<div class="login-form">
<div class="top">
<p class="title" style="margin-bottom: 52px">忘记密码</p>
<!-- <p class="top_desc" style="font-size: 14px">
为了您的账户安全请重新设置位数密码
</p> -->
</div>
<el-form ref="modifyFormRef" :model="modifyForm" size="large">
<Motion :delay="100">
<el-form-item
:rules="[
{
required: true,
message: '请输入账号',
trigger: 'blur'
}
]"
prop="account"
>
<el-input
style="height: 60px; font-size: 16px"
v-model="modifyForm.account"
placeholder="请输入账号"
:prefix-icon="useRenderIcon(User)"
/>
</el-form-item>
</Motion>
<Motion :delay="150">
<el-form-item
prop="password"
:rules="[
{
required: true,
message: '请输入新密码',
trigger: 'blur'
},
{
pattern: /^(?![\u4e00-\u9fa5\s])[\x21-\x7e]{6,18}$/,
message: '密码6-18位 不包含中文特殊字符和空格',
trigger: 'change'
}
]"
>
<el-input
type="password"
autocomplete="new-password"
style="height: 60px; font-size: 16px"
v-model="modifyForm.password"
placeholder="请输入密码"
:prefix-icon="useRenderIcon(Lock)"
/>
</el-form-item>
</Motion>
<Motion :delay="150">
<el-form-item
prop="newPassword"
:rules="[
{
required: true,
message: '请再次输入新密码',
trigger: 'blur'
},
{
pattern: /^(?![\u4e00-\u9fa5\s])[\x21-\x7e]{6,18}$/,
message: '密码6-18位 不包含中文特殊字符和空格',
trigger: 'change'
},
{ validator: validatePassword, trigger: 'blur' }
]"
>
<el-input
type="password"
autocomplete="new-password"
style="height: 60px; font-size: 16px"
v-model="modifyForm.newPassword"
placeholder="请再次输入新密码"
:prefix-icon="useRenderIcon(Lock)"
/>
</el-form-item>
</Motion>
<Motion :delay="250">
<el-button
class="w-full mt-9 login-btn"
size="large"
type="primary"
color="rgba(66, 135, 255, 1)"
:loading="loading"
@click="onModify(modifyFormRef)"
>
确定
</el-button>
</Motion>
</el-form>
<div @click="changeCardType(1)" class="desc">已有账号去登录</div>
</div>
</div>
<div v-if="cardType === 4" class="login-box" style="height: 546px">
<div class="content">
<img :src="registerIcon" alt="" />
<div class="content_top">
<p class="content_top_title">注册成功</p>
<p class="content_top_desc">
已注册成功您可以使用账号密码登录系统
</p>
</div>
<el-button
style="margin-top: 130px"
class="w-full login-btn"
size="large"
type="primary"
color="rgba(66, 135, 255, 1)"
@click="changeCardType(1)"
>
去登录
</el-button>
</div>
</div>
<div v-if="cardType === 5" class="login-box" style="height: 546px">
<div class="content">
<img :src="registerIcon" alt="" />
<div class="content_top">
<p class="content_top_title">重置成功</p>
<p class="content_top_desc">您可以重新登录系统验证您的新密码</p>
</div>
<el-button
style="margin-top: 130px"
class="w-full login-btn"
size="large"
type="primary"
color="rgba(66, 135, 255, 1)"
@click="changeCardType(1)"
>
重新登录
</el-button>
</div> </div>
</div> </div>
</div> </div>
@ -233,12 +571,16 @@ onBeforeUnmount(() => {
} }
.btn-color { .btn-color {
color: #1c0d82; font-size: 16px;
color: #4287ff;
cursor: pointer;
} }
.btn-color:hover { .desc {
color: #1c0d82; margin-top: 16px;
opacity: 0.5; font-size: 14px;
color: #787878;
cursor: pointer;
} }
.el-input__icon { .el-input__icon {
@ -263,7 +605,8 @@ onBeforeUnmount(() => {
} }
} }
.login-box { .login-box,
.register-box {
.top { .top {
.title { .title {
font-size: 24px; font-size: 24px;
@ -278,5 +621,46 @@ onBeforeUnmount(() => {
color: #666; color: #666;
} }
} }
.content {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
padding: 35px 40px 0;
img {
width: 137px;
height: 94px;
margin-bottom: 40px;
}
.content_top {
.content_top_title {
font-size: 24px;
color: #333;
}
.content_top_desc {
margin-top: 8px;
font-size: 14px;
color: #666;
}
}
}
}
.register-box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
width: 500px;
height: 665px;
padding-top: 65px;
margin-left: 160px;
text-align: center;
background: #fff;
border-radius: 10px;
} }
</style> </style>

@ -29,6 +29,7 @@ const addCase = () => {
caseList.value = medicalRecList.value; caseList.value = medicalRecList.value;
}; };
const goBack = () => { const goBack = () => {
console.log("111", userPagination);
addFlag.value = false; addFlag.value = false;
caseList.value = diagnoseProcessList.value; caseList.value = diagnoseProcessList.value;
}; };
@ -114,6 +115,7 @@ const getMedicalRecPageList = async () => {
}; };
const handleUserChange = val => { const handleUserChange = val => {
userPagination.currentPage = val; userPagination.currentPage = val;
console.log("111", userPagination);
getDiagnoseProcessPageList(); getDiagnoseProcessPageList();
}; };
const handleCaseChange = val => { const handleCaseChange = val => {
@ -219,6 +221,7 @@ onMounted(() => {
</div> </div>
<div class="footer"> <div class="footer">
<el-pagination <el-pagination
:current-page="userPagination.currentPage"
v-if="userPagination.total > 11 && !addFlag" v-if="userPagination.total > 11 && !addFlag"
@current-change="handleUserChange" @current-change="handleUserChange"
:hide-on-single-page="true" :hide-on-single-page="true"
@ -229,6 +232,7 @@ onMounted(() => {
class="mt-4" class="mt-4"
/> />
<el-pagination <el-pagination
:current-page="casePagination.currentPage"
v-if="casePagination.total > 11 && addFlag" v-if="casePagination.total > 11 && addFlag"
@current-change="handleCaseChange" @current-change="handleCaseChange"
:hide-on-single-page="true" :hide-on-single-page="true"
@ -315,6 +319,8 @@ onMounted(() => {
display: flex; display: flex;
justify-content: center; justify-content: center;
margin-top: 80px; margin-top: 80px;
margin-bottom: 32px;
overflow: auto;
.content { .content {
width: 1200px; width: 1200px;

Loading…
Cancel
Save