From afae6b790375689d23b2a7a9c996bcdfa91acc73 Mon Sep 17 00:00:00 2001 From: MrKBear Date: Tue, 25 Jan 2022 17:11:29 +0800 Subject: [PATCH] (#22)(#56) Add student info data ware. --- miniprogram/core/Data.ts | 12 +++--- miniprogram/data/StudentInfo.ts | 75 +++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 6 deletions(-) diff --git a/miniprogram/core/Data.ts b/miniprogram/core/Data.ts index 072d601..f870e87 100644 --- a/miniprogram/core/Data.ts +++ b/miniprogram/core/Data.ts @@ -13,22 +13,22 @@ interface IDataParamSettingItem { /** * 键值是否可以获取 */ - get: (...P: any) => this["type"] | INone; + get?: ((...P: any) => this["type"]) | INone; /** * 键值是否可以设置 */ - set: (...P: [this["type"], ...any]) => any | INone; + set?: ((...P: [this["type"], ...any]) => any) | INone; /** * 是否仅为异步获取 */ - getAsync?: (...P: any) => Promise | INone; + getAsync?: ((...P: any) => Promise) | INone; /** * 是否仅为异步设置 */ - setAsync?: (...P: [this["type"], ...any]) => Promise | INone; + setAsync?: ((...P: [this["type"], ...any]) => Promise) | INone; } /** @@ -54,7 +54,7 @@ type IRegistryItem = { * 异步获取方法 */ getAsync: S["getAsync"] extends Function ? S["getAsync"] : - S["get"] extends Function ? (...param: Parameters) => Promise : INone; + S["get"] extends ((...P: any) => S["type"]) ? (...param: Parameters) => Promise : INone; /** * 设置方法 @@ -65,7 +65,7 @@ type IRegistryItem = { * 异步设置方法 */ setAsync: S["setAsync"] extends Function ? S["setAsync"] : - S["set"] extends Function ? (...param: Parameters) => Promise> : INone; + S["set"] extends ((...P: [S["type"], ...any]) => any) ? (...param: Parameters) => Promise> : INone; } /** diff --git a/miniprogram/data/StudentInfo.ts b/miniprogram/data/StudentInfo.ts index e69de29..aa6a2a8 100644 --- a/miniprogram/data/StudentInfo.ts +++ b/miniprogram/data/StudentInfo.ts @@ -0,0 +1,75 @@ +import { Data } from "../core/Data"; + +/** + * 登录状态 + */ +enum LoginStatus { + +} + +/** + * 学生信息数据结构 + */ +type IStudentInfoData = { + + /** + * 学号 + */ + studentId: { + type: string, + }; + + /** + * 教务处密码 + */ + password: { + type: string + }; + + /** + * 身份证后六位 + * 用于尝试水卡登录 + */ + idCardLast6: { + type: string + }; + + /** + * 使用的教务处链接 + */ + eduService: { + type: string + }; + + /** + * 用户的真实姓名 + */ + actualName: { + type: string + }; + + /** + * 用户是否关注了公共号 + */ + isSubscribeWxAccount: { + type: boolean + }; + + /** + * 教务处的 session + */ + eduSession: { + type: string + }; +} + +/** + * 学生信息 + */ +class StudentInfo extends Data { + + public override onLoad() { + + } + +} \ No newline at end of file -- 2.45.2