24 lines
683 B
JavaScript
24 lines
683 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) {
|
||
try {
|
||
await confirm('请先完善您的个人信息,方可使用该功能!', { cancelText: '再等等', confirmText: '去完善' })
|
||
} catch {
|
||
return;
|
||
}
|
||
return uni.navigateTo({ url: '/pages/work/profile' });
|
||
}
|
||
return fn(...args);
|
||
}
|
||
}
|
||
return { withInfo }
|
||
}
|