88 lines
3.0 KiB
JavaScript
88 lines
3.0 KiB
JavaScript
import { ECode } from '../../types/ErrorPage';
|
|
const DefaultErrorInfo = {
|
|
[ECode.forbidden]: {
|
|
title: '403 Forbidden',
|
|
desc: '抱歉,您无权限访问此页面。',
|
|
imagePath: './assets/svg/assets-result-403.svg',
|
|
},
|
|
[ECode.notFound]: {
|
|
title: '404 Not Found',
|
|
desc: '抱歉,您访问的页面不存在。',
|
|
imagePath: './assets/svg/assets-result-404.svg',
|
|
},
|
|
[ECode.error]: {
|
|
title: '500 Internal Server Error',
|
|
desc: '抱歉,服务器出错啦!',
|
|
imagePath: './assets/svg/assets-result-500.svg',
|
|
},
|
|
[ECode.networkError]: {
|
|
title: '网络异常',
|
|
desc: '网络异常,请稍后再试。',
|
|
imagePath: './assets/svg/assets-result-network-error.svg',
|
|
},
|
|
[ECode.maintenance]: {
|
|
title: '系统维护中',
|
|
desc: '系统维护中,请稍后再试。',
|
|
imagePath: './assets/svg/assets-result-maintenance.svg',
|
|
},
|
|
[ECode.browserIncompatible]: {
|
|
title: '浏览器版本低',
|
|
desc: '抱歉,您正在使用的浏览器版本过低,无法打开当前网页。',
|
|
imagePath: './assets/svg/assets-result-browser-incompatible.svg',
|
|
},
|
|
[ECode.pageCrash]: {
|
|
title: '抱歉,网页崩溃了',
|
|
desc: '网页似乎遇到了问题,我们将尽快解决,请稍后重新加载。',
|
|
imagePath: './assets/svg/assets-result-404.svg',
|
|
},
|
|
[ECode.pageUpdate]: {
|
|
title: '网页有更新',
|
|
desc: '检查到网页有更新,请刷新以查看最新内容。',
|
|
imagePath: './assets/svg/assets-result-404.svg',
|
|
},
|
|
[ECode.pageDataCacheFailure]: {
|
|
title: '数据缓存失效',
|
|
desc: '非常抱歉,数据缓存已失效。请点击【清除缓存】以更新信息。',
|
|
imagePath: './assets/svg/assets-result-404.svg',
|
|
},
|
|
};
|
|
export default OakComponent({
|
|
isList: false,
|
|
properties: {
|
|
code: '',
|
|
title: '',
|
|
desc: '',
|
|
icon: '', //web独有
|
|
imagePath: '', //小程序独有
|
|
},
|
|
lifetimes: {
|
|
ready() {
|
|
if (process.env.OAK_PLATFORM === 'wechatMp') {
|
|
const { title, desc, code, imagePath } = this.props;
|
|
let title2 = title;
|
|
if (code) {
|
|
this.setState({
|
|
desc: desc || DefaultErrorInfo[code].desc,
|
|
imagePath: imagePath ||
|
|
DefaultErrorInfo[code].imagePath,
|
|
});
|
|
if (!title2) {
|
|
title2 = DefaultErrorInfo[code].title;
|
|
}
|
|
wx.setNavigationBarTitle({
|
|
title: title2,
|
|
});
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
goBack(delta) {
|
|
this.navigateBack(delta);
|
|
},
|
|
async clearData() {
|
|
await this.features.localStorage.clear();
|
|
}
|
|
},
|
|
});
|