This commit is contained in:
wangdongbo 2026-01-26 18:08:04 +08:00
commit 1332b12b03
9 changed files with 227 additions and 58 deletions

View File

@ -4,7 +4,7 @@
{{ name }}<text v-if="required" class="form-cell--required"></text>
</view>
<view class="mt-10">
<textarea :disabled="disableChange" :value="value" class="form-textarea"
<textarea :auto-height="autoHeight" :disabled="disableChange" :value="value" class="form-textarea"
:class="border ? 'form-textarea--border' : ''" :placeholder="placeholder" placeholder-class="form__placeholder"
:maxlength="wordLimit" @input="change($event)" />
<view v-if="wordLimit > 0" class="form-textarea__count">
@ -43,6 +43,10 @@ const props = defineProps({
wordLimit: {
type: [Number, String],
default: 100
},
autoHeight: {
type: Boolean,
default: false
}
})

View File

@ -56,8 +56,6 @@ export default function useGuard() {
const requireLogin = route && route.meta && route.meta.login;
if (requireLogin && !account.value) {
await login()
console.log('login success')
console.log(account.value)
if (account.value) {
resolve()
} else {
@ -68,7 +66,6 @@ export default function useGuard() {
})
onShow(opts => {
console.log('onShow')
onShowOptions.value = { ...opts };
triggleShowEvents()
})

View File

@ -1,37 +1,85 @@
<template>
<uni-popup ref="popup" type="center" :mask-click="false">
<view class="bg-white rounded overflow-hidden" style="width: 690rpx;">
<view class="px-15 py-12 text-center text-lg font-semibold text-dark">
认证须知
</view>
<view class="text-base text-dark px-15 leading-normal font-semibold mt-10">
1认证通过后您个人账号病历档案管理数含所有团队上限由10个升级至100个
</view>
<view class="px-15 leading-normal mt-10 ">
<text class="text-base text-dark">2认证前请仔细核对个人信息确保准确无误认证后部分信息不支持修改包括姓名岗位等如需修改以上信息请联系客服人工处理</text>
</view>
<view class="mt-10 px-15 leading-normal font-semibold pb-50 text-lg text-primary" @click="toService()">点击添加客服
</view>
<view class="footer-buttons">
<button-footer hideden-shadow confirmText="去认证" @confirm="confirm()" @cancel="close()" />
<template v-if="status === 'unverified'">
<view class="px-15 py-12 text-center text-lg font-semibold text-dark">
认证须知
</view>
<view class="text-base text-dark px-15 leading-normal font-semibold mt-10">
1认证通过后您个人账号病历档案管理数含所有团队上限由10个升级至100个
</view>
<view class="px-15 leading-normal mt-10 ">
<text class="text-base text-dark">2认证前请仔细核对个人信息确保准确无误认证后部分信息不支持修改包括姓名岗位等如需修改以上信息请联系客服人工处理</text>
</view>
<view class="mt-10 px-15 leading-normal font-semibold pb-50 text-lg text-primary" @click="toService()">点击添加客服
</view>
</template>
<template v-else-if="status === 'verified'">
<view class="px-15 py-12 text-center text-lg font-semibold text-dark">
提示
</view>
<view class="text-base text-dark px-15 leading-normal font-semibold mt-10">
您的认证已通过
</view>
<view class="px-15 leading-normal mt-10 text-base text-dark">
若需要修改姓名岗位等信息请联系客服人工处理
</view>
<view class="mt-10 px-15 leading-normal font-semibold pb-50 text-lg text-primary" @click="toService()">
点击添加客服
</view>
</template>
<template v-else-if="status === 'failed'">
<view class="px-15 py-12 text-center text-lg font-semibold text-dark">
认证失败原因
</view>
<view class="px-15 leading-normal mt-10 text-base text-dark pb-50">
{{ reason }}
</view>
</template>
<view v-if="btns" class="footer-buttons">
<button-footer hideden-shadow :cancelText="btns.cancelText" :confirmText="btns.confirmText"
:showCancel="btns.showCancel" :showConfirm="btns.showConfirm" @confirm="confirm()" @cancel="close()" />
</view>
</view>
</uni-popup>
</template>
<script setup>
import { ref, watch } from 'vue';
import { computed, ref, watch } from 'vue';
import { storeToRefs } from "pinia";
import useAccountStore from "@/store/account.js";
import api from "@/utils/api.js";
import { toast } from '@/utils/widget';
import ButtonFooter from '@/components/button-footer.vue';
const emits = defineEmits(['close', 'confirm'])
const props = defineProps({
status: {
type: String,
default: ''
},
visible: {
type: Boolean,
default: false
}
})
const popup = ref()
const popup = ref();
const status = ref('');
const reason = ref('');
const { account, doctorInfo } = storeToRefs(useAccountStore());
const btns = computed(() => {
if (status.value === 'unverified') {
return { showCancel: true, showConfirm: true, confirmText: '去认证' }
}
if (status.value === 'verified') {
return { showConfirm: false, cancelText: '我知道了' }
}
if (status.value === 'failed') {
return { showCancel: true, showConfirm: true, confirmText: '重新认证' }
}
})
function close() {
emits('close')
@ -48,9 +96,21 @@ function toService() {
close()
}
async function getStatus() {
const res = await api('getMemberVerifyStatus', { corpId: account.value.corpId, weChatOpenId: account.value.openid, id: doctorInfo.value._id })
if (res && res.success) {
status.value = res.data.verifyStatus;
reason.value = res.data.reason || '';
popup.value && popup.value.open()
} else {
toast(res.message);
close()
}
}
watch(() => props.visible, n => {
if (n) {
popup.value && popup.value.open()
getStatus()
} else {
popup.value && popup.value.close()
}

View File

@ -2,7 +2,8 @@
<full-page>
<view class="p-15">
<view class="bg-white px-10 mb-10 rounded">
<form-input :form="formData" required wordLimit="10" title="anotherName" name="姓名" @change="onChange($event)" />
<form-input :form="formData" :required="rule.anotherName.required" wordLimit="10" title="anotherName"
:name="rule.anotherName.name" @change="onChange($event)" />
<common-cell title="avatar" name="头像">
<view class="flex-grow flex items-center justify-end" @click="chooseAvatar()">
<image v-if="formData.avatar" class="avatar mr-5 rounded-full" :src="formData.avatar" />
@ -15,19 +16,21 @@
</view>
<view class="bg-white px-10 mb-10 rounded">
<common-cell title="avatar" name="岗位">
<!-- 填写认证资料的时候岗位必填 -->
<common-cell :required="type === 'cert'" title="job" :name="rule.job.name">
<view class="flex-grow flex items-center justify-end" @click="selectJob()">
<view v-if="jobStr" class="text-base text-base">{{ jobStr }}</view>
<!-- <view class="mr-5 rounded-full" style="width: 64rpx;height: 64rpx;background: red;"></view> -->
<uni-icons color="#999" type="right" size="16" />
</view>
</common-cell>
<common-cell title="title" :name="rule.title.name">
<view class="flex-grow flex items-center justify-end">
<!-- <view class="mr-5 rounded-full" style="width: 64rpx;height: 64rpx;background: red;"></view> -->
<uni-icons color="#999" type="right" size="16" />
</view>
</common-cell>
<common-cell title="avatar" name="职称">
<view class="flex-grow flex items-center justify-end">
<!-- <view class="mr-5 rounded-full" style="width: 64rpx;height: 64rpx;background: red;"></view> -->
<uni-icons color="#999" type="right" size="16" />
</view>
</common-cell>
<common-cell title="avatar" name="科室">
<common-cell title="dept" :name="rule.dept.name">
<view class="flex-grow flex items-center justify-end">
<!-- <view class="mr-5 rounded-full" style="width: 64rpx;height: 64rpx;background: red;"></view> -->
<uni-icons color="#999" type="right" size="16" />
@ -36,7 +39,7 @@
</view>
<view class="bg-white rounded">
<form-textarea :border="false" :form="formData" title="intro" name="个人介绍" :wordLimit="300"
<form-textarea autoHeight :border="false" :form="formData" title="intro" name="个人介绍" :wordLimit="300"
@change="onChange($event)" />
</view>
</view>
@ -66,11 +69,33 @@ const { account, doctorInfo } = storeToRefs(useAccountStore());
const { useLoad, useShow } = useGuard();
const { getDoctorInfo } = useAccountStore();
const job = { assistant: '医生助理', doctor: '医生' };
const form = ref({});
const type = ref('')
const type = ref('');
const formData = computed(() => ({ ...(doctorInfo.value || {}), ...form.value, mobile: account.value?.mobile }));
const cancelText = computed(() => doctorInfo.value ? '取消' : '暂不填写');
const confirmText = computed(() => type.value === 'cert' ? '下一步' : '保存');
const jobStr = computed(() => {
const jobs = formData.value && Array.isArray(formData.value.job) ? formData.value.job.filter(i => i === 'assistant' || i === 'doctor') : [];
return jobs[0] && job[jobs[0]] ? job[jobs[0]] : '';
})
const rule = computed(() => {
if (doctorInfo.value && ['verified', 'verifying'].includes(doctorInfo.value.verifyStatus)) {
return {
anotherName: { name: '姓名 (不可修改)', required: false, disabled: true },
job: { name: '岗位 (不可修改)', disabled: true },
title: { name: '职称 (不可修改)', disabled: true },
dept: { name: '科室 (不可修改)', disabled: true },
}
}
return {
anotherName: { name: '姓名', required: true, disabled: false },
job: { name: '岗位', disabled: false },
title: { name: '职称', disabled: false },
dept: { name: '科室', disabled: false },
}
})
//
const genderOptions = [
@ -122,12 +147,37 @@ function onChange({ title, value }) {
form.value[title] = value
}
function selectJob() {
if (rule.value.job.disabled) return;
uni.showActionSheet({
itemList: ['医生', '医生助理', '无'],
success: ({ tapIndex }) => {
const job = ['doctor', 'assistant',][tapIndex];
form.value.job = job ? [job] : [];
}
})
}
function toCert() {
if (jobStr.value === '医生') {
uni.navigateTo({
url: '/pages/work/verify/doctor'
})
} else if (jobStr.value === '医生助理') {
uni.navigateTo({
url: '/pages/work/verify/assistant'
})
} else {
toast('请选择岗位信息')
}
}
async function save() {
if (typeof formData.value.anotherName !== 'string' || !formData.value.anotherName.trim()) {
return toast('请输入姓名')
}
if (type.value === 'cert' && !formData.value.departmentId) {
return toast('请输入岗位信息')
if (type.value === 'cert' && !jobStr.value) {
return toast('请选择岗位信息')
}
const apiName = doctorInfo.value ? 'updateCorpMemberFromWxapp' : 'addCorpMemberFromWxapp';
const data = {
@ -136,11 +186,19 @@ async function save() {
mobile: account.value.mobile,
corpId: account.value.corpId,
}
if (doctorInfo.value) {
data.id = doctorInfo.value._id;
}
const res = await api(apiName, data);
if (res && res.success) {
await toast('保存成功');
await getDoctorInfo()
back()
form.value = {};
if (type.value === 'cert') {
toCert()
} else {
await toast('保存成功');
back()
}
} else {
await toast(res?.message || '保存失败');
}

View File

@ -69,6 +69,7 @@ import { computed, ref } from "vue";
import { storeToRefs } from "pinia";
import useGuard from "@/hooks/useGuard.js";
import useAccountStore from "@/store/account.js";
import api from "@/utils/api.js";
import { upload } from "@/utils/http.js";
import { hideLoading, loading as showLoading, toast } from "@/utils/widget";
@ -108,6 +109,20 @@ async function save() {
}
if (typeof formData.value.idCardBack !== 'string' || formData.value.idCardBack.trim() === '') {
return toast('请上传国徽面')
}
const data = {
idCardFront: formData.value.idCardFront,
idCardBack: formData.value.idCardBack,
corpId: account.value.corpId,
weChatOpenId: account.value.openid,
id: doctorInfo.value._id,
}
const res = await api('submitCertProfile', data);
if (res && res.success) {
await toast('提交成功');
uni.navigateBack({ delta: 2 })
} else {
toast(res.message || '提交失败')
}
console.log('form.value: ', formData.value)

View File

@ -1,12 +1,16 @@
<template>
<full-page pageClass="bg-white">
<view class="p-15">
<view class="title-bar relative text-dark text-base font-semibold">请填写执业医院</view>
<view class="mt-12 p-10 flex items-center justify-between border rounded">
<view class="title-bar relative text-dark text-base font-semibold" @click="log()">请填写执业医院</view>
<!-- <view class="mt-12 p-10 flex items-center justify-between border rounded">
<view class="w-0 flex-grow truncate text-base mr-10" :class="formData.hospitalName ? 'text-dark' : 'text-gray'">
{{ formData.hospitalName || '请填写执业医院' }}
</view>
<uni-icons class="flex-shrink-0" color="#666" type="right" size="16" />
</view> -->
<view class="mt-12 p-10 flex items-center justify-between border rounded">
<input class="w-0 flex-grow text-base mr-10" :value="formData.hospitalName" @change="inputHospitalName($event)"
placeholder="请填写执业医院" />
</view>
<view class="mt-15 title-bar relative font-semibold">
<text class="mr-5 text-dark text-base">请上传</text>
@ -48,6 +52,7 @@ import { computed, ref } from "vue";
import { storeToRefs } from "pinia";
import useGuard from "@/hooks/useGuard.js";
import useAccountStore from "@/store/account.js";
import api from "@/utils/api.js";
import { upload } from "@/utils/http.js";
import { hideLoading, loading as showLoading, toast } from "@/utils/widget";
@ -63,6 +68,10 @@ function back() {
uni.navigateBack()
}
function inputHospitalName(e) {
form.value.hospitalName = e.detail.value
}
function uploadLicense(type) {
uni.chooseImage({
count: 1,
@ -90,10 +99,29 @@ async function save() {
if (typeof formData.value.medicalLicenseBack !== 'string' || formData.value.medicalLicenseBack.trim() === '') {
return toast('请上传医师执业资格证第二页')
}
console.log('form.value: ', formData.value)
const data = {
hospitalName: formData.value.hospitalName,
medicalLicenseFront: formData.value.medicalLicenseFront,
medicalLicenseBack: formData.value.medicalLicenseBack,
corpId: account.value.corpId,
weChatOpenId: account.value.openid,
id: doctorInfo.value._id,
}
const res = await api('submitCertProfile', data);
if (res && res.success) {
await toast('提交成功');
uni.navigateBack({ delta: 2 })
} else {
toast(res.message || '提交失败')
}
// uni.showToast({ title: '', icon: 'none' })
}
function log() {
console.log(doctorInfo.value)
console.log(formData.value)
}
</script>
<style scoped>
.title-bar {

View File

@ -23,7 +23,7 @@
<text class="tag-text text-white">信息待完善</text>
</view>
<view v-if="certStatus" class="px-10 py-3 text-sm rounded-full" :class="certStatus.classnames"
@click.stop="toCert()">
@click.stop="handleCert()">
{{ certStatus.text }}
</view>
</view>
@ -73,20 +73,22 @@ import useAccountStore from "@/store/account.js";
import certPopup from "./components/cert-popup.vue";
import EmptyData from "@/components/empty-data.vue";
import fullPage from '@/components/full-page.vue';
import { toast } from '@/utils/widget';
const certConfig = {
failed: { text: '认证失败', classnames: 'bg-danger text-white' },
verified: { text: '已认证', classnames: 'bg-success text-white' },
verifing: { text: '认证中', classnames: 'bg-orange text-white' },
verifying: { text: '认证中', classnames: 'bg-warning text-white' },
unverified: { text: '未认证', classnames: 'bg-gray text-dark' },
};
const { useLoad, useShow } = useGuard();
const { getDoctorInfo } = useAccountStore();
const { doctorInfo } = storeToRefs(useAccountStore());
const { account, doctorInfo } = storeToRefs(useAccountStore());
const list = ref([1]);
const visible = ref(false);
const certStatus = computed(() => doctorInfo.value?.verifyStatus ? certConfig[doctorInfo.value.verifyStatus] : certConfig.unverified)
const certStatus = computed(() => doctorInfo.value?.verifyStatus ? certConfig[doctorInfo.value.verifyStatus] : null)
//
const handleVerify = () => {
@ -120,10 +122,12 @@ function editProfile() {
});
}
function toCert() {
// if (doctorInfo.value.verifyStatus === 'unverified') {
visible.value = true
// }
function handleCert() {
if (doctorInfo.value.verifyStatus === 'verifying') {
toast('信息认证中,请耐心等待!')
} else {
visible.value = true
}
}
useLoad(() => {
@ -131,7 +135,7 @@ useLoad(() => {
});
useShow(() => {
getDoctorInfo()
getDoctorInfo();
})
</script>

View File

@ -25,8 +25,9 @@ export default defineStore("accountStore", () => {
}
async function login(phoneCode) {
await getLoginPromise(phoneCode);
const res = await getLoginPromise(phoneCode);
loginPromise.value = null;
return res
}
async function loginByCode(phoneCode = '') {
@ -51,15 +52,15 @@ export default defineStore("accountStore", () => {
account.value = res.data;
openid.value = res.data.openid;
// 登录成功后初始化腾讯IM
try {
console.log('开始初始化腾讯IMuserID:', res.data.openid);
await initGlobalTIM(res.data.openid);
isIMInitialized.value = true;
console.log('腾讯IM初始化成功');
} catch (imError) {
console.error('腾讯IM初始化失败:', imError);
// IM初始化失败不影响登录流程
}
// try {
// console.log('开始初始化腾讯IMuserID:', res.data.openid);
// await initGlobalTIM(res.data.openid);
// isIMInitialized.value = true;
// console.log('腾讯IM初始化成功');
// } catch (imError) {
// console.error('腾讯IM初始化失败:', imError);
// // IM初始化失败不影响登录流程
// }
await getDoctorInfo(openid.value);
return res.data
}

View File

@ -13,7 +13,9 @@ const urlsConfig = {
getCorpMemberData: 'getCorpMemberData',
updateCorpMember: 'updateCorpMember',
addCorpMemberFromWxapp: "addCorpMemberFromWxapp",
updateCorpMemberFromWxapp: "updateCorpMemberFromWxapp"
updateCorpMemberFromWxapp: "updateCorpMemberFromWxapp",
submitCertProfile: 'submitCertProfile',
getMemberVerifyStatus: "getMemberVerifyStatus"
},
knowledgeBase: {