7 Commits
8 changed files with 137 additions and 47 deletions
+8
View File
@@ -0,0 +1,8 @@
view.mask {
position: fixed;
width: 100%;
height: 100%;
background-color: rgba($color: #000000, $alpha: .2);
z-index: 1;
}
+45
View File
@@ -0,0 +1,45 @@
import { Modular, Manager } from "../../core/Module";
class Mask<M extends Manager> extends Modular<M> {
public data? = {
/**
* 蒙版的层级
*/
zIndex: 1,
/**
* 蒙版是否显示
*/
isShow: false
};
private disappearTimer?: number;
/**
* 显示蒙版
*/
public showMask() {
this.setData({ isShow: true });
}
/**
* 隐藏蒙版
*/
public hideMask() {
this.setData({ isShow: false });
}
public override onLoad() {
this.setFunc(this.handleClickMask, "handleClickMask");
// Do something
}
private handleClickMask() {
this.hideMask();
}
}
export { Mask };
export default Mask;
+1 -1
View File
@@ -1,7 +1,7 @@
@import "./UserCard.scss"; @import "./UserCard.scss";
@import "./MainFunction.scss"; @import "./MainFunction.scss";
@import "./FunctionList.scss"; @import "./FunctionList.scss";
@import "../../modular/Mask/Mask.scss";
view.container{ view.container{
padding-top: 50rpx; padding-top: 50rpx;
+3 -1
View File
@@ -2,9 +2,11 @@ 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";
Manager.Page((manager) => { Manager.Page((manager) => {
manager.addModule(UserCard, "userCard"); const mask = manager.addModule(Mask, "mask");
manager.addModule(UserCard, "userCard", { mask });
manager.addModule(MainFunction, "mainFunction"); manager.addModule(MainFunction, "mainFunction");
manager.addModule(FunctionList, "functionList"); manager.addModule(FunctionList, "functionList");
}); });
+9 -37
View File
@@ -1,3 +1,5 @@
<!-- 蒙版 -->
<view class="mask" bindtap="mask$handleClickMask" style="display:{{mask$isShow ? 'block' : 'none'}}"></view>
<!-- 顶部的阴影 --> <!-- 顶部的阴影 -->
<view class="top-shadow"></view> <view class="top-shadow"></view>
@@ -14,8 +16,10 @@
<!-- 主题变换按钮 --> <!-- 主题变换按钮 -->
<view class="theme"> <view class="theme">
<view bindtap="userCard$changeTheme">
<image class="icon-sub" src="../../image/account/Account_Theme.svg" /> <image class="icon-sub" src="../../image/account/Account_Theme.svg" />
</view> </view>
</view>
<!-- 用户昵称 --> <!-- 用户昵称 -->
<view class="nick h1"> <view class="nick h1">
@@ -27,7 +31,7 @@
<view class="name">秦浩轩</view> <view class="name">秦浩轩</view>
<view class="certified"> <view class="certified">
<view class="certifi-info">已认证</view> <view class="certifi-info">已认证</view>
<view class="text-icon">√</view> <image class="text-icon" src="../../image/account/Account_OK.svg"></image>
</view> </view>
</view> </view>
@@ -72,42 +76,10 @@
<!-- 功能列表 --> <!-- 功能列表 -->
<view class="card function-list"> <view class="card function-list">
<view class="function"> <view class="function" wx:for="{{functionList$functionList}}" wx:for-index="index" wx:key="id">
<view> <view style="{{item.id == (functionList$functionList.length - 1) ? 'border-bottom: 0px' : ''}}">
<image class="icon func-icon" src="../../image/account/Account_Sponsor.svg" /> <image class="icon func-icon" src="../../image/account/Account_{{item.iconUrl}}.svg" />
<view>赞助计划</view> <view>{{item.displayName}}</view>
<image class="icon-sub arrow" src="../../image/account/Account_Arrow.svg" />
</view>
</view>
<view class="function">
<view>
<image class="icon func-icon" src="../../image/account/Account_PubilcAccount.svg" />
<view>公众号</view>
<image class="icon-sub arrow" src="../../image/account/Account_Arrow.svg" />
</view>
</view>
<view class="function">
<view>
<image class="icon func-icon" src="../../image/account/Account_FAQ.svg" />
<view>自助问答</view>
<image class="icon-sub arrow" src="../../image/account/Account_Arrow.svg" />
</view>
</view>
<view class="function">
<view>
<image class="icon func-icon" src="../../image/account/Account_AboutUs.svg" />
<view>关于我们</view>
<image class="icon-sub arrow" src="../../image/account/Account_Arrow.svg" />
</view>
</view>
<view class="function">
<view style="border-bottom: 0px;">
<image class="icon func-icon" src="../../image/account/Account_Support.svg" />
<view>联系客服</view>
<image class="icon-sub arrow" src="../../image/account/Account_Arrow.svg" /> <image class="icon-sub arrow" src="../../image/account/Account_Arrow.svg" />
</view> </view>
</view> </view>
+41 -1
View File
@@ -1,9 +1,49 @@
import { Modular, Manager } from "../../core/Module"; import { Modular, Manager } from "../../core/Module";
interface IFunctionListItem {
/**
* id
*/
id?: number
/**
* 显示名称
*/
displayName: string;
/**
* 图标路径
*/
iconUrl: string;
}
interface IFunctionListData {
functionList?: IFunctionListItem[];
};
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: IFunctionListData = {
functionList: undefined
};
public override onLoad() { public override onLoad() {
// Do something console.log(FunctionList.functionList)
this.setData({
functionList: FunctionList.functionList.map((value, index) => {
value.id = index;
return value;
})
})
} }
} }
+14 -3
View File
@@ -27,9 +27,17 @@ view.user-card {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
image { view {
width: 23px; width: 23px;
height: 23px; height: 23px;
padding: 20px;
margin: -20px;
border-radius: 20px;
image {
width: 100%;
height: 100%;
}
} }
} }
@@ -41,6 +49,7 @@ view.user-card {
text-overflow: ellipsis; text-overflow: ellipsis;
} }
// 学生信息
view.student { view.student {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -57,8 +66,10 @@ view.user-card {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
view.text-icon { image.text-icon {
margin-left: .3em; margin-left: .25em;
width: 10px;
height: 10px;
} }
} }
} }
+14 -2
View File
@@ -1,9 +1,21 @@
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>
}
class UserCard<M extends Manager> extends Modular<M, IUserCardDependent<M>> {
public override onLoad() { public override onLoad() {
// Do something this.setFunc(this.handleChangeTheme, "changeTheme")
}
/**
* 处理主题更换
*/
private handleChangeTheme() {
this.depends?.mask.showMask();
} }
} }