Selaa lähdekoodia

fix: 内部成员号码与问题上报表单交互

- 同步访客资料时合并 internal.mobile 与 telephone 写入缓存
- 无手机号提示改为 Notify warning 类型
- 切换问题类型时保留姓名与手机号,清空其余表单及所在地相关状态

Made-with: Cursor
haifeng.zhang 1 viikko sitten
vanhempi
commit
01a4b30628
3 muutettua tiedostoa jossa 17 lisäystä ja 8 poistoa
  1. 1 1
      src/api/wecom/index.ts
  2. 1 0
      src/api/wecom/types.ts
  3. 15 7
      src/subPages/pages/reportProblems/index.vue

+ 1 - 1
src/api/wecom/index.ts

@@ -323,7 +323,7 @@ export async function syncExternalVisitorProfile(code: string) {
     const internal = await getWecomInternalUser(memberUserId)
     const profile: WecomVisitorProfile = {
       name: internal.name || '',
-      mobile: internal.mobile || '',
+      mobile: (internal.mobile || internal.telephone || '').trim(),
       unionid: '',
       internalUserid: memberUserId,
     }

+ 1 - 0
src/api/wecom/types.ts

@@ -22,6 +22,7 @@ export interface WecomInternalUserResponse extends WecomBaseResponse {
   userid?: string
   name?: string
   mobile?: string
+  telephone?: string
   department?: number[]
   position?: string
 }

+ 15 - 7
src/subPages/pages/reportProblems/index.vue

@@ -47,11 +47,6 @@ const formData = ref<ReportFormData>(createInitialFormData())
 const range = ref<{ text: string; value: string }[]>([])
 const rangePerson = ref([]) as any
 
-const changeQuestionType = (e:any) => {
-  formData.value = createInitialFormData();
-  formData.value.questionType = e;
-}
-
 const rules = ref({
   questionType: [{ required: true, message: '请选择类型' }],
   // questionTitle: [{ required: true, message: '请输入标题' }],
@@ -97,10 +92,10 @@ const fillVisitorName = () => {
 
 const fillVisitorPhone = () => {
   const profile = getCachedWecomVisitorProfile()
-  const mobile = profile?.mobile || visitorPhone.value
+  const mobile = (profile?.mobile || visitorPhone.value || '').trim()
 
   if (!mobile) {
-    showNotify('暂未获取到您的手机号,请手动填写')
+    showNotify({ type: 'warning', message: '暂未获取到您的手机号,请手动填写' })
     return
   }
 
@@ -248,6 +243,19 @@ const hanleSelectArea = () => {
   areaShow.value = true
 }
 
+const changeQuestionType = (e: any) => {
+  const { contactPerson, contactPhone, contactPersonPhone } = formData.value
+  formData.value = createInitialFormData()
+  formData.value.questionType = e
+  formData.value.contactPerson = contactPerson
+  formData.value.contactPhone = contactPhone
+  formData.value.contactPersonPhone = contactPersonPhone
+  addressList.value = null
+  personData.value = []
+  rangePerson.value = []
+  areaShow.value = false
+}
+
 onMounted(async () => {
   fillVisitorName()