|
@@ -47,6 +47,9 @@ export function usePreLeaveInfo(options = {}) {
|
|
|
const staticInfo = computed(() => props.staticInfo)
|
|
|
function updateVisible(e) {
|
|
|
visible.value = e
|
|
|
+ if (e) {
|
|
|
+ createClueWhenOpen()
|
|
|
+ }
|
|
|
}
|
|
|
function close() {
|
|
|
updateVisible(false)
|
|
@@ -59,24 +62,23 @@ export function usePreLeaveInfo(options = {}) {
|
|
|
configInfo.isCurrentPhone = r.info.isCurrentPhone
|
|
|
}
|
|
|
})
|
|
|
- watch(() => visible.value, async (val) => {
|
|
|
- if (val) {
|
|
|
- if (staticInfo.value) {
|
|
|
- // 获取静态信息
|
|
|
- const r = await useStaticInfoRequest()
|
|
|
- if (r) {
|
|
|
- Object.assign(configInfo, r)
|
|
|
- }
|
|
|
+
|
|
|
+ async function createClueWhenOpen() {
|
|
|
+ if (staticInfo.value) {
|
|
|
+ // 获取静态信息
|
|
|
+ const r = await useStaticInfoRequest()
|
|
|
+ if (r) {
|
|
|
+ Object.assign(configInfo, r)
|
|
|
}
|
|
|
- else {
|
|
|
- // 获取动态分配信息
|
|
|
- const r = await useBehaviorCluesRequest(sourceDesc.value)
|
|
|
- if (r) {
|
|
|
- Object.assign(configInfo, r)
|
|
|
- }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ // 获取动态分配信息
|
|
|
+ const r = await useBehaviorCluesRequest(sourceDesc.value)
|
|
|
+ if (r) {
|
|
|
+ Object.assign(configInfo, r)
|
|
|
}
|
|
|
}
|
|
|
- })
|
|
|
+ }
|
|
|
|
|
|
return {
|
|
|
updateVisible,
|
|
@@ -102,7 +104,7 @@ export async function useContactMeLogic(options = {}) {
|
|
|
}
|
|
|
|
|
|
export function usePhoneCheck(options = {}) {
|
|
|
- const { configInfo, props, popupVisible } = options
|
|
|
+ const { configInfo, props } = options
|
|
|
const phone = ref(configInfo.phone)
|
|
|
const source = computed(() => props.source)
|
|
|
|
|
@@ -135,6 +137,17 @@ export function usePhoneCheck(options = {}) {
|
|
|
contentText: confirmContentText,
|
|
|
})
|
|
|
|
|
|
+ function closeAllDialog() {
|
|
|
+ changePhoneDialog.show = false
|
|
|
+ confirmPhoneDialog.show = false
|
|
|
+ successCheckDialog.show = false
|
|
|
+ }
|
|
|
+ function showSuccessDialog() {
|
|
|
+ changePhoneDialog.show = false
|
|
|
+ confirmPhoneDialog.show = false
|
|
|
+ successCheckDialog.show = true
|
|
|
+ }
|
|
|
+
|
|
|
const dialogEvents = {
|
|
|
confirmPhoneConfirm() {
|
|
|
doConfirmLeave()
|
|
@@ -146,6 +159,9 @@ export function usePhoneCheck(options = {}) {
|
|
|
successConfirm() {
|
|
|
successCheckDialog.show = false
|
|
|
},
|
|
|
+ async successClose() {
|
|
|
+ closeAllDialog()
|
|
|
+ },
|
|
|
phoneChangeConfirm() {
|
|
|
doConfirmLeave()
|
|
|
},
|
|
@@ -185,22 +201,14 @@ export function usePhoneCheck(options = {}) {
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- await requestSubmitLeaveInfo(payload)
|
|
|
+ const res = await requestSubmitLeaveInfo(payload)
|
|
|
+ if (res && res.data) {
|
|
|
+ showSuccessDialog()
|
|
|
+ }
|
|
|
}
|
|
|
catch (error) {
|
|
|
console.log(error)
|
|
|
}
|
|
|
- finally {
|
|
|
- changePhoneDialog.show = false
|
|
|
- confirmPhoneDialog.show = false
|
|
|
- if (popupVisible) {
|
|
|
- popupVisible.value = false
|
|
|
- }
|
|
|
- successCheckDialog.show = false
|
|
|
- // 使用 nextTick 确保状态更新
|
|
|
- await nextTick()
|
|
|
- successCheckDialog.show = true
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
function contactMe() {
|
|
@@ -217,6 +225,8 @@ export function usePhoneCheck(options = {}) {
|
|
|
changePhoneDialog,
|
|
|
successCheckDialog,
|
|
|
confirmPhoneDialog,
|
|
|
+ closeAllDialog,
|
|
|
+ showSuccessDialog,
|
|
|
dialogEvents,
|
|
|
contactMe
|
|
|
}
|