From 4b7948ff9324254a5694aea532d1f0a68e0eaf5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=A5=E6=B5=B7?= Date: Wed, 28 Feb 2024 22:07:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=BE=A4=E8=81=8A=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webview/src/apps/chatroom/create.html | 73 +++++++++++++++++++++++++++ webview/src/apps/chatroom/create.scss | 0 webview/src/apps/chatroom/create.ts | 35 +++++++++++++ webview/src/apps/chatroom/list.html | 4 ++ webview/src/apps/chatroom/list.ts | 14 ++--- 5 files changed, 119 insertions(+), 7 deletions(-) create mode 100644 webview/src/apps/chatroom/create.html create mode 100644 webview/src/apps/chatroom/create.scss create mode 100644 webview/src/apps/chatroom/create.ts 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) => {