|
@@ -1,5 +1,5 @@
|
|
|
import { Component, inject } from '@angular/core';
|
|
import { Component, inject } from '@angular/core';
|
|
|
-
|
|
|
|
|
|
|
+import { CommonModule } from '@angular/common';
|
|
|
import { ModalController } from '@ionic/angular/standalone';
|
|
import { ModalController } from '@ionic/angular/standalone';
|
|
|
import { CloudUser } from 'src/lib/ncloud';
|
|
import { CloudUser } from 'src/lib/ncloud';
|
|
|
import { ModalUserEditComponent } from './modal-user-edit/modal-user-edit.component';
|
|
import { ModalUserEditComponent } from './modal-user-edit/modal-user-edit.component';
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
standalone: true,
|
|
standalone: true,
|
|
|
providers: [ModalController],
|
|
providers: [ModalController],
|
|
|
imports: [
|
|
imports: [
|
|
|
|
|
+ CommonModule,
|
|
|
IonContent, IonHeader, IonTitle, IonToolbar, IonCard,
|
|
IonContent, IonHeader, IonTitle, IonToolbar, IonCard,
|
|
|
IonCardHeader, IonCardTitle, IonCardSubtitle, IonCardContent,
|
|
IonCardHeader, IonCardTitle, IonCardSubtitle, IonCardContent,
|
|
|
IonButton, IonAvatar, IonList, IonItem, IonLabel, IonNote, IonIcon
|
|
IonButton, IonAvatar, IonList, IonItem, IonLabel, IonNote, IonIcon
|
|
@@ -37,7 +38,18 @@ export class PageMineComponent {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ async signup() {
|
|
|
|
|
+ const username = window.prompt('请输入用户名', 'ff');
|
|
|
|
|
+ if (!username) return;
|
|
|
|
|
+ const password = window.prompt('请输入密码', '1234');
|
|
|
|
|
+ if (!password) return;
|
|
|
|
|
+ const user = new CloudUser();
|
|
|
|
|
+ // 假设 signUp 会存储到你的用户表
|
|
|
|
|
+ const newUser = await user.signUp(username, password);
|
|
|
|
|
+ if (newUser?.id) {
|
|
|
|
|
+ this.currentUser = newUser;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
async edit() {
|
|
async edit() {
|
|
|
const modal = await this.modalCtrl.create({
|
|
const modal = await this.modalCtrl.create({
|
|
|
component: ModalUserEditComponent,
|
|
component: ModalUserEditComponent,
|
|
@@ -46,8 +58,12 @@ export class PageMineComponent {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async login() {
|
|
async login() {
|
|
|
|
|
+ const username = window.prompt('请输入用户名', 'ff');
|
|
|
|
|
+ if (!username) return;
|
|
|
|
|
+ const password = window.prompt('请输入密码', '1234');
|
|
|
|
|
+ if (!password) return;
|
|
|
const user = new CloudUser();
|
|
const user = new CloudUser();
|
|
|
- const loggedInUser = await user.login("cccac", "123");
|
|
|
|
|
|
|
+ const loggedInUser = await user.login(username, password);
|
|
|
if (loggedInUser?.id) {
|
|
if (loggedInUser?.id) {
|
|
|
this.currentUser = loggedInUser;
|
|
this.currentUser = loggedInUser;
|
|
|
}
|
|
}
|