Przeglądaj źródła

feature: 首页修改

ljc 7 miesięcy temu
rodzic
commit
11b8549602
3 zmienionych plików z 53 dodań i 64 usunięć
  1. 15 31
      src/service/login.ts
  2. 1 1
      src/views/card/CardOrder/index.vue
  3. 37 32
      src/views/home2/Home.vue

+ 15 - 31
src/service/login.ts

@@ -10,93 +10,77 @@ class LoginService extends Service {
 
   //登录
   async Login(params = {}) {
-    console.log(this)
-    const res = await this.post('/user/login', params)
-    return res
+    return await this.post('/user/login', params)
   }
 
   // 获取登录信息
   async CustomLoginInfo(params = {}) {
-    const res = await this.post('/user/info', params)
-    return res
+    return await this.post('/user/info', params)
   }
 
   //登出
   async Logout(params = {}) {
-    const res = await this.post('/user/logout', params)
-    return res
+    return await this.post('/user/logout', params)
   }
 
   //注册
   async Register(params = {}) {
-    const res = await this.post('/custom/register', params)
-    return res
+    return await this.post('/custom/register', params)
   }
 
   //发送邮件验证
   async Code(params = {}) {
-    const res = await this.post('/custom/register/send/code', params)
-    return res
+    return await this.post('/custom/register/send/code', params)
   }
 
   //当前国家编码
   async CodeById(params = {}) {
-    const res = await this.post('/country/getCodeByIp', params)
-    return res
+    return await this.post('/country/getCodeByIp', params)
   }
 
   //语言切换
   async switchLanguage(params = {}) {
-    const res = await this.post('/user/switch/lang', params)
-    return res
+    return await this.post('/user/switch/lang', params)
   }
 
   //忘记密码
   async forgetPwd(params = {}) {
-    const res = await this.post('/user/update/password/send/email', params)
-    return res
+    return await this.post('/user/update/password/send/email', params)
   }
 
   //修改密码
   async updatePwd(params = {}) {
-    const res = await this.post('/user/update/login/password', params)
-    return res
+    return await this.post('/user/update/login/password', params)
   }
 
   //高风险客户内转提醒list
   async financeTransferRiskRemindList(params = {}) {
-    const res = await this.post('/finance/transfer/risk/remind/list', params)
-    return res
+    return await this.post('/finance/transfer/risk/remind/list', params)
   }
 
   //高风险客户内转提醒
   async financeTransferRiskRemindConfirm(params = {}) {
-    const res = await this.post('/finance/transfer/risk/remind/confirm', params)
-    return res
+    return await this.post('/finance/transfer/risk/remind/confirm', params)
   }
 
   //发送邮件验证
   async sendCode(params = {}) {
-    const res = await this.post('/user/login/send/code', params)
-    return res
+    return await this.post('/user/login/send/code', params)
   }
 
   //登录验证方式
   async loginValid(params = {}) {
-    const res = await this.post('/user/login/valid', params)
-    return res
+    return await this.post('/user/login/valid', params)
   }
 
   //获取用户附加信息(角色列表)
   async getUserAttachs(params = {}) {
-    const res = await this.post('/user/attachs', params)
-    return res
+    return await this.post('/user/attachs', params)
   }
 
   //切换登录身份
   async switchLogin(params = {}) {
-    const res = await this.post('/user/switchLogin', params)
-    return res
+    return await this.post('/user/switchLogin', params)
   }
 }
 

+ 1 - 1
src/views/card/CardOrder/index.vue

@@ -57,7 +57,7 @@
                 class="crm-border-radius-no"
                 clearable
                 size="small"
-                :placeholder="$t('Ucard.CardOrder.item8')"
+                :placeholder="t('Ucard.CardOrder.item8')"
                 @change="toSearch"
               >
                 <el-option :label="$t('Ucard.CardOrder.t5')" :value="1"></el-option>

+ 37 - 32
src/views/home2/Home.vue

@@ -200,6 +200,7 @@
   // 引入注入的全局
   const session = inject('session')
   const reload = inject('reload')
+  const pigeon = inject('pigeon')
 
   // Vue 相关
   const router = useRouter()
@@ -321,7 +322,7 @@
   }
 
   const isQAlistGet = () => {
-    const display = safeGetDisplay(sessionStorage)
+    const display = safeGetDisplay(session)
     if (display && display['R-System-QAList-Search'] && display['R-System-QAList-Search'].show) {
       isQAlist.value = true
     } else {
@@ -331,7 +332,7 @@
 
   // 退出登录
   const beforeLogout = () => {
-    ElMessageBox.confirm('确定要退出登录吗?', '系统提示', {
+    pi.confirm('确定要退出登录吗?', '系统提示', {
       confirmButtonText: '确认',
       cancelButtonText: '取消',
       type: 'warning',
@@ -347,7 +348,7 @@
       router.push({ path: '/signin' })
       store.commit('InfoExpire', false)
     } else {
-      ElMessage.error(res.msg)
+      pigeon.MessageError(res.msg)
     }
   }
 
@@ -455,10 +456,10 @@
           newPassword: dialogCheck_form.newPassword,
         })
         if (res.code == Code.StatusOK) {
-          ElMessage.success('修改成功')
+          pigeon.MessageOK(t('Msg.ModifySuccess'))
           cancel()
         } else {
-          ElMessage.error(res.msg)
+          pigeon.MessageError(res.msg)
         }
       }
     } catch (error) {
@@ -490,7 +491,7 @@
           }
         }
       } else {
-        ElMessage.error(res.msg)
+        pigeon.MessageError(res.msg)
       }
     } catch (error) {
       console.error('获取角色列表失败:', error)
@@ -500,13 +501,16 @@
   const switchRole = (item) => {
     if (item.id === currentAttachId.value) return
 
-    ElMessageBox.confirm('是否切换身份?', '系统提示', {
-      confirmButtonText: '确认',
-      cancelButtonText: '取消',
-      type: 'warning',
-    }).then(async () => {
-      await confirmSwitchRole(item.id)
-    })
+    pigeon.MessageConfirm(
+      '是否切换身份?',
+      '系统提示',
+      '确认',
+      '取消',
+      async () => {
+        await confirmSwitchRole(item.id)
+      },
+      () => {}
+    )
   }
 
   const confirmSwitchRole = async (attachId) => {
@@ -521,11 +525,11 @@
         await nextTick()
         await getLoginInfo(attachId)
       } else {
-        ElMessage.error(res.msg)
+        pigeon.MessageError(res.msg)
       }
     } catch (error) {
       console.error('切换角色失败:', error)
-      ElMessage.error('切换角色失败')
+      pigeon.MessageError('切换角色失败')
     } finally {
       loading.value = false
     }
@@ -537,15 +541,15 @@
       store.commit('InitInfo', res.data)
       store.commit('InfoExpire', false)
       sessionStorage.setItem('info', JSON.stringify(res.data))
-      ElMessage.success('登录成功')
+      pigeon.MessageOK(t('Msg.LoginSuccess'))
       setTimeout(() => {
         loading.value = false
-        window.location.reload()
+        reload()
         router.push({ path: '/' }).catch((arr) => arr)
       }, 1000)
     } else {
       store.commit('InfoExpire', false)
-      ElMessage.error('系统错误')
+      pigeon.MessageError(t('Msg.SystemError'))
       loading.value = false
     }
   }
@@ -622,24 +626,25 @@
 
   watch(expire, (val) => {
     if (val) {
-      ElMessageBox.confirm('登录已过期,请重新登录', '系统提示', {
-        confirmButtonText: '确认',
-        cancelButtonText: '取消',
-        type: 'warning',
-      })
-        .then(async () => {
-          const res = await Service.Logout({})
+      pigeon.MessageConfirm(
+        t('Msg.LogoutTime'),
+        t('Msg.SystemPrompt'),
+        t('Btn.Confirm'),
+        t('Btn.Cancel'),
+        async function () {
+          let res = await Service.Logout({})
           if (res.code == Code.StatusOK) {
             sessionStorage.clear()
-            router.push({ path: '/signin' })
-            store.commit('InfoExpire', false)
+            _this.$router.push({ path: '/signin' })
+            _this.$store.commit('InfoExpire', false)
           } else {
-            ElMessage.error(res.msg)
+            _this.$pigeon.MessageError(res.msg)
           }
-        })
-        .catch(() => {
-          store.commit('InfoExpire', false)
-        })
+        },
+        function () {
+          _this.$store.commit('InfoExpire', false)
+        }
+      )
     }
   })
 </script>