fix: 问题修复
This commit is contained in:
parent
14149ef143
commit
9d549afaa4
@ -1,24 +1,32 @@
|
|||||||
<template>
|
<template>
|
||||||
<view v-if="showCancel || showConfirm" class="relative flex px-15 py-12 bg-white text-center"
|
<view v-if="showCancel || showConfirm" class="relative flex px-15 py-12 bg-white text-center"
|
||||||
:class="hidedenShadow ? '' : 'shadow-up'">
|
:class="showShadow ? 'shadow-up' : ''">
|
||||||
<view v-if="showCancel" class="flex-grow py-10 text-base border-primary rounded text-primary rounded"
|
<view v-if="showCancel && customCancel" class="relative" :style="widthStyle">
|
||||||
|
<slot name="cancel"></slot>
|
||||||
|
</view>
|
||||||
|
<view v-else-if="showCancel" class="py-10 text-base border-primary rounded text-primary rounded" :style="widthStyle"
|
||||||
@click="cancel()">
|
@click="cancel()">
|
||||||
{{ cancelText }}
|
{{ cancelText }}
|
||||||
</view>
|
</view>
|
||||||
<view v-if="showConfirm" class="flex-grow py-10 text-base border-primary bg-primary text-white rounded"
|
<view v-if="showConfirm && customConfirm" :class="showCancel && showConfirm ? 'ml-15' : ''" :style="widthStyle">
|
||||||
:class="showCancel && showConfirm ? 'ml-15' : ''" @click="confirm()">
|
<slot name="confirm"></slot>
|
||||||
|
</view>
|
||||||
|
<view v-else-if="showConfirm" class="py-10 text-base border-primary bg-primary text-white rounded"
|
||||||
|
:class="showCancel && showConfirm ? 'ml-15' : ''" :style="widthStyle" @click="confirm()">
|
||||||
{{ confirmText }}
|
{{ confirmText }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { computed, useSlots, ref } from "vue";
|
||||||
|
|
||||||
import useDebounce from '@/utils/useDebounce';
|
import useDebounce from '@/utils/useDebounce';
|
||||||
|
|
||||||
const emits = defineEmits(['cancel', 'confirm']);
|
const emits = defineEmits(['cancel', 'confirm']);
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
hidedenShadow: {
|
showShadow: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: true
|
||||||
},
|
},
|
||||||
cancelText: {
|
cancelText: {
|
||||||
type: String,
|
type: String,
|
||||||
@ -40,5 +48,11 @@ const props = defineProps({
|
|||||||
|
|
||||||
const cancel = useDebounce(() => emits('cancel'));
|
const cancel = useDebounce(() => emits('cancel'));
|
||||||
const confirm = useDebounce(() => emits('confirm'));
|
const confirm = useDebounce(() => emits('confirm'));
|
||||||
|
const slots = useSlots();
|
||||||
|
const customCancel = computed(() => !!slots.cancel);
|
||||||
|
const customConfirm = computed(() => !!slots.confirm);
|
||||||
|
const widthStyle = computed(() => {
|
||||||
|
const val = [props.showCancel, props.showConfirm].filter(Boolean);
|
||||||
|
return `width: ${100 / (val.length || 1)}%`
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
@ -42,9 +42,13 @@ const props = defineProps({
|
|||||||
type: [Number, String],
|
type: [Number, String],
|
||||||
default: 20
|
default: 20
|
||||||
},
|
},
|
||||||
|
placeholder: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const placeholder = computed(() => `请输入${props.name || ''}`)
|
const placeholder = computed(() => props.placeholder || `请输入${props.name || ''}`)
|
||||||
const value = computed(() => {
|
const value = computed(() => {
|
||||||
const v = props.form?.[props.title];
|
const v = props.form?.[props.title];
|
||||||
return v === undefined || v === null ? '' : String(v);
|
return v === undefined || v === null ? '' : String(v);
|
||||||
|
|||||||
@ -37,7 +37,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<view v-if="btns" class="footer-buttons">
|
<view v-if="btns" class="footer-buttons">
|
||||||
<button-footer hideden-shadow :cancelText="btns.cancelText" :confirmText="btns.confirmText"
|
<button-footer :showShadow="false" :cancelText="btns.cancelText" :confirmText="btns.confirmText"
|
||||||
:showCancel="btns.showCancel" :showConfirm="btns.showConfirm" @confirm="confirm()" @cancel="close()" />
|
:showCancel="btns.showCancel" :showConfirm="btns.showConfirm" @confirm="confirm()" @cancel="close()" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@ -84,7 +84,7 @@ function toAggreement(type) {
|
|||||||
|
|
||||||
async function getPhoneNumber(e) {
|
async function getPhoneNumber(e) {
|
||||||
const phoneCode = e && e.detail && e.detail.code;
|
const phoneCode = e && e.detail && e.detail.code;
|
||||||
// if (e && !phoneCode) return;
|
if (e && !phoneCode) return;
|
||||||
const res = await login(phoneCode);
|
const res = await login(phoneCode);
|
||||||
|
|
||||||
if (res && redirectUrl.value) {
|
if (res && redirectUrl.value) {
|
||||||
|
|||||||
@ -48,7 +48,7 @@
|
|||||||
<text class="mr-5 text-base text-gray">如没有符合的内容,请</text>
|
<text class="mr-5 text-base text-gray">如没有符合的内容,请</text>
|
||||||
<text class="text-base text-primary">联系客服</text>
|
<text class="text-base text-primary">联系客服</text>
|
||||||
</view>
|
</view>
|
||||||
<button-footer :showCancel="false" @confirm="save()" />
|
<button-footer :showShadow="false" :showCancel="false" @confirm="save()" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</full-page>
|
</full-page>
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
<text class="mr-5 text-base text-gray">如没有符合的内容,请</text>
|
<text class="mr-5 text-base text-gray">如没有符合的内容,请</text>
|
||||||
<text class="text-base text-primary">联系客服</text>
|
<text class="text-base text-primary">联系客服</text>
|
||||||
</view>
|
</view>
|
||||||
<button-footer :showCancel="false" @confirm="save()" />
|
<button-footer :showShadow="false" :showCancel="false" @confirm="save()" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</full-page>
|
</full-page>
|
||||||
|
|||||||
@ -12,7 +12,10 @@
|
|||||||
</view>
|
</view>
|
||||||
</common-cell>
|
</common-cell>
|
||||||
<form-select :form="formData" name="性别" title="gender" :range="genderOptions" @change="onChange($event)" />
|
<form-select :form="formData" name="性别" title="gender" :range="genderOptions" @change="onChange($event)" />
|
||||||
<form-input :form="formData" disableChange wordLimit="11" title="mobile" name="手机号 (不可修改)" />
|
<form-input v-if="account && account.mobile" :form="formData" disableChange wordLimit="11" title="mobile"
|
||||||
|
name="手机号 (不可修改)" />
|
||||||
|
<form-input v-else :form="formData" disableChange wordLimit="11" title="mobile" name="手机号 (不可修改)"
|
||||||
|
placeholder=" " />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="bg-white px-10 mb-10 rounded">
|
<view class="bg-white px-10 mb-10 rounded">
|
||||||
@ -48,7 +51,17 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<button-footer :cancelText="cancelText" :confirmText="confirmText" @confirm="save()" @cancel="back()" />
|
<button-footer v-if="account && account.mobile" :cancelText="cancelText" :confirmText="confirmText"
|
||||||
|
@confirm="save()" @cancel="back()" />
|
||||||
|
<button-footer v-else :cancelText="cancelText" :confirmText="confirmText" @confirm="save()" @cancel="back()">
|
||||||
|
<template #confirm>
|
||||||
|
<view class="relative py-10 text-base border-primary bg-primary text-white rounded">
|
||||||
|
{{ confirmText }}
|
||||||
|
<button class="phone-btn absolute w-full h-full" open-type="getPhoneNumber"
|
||||||
|
@getphonenumber="getPhoneNumber"></button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</button-footer>
|
||||||
</template>
|
</template>
|
||||||
</full-page>
|
</full-page>
|
||||||
</template>
|
</template>
|
||||||
@ -72,7 +85,7 @@ import fullPage from "@/components/full-page.vue";
|
|||||||
|
|
||||||
const { account, doctorInfo } = storeToRefs(useAccountStore());
|
const { account, doctorInfo } = storeToRefs(useAccountStore());
|
||||||
const { useLoad, useShow } = useGuard();
|
const { useLoad, useShow } = useGuard();
|
||||||
const { getDoctorInfo } = useAccountStore();
|
const { getDoctorInfo, login } = useAccountStore();
|
||||||
|
|
||||||
const job = { assistant: "医生助理", doctor: "医生" };
|
const job = { assistant: "医生助理", doctor: "医生" };
|
||||||
const jobOptions = [{ name: '医生', value: 'doctor' }, { name: '医生助理', value: 'assistant' }, { name: '无', value: '' }];
|
const jobOptions = [{ name: '医生', value: 'doctor' }, { name: '医生助理', value: 'assistant' }, { name: '无', value: '' }];
|
||||||
@ -185,7 +198,7 @@ function toCert() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectDept() {
|
function selectDept() {
|
||||||
if(rule.value.dept.disabled) return;
|
if (rule.value.dept.disabled) return;
|
||||||
const eventName = `selectDept_${Date.now()}`
|
const eventName = `selectDept_${Date.now()}`
|
||||||
const deptIds = (formData.value.hlwDepts || []).map(i => i.deptId).filter(Boolean).join(',')
|
const deptIds = (formData.value.hlwDepts || []).map(i => i.deptId).filter(Boolean).join(',')
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@ -196,6 +209,21 @@ function selectDept() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getPhoneNumber(e) {
|
||||||
|
const phoneCode = e && e.detail && e.detail.code;
|
||||||
|
if (e && !phoneCode) return;
|
||||||
|
try {
|
||||||
|
const res = await login(phoneCode);
|
||||||
|
if (!res || !res.mobile) {
|
||||||
|
return toast('绑定手机号失败')
|
||||||
|
}
|
||||||
|
save()
|
||||||
|
} catch (e) {
|
||||||
|
toast('绑定手机号失败')
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
if (
|
if (
|
||||||
typeof formData.value.anotherName !== "string" ||
|
typeof formData.value.anotherName !== "string" ||
|
||||||
@ -253,4 +281,10 @@ useShow(() => {
|
|||||||
width: 64rpx;
|
width: 64rpx;
|
||||||
height: 64rpx;
|
height: 64rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.phone-btn {
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
<input v-model="name" class="w-full" placeholder="请输入名称" />
|
<input v-model="name" class="w-full" placeholder="请输入名称" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<button-footer hideden-shadow confirmText="保存" @confirm="confirm()" @cancel="close()" />
|
<button-footer :showShadow="false" confirmText="保存" @confirm="confirm()" @cancel="close()" />
|
||||||
</view>
|
</view>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ref } from "vue";
|
import { ref, watch } from "vue";
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import api from '@/utils/api';
|
import api from '@/utils/api';
|
||||||
import { toast } from '@/utils/widget';
|
import { toast } from '@/utils/widget';
|
||||||
@ -55,16 +55,16 @@ export default defineStore("accountStore", () => {
|
|||||||
corpId,
|
corpId,
|
||||||
});
|
});
|
||||||
if (res.success && res.data) {
|
if (res.success && res.data) {
|
||||||
if (!res.data.mobile) {
|
// if (!res.data.mobile) {
|
||||||
const target = '/pages/login/login';
|
// const target = '/pages/login/login';
|
||||||
uni.redirectTo({ url: target });
|
// uni.redirectTo({ url: target });
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
account.value = res.data;
|
account.value = res.data;
|
||||||
openid.value = res.data.openid;
|
openid.value = res.data.openid;
|
||||||
// 持久化账户信息
|
// 持久化账户信息
|
||||||
cache.set(CACHE_KEYS.ACCOUNT, res.data);
|
// cache.set(CACHE_KEYS.ACCOUNT, res.data);
|
||||||
cache.set(CACHE_KEYS.OPENID, res.data.openid);
|
// cache.set(CACHE_KEYS.OPENID, res.data.openid);
|
||||||
|
|
||||||
// 登录成功后初始化腾讯IM
|
// 登录成功后初始化腾讯IM
|
||||||
await getDoctorInfo({ openid: openid.value });
|
await getDoctorInfo({ openid: openid.value });
|
||||||
@ -155,9 +155,25 @@ export default defineStore("accountStore", () => {
|
|||||||
doctorInfo.value = null;
|
doctorInfo.value = null;
|
||||||
|
|
||||||
// 清空缓存
|
// 清空缓存
|
||||||
cache.remove(CACHE_KEYS.ACCOUNT);
|
// cache.remove(CACHE_KEYS.ACCOUNT);
|
||||||
cache.remove(CACHE_KEYS.OPENID);
|
// cache.remove(CACHE_KEYS.OPENID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(account, n => {
|
||||||
|
if (n) {
|
||||||
|
cache.set(CACHE_KEYS.ACCOUNT, n);
|
||||||
|
} else {
|
||||||
|
cache.remove(CACHE_KEYS.ACCOUNT);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(openid, n => {
|
||||||
|
if (n) {
|
||||||
|
cache.set(CACHE_KEYS.OPENID, n);
|
||||||
|
} else {
|
||||||
|
cache.remove(CACHE_KEYS.OPENID);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
return { account, openid, isIMInitialized, doctorInfo, login, getDoctorInfo, initIMAfterLogin, logout }
|
return { account, openid, isIMInitialized, doctorInfo, login, getDoctorInfo, initIMAfterLogin, logout }
|
||||||
})
|
})
|
||||||
Loading…
x
Reference in New Issue
Block a user