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
This commit is contained in:
MrKBear 2022-01-19 21:58:20 +08:00
commit cf4dd727c5
2 changed files with 45 additions and 37 deletions

View File

@ -76,42 +76,10 @@
<!-- 功能列表 -->
<view class="card function-list">
<view class="function">
<view>
<image class="icon func-icon" src="../../image/account/Account_Sponsor.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_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>
<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>
<image class="icon-sub arrow" src="../../image/account/Account_Arrow.svg" />
</view>
</view>

View File

@ -1,9 +1,49 @@
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> {
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() {
// Do something
console.log(FunctionList.functionList)
this.setData({
functionList: FunctionList.functionList.map((value, index) => {
value.id = index;
return value;
})
})
}
}