(#37) Fix checkmark display #43

Merged
MrKBear merged 3 commits from dev-mrkbear into master 2022-01-19 21:22:03 +08:00
7 changed files with 92 additions and 10 deletions

View File

@ -0,0 +1,8 @@
view.mask {
position: fixed;
width: 100%;
height: 100%;
background-color: rgba($color: #000000, $alpha: .2);
z-index: 1;
}

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;

View File

@ -1,7 +1,7 @@
@import "./UserCard.scss";
@import "./MainFunction.scss";
@import "./FunctionList.scss";
@import "../../modular/Mask/Mask.scss";
view.container{
padding-top: 50rpx;

View File

@ -2,9 +2,11 @@ import { Manager } from "../../core/Module";
import { UserCard } from "./UserCard";
import { MainFunction } from "./MainFunction";
import { FunctionList } from "./FunctionList";
import { Mask } from "../../modular/Mask/Mask";
Manager.Page((manager) => {
manager.addModule(UserCard, "userCard");
const mask = manager.addModule(Mask, "mask");
manager.addModule(UserCard, "userCard", { mask });
manager.addModule(MainFunction, "mainFunction");
manager.addModule(FunctionList, "functionList");
});

View File

@ -1,3 +1,5 @@
<!-- 蒙版 -->
<view class="mask" bindtap="mask$handleClickMask" style="display:{{mask$isShow ? 'block' : 'none'}}"></view>
<!-- 顶部的阴影 -->
<view class="top-shadow"></view>
@ -14,7 +16,9 @@
<!-- 主题变换按钮 -->
<view class="theme">
<image class="icon-sub" src="../../image/account/Account_Theme.svg" />
<view bindtap="userCard$changeTheme">
<image class="icon-sub" src="../../image/account/Account_Theme.svg" />
</view>
</view>
<!-- 用户昵称 -->
@ -27,7 +31,7 @@
<view class="name">秦浩轩</view>
<view class="certified">
<view class="certifi-info">已认证</view>
<view class="text-icon"></view>
<image class="text-icon" src="../../image/account/Account_OK.svg"></image>
</view>
</view>

View File

@ -27,9 +27,17 @@ view.user-card {
display: flex;
justify-content: flex-end;
image {
view {
width: 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;
}
// 学生信息
view.student {
display: flex;
align-items: center;
@ -57,8 +66,10 @@ view.user-card {
justify-content: center;
align-items: center;
view.text-icon {
margin-left: .3em;
image.text-icon {
margin-left: .25em;
width: 10px;
height: 10px;
}
}
}

View File

@ -1,9 +1,21 @@
import { Modular, Manager } from "../../core/Module";
import { Mask } from "../../modular/Mask/Mask";
type IUserCardDependent<M extends Manager> = {
mask: Mask<M>
}
class UserCard<M extends Manager> extends Modular<M, IUserCardDependent<M>> {
class UserCard<M extends Manager> extends Modular<M> {
public override onLoad() {
// Do something
this.setFunc(this.handleChangeTheme, "changeTheme")
}
/**
*
*/
private handleChangeTheme() {
this.depends?.mask.showMask();
}
}