19 lines
620 B
JavaScript
19 lines
620 B
JavaScript
|
|
import { storeToRefs } from 'pinia';
|
||
|
|
import useAccountStore from "@/store/account.js";
|
||
|
|
import { confirm } from '@/utils/widget';
|
||
|
|
|
||
|
|
export default function useInfoCheck() {
|
||
|
|
|
||
|
|
const { doctorInfo } = storeToRefs(useAccountStore());
|
||
|
|
|
||
|
|
function withInfo(fn) {
|
||
|
|
return async (...args) => {
|
||
|
|
if (!doctorInfo.value || !doctorInfo.value.anotherName) {
|
||
|
|
await confirm('请先完善您的个人信息,方可使用该功能!', { cancelText: '再等等', confirmText: '去完善' })
|
||
|
|
return uni.navigateTo({ url: '/pages/work/profile' });
|
||
|
|
}
|
||
|
|
return fn(...args);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return { withInfo }
|
||
|
|
}
|