Merge 'master' into dev-yzy

This commit is contained in:
2022-01-21 20:04:13 +08:00
17 changed files with 712 additions and 162 deletions
+19 -4
View File
@@ -5,10 +5,25 @@ import { FunctionList } from "./FunctionList";
import { Mask } from "../../modular/Mask/Mask";
import {Popups} from "../../modular/Popups/Popups"
Manager.Page((manager) => {
const popups = manager.addModule(Popups,"popups")
(async () => {
// 初始化页面
const { manager, query } = await Manager.PageAsync();
// 添加蒙版 Modular
const mask = manager.addModule(Mask, "mask");
manager.addModule(UserCard, "userCard", { mask,popups });
const popups = manager.addModule(Popups,"popups")
// 添加 UserCard Modular
manager.addModule(UserCard, "userCard", { mask, popups });
// 添加 MainFunction Modular
manager.addModule(MainFunction, "mainFunction");
// 添加 FunctionList Modular
manager.addModule(FunctionList, "functionList");
});
// 初始化全部 Modular
await manager.loadAllModule(query);
})();
+17 -31
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="popups" style="display:{{popups$isShow ? 'block' : 'none'}}"></view>
@@ -47,42 +48,27 @@
</view>
<!--主要功能-->
<view class="card main-function"><!--四个功能合在一起的容器-->
<view class="branch-funtion">
<view><!--每个功能的容器-->
<image class="icon" src="../../image/account/Account_UserInfo.svg"></image><!--每个功能的图片-->
<view>账号信息</view><!--每个功能的文字-->
</view>
</view>
<view class="branch-funtion">
<view>
<image class="icon" src="../../image/account/Account_DateList.svg"></image>
<view>课表缓存</view>
</view>
</view>
<view class="branch-funtion">
<view>
<image class="icon" src="../../image/account/Account_Customer.svg"></image>
<view>功能定制</view>
</view>
</view>
<view class="branch-funtion">
<view style="border-right: 0px;">
<image class="icon" src="../../image/account/Account_Settings.svg"></image>
<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:for-index="index" wx:key="id">
<view style="{{item.id == (functionList$functionList.length - 1) ? 'border-bottom: 0px' : ''}}">
<image class="icon func-icon" src="../../image/account/Account_{{item.iconUrl}}.svg" />
<view>{{item.displayName}}</view>
<!-- 每一行 -->
<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>
+3 -18
View File
@@ -2,11 +2,6 @@ import { Modular, Manager } from "../../core/Module";
interface IFunctionListItem {
/**
* id
*/
id?: number
/**
* 显示名称
*/
@@ -18,10 +13,6 @@ interface IFunctionListItem {
iconUrl: string;
}
interface IFunctionListData {
functionList?: IFunctionListItem[];
};
class FunctionList<M extends Manager> extends Modular<M> {
public static readonly functionList: IFunctionListItem[] = [
@@ -32,18 +23,12 @@ class FunctionList<M extends Manager> extends Modular<M> {
{ displayName: "联系客服", iconUrl: "Support" }
];
public data: IFunctionListData = {
functionList: undefined
public data = {
functionList: FunctionList.functionList
};
public override onLoad() {
console.log(FunctionList.functionList)
this.setData({
functionList: FunctionList.functionList.map((value, index) => {
value.id = index;
return value;
})
})
// Do something
}
}
+24
View File
@@ -1,6 +1,30 @@
import { Modular, Manager } from "../../core/Module";
interface IMainFunctionItem {
/**
* 显示名称
*/
displayName: string;
/**
* 图标路径
*/
iconUrl: string;
}
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() {
// Do something
+12 -3
View File
@@ -4,10 +4,18 @@ import { Mask } from "../../modular/Mask/Mask";
type IUserCardDependent<M extends Manager> = {
mask: Mask<M>
popups:Popups<M>
popups: Popups<M>
}
class UserCard<M extends Manager> extends Modular<M, IUserCardDependent<M>> {
type IUserCardEvent = {
/**
* 主题更换按钮点击事件
*/
clickChangeTheme: void;
}
class UserCard<M extends Manager> extends Modular<M, IUserCardDependent<M>, IUserCardEvent> {
public override onLoad() {
this.setFunc(this.handleChangeTheme, "changeTheme")
@@ -17,8 +25,9 @@ class UserCard<M extends Manager> extends Modular<M, IUserCardDependent<M>> {
* 处理主题更换
*/
private handleChangeTheme() {
this.depends?.mask.showMask();
this.depends?.popups.showPopups();
this.depends?.mask.emit("show", void 0);
this.emit("clickChangeTheme", void 0);
}
}