This commit is contained in:
Ling53666
2025-08-18 09:11:51 +08:00
commit 02554225da
2516 changed files with 133155 additions and 0 deletions

View File

@ -0,0 +1 @@
.ant-page-container{overflow:auto;color:#333}.ant-page-container-safe-top{padding-top:constant(safe-area-inset-top);padding-top:env(safe-area-inset-top)}.ant-page-container-safe-bottom{padding-bottom:constant(safe-area-inset-bottom);padding-bottom:env(safe-area-inset-bottom)}.ant-page-container-loading-wrap{position:fixed;left:0;top:0;width:100%;height:100vh;background:#f5f5f5;opacity:.4;z-index:3}.ant-page-container-loading{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}.ant-page-container-status{margin-top:210px;text-align:center}

View File

@ -0,0 +1,55 @@
<view
class="ant-page-container {{className || ''}} {{safeArea === 'top' || safeArea === 'both' ? 'ant-page-container-safe-top' : ''}} {{safeArea === 'bottom' || safeArea === 'both' ? 'ant-page-container-safe-bottom' : ''}}"
style="{{style || ''}}"
>
<!--loading-->
<view
a:if="{{loading}}"
class="ant-page-container-loading-wrap"
>
<view class="ant-page-container-loading">
<slot name="loading">
<ant-loading
type="{{loadingType}}"
size="{{loadingSize}}"
color="{{loadingColor}}"
></ant-loading>
</slot>
</view>
</view>
<!--页面异常状态-->
<view
a:if="{{image && title && message}}"
class="ant-page-container-status"
>
<ant-empty
image="{{image}}"
title="{{title}}"
message="{{message}}"
>
<view slot="extra">
<ant-button
a:if="{{actionText}}"
onTap="handleActionTap"
type="primary"
size="small"
inline
>
{{actionText}}
</ant-button>
<ant-button
a:if="{{secondaryActionText}}"
onTap="handleSecondaryActionTap"
size="small"
inline
style="margin-left: 12px"
>
{{secondaryActionText}}
</ant-button>
<slot name="extra"></slot>
</view>
</ant-empty>
</view>
<!--正常页面内容-->
<slot a:else></slot>
</view>

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,31 @@
import { __assign } from "tslib";
import equal from 'fast-deep-equal';
import { Component, getValueFromProps, triggerEventOnly } from '../_util/simply';
import { PageDefaultProps, BuiltinStatus } from './props';
Component(PageDefaultProps, {
handleActionTap: function (e) {
triggerEventOnly(this, 'actionTap', e);
},
handleSecondaryActionTap: function (e) {
triggerEventOnly(this, 'secondaryActionTap', e);
},
updatePageStatus: function (prevProps, nextProps) {
var _a, _b, _c;
if (!equal(prevProps, nextProps)) {
var status_1 = nextProps.status, image = nextProps.image, title = nextProps.title, message = nextProps.message;
var updateData = __assign(__assign({}, nextProps), {
// 自定义内容优先 status
image: image || ((_a = BuiltinStatus[status_1]) === null || _a === void 0 ? void 0 : _a.image) || '', title: title || ((_b = BuiltinStatus[status_1]) === null || _b === void 0 ? void 0 : _b.title) || '', message: message || ((_c = BuiltinStatus[status_1]) === null || _c === void 0 ? void 0 : _c.message) || '' });
this.setData(updateData);
}
}
}, {}, undefined, {
didMount: function () {
var props = getValueFromProps(this);
this.updatePageStatus({}, props);
},
deriveDataFromProps: function (nextProps) {
var props = getValueFromProps(this);
this.updatePageStatus(props, nextProps);
}
});

View File

@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"ant-button": "../Button/index",
"ant-loading": "../Loading/index",
"ant-empty": "../Empty/index"
}
}

View File

@ -0,0 +1,77 @@
import { IBaseProps } from '../_util/base';
/**
* @description 页面容器,提供开箱即用的页面状态展示和基础能力。
*/
export interface IPageProps extends IBaseProps {
/**
* @description 安全区内边距位置 top=顶部 bottom=底部 both=顶部和底部
*/
safeArea?: 'top' | 'bottom' | 'both';
/**
* @description 加载中
*/
loading?: boolean;
/**
* @description 加载样式类型,参考 Loading 组件
*/
loadingType?: string;
/**
* @description 加载样式大小,参考 Loading 组件
*/
loadingSize?: string;
/**
* @description 加载样式颜色,参考 Loading 组件
*/
loadingColor?: string;
/**
* @description 页面异常状态
*/
status?: 'failed' | 'busy' | 'disconnected' | 'empty';
/**
* @description 页面异常状态-标题
*/
title?: string;
/**
* @description 页面异常状态-描述
*/
message?: string;
/**
* @description 页面异常状态-按钮文案
*/
actionText?: string;
/**
* @description 页面异常状态-次要按钮文案
*/
secondaryActionText?: string;
/**
* @description 页面异常状态-按钮点击事件
*/
onActionTap?: (e: any) => void;
/**
* @description 页面异常状态-次要按钮点击事件
*/
onSecondaryActionTap?: (e: any) => void;
}
export declare const PageDefaultProps: IPageProps;
export declare const BuiltinStatus: {
failed: {
image: string;
title: string;
message: string;
};
disconnected: {
image: string;
title: string;
message: string;
};
empty: {
title: string;
message: string;
image: string;
};
busy: {
image: string;
title: string;
message: string;
};
};

View File

@ -0,0 +1,29 @@
export var PageDefaultProps = {
safeArea: 'both',
loadingColor: '#ccc',
loadingSize: 'medium',
loadingType: 'spin',
};
// 内置异常配置
export var BuiltinStatus = {
'failed': {
image: 'https://gw.alipayobjects.com/mdn/rms_7cc883/afts/img/A*PG7NQoXbN38AAAAAAAAAAAAAARQnAQ',
title: '页面遇到一些小问题',
message: '待会来试试'
},
'disconnected': {
image: 'https://mdn.alipayobjects.com/huamei_yqdpol/afts/img/A*uqB5TY4urA4AAAAAAAAAAAAADj16AQ/original',
title: '网络有点忙',
message: '动动手指帮忙修复'
},
'empty': {
title: '这里什么也没有',
message: '看看其它吧',
image: 'https://gw.alipayobjects.com/mdn/rms_226d75/afts/img/A*0AaRRrYlVDkAAAAAAAAAAAAAARQnAQ'
},
'busy': {
image: 'https://mdn.alipayobjects.com/huamei_yqdpol/afts/img/A*avTGQIyeHk0AAAAAAAAAAAAADj16AQ/original',
title: '前方拥堵',
message: '刷新试试'
}
};