Bläddra i källkod

feat: 调整 hasLogin 接口为 getUserInfo

zhangyuhan 1 år sedan
förälder
incheckning
b0ed84a378

+ 7 - 0
plugins/login-auth/src/api/login.js

@@ -25,6 +25,13 @@ export function ajaxGetHasLogin(data) {
   })
 }
 
+export function ajaxGetUserInfo() {
+  return request({
+    url: '/jypay/user/getSimpleData',
+    method: 'post'
+  })
+}
+
 export function ajaxGetLoginPolling(data) {
   return request({
     url: '/front/ajaxPolling',

+ 1 - 1
plugins/login-auth/src/components/form/imgCaptchaInput.vue

@@ -5,7 +5,7 @@ import { ref } from 'vue'
  *  图片验证码刷新逻辑
  */
 
-const baseImgCaptcha = 'https://www.jianyu360.cn/front/landpage/captcha'
+const baseImgCaptcha = import.meta.env.VITE_APP_IMAGE_BASE + '/front/landpage/captcha'
 const imgCaptcha = ref(baseImgCaptcha)
 
 function doRefreshCaptcha() {

+ 10 - 4
plugins/login-auth/src/utils/Login.ts

@@ -10,7 +10,7 @@
  *  3./front/ajaxPolling {reqType: 1,shareIds: pageshareid+"___"+kopshareid}
  */
 import { useWebSocket } from '@vueuse/core'
-import { ajaxGetHasLogin, ajaxGetLoginPolling, ajaxGetLoginNum } from '@/api'
+import { ajaxGetUserInfo, ajaxGetLoginPolling, ajaxGetLoginNum } from '@/api'
 
 
 /**
@@ -151,13 +151,19 @@ class ScanCodeLoginDetection {
   }
 
   hasLogin() {
-    return ajaxGetHasLogin().then(({ data }) => {
-      if (!data) {
+    return ajaxGetUserInfo().then(({ data }) => {
+      if (!Object.hasOwnProperty.call(data, 'userId')) {
         return
       }
 
       this.options.login = true
-      this.update('login', data)
+      this.update('login', {
+        result: 'ok',
+        s_headimage: data.headImage,
+        s_nickname: data.name,
+        phone: data.phone,
+        openid: ''
+      })
     })
   }
 

+ 1 - 0
plugins/login-auth/src/views/form/setPass.vue

@@ -85,6 +85,7 @@ function doSubmit(type) {
   ajaxSetPass(params).then(({ data }) => {
     if (data) {
       pluginLogin.handleSuccess('set-pass', data)
+      pluginLogin.close()
     } else {
       formNode.value.showError(1, '密码保存失败')
     }