| | |
| | | import { UserInfoBase } from '../../data/UserInfoBase' |
| | | import { promptAction } from '@kit.ArkUI' |
| | | import { promptAction, router } from '@kit.ArkUI' |
| | | import PreferencesUtils from '../../utils/PreferencesUtils' |
| | | import http from '@ohos.net.http'; |
| | | import { HttpResponseResult } from '../../data/HttpResponse'; |
| | | import { JSON } from '@kit.ArkTS'; |
| | | import { ROMAIN } from '../../utils/config'; |
| | | |
| | | /** |
| | | * @Description : 登录页 |
| | |
| | | } |
| | | |
| | | httpRequest.request( |
| | | "http://192.168.20.70:8080/quiz-community/public/v1.0/users/login", |
| | | `${ROMAIN}/quiz-community/public/v1.0/users/login`, |
| | | { |
| | | method: http.RequestMethod.PUT, |
| | | header: { 'Content-Type': 'application/json' }, |
| | |
| | | PreferencesUtils.putPreferences('UserInfo','user',JSON.stringify(this.userInfoData)) |
| | | AppStorage.SetOrCreate('x-jwt-token', resData.data?.token) |
| | | promptAction.showToast({ message: '登录成功' }) |
| | | router.push({ |
| | | url: 'pages/MainPage' |
| | | }) |
| | | } else { |
| | | promptAction.showToast({ message: resData.msg }) |
| | | } |