|
@@ -1,5 +1,6 @@
|
|
|
import router from '@ohos.router'
|
|
|
import JGRequest from '../common/util/request/Request'
|
|
|
+import {getToken} from '../common/util/request/RequestInstance'
|
|
|
|
|
|
@Entry
|
|
|
@Component
|
|
@@ -11,17 +12,6 @@ struct LoginPage {
|
|
|
@State dept: DeptInfo = null
|
|
|
@State workstation: WorkstationInfo = null
|
|
|
|
|
|
- token: string
|
|
|
-
|
|
|
- async getToken(): Promise<string> {
|
|
|
- return await JGRequest.post("/api/auth/aioLogin", {
|
|
|
- "userName": this.loginName,
|
|
|
- "password": this.password,
|
|
|
- "orgId": this.dept ? this.dept.id : 0,
|
|
|
- "stationId": this.workstation ? this.workstation.id : 0,
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
// 部门选择弹框
|
|
|
selectDeptController: CustomDialogController = new CustomDialogController({
|
|
|
builder: SelectDeptDialog({
|
|
@@ -180,9 +170,8 @@ struct LoginPage {
|
|
|
}
|
|
|
.onClick(()=>{
|
|
|
if (this.loginName && this.loginName.length > 0 && this.password && this.password.length > 0) {
|
|
|
- this.getToken().then(token =>{
|
|
|
- this.token = token
|
|
|
- if (this.token && this.token.length > 0) {
|
|
|
+ getToken().then(token =>{
|
|
|
+ if (token && token.length > 0) {
|
|
|
router.pushUrl({
|
|
|
url:'pages/Index'
|
|
|
})
|