11 Commits
6 changed files with 186 additions and 16 deletions
+110
View File
@@ -0,0 +1,110 @@
import { API, HTTPMethod, IParamSetting, GeneralCallbackResult} from "../core/Api";
interface IScheduleInput {
/**
* session
*/
cookie: string;
/**
* 学期
*/
semester: string;
}
interface IClassData {
/**
* 课程名字
*/
name: string;
/**
* 上课地点
*/
room?: string;
/**
* 课程老师
*/
teacher?: string;
/**
* 周数
*/
week: string;
}
interface IScheduleOutput {
/**
* 课程列表
*/
classList: IClassData[];
/**
* 稀疏矩阵编号
*/
index: number;
}[];
interface IScheduleEvent {
/**
* session 过期
*/
expire: GeneralCallbackResult;
/**
* 登录失败
*/
unauthorized: GeneralCallbackResult;
/**
* 未知的问题
*/
error: GeneralCallbackResult;
/**
* 数据损坏或丢失
*/
badData: GeneralCallbackResult;
}
/**
* Schedule API
* 需要session与semester
* 此 API 用来向教务处发起获取课程表的请求
* 请求成功后将获得教务处返回的课程表JSON文件
*/
class Schedlue extends API<IScheduleInput, IScheduleOutput, IScheduleEvent> {
public override baseUrl: string = "jwc.2333.pub";
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.addFailedCallBack();
}
}
export { Schedlue };
export default Schedlue;
+8 -7
View File
@@ -168,16 +168,17 @@ 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,
+37
View File
@@ -1,3 +1,4 @@
@import "../../app.scss";
view.mask { view.mask {
position: fixed; position: fixed;
@@ -5,4 +6,40 @@ view.mask {
height: 100%; height: 100%;
background-color: rgba($color: #000000, $alpha: .2); background-color: rgba($color: #000000, $alpha: .2);
z-index: 1; 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;
}
} }
+23 -2
View File
@@ -2,6 +2,11 @@ import { Modular, Manager } from "../../core/Module";
class Mask<M extends Manager> extends Modular<M> { class Mask<M extends Manager> extends Modular<M> {
/**
* 动画运行时间
*/
public static readonly animateTime: number = 100;
public data? = { public data? = {
/** /**
@@ -9,6 +14,11 @@ class Mask<M extends Manager> extends Modular<M> {
*/ */
zIndex: 1, zIndex: 1,
/**
* 蒙版是否显示
*/
isDisplay: false,
/** /**
* 蒙版是否显示 * 蒙版是否显示
*/ */
@@ -21,14 +31,25 @@ class Mask<M extends Manager> extends Modular<M> {
* 显示蒙版 * 显示蒙版
*/ */
public showMask() { public showMask() {
this.setData({ isShow: true }); this.setData({
isShow: true,
isDisplay: true
});
} }
/** /**
* 隐藏蒙版 * 隐藏蒙版
*/ */
public hideMask() { public hideMask() {
this.setData({ isShow: false }); this.setData({
isShow: false
});
this.disappearTimer = setTimeout(() => {
this.setData({
isDisplay: false
});
}, Mask.animateTime);
} }
public override onLoad() { public override onLoad() {
+2 -1
View File
@@ -1,5 +1,6 @@
<!-- 蒙版 --> <!-- 蒙版 -->
<view class="mask" bindtap="mask$handleClickMask" style="display:{{mask$isShow ? 'block' : 'none'}}"></view> <view class="mask {{ mask$isShow ? 'show' : 'hide' }} {{ mask$isDisplay ? 'block' : 'none' }}"
bindtap="mask$handleClickMask"></view>
<!-- 顶部的阴影 --> <!-- 顶部的阴影 -->
<view class="top-shadow"></view> <view class="top-shadow"></view>
+6 -6
View File
@@ -28,12 +28,12 @@ implements Partial<ILifetime> {
s.set("be", 12); s.set("be", 12);
}, 1000) }, 1000)
// new Login().param({studentId: "1806240113", password: ""}) new Login().param({studentId: "2017060129", password: "hch2000210%"})
// .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)}
// }); });
} }
} }