55 Commits
Author SHA1 Message Date
yzy 49851d4a57 (#36) Add popups 2022-01-21 20:11:11 +08:00
MrKBear df4229bf2f Merge 'master' into dev-yzy 2022-01-21 20:04:13 +08:00
MrKBear 43d87b40f7 Merge pull request '(#21) Mixin IAnyData in app' (#59) from dev-mrkbear into master
Reviewed-on: http://git.mrkbear.com/MrKBear/mini-dlpu-v3/pulls/59
2022-01-21 17:39:13 +08:00
MrKBear 660f6921de (#21) Mixin IAnyData in app 2022-01-21 17:38:41 +08:00
MrKBear 86101e01d1 Merge pull request '(#22) Add StudentInfo file' (#58) from dev-mrkbear into master
Reviewed-on: http://git.mrkbear.com/MrKBear/mini-dlpu-v3/pulls/58
2022-01-21 17:37:05 +08:00
MrKBear 1f2a2ad6bd (#22) Add StudentInfo file 2022-01-21 17:36:16 +08:00
MrKBear b91a9271a7 Merge pull request '(#56) Add Core Data.' (#57) from dev-mrkbear into master
Reviewed-on: http://git.mrkbear.com/MrKBear/mini-dlpu-v3/pulls/57
2022-01-21 17:33:10 +08:00
MrKBear ec635b9ae6 (#56) Add Core Data. 2022-01-21 17:30:08 +08:00
MrKBear 6f96a69900 Merge pull request '(#35)Add mask modular event.' (#55) from dev-mrkbear into master
Reviewed-on: http://git.mrkbear.com/MrKBear/mini-dlpu-v3/pulls/55
2022-01-21 10:43:24 +08:00
MrKBear 58d8d74158 (#35)Add mask modular event. 2022-01-21 10:38:37 +08:00
MrKBear 96b3414d22 Merge pull request '(#28)Add a api frame (incomplete file)' (#51) from dev-tamako into master
Reviewed-on: http://git.mrkbear.com/MrKBear/mini-dlpu-v3/pulls/51
2022-01-20 23:52:35 +08:00
TamakoStar 529011b0dd (#28)Add Schedule API 2022-01-20 23:47:02 +08:00
TamakoStar 4da257c2e2 (#28)Add Schedule API 2022-01-20 22:19:10 +08:00
TamakoStar f11eb63ee1 Merge branch 'master' into dev-tamako 2022-01-20 21:45:30 +08:00
MrKBear 49c4f7f0d4 Merge pull request '(#52) Add EduBase API' (#53) from dev-mrkbear into master
Reviewed-on: http://git.mrkbear.com/MrKBear/mini-dlpu-v3/pulls/53
2022-01-20 21:43:41 +08:00
MrKBear 4158887d2e (#52) Add EduBase API 2022-01-20 21:42:44 +08:00
MrKBear a8e16f5972 (#28) Add output data mod 2022-01-20 20:57:41 +08:00
TamakoStar d9825d6d68 (#28)Add a api frame (incomplete file) 2022-01-20 20:38:57 +08:00
TamakoStar fab73f00ab Merge branch 'master' into dev-tamako 2022-01-20 20:33:02 +08:00
TamakoStar edb26b3d8b Merge branch 'dev-tamako' of http://git.mrkbear.com/MrKBear/mini-dlpu-v3 into dev-tamako 2022-01-20 20:31:52 +08:00
TamakoStar 443f82ea75 (#28)Add a api frame (incomplete file) 2022-01-20 20:30:36 +08:00
TamakoStar 75adb97abb (#28)Add a api frame (incomplete file) 2022-01-20 20:17:32 +08:00
MrKBear b36996e352 Merge pull request '(#35) Add mask show hide motion' (#50) from dev-mrkbear into master
Reviewed-on: http://git.mrkbear.com/MrKBear/mini-dlpu-v3/pulls/50
2022-01-20 17:20:42 +08:00
MrKBear 6bef08f12e (#35) Add mask show hide motion 2022-01-20 17:18:44 +08:00
MrKBear 1f24a59bd9 Merge pull request '(#48) Core Api baseUrl param can be overridden' (#49) from dev-mrkbear into master
Reviewed-on: http://git.mrkbear.com/MrKBear/mini-dlpu-v3/pulls/49
2022-01-20 16:11:42 +08:00
MrKBear 14d0c9c123 (#48) Core Api baseUrl param can be overridden 2022-01-20 16:10:55 +08:00
MrKBear b99a3412e2 Merge pull request '(#37) Optimize Account page' (#47) from dev-mrkbear into master
Reviewed-on: http://git.mrkbear.com/MrKBear/mini-dlpu-v3/pulls/47
2022-01-20 13:27:16 +08:00
MrKBear 63300f68f8 (#37) Optimize Account page 2022-01-20 13:26:24 +08:00
yzy cd8ca7dcc4 #36 Add basic popups 2022-01-20 12:49:02 +08:00
MrKBear acf4f94798 Merge pull request '(#45) Optimize Modular loading performance' (#46) from dev-mrkbear into master
Reviewed-on: http://git.mrkbear.com/MrKBear/mini-dlpu-v3/pulls/46
2022-01-20 11:53:14 +08:00
MrKBear 87f4d220e5 (#45) Optimize Modular loading performance 2022-01-20 11:52:10 +08:00
MrKBear cf4dd727c5 Merge pull request '(#37) Optimization function list' (#44) from dev-mrkbear into master
Reviewed-on: http://git.mrkbear.com/MrKBear/mini-dlpu-v3/pulls/44
2022-01-19 21:58:20 +08:00
MrKBear 49055e892c (#37) Optimization function list 2022-01-19 21:55:55 +08:00
MrKBear afedb81633 Merge pull request '(#37) Fix checkmark display' (#43) from dev-mrkbear into master
Reviewed-on: http://git.mrkbear.com/MrKBear/mini-dlpu-v3/pulls/43
2022-01-19 21:22:03 +08:00
MrKBear 04b8bf365f Merge branch 'dev-mrkbear' of http://git.mrkbear.com/MrKBear/mini-dlpu-v3 into dev-mrkbear 2022-01-19 21:21:41 +08:00
MrKBear 874c64829a (#37) Add mask modular 2022-01-19 21:21:21 +08:00
MrKBear 82e1c0941e (#37) Fix checkmark display 2022-01-19 17:38:15 +08:00
MrKBear 3119c862b1 Merge pull request '用户页面实现 #37 dev-sanaesy' (#40) from dev-sanaesy into master
Reviewed-on: http://git.mrkbear.com/MrKBear/mini-dlpu-v3/pulls/40
2022-01-18 22:34:12 +08:00
MrKBear 23f46a24c9 (#37)Add Function List 2022-01-18 22:30:05 +08:00
MrKBear fc8aa19c67 Merge 'master' into dev-sanaesy 2022-01-18 21:36:37 +08:00
MrKBear 72448038d1 Merge pull request '用户界面实现(#37)dev-gia_jie' (#41) from dev-gia_jie into master
Reviewed-on: http://git.mrkbear.com/MrKBear/mini-dlpu-v3/pulls/41
2022-01-18 21:18:46 +08:00
MrKBear 196be3099a (#37)Add main funcion modular 2022-01-18 21:16:08 +08:00
MrKBear 87d33bb1df Merge branch 'master' into dev-gia_jie 2022-01-18 20:32:01 +08:00
MrKBear efd9b9be57 Merge pull request '(#37)Add icon' (#42) from dev-mrkbear into master
Reviewed-on: http://git.mrkbear.com/MrKBear/mini-dlpu-v3/pulls/42
2022-01-18 20:30:53 +08:00
MrKBear 7dd46dbd15 (#37)Add ok no arrow ICON 2022-01-18 20:11:09 +08:00
MrKBear d70ead2f77 (#37)Style optimization 2022-01-18 17:56:44 +08:00
sanaesy 95f1f6d484 (#37) 2022-01-18 11:47:25 +08:00
sanaesy 54d87fc5db (#37) 2022-01-18 11:39:15 +08:00
sanaesy f434ad531c (#37) 2022-01-18 11:06:11 +08:00
gia_jie 3bb47109ed (#37) 2022-01-18 10:44:32 +08:00
MrKBear 84bc1c6fbc Merge pull request '(#37)Mod global image style' (#39) from dev-mrkbear into master
Reviewed-on: http://git.mrkbear.com/MrKBear/mini-dlpu-v3/pulls/39
2022-01-18 08:40:20 +08:00
111 a92f2d06ea (#37) 2022-01-18 00:43:38 +08:00
111 45e8ef9322 (#37) 2022-01-17 23:03:48 +08:00
sanae kochiya 7c1e4e441a (#37) 2022-01-17 22:57:05 +08:00
MrKBear 4d3c44be6e (#37)Mod global image style 2022-01-17 22:35:38 +08:00
29 changed files with 1306 additions and 170 deletions
+95
View File
@@ -0,0 +1,95 @@
import { API, IAnyData, GeneralCallbackResult } from "../core/Api";
import { EventType } from "../core/Emitter";
interface ILoginEvent {
/**
* session 过期
*/
expire: GeneralCallbackResult;
/**
* 登录失败
*/
unauthorized: GeneralCallbackResult;
/**
* 未知的问题
*/
error: GeneralCallbackResult;
/**
* 数据损坏或丢失
*/
badData: GeneralCallbackResult;
}
/**
* 教务处基础 API
* @template I API 输入数据
* @template O API 输出数据
* @template E API 中的事件
* @template U 用户自定义的输出数据
*/
abstract class EduBase<
I extends IAnyData = IAnyData,
O extends IAnyData = IAnyData,
E extends Record<EventType, any> = {}
> extends API<I, O, {
[P in (keyof ILoginEvent | keyof E)]: P extends keyof ILoginEvent ? ILoginEvent[P] : E[P]
}> {
protected useEduCallback(
parseFunction: (data: any) => O
): void {
this.addFailedCallBack();
this.on("success", (data) => {
let isSuccess = true;
let errMsg = "";
let res: O | undefined;
const info: any = data.data;
// 数据缺失检测
if(!info) {
isSuccess = false;
errMsg = "Bad Data";
this.emit("badData", { errMsg });
}
if (isSuccess) switch (info.code) {
case (1):
res = parseFunction(info.data);
errMsg = info.err_msg ?? "Success";
this.emit("ok", res!);
break;
case (2):
isSuccess = false;
errMsg = info.err_msg ?? "Session Expire";
this.emit("expire", { errMsg });
break;
case (3):
isSuccess = false;
errMsg = info.err_msg ?? "Unauthorized";
this.emit("unauthorized", { errMsg });
break;
case (4):
isSuccess = false;
errMsg = info.err_msg ?? "Error";
this.emit("error", { errMsg });
break;
}
if (!isSuccess) this.emit("no", { errMsg });
this.emit("done", { errMsg, data: res });
});
}
}
export { EduBase };
export default EduBase;
+10 -76
View File
@@ -1,4 +1,5 @@
import { API, HTTPMethod, IParamSetting, GeneralCallbackResult } from "../core/Api"; import { HTTPMethod, IParamSetting } from "../core/Api";
import { EduBase } from "./EduBase";
interface ILoginInput { interface ILoginInput {
@@ -42,35 +43,12 @@ interface ILoginOutput {
eduSession: string; eduSession: string;
} }
interface ILoginEvent {
/**
* session 过期
*/
expire: GeneralCallbackResult;
/**
* 登录失败
*/
unauthorized: GeneralCallbackResult;
/**
* 未知的问题
*/
error: GeneralCallbackResult;
/**
* 数据损坏或丢失
*/
badData: GeneralCallbackResult;
}
/** /**
* Login API * Login API
* 此 API 用来向教务处发起登录请求 * 此 API 用来向教务处发起登录请求
* 请求成功后将获得教务处返回的 session * 请求成功后将获得教务处返回的 session
*/ */
class Login extends API<ILoginInput, ILoginOutput, ILoginEvent> { class Login extends EduBase<ILoginInput, ILoginOutput> {
public override url: string = "/login"; public override url: string = "/login";
@@ -92,57 +70,13 @@ class Login extends API<ILoginInput, ILoginOutput, ILoginEvent> {
super(); super();
this.initDebugLabel("Login"); this.initDebugLabel("Login");
this.addFailedCallBack(); this.useEduCallback((data) => ({
idCardLast6: data.idCard,
this.on("success", (data) => { eduService: data.ip,
actualName: data.name,
let isSuccess = true; isSubscribeWxAccount: data.official,
let errMsg = ""; eduSession: data.session
let res: ILoginOutput | undefined; }));
const info: any = data.data;
// 数据缺失检测
if(!info) {
isSuccess = false;
errMsg = "Bad Data";
this.emit("badData", { errMsg });
}
if (isSuccess) switch (info.code) {
case (1):
res = {
idCardLast6: info.data.idCard,
eduService: info.data.ip,
actualName: info.data.name,
isSubscribeWxAccount: info.data.official,
eduSession: info.data.session
};
errMsg = info.err_msg ?? "Success";
this.emit("ok", res);
break;
case (2):
isSuccess = false;
errMsg = info.err_msg ?? "Session Expire";
this.emit("expire", { errMsg });
break;
case (3):
isSuccess = false;
errMsg = info.err_msg ?? "Unauthorized";
this.emit("unauthorized", { errMsg });
break;
case (4):
isSuccess = false;
errMsg = info.err_msg ?? "Error";
this.emit("error", { errMsg });
break;
}
if (!isSuccess) this.emit("no", { errMsg });
this.emit("done", { errMsg, data: res });
});
} }
} }
+110
View File
@@ -0,0 +1,110 @@
import { HTTPMethod, IParamSetting } from "../core/Api";
import { EduBase } from "./EduBase";
interface IScheduleInput {
/**
* session
*/
cookie: string;
/**
* 学期
*/
semester: string;
}
interface IClassData {
/**
* 课程名字
*/
name: string;
/**
* 上课地点
*/
room?: string;
/**
* 课程老师
*/
teacher?: string;
/**
* 周数
*/
week: string;
}
type IScheduleOutput = {
/**
* 课程列表
*/
classList: IClassData[];
/**
* 稀疏矩阵编号
*/
index: number;
}[];
/**
* Schedule API
* 需要session与semester
* 此 API 用来向教务处发起获取课程表的请求
* 请求成功后将获得教务处返回的课程表JSON文件
*/
class Schedlue extends EduBase<IScheduleInput, IScheduleOutput> {
public override url = "/course_timetable";
public override method: HTTPMethod = HTTPMethod.GET;
public override params: IParamSetting<IScheduleInput> = {
cookie: {
mapKey: "cookie",
isHeader: true
},
semester: {
mapKey: "semester",
}
};
public constructor() {
super();
this.initDebugLabel("Schedule");
this.useEduCallback((data) => {
const res: IScheduleOutput = [];
for( let i = 0; i < data.length; i++ ) {
const classList: IClassData[] = [];
const CTTDetails = data[i].CTTDetails ?? [];
for( let j = 0; j < CTTDetails.length; j++ ) {
classList.push({
name: CTTDetails[j].Name,
room: CTTDetails[j].Room,
teacher: CTTDetails[j].Teacher,
week: CTTDetails[j].Week,
})
}
res.push({
classList,
index: data[i].Id
})
}
return res;
});
}
}
export { Schedlue };
export default Schedlue;
+25 -4
View File
@@ -14,7 +14,7 @@ $theme-color-dark-text: rgba(255, 255, 255, .5);
$black-filter: brightness(0) opacity(.65); $black-filter: brightness(0) opacity(.65);
$white-filter: brightness(100) opacity(.65); $white-filter: brightness(100) opacity(.65);
$blue-filter: opacity(.65); $blue-filter: opacity(1);
// 页面容器外边距 // 页面容器外边距
view.container { view.container {
@@ -24,14 +24,23 @@ view.container {
// 带阴影的 card // 带阴影的 card
view.card { view.card {
width: calc( 100% - 36px ); width: calc( 100% - 40px );
padding: 0 18px; padding: 0 20px;
border-radius: 15px; border-radius: 15px;
background-color: $theme-color-light-layout; background-color: $theme-color-light-layout;
box-shadow: 0 1.6px 3.6px 0 rgba(0, 0, 0, .08), box-shadow: 0 1.6px 3.6px 0 rgba(0, 0, 0, .08),
0 0.3px 0.9px 0 rgba(0, 0, 0, .05); 0 0.3px 0.9px 0 rgba(0, 0, 0, .05);
} }
image.icon {
filter: $black-filter;
}
image.icon-sub {
filter: $black-filter;
opacity: .6;
}
// 顶部导航栏阴影 // 顶部导航栏阴影
view.top-shadow { view.top-shadow {
position: fixed; position: fixed;
@@ -48,23 +57,27 @@ page {
} }
view, text { view, text {
font-size: .99em; font-size: .97em;
letter-spacing: .1em;
font-family: Hiragino Sans GB, MicroSoft YaHei; font-family: Hiragino Sans GB, MicroSoft YaHei;
} }
view.h1 { view.h1 {
color: $theme-color-light-title; color: $theme-color-light-title;
font-size: 1.5em; font-size: 1.5em;
letter-spacing: .1em;
} }
view.h2 { view.h2 {
color: $theme-color-light-title; color: $theme-color-light-title;
font-size: 1.3em; font-size: 1.3em;
letter-spacing: .1em;
} }
view.h3 { view.h3 {
color: $theme-color-light-title; color: $theme-color-light-title;
font-size: 1em; font-size: 1em;
letter-spacing: .1em;
} }
@media (prefers-color-scheme: dark){ @media (prefers-color-scheme: dark){
@@ -77,6 +90,14 @@ view.h3 {
background-color: $theme-color-dark-layout; background-color: $theme-color-dark-layout;
} }
image.icon {
filter: $white-filter;
}
image.icon-sub {
filter: $white-filter;
}
view.h1 { view.h1 {
color: $theme-color-dark-title; color: $theme-color-dark-title;
font-size: 1.2em; font-size: 1.2em;
+2 -2
View File
@@ -1,9 +1,9 @@
import { IAppAPIParam } from "./core/Api"; import { IAppAPIParam, IAnyData } from "./core/Api";
import { IAppStorageParam, Storage, IStorageData } from "./core/Storage"; import { IAppStorageParam, Storage, IStorageData } from "./core/Storage";
import { Logger, LevelLogLabel, LifeCycleLogLabel } from "./core/Logger"; import { Logger, LevelLogLabel, LifeCycleLogLabel } from "./core/Logger";
App<IAppAPIParam & IAppStorageParam>({ App<IAppAPIParam & IAppStorageParam & IAnyData>({
/** /**
* API 模块需要的全局数据 * API 模块需要的全局数据
+9 -8
View File
@@ -168,17 +168,18 @@ class API<
> { > {
/** /**
* 基础 URL * 默认调试标签
* TODO: 这里可能涉及负载均衡
*/ */
public static get baseUrl():string {
return "https://jwc.nogg.cn";
}
public static defaultLogLabel:LogLabel = new LogLabel( public static defaultLogLabel:LogLabel = new LogLabel(
`API:API`, colorRadio(200, 120, 222) `API:API`, colorRadio(200, 120, 222)
); );
/**
* 基础 URL
* TODO: 这里可能涉及负载均衡
*/
public baseUrl: string = "https://jwc.nogg.cn";
/** /**
* Logger 使用的标签 * Logger 使用的标签
*/ */
@@ -319,7 +320,7 @@ class API<
// 重置请求数据 // 重置请求数据
const requestData:IWxRequestOption<O> = this.requestData = { const requestData:IWxRequestOption<O> = this.requestData = {
url: API.baseUrl + this.url, url: this.baseUrl + this.url,
data: {}, header: {}, data: {}, header: {},
timeout: this.timeout, timeout: this.timeout,
method: this.method, method: this.method,
@@ -697,4 +698,4 @@ enum HTTPMethod {
} }
export default API; export default API;
export { API, IParamSetting, IAppAPIParam, ICallBack, HTTPMethod, RequestPolicy, GeneralCallbackResult } export { API, IParamSetting, IAppAPIParam, IAnyData, ICallBack, HTTPMethod, RequestPolicy, GeneralCallbackResult }
+250
View File
@@ -0,0 +1,250 @@
/**
* 数据层键值设置
*/
interface IDataParamSettingItem {
/**
* 类型
*/
type: any;
/**
* 键值是否可以获取
*/
isGet: boolean;
/**
* 键值是否可以设置
*/
isSet: boolean;
/**
* 是否仅为异步获取
*/
isGetAsync?: boolean;
/**
* 是否仅为异步设置
*/
isSetAsync?: boolean;
}
/**
* 数据层参数类型
*/
interface IDataParamSetting {
[x: string]: IDataParamSettingItem
}
type IGet<T> = () => T;
type IGetAsync<T> = () => Promise<T>;
type ISet<T> = (data: T) => INone;
type ISetAsync<T> = (data: T) => Promise<INone>;
type INone = undefined | void | unknown;
/**
* 注册表结构
*/
type IRegistryItem<S extends IDataParamSettingItem> = {
/**
* 获取方法
*/
get: S["isGetAsync"] extends true ? INone : S["isGet"] extends true ? IGet<S["type"]> : INone;
/**
* 异步获取方法
*/
getAsync: S["isGet"] extends true ? IGetAsync<S["type"]> : INone;
/**
* 设置方法
*/
set: S["isSetAsync"] extends true ? INone : S["isSet"] extends true ? ISet<S["type"]> : INone;
/**
* 异步设置方法
*/
setAsync: S["isSet"] extends true ? ISetAsync<S["type"]> : INone;
}
/**
* 注册表参数类型
*/
type IRegistry<D extends IDataParamSetting> = {
[P in keyof D]: IRegistryItem<D[P]>;
}
type IRegistryPartial<D extends IDataParamSetting> = {
[P in keyof D]?: Partial<IRegistryItem<D[P]>>;
}
type IAutoSelect<IF extends boolean, A, B> = IF extends true ? A : B;
/**
* Core 数据层架构
*
* 使用示例:
* ```typescript
* class TestData extends Data<{
* test: {
* type: number,
* isGet: true,
* isSet: true,
* isGetAsync: true
* }
* }> {
* public onLoad() {
* let dataObject = {key: 1}
* this.getter("test", () => 1);
* this.registerKeyFromObject("test", "key", dataObject);
* }
* }
* ```
*/
class Data<D extends IDataParamSetting> {
/**
* getter setter 注册表
*/
private registryList: IRegistryPartial<D> = {};
/**
* 加载函数
*/
public onLoad(): any {};
/**
* 注册一个 Setter 到键值上
* @param key 注册的键值
* @param setter 注册的 Setter
* @param isAsync 是否为异步函数
*/
protected setter<KEY extends keyof D> (key: KEY, setter: IRegistryItem<D[KEY]>["set"]): this
protected setter<KEY extends keyof D> (key: KEY, setter: IRegistryItem<D[KEY]>["setAsync"], isAsync: true): this
protected setter<
KEY extends keyof D,
ASYNC extends boolean
> (
key: KEY,
setter: IAutoSelect<ASYNC, IRegistryItem<D[KEY]>["setAsync"], IRegistryItem<D[KEY]>["set"]>,
isAsync?: ASYNC
): this {
// 如果此键值不存在,新建
if (!this.registryList[key]) this.registryList[key] = {};
// 设置异步 setter
if (isAsync) this.registryList[key]!.setAsync = setter as IRegistryItem<D[KEY]>["setAsync"];
// 设置同步 setter
else this.registryList[key]!.set = setter as IRegistryItem<D[KEY]>["set"];
return this;
}
/**
* 注册一个 Getter 到键值上
* @param key 注册的键值
* @param getter 注册的 Getter
* @param isAsync 是否为异步函数
*/
protected getter<KEY extends keyof D> (key: KEY, getter: IRegistryItem<D[KEY]>["get"]): this
protected getter<KEY extends keyof D> (key: KEY, getter: IRegistryItem<D[KEY]>["getAsync"], isAsync: true): this
protected getter<
KEY extends keyof D,
ASYNC extends boolean
> (
key: KEY,
getter: IAutoSelect<ASYNC, IRegistryItem<D[KEY]>["getAsync"], IRegistryItem<D[KEY]>["get"]>,
isAsync?: ASYNC
): this {
// 如果此键值不存在,新建
if (!this.registryList[key]) this.registryList[key] = {};
// 设置异步 getter
if (isAsync) this.registryList[key]!.getAsync = getter as IRegistryItem<D[KEY]>["getAsync"];
// 设置同步 getter
else this.registryList[key]!.get = getter as IRegistryItem<D[KEY]>["get"];
return this;
}
/**
* 将对象的键值关联到 Data 层中
* @param key Data 层键值
* @param keyFromObject 对象源键值
* @param object 关联对象
*/
protected registerKeyFromObject<
KEY extends keyof D,
F extends keyof O,
O extends {[K in F]: D[KEY]["type"]}
> (key: KEY, keyFromObject: F, object: O) {
// 注册同步获取
this.getter(key, () => {
return object[keyFromObject]
});
// 注册同步设置
this.setter(key, (data: any) => {
object[keyFromObject] = data
})
}
/**
* 导出数据对象
* @returns 数据对象
*/
public export(): IRegistry<D> {
this.autoFillFunction();
return this.registryList as IRegistry<D>;
}
/**
* 自动填充缺失的异步函数
* 在注册表中搜索全部的同步函数
* 并自动填充对应的异步函数
* 此函数会在 export 前静默执行
*/
protected autoFillFunction(): void {
// 填充函数
const fillFunction = <KEY extends keyof D>(key: KEY): void => {
const item = this.registryList[key] as IRegistryItem<D[KEY]>;
if (!item) return;
// 检验 getter
if (item.get && !item.getAsync) {
item.getAsync = this.syncFn2AsyncFn(item.get as IGet<D[KEY]["type"]>);
}
// 检验 setter
if (item.set && !item.setAsync) {
item.setAsync = this.syncFn2AsyncFn(item.set as ISet<D[KEY]["type"]>);
}
}
// 在注册表中查找
for (const key in this.registryList) fillFunction(key);
}
/**
* 将同步函数转换为异步函数
* @param fn 同步函数
*/
protected syncFn2AsyncFn<D, H extends (IGet<D> | ISet<D>)> (fn: H):
IAutoSelect<H extends IGet<D> ? true : false, IGetAsync<D>, ISetAsync<D>> {
const asyncFn = async (...param: [D]) => {
return fn(...param);
};
return asyncFn as any;
}
}
+21
View File
@@ -491,6 +491,27 @@ class Manager<WXC extends AnyWXContext = AnyWXContext> {
}) })
} }
/**
* 异步页面加载
*
* *注意*
* 页面模块加载后,必须手动执行 loadAllModule
* loadAllModule Modular 才会真正的被加载
* 模块加载后可以处理逻辑绑定
*/
public static async PageAsync(): Promise<{
manager: Manager<AnyWXContext>,
query: Record<string, string | undefined>
}> {
return new Promise((solve) => {
Page({
async onLoad(query) {
let manager = new Manager(this);
await solve({ manager, query });
}
})
});
}
} }
export { Manager, Modular, AnyWXContext, WXContext, ILifetime} export { Manager, Modular, AnyWXContext, WXContext, ILifetime}
View File
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
<style type="text/css">
.st0{fill:#F4F0F1;}
.st1{fill:#FFFFFF;}
.st2{fill:#3EA3D8;}
.st3{fill:#CCCCCC;}
.st4{fill:none;stroke:#CCCCCC;stroke-linecap:square;stroke-miterlimit:10;}
.st5{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;}
.st6{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;stroke-dasharray:1.9084,1.9084;}
.st7{fill:#1A1A1A;}
.st8{fill:none;stroke:#1A1A1A;stroke-width:3;stroke-miterlimit:10;}
.st9{fill:none;stroke:#1A1A1A;stroke-miterlimit:10;}
.st10{fill:none;stroke:#E6E6E6;stroke-miterlimit:10;}
.st11{fill:#666666;}
.st12{fill:none;stroke:#B3B3B3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
.st13{fill:#B3B3B3;}
.st14{opacity:0.05;}
.st15{clip-path:url(#SVGID_00000148643560888163687730000014354677953684036249_);}
.st16{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;}
.st17{opacity:0.4;fill:#3EA3D8;}
.st18{fill:none;stroke:#3EA3D8;stroke-miterlimit:10;}
.st19{fill:none;stroke:#3EA3D8;stroke-width:11;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
</style>
<g id="A1">
<g id="NAV_x5F_BAR_00000129914889952932149030000011711506177042644156_">
</g>
<g id="HEADER_x5F_BAR_00000015351907221170818370000001589878730520391302_">
</g>
<g id="FUNC_x5F_LIST">
</g>
<g id="MAIN_x5F_FUNC">
</g>
<g id="USER_x5F_CARD">
<g id="BG" class="st14">
</g>
</g>
</g>
<g id="ICON">
<polyline class="st19" points="17.39,10.88 83.65,50 17.39,89.12 "/>
</g>
<g id="DEFAULT_x5F_AVATOR">
</g>
<g id="COLOR">
</g>
<g id="NAV_x5F_BAR">
<g id="ICON_x5F_SETTING">
</g>
<g id="ICON_x5F_INFO">
</g>
<g id="ICON_x5F_KCB">
</g>
</g>
<g id="HEADER_x5F_BAR">
<g id="BUTTON">
</g>
<g id="TOP">
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

+65
View File
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
<style type="text/css">
.st0{fill:#F4F0F1;}
.st1{fill:#FFFFFF;}
.st2{fill:#3EA3D8;}
.st3{fill:#CCCCCC;}
.st4{fill:none;stroke:#CCCCCC;stroke-linecap:square;stroke-miterlimit:10;}
.st5{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;}
.st6{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;stroke-dasharray:1.9084,1.9084;}
.st7{fill:#1A1A1A;}
.st8{fill:none;stroke:#1A1A1A;stroke-width:3;stroke-miterlimit:10;}
.st9{fill:none;stroke:#1A1A1A;stroke-miterlimit:10;}
.st10{fill:none;stroke:#E6E6E6;stroke-miterlimit:10;}
.st11{fill:#666666;}
.st12{fill:none;stroke:#B3B3B3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
.st13{fill:#B3B3B3;}
.st14{opacity:0.05;}
.st15{clip-path:url(#SVGID_00000174590641328129768410000008888487617591348397_);}
.st16{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;}
.st17{opacity:0.4;fill:#3EA3D8;}
.st18{fill:none;stroke:#3EA3D8;stroke-miterlimit:10;}
.st19{fill:none;stroke:#3EA3D8;stroke-width:11;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
</style>
<g id="A1">
<g id="NAV_x5F_BAR_00000129914889952932149030000011711506177042644156_">
</g>
<g id="HEADER_x5F_BAR_00000015351907221170818370000001589878730520391302_">
</g>
<g id="FUNC_x5F_LIST">
</g>
<g id="MAIN_x5F_FUNC">
</g>
<g id="USER_x5F_CARD">
<g id="BG" class="st14">
</g>
</g>
</g>
<g id="ICON">
<g>
<line class="st19" x1="10.88" y1="10.88" x2="89.12" y2="89.12"/>
<line class="st19" x1="89.12" y1="10.88" x2="10.88" y2="89.12"/>
</g>
</g>
<g id="DEFAULT_x5F_AVATOR">
</g>
<g id="COLOR">
</g>
<g id="NAV_x5F_BAR">
<g id="ICON_x5F_SETTING">
</g>
<g id="ICON_x5F_INFO">
</g>
<g id="ICON_x5F_KCB">
</g>
</g>
<g id="HEADER_x5F_BAR">
<g id="BUTTON">
</g>
<g id="TOP">
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

+1 -1
View File
@@ -18,7 +18,7 @@
.st12{fill:none;stroke:#B3B3B3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;} .st12{fill:none;stroke:#B3B3B3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
.st13{fill:#B3B3B3;} .st13{fill:#B3B3B3;}
.st14{opacity:0.05;} .st14{opacity:0.05;}
.st15{clip-path:url(#SVGID_00000119811792014936471320000011453116645578675119_);} .st15{clip-path:url(#SVGID_00000000193655916124849200000001531564748471850152_);}
.st16{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;} .st16{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;}
.st17{opacity:0.4;fill:#3EA3D8;} .st17{opacity:0.4;fill:#3EA3D8;}
.st18{fill:none;stroke:#3EA3D8;stroke-miterlimit:10;} .st18{fill:none;stroke:#3EA3D8;stroke-miterlimit:10;}

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

+45
View File
@@ -0,0 +1,45 @@
@import "../../app.scss";
view.mask {
position: fixed;
width: 100%;
height: 100%;
background-color: rgba($color: #000000, $alpha: .2);
z-index: 1;
}
view.mask.block {
display: block;
}
view.mask.none {
display: none;
}
view.mask.show {
animation: show .1s cubic-bezier(0, 0, 1, 1) both;
opacity: 1;
}
view.mask.hide {
animation: hide .1s cubic-bezier(0, 0, 1, 1) both;
opacity: 0;
}
@keyframes show{
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes hide{
from {
opacity: 1;
}
to {
opacity: 0;
}
}
+115
View File
@@ -0,0 +1,115 @@
import { Modular, Manager } from "../../core/Module";
/**
* 蒙版事件
*/
type IMaskEvent = {
/**
* 蒙版显示事件
*/
show: void;
/**
* 蒙版隐藏事件
*/
hide: void;
/**
* 蒙版状态改变事件
*/
change: boolean;
/**
* 蒙版点击事件
*/
click: void;
}
/**
* 蒙版 Modular
*/
class Mask<M extends Manager> extends Modular<M, {}, IMaskEvent> {
/**
* 动画运行时间
*/
public static readonly animateTime: number = 100;
public data? = {
/**
* 蒙版的层级
*/
zIndex: 1,
/**
* 蒙版是否显示
*/
isDisplay: false,
/**
* 蒙版是否显示
*/
isShow: false
};
/**
* 当点击时是否自动关闭蒙版
*/
public autoCloseOnClick: boolean = true;
/**
* 消失动画计时器
*/
private disappearTimer?: number;
public override onLoad() {
this.setFunc(this.handleClickMask, "handleClickMask");
this.on("show", this.showMask);
this.on("hide", this.hideMask);
}
/**
* 显示蒙版
*/
private showMask = () => {
this.disappearTimer && clearTimeout(this.disappearTimer);
this.setData({
isShow: true,
isDisplay: true
});
this.emit("change", true);
}
/**
* 隐藏蒙版
*/
private hideMask = () => {
this.setData({
isShow: false
});
this.disappearTimer = setTimeout(() => {
this.setData({
isDisplay: false
});
}, Mask.animateTime);
this.emit("change", false);
}
/**
* 处理蒙版点击事件
*/
private handleClickMask() {
if (this.autoCloseOnClick) this.emit("hide", void 0);
this.emit("click", void 0);
}
}
export { Mask };
export default Mask;
+49
View File
@@ -0,0 +1,49 @@
@import "../../app.scss";
view.popups {
position: fixed;
width: 75%;
height: 75%;
margin:auto;
left:0;
right:0;
top:0;
bottom:0;
background-color: $theme-color-light-layout;
border-radius: 15px;
z-index: 2;
}
view.popups.block {
display: block;
}
view.popups.none {
display: none;
}
view.popups.show {
animation-duration: 0.5s;
animation-name: show;
}
view.popups.hide {
animation-duration: 0.5s;
animation-name: hide;
}
@keyframes show{
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes hide{
from {
opacity: 1;
}
to {
opacity: 0;
}
}
+58
View File
@@ -0,0 +1,58 @@
import { Modular, Manager } from "../../core/Module";
class Popups<M extends Manager> extends Modular<M> {
/**
* 动画运行时间
*/
public static readonly animateTime: number = 100;
public data? = {
/**
* 弹出层是否显示
*/
display:false,
/**
* 弹出层动画
*/
isShow:false
};
disappearTimer: number | undefined;
/**
* 显示弹出层
*/
public showPopups() {
this.setData({
isShow:true,
display:true
});
}
/**
* 隐藏弹出层
*/
public hidePopups() {
this.setData({
isShow:false
});
this.disappearTimer = setTimeout(() => {
this.setData({
display: false
});
}, Popups.animateTime);
}
public override onLoad() {
// Do something
}
}
export { Popups };
export default Popups;
+8
View File
@@ -1,3 +1,11 @@
@import "./UserCard.scss"; @import "./UserCard.scss";
@import "./MainFunction.scss"; @import "./MainFunction.scss";
@import "./FunctionList.scss"; @import "./FunctionList.scss";
@import "../../modular/Mask/Mask.scss";
@import "../../modular/Popups/Popups.scss";
view.container{
padding-top: 50rpx;
}
+22 -3
View File
@@ -2,9 +2,28 @@ import { Manager } from "../../core/Module";
import { UserCard } from "./UserCard"; import { UserCard } from "./UserCard";
import { MainFunction } from "./MainFunction"; import { MainFunction } from "./MainFunction";
import { FunctionList } from "./FunctionList"; import { FunctionList } from "./FunctionList";
import { Mask } from "../../modular/Mask/Mask";
import {Popups} from "../../modular/Popups/Popups"
Manager.Page((manager) => { (async () => {
manager.addModule(UserCard, "userCard");
// 初始化页面
const { manager, query } = await Manager.PageAsync();
// 添加蒙版 Modular
const mask = manager.addModule(Mask, "mask");
const popups = manager.addModule(Popups,"popups")
// 添加 UserCard Modular
manager.addModule(UserCard, "userCard", { mask, popups });
// 添加 MainFunction Modular
manager.addModule(MainFunction, "mainFunction"); manager.addModule(MainFunction, "mainFunction");
// 添加 FunctionList Modular
manager.addModule(FunctionList, "functionList"); manager.addModule(FunctionList, "functionList");
});
// 初始化全部 Modular
await manager.loadAllModule(query);
})();
+59 -5
View File
@@ -1,3 +1,9 @@
<!-- 蒙版 -->
<view class="mask {{ mask$isShow ? 'show' : 'hide' }} {{ mask$isDisplay ? 'block' : 'none' }}"
bindtap="mask$handleClickMask"></view>
<!-- 弹出层 -->
<view class="popups" style="display:{{popups$isShow ? 'block' : 'none'}}"></view>
<!-- 顶部的阴影 --> <!-- 顶部的阴影 -->
<view class="top-shadow"></view> <view class="top-shadow"></view>
@@ -11,12 +17,60 @@
<open-data type="userAvatarUrl" /> <open-data type="userAvatarUrl" />
</view> </view>
<view class="info"> <view class="info">
<view class="nick h1">
<open-data type="userNickName" /> <!-- 主题变换按钮 -->
</view> <view class="theme">
<view class="student">秦浩轩</view> <view bindtap="userCard$changeTheme">
<view class="student">1806240113</view> <image class="icon-sub" src="../../image/account/Account_Theme.svg" />
</view> </view>
</view> </view>
<!-- 用户昵称 -->
<view class="nick h1">
<open-data type="userNickName" />
</view>
<!-- 学生信息 -->
<view class="student">
<view class="name">秦浩轩</view>
<view class="certified">
<view class="certifi-info">已认证</view>
<image class="text-icon" src="../../image/account/Account_OK.svg"></image>
</view>
</view>
<!-- 学号信息 -->
<view class="student-id">1806240113</view>
<!-- 学校 -->
<view class="school">大连工业大学</view>
</view>
</view>
<!--主要功能-->
<view class="card main-function">
<!--每个功能的容器-->
<view class="branch-funtion" wx:for="{{ mainFunction$mainFunctionList }}" wx:key="index">
<view style="{{ index == (mainFunction$mainFunctionList - 1) ? 'border-bottom: 0px' : '' }}">
<!--每个功能的图片-->
<image class="icon" src="../../image/account/Account_{{ item.iconUrl }}.svg"></image>
<!--每个功能的文字-->
<view>{{ item.displayName }}</view>
</view>
</view>
</view>
<!-- 功能列表 -->
<view class="card function-list">
<!-- 每一行 -->
<view class="function" wx:for="{{ functionList$functionList }}" wx:key="index">
<view style="{{ index == (functionList$functionList.length - 1) ? 'border-bottom: 0px' : '' }}">
<image class="icon func-icon" src="../../image/account/Account_{{ item.iconUrl }}.svg" />
<view>{{ item.displayName }}</view>
<image class="icon-sub arrow" src="../../image/account/Account_Arrow.svg" />
</view>
</view>
</view>
</view> </view>
@@ -1 +1,43 @@
@import "../../app.scss"; @import "../../app.scss";
view.function-list {
margin-top: 50rpx;
margin-bottom: 50rpx;
padding: 0 0 !important;
width: 100% !important;
view.function {
padding: 0 20px;
width: calc( 100% - 40px );
height: 55px;
> view {
height: 100%;
display: flex;
align-items: center;
border-bottom: 1px solid rgba($color: #000000, $alpha: .1);
image.func-icon {
width: 26px;
height: 26px;
}
view {
margin-left: 15px;
flex-grow: 1;
font-size: .9em;
}
image.arrow {
width: 10px;
height: 10px;
}
}
}
}
@media (prefers-color-scheme: dark) {
view.function-list view.function > view {
border-bottom: 1px solid rgba($color: #ffffff, $alpha: .1);
}
}
+25
View File
@@ -1,7 +1,32 @@
import { Modular, Manager } from "../../core/Module"; import { Modular, Manager } from "../../core/Module";
interface IFunctionListItem {
/**
* 显示名称
*/
displayName: string;
/**
* 图标路径
*/
iconUrl: string;
}
class FunctionList<M extends Manager> extends Modular<M> { class FunctionList<M extends Manager> extends Modular<M> {
public static readonly functionList: IFunctionListItem[] = [
{ displayName: "赞助计划", iconUrl: "Sponsor" },
{ displayName: "公众号", iconUrl: "PubilcAccount" },
{ displayName: "自助问答", iconUrl: "FAQ" },
{ displayName: "关于我们", iconUrl: "AboutUs" },
{ displayName: "联系客服", iconUrl: "Support" }
];
public data = {
functionList: FunctionList.functionList
};
public override onLoad() { public override onLoad() {
// Do something // Do something
} }
@@ -1 +1,39 @@
@import "../../app.scss"; @import "../../app.scss";
//主要功能
view.main-function {
display: flex;
margin-top: 50rpx;
padding: 0 !important;
width: 100% !important;
view.branch-funtion {
padding: 13px 0;
width: 100%;
> view {
display: flex;
flex-direction: column;
align-items: center;
justify-self: center;
border-right: 1px solid rgba($color: #000000, $alpha: .1);
image {
height: 35px;
width: 35px;
}
view {
text-align: center;
margin-top: 5px;
font-size: .9em;
}
}
}
}
@media (prefers-color-scheme: dark) {
view.main-function view.branch-funtion > view {
border-right: 1px solid rgba($color: #ffffff, $alpha: .1);
}
}
+24
View File
@@ -1,7 +1,31 @@
import { Modular, Manager } from "../../core/Module"; import { Modular, Manager } from "../../core/Module";
interface IMainFunctionItem {
/**
* 显示名称
*/
displayName: string;
/**
* 图标路径
*/
iconUrl: string;
}
class MainFunction<M extends Manager> extends Modular<M> { class MainFunction<M extends Manager> extends Modular<M> {
public static readonly MainFunctionList: IMainFunctionItem[] = [
{ displayName: "账号信息", iconUrl: "UserInfo" },
{ displayName: "课表缓存", iconUrl: "DateList" },
{ displayName: "功能定制", iconUrl: "Customer" },
{ displayName: "更多设置", iconUrl: "Settings" }
];
public data? = {
mainFunctionList: MainFunction.MainFunctionList
}
public override onLoad() { public override onLoad() {
// Do something // Do something
} }
+62 -6
View File
@@ -2,29 +2,85 @@
// 用户卡片 // 用户卡片
view.user-card { view.user-card {
margin-top: 20px;
height: 100px;
display: flex; display: flex;
align-items: center;
padding-top: 20px; padding-top: 20px;
padding-bottom: 20px; padding-bottom: 20px;
view.avatar { view.avatar {
flex-basis: 80px;
width: 80px; width: 80px;
height: 80px; height: 80px;
border-radius: 1000px; border-radius: 1000px;
flex-shrink: 0;
overflow: hidden; overflow: hidden;
} }
view.info { view.info {
width: calc(100% - 80px - 20px); flex-grow: 1;
padding-left: 20px; padding-left: 20px;
max-width: calc(100% - 80px - 20px);
view.nick { view.theme {
margin: 4px 0; width: 100%;
padding: 20px 0 10px 0;
display: flex;
justify-content: flex-end;
view {
width: 23px;
height: 23px;
padding: 20px;
margin: -20px;
border-radius: 20px;
image {
width: 100%;
height: 100%;
}
}
} }
view.nick {
margin-bottom: 6px;
word-break: keep-all;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
// 学生信息
view.student { view.student {
margin: 1px 0; display: flex;
align-items: center;
view.certified {
color: $theme-color-blue;
border: 1px solid $theme-color-blue;
border-radius: 4px;
margin-left: .3em;
font-size: .85em;
height: 1.2em;
padding: 0 2px;
display: flex;
justify-content: center;
align-items: center;
image.text-icon {
margin-left: .25em;
width: 10px;
height: 10px;
}
}
}
view.student-id {
margin-bottom: 3px;
}
view.school {
text-align: right;
padding: 10px 0 20px 0;
} }
} }
} }
+26 -2
View File
@@ -1,9 +1,33 @@
import Popups from "modular/Popups/Popups";
import { Modular, Manager } from "../../core/Module"; import { Modular, Manager } from "../../core/Module";
import { Mask } from "../../modular/Mask/Mask";
class UserCard<M extends Manager> extends Modular<M> { type IUserCardDependent<M extends Manager> = {
mask: Mask<M>
popups: Popups<M>
}
type IUserCardEvent = {
/**
* 主题更换按钮点击事件
*/
clickChangeTheme: void;
}
class UserCard<M extends Manager> extends Modular<M, IUserCardDependent<M>, IUserCardEvent> {
public override onLoad() { public override onLoad() {
// Do something this.setFunc(this.handleChangeTheme, "changeTheme")
}
/**
* 处理主题更换
*/
private handleChangeTheme() {
this.depends?.popups.showPopups();
this.depends?.mask.emit("show", void 0);
this.emit("clickChangeTheme", void 0);
} }
} }
+9 -6
View File
@@ -1,5 +1,6 @@
import { Modular, Manager, ILifetime } from "../../core/Module"; import { Modular, Manager, ILifetime } from "../../core/Module";
import { Login } from "../../api/Login"; import { Login } from "../../api/Login";
import { Schedlue } from "../../api/Schedule"
import { Storage } from "../../core/Storage"; import { Storage } from "../../core/Storage";
/** /**
@@ -28,12 +29,14 @@ implements Partial<ILifetime> {
s.set("be", 12); s.set("be", 12);
}, 1000) }, 1000)
new Login().param({studentId: "1806240113", password: "qazxsw123"}) // new Login().param({studentId: "2017060129", password: ""})
.request().wait({ // .request().wait({
ok: (w) => {console.log("ok", w)}, // ok: (w) => {console.log("ok", w)},
no: (w) => {console.log("no", w)}, // no: (w) => {console.log("no", w)},
done: (w) => {console.log("done", w)} // done: (w) => {console.log("done", w)}
}); // });
// new Schedlue().param({cookie:"C729D1AB1B17077485ACCD9279135C22",semester:"2020-2021-2"})
// .request()
} }
} }
+12 -2
View File
@@ -6,7 +6,17 @@ import { TestCore } from "./TestCore";
* 此页面使用 Manager 进行模块化管理 * 此页面使用 Manager 进行模块化管理
* 若要添加先功能请先定义 Modular 并添加至 Manager * 若要添加先功能请先定义 Modular 并添加至 Manager
*/ */
Manager.Page((manager)=>{ (async () => {
// 初始化页面
const { manager, query } = await Manager.PageAsync();
// 添加 StatusBar Modular
manager.addModule(StatusBar, "statusBar"); manager.addModule(StatusBar, "statusBar");
// 添加 TestCore Modular
manager.addModule(TestCore, "testCore"); manager.addModule(TestCore, "testCore");
})
// 初始化全部 Modular
await manager.loadAllModule(query);
})()
+3 -3
View File
@@ -26,9 +26,9 @@
"uploadWithSourceMap": true, "uploadWithSourceMap": true,
"compileHotReLoad": false, "compileHotReLoad": false,
"lazyloadPlaceholderEnable": false, "lazyloadPlaceholderEnable": false,
"useMultiFrameRuntime": false, "useMultiFrameRuntime": true,
"useApiHook": false, "useApiHook": true,
"useApiHostProcess": false, "useApiHostProcess": true,
"babelSetting": { "babelSetting": {
"ignore": [], "ignore": [],
"disablePlugins": [], "disablePlugins": [],
+7
View File
@@ -1,4 +1,5 @@
{ {
"setting": {},
"condition": { "condition": {
"plugin": { "plugin": {
"list": [] "list": []
@@ -16,6 +17,12 @@
"pathName": "pages/Account/Account", "pathName": "pages/Account/Account",
"query": "", "query": "",
"scene": null "scene": null
},
{
"name": "pages/Account/Account",
"pathName": "pages/Account/Account",
"query": "",
"scene": null
} }
] ]
} }