diff --git a/webview/src/apps/chatroom/create.html b/webview/src/apps/chatroom/create.html
new file mode 100644
index 00000000..3edf8c40
--- /dev/null
+++ b/webview/src/apps/chatroom/create.html
@@ -0,0 +1,73 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/webview/src/apps/chatroom/create.scss b/webview/src/apps/chatroom/create.scss
new file mode 100644
index 00000000..e69de29b
diff --git a/webview/src/apps/chatroom/create.ts b/webview/src/apps/chatroom/create.ts
new file mode 100644
index 00000000..59e0fdda
--- /dev/null
+++ b/webview/src/apps/chatroom/create.ts
@@ -0,0 +1,35 @@
+import { Component } from '@angular/core';
+import { Router } from '@angular/router';
+
+import { RobotApi, ChatroomCreateParam } from '../../openapi/wrobot';
+import { WrestApi, WcfrestContactPayload } from '../../openapi/wcfrest';
+
+
+@Component({
+ selector: 'page-chatroom-create',
+ templateUrl: 'create.html',
+ styleUrls: ['create.scss']
+})
+export class ChatroomCreateComponent {
+
+ public chatrooms: Array = [];
+
+ public formdata = { level: 1 } as ChatroomCreateParam;
+
+ constructor(private router: Router) {
+ this.getChatrooms();
+ }
+
+ public createChatroom() {
+ RobotApi.chatroomCreate(this.formdata).then(() => {
+ this.router.navigate(['chatroom/list']);
+ });
+ }
+
+ public getChatrooms() {
+ WrestApi.chatrooms().then((data) => {
+ this.chatrooms = data || [];
+ });
+ }
+
+}
diff --git a/webview/src/apps/chatroom/list.html b/webview/src/apps/chatroom/list.html
index 131bb9e4..170f5bb4 100644
--- a/webview/src/apps/chatroom/list.html
+++ b/webview/src/apps/chatroom/list.html
@@ -8,6 +8,10 @@
+
+
+
+
diff --git a/webview/src/apps/chatroom/list.ts b/webview/src/apps/chatroom/list.ts
index 5c5ad21d..53f7ddfb 100644
--- a/webview/src/apps/chatroom/list.ts
+++ b/webview/src/apps/chatroom/list.ts
@@ -20,14 +20,8 @@ export class ChatroomListComponent {
public chatrooms: Array = [];
constructor() {
- this.getContacts();
this.getChatrooms();
- }
-
- public getContacts() {
- WrestApi.contacts().then((data) => {
- data.forEach((item) => this.contacts[item.wxid] = item);
- });
+ this.getContacts();
}
public getChatrooms() {
@@ -43,6 +37,12 @@ export class ChatroomListComponent {
});
}
+ public getContacts() {
+ WrestApi.contacts().then((data) => {
+ data.forEach((item) => this.contacts[item.wxid] = item);
+ });
+ }
+
public getAvatars(ids: string[]) {
WrestApi.avatars({ wxids: [...new Set(ids)] }).then((data) => {
data && data.forEach((item) => {