Skip to content
This repository was archived by the owner on May 8, 2022. It is now read-only.
Open

Wx #13

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

部分代码及功能参考于 [Ant Design pro](https://pro.ant.design/)

:clap: 已经支持微信开发,相见 [wx](https://github.com/hqwlkj/umi-dva-antd-mobile/tree/wx) 分支。

## 目录结构

|-- config # umi 配置,包含路由,构建等配置
Expand Down
28 changes: 15 additions & 13 deletions config/plugin.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@ export default config => {
plugin: {
install: {
plugin: require('uglifyjs-webpack-plugin'),
args: [{
sourceMap: false,
uglifyOptions: {
compress: {
// 删除所有的 `console` 语句
drop_console: true,
},
output: {
// 最紧凑的输出
beautify: false,
// 删除所有的注释
comments: false,
args: [
{
sourceMap: false,
uglifyOptions: {
compress: {
// 删除所有的 `console` 语句
drop_console: true,
},
output: {
// 最紧凑的输出
beautify: false,
// 删除所有的注释
comments: false,
},
},
},
}],
],
},
},
});
Expand Down
12 changes: 6 additions & 6 deletions config/router.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,37 @@ export default [
{
path: '/tabbar/index',
title: 'index',
component: '/tabbar/index',
component: './tabbar/index',
iconName: 'alipay',
},
{
path: '/tabbar/koubei',
title: 'Koubei',
component: '/tabbar/Koubei',
component: './tabbar/Koubei',
iconName: 'koubei',
},
{
path: '/tabbar/friend',
title: 'Friend',
component: '/tabbar/Koubei',
component: './tabbar/Friend',
iconName: 'friend',
},
{
path: '/tabbar/my',
title: 'My',
component: '/tabbar/Koubei',
component: './tabbar/Koubei',
iconName: 'my',
},
{
path: '/tabbar/my1',
title: 'My1',
component: '/tabbar/Koubei',
component: './tabbar/Koubei',
iconName: 'my',
},
{
path: '/tabbar/my2',
title: 'My2',
component: '/tabbar/Koubei',
component: './tabbar/Koubei',
iconName: 'my',
},
],
Expand Down
40 changes: 20 additions & 20 deletions src/components/Exception/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { Button } from "antd";
import classNames from "classnames";
import React, { createElement } from "react";
import config from "./typeConfig";

const styles = require("./index.less");
import { Button } from 'antd';
import classNames from 'classnames';
import React, { createElement } from 'react';
import config from './typeConfig';

const styles = require('./index.less');

export interface IExceptionProps {
type?: "403" | "404" | "500";
type?: '403' | '404' | '500';
title?: React.ReactNode;
desc?: React.ReactNode;
img?: string;
Expand All @@ -21,8 +20,8 @@ export interface IExceptionProps {

class Exception extends React.PureComponent<IExceptionProps, any> {
public static defaultProps = {
backText: "back to home",
redirect: "/"
backText: 'back to home',
redirect: '/',
};

constructor(props) {
Expand All @@ -34,7 +33,7 @@ class Exception extends React.PureComponent<IExceptionProps, any> {
const {
className,
backText,
linkElement = "a",
linkElement = 'a',
type,
title,
desc,
Expand All @@ -43,15 +42,16 @@ class Exception extends React.PureComponent<IExceptionProps, any> {
redirect,
...rest
} = this.props;
const pageType = type in config ? type : "404";
const pageType = type in config ? type : '404';
const clsString = classNames(styles.exception, className);
const createElementProps: {
key: string,
key: string;
to: string;
href: string
href: string;
} = {
key: "back-btn",
to: redirect, href: redirect
key: 'back-btn',
to: redirect,
href: redirect,
};
return (
<div className={clsString} {...rest}>
Expand All @@ -66,11 +66,11 @@ class Exception extends React.PureComponent<IExceptionProps, any> {
<div className={styles.desc}>{desc || config[pageType].desc}</div>
<div className={styles.actions}>
{actions ||
createElement(
linkElement,
createElementProps,
<Button type="primary">{backText}</Button>
)}
createElement(
linkElement,
createElementProps,
<Button type="primary">{backText}</Button>
)}
</div>
</div>
</div>
Expand Down
20 changes: 10 additions & 10 deletions src/components/Exception/typeConfig.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
const config = {
403: {
img: "https://gw.alipayobjects.com/zos/rmsportal/wZcnGqRDyhPOEYFcZDnb.svg",
title: "403",
desc: "抱歉,你无权访问该页面"
img: 'https://gw.alipayobjects.com/zos/rmsportal/wZcnGqRDyhPOEYFcZDnb.svg',
title: '403',
desc: '抱歉,你无权访问该页面',
},
404: {
img: "https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozzI.svg",
title: "404",
desc: "抱歉,你访问的页面不存在"
img: 'https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozzI.svg',
title: '404',
desc: '抱歉,你访问的页面不存在',
},
500: {
img: "https://gw.alipayobjects.com/zos/rmsportal/RVRUAYdCGeYNBWoKiIwB.svg",
title: "500",
desc: "抱歉,服务器出错了"
}
img: 'https://gw.alipayobjects.com/zos/rmsportal/RVRUAYdCGeYNBWoKiIwB.svg',
title: '500',
desc: '抱歉,服务器出错了',
},
};

export default config;
2 changes: 1 addition & 1 deletion src/components/PageLoading/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { ActivityIndicator } from 'antd-mobile';
import React from 'react';

export default () => (
<div
Expand Down
8 changes: 5 additions & 3 deletions src/components/TabBarMenu/tabBarItemProps.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React from 'react';

export declare type TabIcon = React.ReactElement<any> | {
uri: string;
};
export declare type TabIcon =
| React.ReactElement<any>
| {
uri: string;
};

export interface ITabBarItemProps {
badge?: string | number;
Expand Down
1 change: 0 additions & 1 deletion src/global.less
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,3 @@ body {
display: table;
clear: both;
}

Loading