登录和接口请求

This commit is contained in:
XiuYun CHEN
2025-08-05 10:52:22 +08:00
parent ef0b32cfe4
commit 9355959b36
11 changed files with 263 additions and 83 deletions
@@ -7,7 +7,7 @@ export struct PerfactInputSheet {
@Prop inputTitle:string = '';
@Prop inputPlaceholder:string = ''
@State inputText:string = ''
@State style:string = '0'//默认类型为注册时候的弹窗//1为普通确认取消输入框//2未普通弹框
@State style:string = '0'//默认类型为注册时候的弹窗//1为普通确认取消输入框//2未普通弹框//3为只有一个确定按钮的弹窗
// 添加回调函数属性
@State okColor:ResourceStr='#000000'
@State cancelColor:ResourceStr='#333333'
@@ -195,6 +195,63 @@ export struct PerfactInputSheet {
}.margin({ top: 10, bottom: 10 }).width('100%')
}
.width('80%').backgroundColor(Color.White)
}.borderRadius(24)
}
else if(this.style=='3')
{
Row(){
Column() {
Text(this.inputTitle)
.fontSize(18)
.padding(20)
.width('100%')
.textAlign(TextAlign.Center)
.fontColor('#444444')
Row(){
Text(this.inputPlaceholder)
.fontColor('#444444')
.backgroundColor(Color.White)
.padding({left:10,right:10,bottom:20})
}
.backgroundColor(Color.White)
Text('').height(1).width('100%')
.backgroundColor($r('app.color.home_gray')).margin({top:10})
Row() {
// Text(this.cancelText)
// .fontSize(15)
// .fontColor(this.cancelColor)
// .textAlign(TextAlign.Center)
//
// .height(30).layoutWeight(1)
// .onClick(() => {
// if(this.needcancelCallBack)
// {
// this.inputCallBack(this.inputText, 'needcancelCallBack');
// }
// this.controller.close()
// })
// Text('').height(30).width(1)
// .backgroundColor($r('app.color.home_gray'))
Text(this.okText)
.textAlign(TextAlign.Center)
.fontColor(this.okColor)
.fontSize(15)
.onClick(() => {
this.controller.close()
this.inputCallBack(this.inputText, this.inputTitle);
})
.height(30).layoutWeight(1)
}.margin({ top: 10, bottom: 10 }).width('100%')
}
.width('80%').backgroundColor(Color.White)
@@ -10,7 +10,9 @@ import { i18n } from '@kit.LocalizationKit';
import { connection } from '@kit.NetworkKit';
import http from '@ohos.net.http'
import {BasicConstant} from '../constants/BasicConstant'
import { componentUtils } from '@kit.ArkUI';
import { componentUtils, router } from '@kit.ArkUI';
import { authStore } from './auth';
import { preferenceStore } from './PreferenceStore';
export class ChangeUtil {
/**
@@ -312,4 +314,20 @@ export class ChangeUtil {
const height = componentInfo.size.height//3.38
return height
}
static Logout(phone:string)
{
authStore.delUser();
preferenceStore.clear()
preferenceStore.setItemBoolean('isLogin',false)
preferenceStore.setItemBoolean('isFirstRun',false)
// router.back()
router.replaceUrl({
url: 'pages/LoginPage/LoginPage', // 目标url
params: {
phone:phone
}
},router.RouterMode.Single)
router.clear()
}
}