From 382011d592cd2b82e0f305223726a6eea41c3a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=85=E5=BF=B5?= Date: Fri, 25 Jul 2025 15:11:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=99=BB=E5=BD=95=E9=A1=B5?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E5=85=AC=E6=B5=B7=E6=95=B0=E6=8D=AE=20?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF=E9=BB=98=E8=AE=A4=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/auth/login/index.vue | 126 +++++++++++++------------ src/views/crmpc/highseas/index.vue | 18 +--- src/views/system/user-center/index.vue | 96 ++++++++++++------- 3 files changed, 134 insertions(+), 106 deletions(-) diff --git a/src/views/auth/login/index.vue b/src/views/auth/login/index.vue index f69927f..b8da14c 100644 --- a/src/views/auth/login/index.vue +++ b/src/views/auth/login/index.vue @@ -36,8 +36,16 @@
- - + + {{ account.name }} - +
- + - + - + -
@@ -184,7 +196,7 @@ import type { FormInstance, FormRules } from 'element-plus' const settingStore = useSettingStore() - const { isDark, systemThemeType } = storeToRefs(settingStore) + const { systemThemeType } = storeToRefs(settingStore) const dragVerify = ref() @@ -201,17 +213,17 @@ companyid.value = useUserStore().companyid const systemsid = ref('') systemsid.value = useUserStore().systemsid - const iscompany = ref(false) + const iscompany = ref(false) const { companyabbr } = useUserStore() - //获取公司 getCompanyList + //获取公司 getCompanyList const companyList = ref() //系统 const systemsList = ref() - const feishuresponse=ref() + const feishuresponse = ref() const formData = reactive({ account: '', - systems: useUserStore().companyid?Number(useUserStore().companyid):'', - company: useUserStore().companyid?Number(useUserStore().companyid):'', + systems: useUserStore().companyid ? Number(useUserStore().companyid) : '', + company: useUserStore().companyid ? Number(useUserStore().companyid) : '', username: '', password: '', rememberPassword: true @@ -226,22 +238,15 @@ const loading = ref(false) const { width } = useWindowSize() const getcompanyList = async () => { - try { - // 这里调用公司列表的接口 - const response = await UserService.getCompanyList() - companyList.value = response || [] - } catch (error) { } + const response = await UserService.getCompanyList() + companyList.value = response || [] } const getsystemsList = async () => { - try { - // 这里调用公司列表的接口 - const response = await UserService.getsystemsList() - systemsList.value = response || [] - } catch (error) { } + const response = await UserService.getsystemsList() + systemsList.value = response || [] } - - // 切换语言 - const { locale } = useI18n() + // 切换语言 + const { locale } = useI18n() const changeLanguage = (lang: LanguageEnum) => { if (locale.value === lang) return @@ -250,36 +255,32 @@ } const getfeishuAppList = async () => { - try { - // 这里调用飞书 - feishuresponse.value = await UserService.getfeishuAppList({ corp_id: companyid.value }) - if(activeLoginType.value=='qrcode'){ - feishulogin() - } - console.log(feishuresponse) - } catch (error) { } + feishuresponse.value = await UserService.getfeishuAppList({ corp_id: companyid.value }) + if (activeLoginType.value == 'qrcode') { + feishulogin() + } } - //切换系统 + //切换系统 const changesystems = (systems: any) => { const systemsdata = systemsList.value.find((c: any) => c.id === systems) systemsid.value = systems - userStore.setSystems(systems,systemsdata?.code) + userStore.setSystems(systems, systemsdata?.code) } //切换公司 - + const changeCompany = (company: any) => { // if (companyid.value === company) return const companyt = companyList.value.find((c: any) => c.id === company) companyid.value = company iscompany.value = company - userStore.setCompany(company,companyt?.abbr) + userStore.setCompany(company, companyt?.abbr) getfeishuAppList() } - if(companyabbr!=''){ + if (companyabbr != '') { iscompany.value = true getfeishuAppList() } - + const feishulogin = async () => { userStore.setLoginType('feishu') if (isInFeishu) { @@ -292,7 +293,7 @@ const waitForQRLogin = () => new Promise((resolve) => { const check = () => { - // @ts-ignore + // @ts-expect-error if (window.QRLogin) resolve() else setTimeout(check, 100) } @@ -314,7 +315,7 @@ goto: feishuGotoUrl, width: '250', height: '250', - style: 'width:350px;height:350px;border:none' + style: 'width:350px;height:270px;border:none' }) const handleMessage = function (event: MessageEvent) { if (QRLoginObj.matchOrigin(event.origin) && QRLoginObj.matchData(event.data)) { @@ -325,25 +326,25 @@ window.addEventListener('message', handleMessage, false) } } - watch( + watch( (activeLoginType as import('vue').Ref), async (val) => { if (val === 'qrcode') { userStore.setLoginType('feishu') - if(companyid.value!=''){ + if (companyid.value != '') { feishulogin() } - }else{ + } else { userStore.setLoginType('upwd') } }, { immediate: true } ) //飞书登录 - const feishuSubmit = async () => { + const feishuSubmit = async () => { try { const { auth_url } = await UserService.getfeishuscope() - window.location.href = auth_url + window.location.href = auth_url } catch (error) { ElMessage.error('登录失败,请稍后重试') } finally { @@ -371,7 +372,7 @@ // 登录请求 const { username, password } = formData - const { data } = await UserService.login({ + const { data } = await UserService.login({ account: username, password }) @@ -428,14 +429,17 @@ getcompanyList() getsystemsList() // 自动读取 query 参数并存入 userStore - const companyid = Array.isArray(route.query.corp_id) ? route.query.corp_id[0] : route.query.corp_id - const companyabbr = Array.isArray(route.query.corp_abbr) ? route.query.corp_abbr[0] : route.query.corp_abbr + const companyid = Array.isArray(route.query.corp_id) + ? route.query.corp_id[0] + : route.query.corp_id + const companyabbr = Array.isArray(route.query.corp_abbr) + ? route.query.corp_abbr[0] + : route.query.corp_abbr if (companyid) { userStore.setCompany(companyid as string, (companyabbr as string) || '') formData.company = Number(companyid) } }) - // 切换主题 import { useTheme } from '@/composables/useTheme' diff --git a/src/views/crmpc/highseas/index.vue b/src/views/crmpc/highseas/index.vue index 5edee1b..0f0585e 100644 --- a/src/views/crmpc/highseas/index.vue +++ b/src/views/crmpc/highseas/index.vue @@ -29,19 +29,11 @@ @current-change="handleCurrentChange" >