This commit is contained in:
Wang Kejun 2023-11-09 12:15:11 +08:00
parent 5aa5cd8950
commit c32bc01be7
300 changed files with 191 additions and 9100 deletions

View File

@ -20,7 +20,7 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
loadingIcon?: import("react").ReactNode;
disabled?: boolean | undefined;
onClick?: ((event: import("react").MouseEvent<HTMLButtonElement, MouseEvent>) => unknown) | undefined;
type?: "button" | "submit" | "reset" | undefined;
type?: "button" | "reset" | "submit" | undefined;
shape?: "default" | "rounded" | "rectangular" | undefined;
children?: import("react").ReactNode;
} & Pick<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement>, "id" | "onMouseUp" | "onMouseDown" | "onTouchStart" | "onTouchEnd"> & {

View File

@ -1,4 +1,4 @@
import { EntityDict } from './../../../oak-app-domain';
import { EntityDict } from '../../../oak-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'article', false, {
title?: string;

View File

@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Table, Tag, Button, Modal, Space, Row, Col, Input, } from 'antd';
import { SearchOutlined } from '@ant-design/icons';
import Style from './web.module.less';
import PageHeader from '../../../components/common/pageHeader';
import PageHeader from '../../common/pageHeader';
export default function render(props) {
const { pagination, articles = [], oakLoading, searchValue, title, showBack = false, } = props.data;
const { pageSize, total, currentPage } = pagination || {};

View File

@ -1,5 +1,5 @@
import '@wangeditor/editor/dist/css/style.css';
import { EntityDict } from './../../../oak-app-domain';
import { EntityDict } from '../../../oak-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'article', false, {
editor: any;

View File

@ -3,7 +3,7 @@ import { generateNewId } from 'oak-domain/lib/utils/uuid';
import { Alert, Card, Button, Row, Col, Space, Affix, Input } from 'antd';
import '@wangeditor/editor/dist/css/style.css'; // 引入 css
import { Editor, Toolbar } from '@wangeditor/editor-for-react';
import OakGallery from './../../../components/extraFile/gallery';
import OakGallery from '../../extraFile/gallery';
import Style from './web.module.less';
// 工具栏配置
const toolbarConfig = {

View File

@ -116,8 +116,15 @@ export default OakComponent({
return afterClaim(userEntityGrant);
}
else if (redirectTo) {
const { pathname, props, state } = redirectTo;
const { pathname, props = {}, state, isTabBar } = redirectTo;
if (pathname) {
if (isTabBar) {
this.switchTab({
url: pathname,
...props,
}, state);
return;
}
this.navigateTo({
url: pathname,
...props,

View File

@ -1,92 +1,5 @@
// 本文件为自动编译产生,请勿直接修改
const i18ns = [
{
id: "a85ac2eff2d138152ef083e37c2b366c",
namespace: "oak-general-business-p-paper-detail",
language: "zh-CN",
module: "oak-general-business",
position: "src/pages/paper/detail",
data: {
"detail": "详情"
}
},
{
id: "e3c5e1767a1ad30ddf15adeb43a5fbab",
namespace: "oak-general-business-p-paper-list",
language: "zh-CN",
module: "oak-general-business",
position: "src/pages/paper/list",
data: {
"action": {
"add": "添加"
}
}
},
{
id: "99445bede532d740b807f2eda058daac",
namespace: "oak-general-business-p-paper-preview",
language: "zh-CN",
module: "oak-general-business",
position: "src/pages/paper/preview",
data: {
"detail": "预览"
}
},
{
id: "65186dcd507e2a8b0bfe0f6f8e9e98e4",
namespace: "oak-general-business-p-paper-upsert",
language: "zh-CN",
module: "oak-general-business",
position: "src/pages/paper/upsert",
data: {
"submit": "提交",
"reset": "重置",
"placeholder": {
"author": "请输入作者",
"title": "请在这里输入标题",
"content": "从这里开始正文",
"abstract": "选填摘要会在订阅号消息、转发链接等文章外的场景显露帮助读者快速了解内容如不填写则默认抓取正文前54字"
},
"tips": {
"content": "请先输入一段正文(或者标题),再点击保存按钮。"
}
}
},
{
id: "b40594f173c7c593719746c2f63ca126",
namespace: "oak-general-business-p-user-info",
language: "zh-CN",
module: "oak-general-business",
position: "src/pages/user/info",
data: {
"avatar": "头像",
"mobile": "手机号",
"password": "密码",
"manage": "管理",
"bind": "绑定",
"syncWeChat": "同步微信信息",
"send": "发送验证码",
"cancel": "取消",
"unbind": "解绑",
"Mobile-Number-Verification": "手机号验证",
"unbindingWechat": "确定解绑微信账号",
"placeholder": {
"Captcha": "输入4位短信验证码"
}
}
},
{
id: "75a707a016ee5fc0574e16507270753d",
namespace: "oak-general-business-p-user-manage-detail",
language: "zh-CN",
module: "oak-general-business",
position: "src/pages/user/manage/detail",
data: {
"mobile": "手机号",
"unset": "未设置",
"avatar": "头像"
}
},
{
id: "2ebe552614a81e57fa1a1c21b5dc84f8",
namespace: "oak-general-business-c-application-panel",
@ -212,6 +125,58 @@ const i18ns = [
"moreThanOne": "多于一条手机号"
}
},
{
id: "d558d71567b4e379250a5f2cd43e4a27",
namespace: "oak-general-business-c-paper-detail",
language: "zh-CN",
module: "oak-general-business",
position: "src/components/paper/detail",
data: {
"detail": "详情"
}
},
{
id: "992af92da3504b0ec27f55a4ac4e2432",
namespace: "oak-general-business-c-paper-list",
language: "zh-CN",
module: "oak-general-business",
position: "src/components/paper/list",
data: {
"action": {
"add": "添加"
}
}
},
{
id: "6cedaa26d9738d509c3c99ad06064282",
namespace: "oak-general-business-c-paper-preview",
language: "zh-CN",
module: "oak-general-business",
position: "src/components/paper/preview",
data: {
"detail": "预览"
}
},
{
id: "f2a1934629b4b8f7219007245cfdd332",
namespace: "oak-general-business-c-paper-upsert",
language: "zh-CN",
module: "oak-general-business",
position: "src/components/paper/upsert",
data: {
"submit": "提交",
"reset": "重置",
"placeholder": {
"author": "请输入作者",
"title": "请在这里输入标题",
"content": "从这里开始正文",
"abstract": "选填摘要会在订阅号消息、转发链接等文章外的场景显露帮助读者快速了解内容如不填写则默认抓取正文前54字"
},
"tips": {
"content": "请先输入一段正文(或者标题),再点击保存按钮。"
}
}
},
{
id: "be4a42e798e981b6ef0c0877904dbb11",
namespace: "oak-general-business-c-platform-panel",

View File

@ -1,4 +0,0 @@
/// <reference types="wechat-miniprogram" />
/// <reference types="react" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "message", false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
export default _default;

View File

@ -1,46 +0,0 @@
export default OakComponent({
entity: 'message',
projection: {
id: 1,
$$createAt$$: 1,
type: 1,
title: 1,
content: 1,
visitState: 1,
userId: 1,
user: {
id: 1,
name: 1,
},
router: 1,
},
isList: false,
formData: ({ data: message }) => {
return message || {};
},
listeners: {
'visitState,userId'(prev, next) {
const userId2 = this.features.token.getUserId(true);
if (next.userId === userId2) {
if (next.visitState === 'unvisited') {
this.execute('visit', false);
}
}
},
},
methods: {
goPage() {
const { router } = this.state;
const pathname = router?.pathname;
const props = router?.props || {};
const state = router?.state;
if (!pathname) {
return;
}
this.redirectTo({
url: pathname,
...props,
}, state, true);
},
},
});

View File

@ -1,4 +0,0 @@
{
"navigationBarTitleText": "消息详情",
"usingComponents": {}
}

View File

@ -1,32 +0,0 @@
/** index.wxss **/
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
margin: 20px;
}
.title {
font-family: "helvetica neue", PingFangSC-Light, arial, "hiragino sans gb", "microsoft yahei ui", "microsoft yahei", simsun, sans-serif;
font-size: 20px;
line-height: 36px;
margin: 0px 0px 22px;
}
.content {
font-family: "helvetica neue", PingFangSC-Light, arial, "hiragino sans gb", "microsoft yahei ui", "microsoft yahei", simsun, sans-serif;
font-size: 14px;
color: rgb(51, 51, 51);
line-height: 24px;
margin: 6px 0px 0px;
overflow-wrap: break-word;
word-break: break-all;
font-size: 14px;
}
.btn {
margin-top: 30px;
}

View File

@ -1,13 +0,0 @@
import { EntityDict } from '../../../oak-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'message', false, {
title: string;
content: string;
id: string;
$$createAt$$: number;
type: string;
visitState: EntityDict['message']['Schema']['visitState'];
router: EntityDict['message']['Schema']['router'];
}, {
goPage: () => void;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -1,12 +0,0 @@
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Button, } from 'antd';
import Style from './mobile.module.less';
export default function Render(props) {
const { data, methods } = props;
const { title, content, router } = data;
const { t, goPage } = methods;
const pathname = router?.pathname;
return (_jsxs("div", { className: Style.container, children: [_jsx("h1", { className: Style.title, children: title }), _jsx("div", { className: Style.content, children: content }), pathname && (_jsx(Button, { className: Style.btn, block: true, type: "primary", onClick: () => {
goPage();
}, children: "\u524D\u5F80" }))] }));
}

View File

@ -1,46 +0,0 @@
/** index.wxss **/
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
}
.warp {
word-break: break-all;
min-width: 320px;
max-width: 600px;
border: 1px solid rgb(246, 246, 246);
background-color: rgb(247, 248, 250);
margin: auto;
padding: 30px;
}
.inner {
background-color: rgb(255, 255, 255);
padding: 30px;
box-shadow: rgb(122 55 55 / 20%) 0px 1px 1px 0px;
}
.title {
// font-family: "helvetica neue", PingFangSC-Light, arial, "hiragino sans gb", "microsoft yahei ui", "microsoft yahei", simsun, sans-serif;
font-size: 20px;
line-height: 36px;
margin: 0px 0px 22px;
}
.content {
// font-family: "helvetica neue", PingFangSC-Light, arial, "hiragino sans gb", "microsoft yahei ui", "microsoft yahei", simsun, sans-serif;
font-size: 14px;
color: rgb(51, 51, 51);
line-height: 24px;
margin: 6px 0px 0px;
overflow-wrap: break-word;
word-break: break-all;
font-size: 14px;
}
.btn {
margin-top: 30px;
}

View File

@ -1,13 +0,0 @@
import { EntityDict } from '../../../oak-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'message', false, {
title: string;
content: string;
id: string;
$$createAt$$: number;
type: string;
visitState: EntityDict['message']['Schema']['visitState'];
router: EntityDict['message']['Schema']['router'];
}, {
goPage: () => void;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -1,13 +0,0 @@
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Button, } from 'antd';
import PageHeader from '../../../components/common/pageHeader';
import Style from './web.module.less';
export default function Render(props) {
const { data, methods } = props;
const { title, content, router } = data;
const { t, goPage } = methods;
const pathname = router?.pathname;
return (_jsx(PageHeader, { title: "\u6D88\u606F\u8BE6\u60C5", showBack: true, children: _jsx("div", { className: Style.container, children: _jsx("div", { className: Style.warp, children: _jsxs("div", { className: Style.inner, children: [_jsx("h1", { className: Style.title, children: title }), _jsx("div", { className: Style.content, children: content }), pathname && (_jsx(Button, { className: Style.btn, block: true, type: "primary", onClick: () => {
goPage();
}, children: "\u524D\u5F80" }))] }) }) }) }));
}

View File

@ -1,4 +0,0 @@
/// <reference types="wechat-miniprogram" />
/// <reference types="react" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "message", true, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
export default _default;

View File

@ -1,66 +0,0 @@
export default OakComponent({
entity: 'message',
isList: true,
projection: {
id: 1,
$$createAt$$: 1,
type: 1,
title: 1,
content: 1,
visitState: 1,
userId: 1,
user: {
id: 1,
name: 1,
},
router: 1,
},
filters: [
{
filter() {
const userId = this.features.token.getUserId(true);
if (userId) {
return {
userId,
};
}
else {
return {
id: 'illegal',
};
}
},
},
],
actions: ['visit'],
sorters: [
{
sorter: () => {
return {
$attr: {
$$createAt$$: 1,
},
$direction: 'desc',
};
},
},
],
formData: function ({ data: messages, features, props }) {
return {
messages,
};
},
lifetimes: {
attached() {
this.subscribed.push(this.features.token.subscribe(() => this.reRender()));
},
},
methods: {
goDetailById(id) {
this.navigateTo({
url: `/message/detail`,
oakId: id,
});
},
},
});

View File

@ -1,4 +0,0 @@
{
"navigationBarTitleText": "消息通知",
"usingComponents": {}
}

View File

@ -1,6 +0,0 @@
.container {
display: flex;
flex-direction: column;
flex: 1;
background-color: var(--oak-bg-color-page);
}

View File

@ -1,7 +0,0 @@
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../oak-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'message', true, {
messages: EntityDict['message']['Schema'][];
}, {
goDetailById: (id: string) => void;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -1,14 +0,0 @@
import { jsx as _jsx } from "react/jsx-runtime";
import Style from './mobile.module.less';
import MessageCell from '../../../components/message/cell';
import Empty from '../../../components/common/empty';
export default function Render(props) {
const { data, methods } = props;
const { messages, oakFullpath } = data;
const { goDetailById } = methods;
return (_jsx("div", { className: Style.container, children: messages?.length > 0 ? (_jsx("div", { children: messages?.map((message, index) => (_jsx(MessageCell, { oakId: message.id, oakPath: oakFullpath
? `${oakFullpath}.${message.id}`
: '', onItemClicked: (item) => {
goDetailById(item.id);
} }, message.id))) })) : (_jsx("div", { className: Style.noData, children: _jsx(Empty, { description: "\u6682\u65E0\u6D88\u606F", image: Empty.PRESENTED_IMAGE_SIMPLE }) })) }));
}

View File

@ -1,7 +0,0 @@
/** index.wxss **/
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
}

View File

@ -1,7 +0,0 @@
import { WebComponentProps, RowWithActions } from 'oak-frontend-base';
import { EntityDict } from '../../../oak-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'message', true, {
messages: RowWithActions<EntityDict, 'message'>[];
}, {
goDetailById: (id: string) => void;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -1,93 +0,0 @@
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { Badge, Table, Typography } from 'antd';
import dayjs from 'dayjs';
import Style from './web.module.less';
import PageHeader from '../../../components/common/pageHeader';
import ActionBtnPanel from 'oak-frontend-base/es/components/actionBtnPanel';
export default function Render(props) {
const { data, methods } = props;
const { t, setPageSize, setCurrentPage, goDetailById } = methods;
const { messages, oakFullpath, oakLoading, oakPagination } = data;
const { pageSize, total, currentPage } = oakPagination || {};
return (_jsx(PageHeader, { title: "\u6D88\u606F\u901A\u77E5", children: _jsx("div", { className: Style.container, children: _jsx(Table, { loading: oakLoading, dataSource: messages || [], rowKey: "id",
// scroll={{ x: 1200 }}
columns: [
{
dataIndex: 'serial-number',
title: '#',
render: (value, record, index) => {
return index + 1;
},
},
{
dataIndex: 'title',
title: '消息内容',
render: (value, record, index) => {
if (record.visitState === 'unvisited') {
return (_jsxs(_Fragment, { children: [_jsx(Badge, { style: { marginRight: 5 }, status: "processing" }), _jsx(Typography.Link, { onClick: () => {
goDetailById(record.id);
}, children: value })] }));
}
return (_jsx(Typography.Text, { onClick: () => {
goDetailById(record.id);
}, children: value }));
},
},
{
dataIndex: 'type',
title: '类型',
render: (value, record, index) => {
return '';
},
},
{
dataIndex: 'visitState',
title: '是否已读',
render: (value, record, index) => {
return value === 'unvisited' ? '未读' : '已读';
},
},
{
dataIndex: '$$createAt$$',
title: '接收时间',
render: (value, record, index) => {
return (_jsx("div", { children: dayjs(value).format('YYYY-MM-DD HH:mm:ss') }));
},
},
{
dataIndex: 'op',
width: 300,
title: '操作',
align: 'center',
render: (value, record, index) => {
return (_jsx(ActionBtnPanel, { mode: "table-cell", entity: "message", items: [
{
label: '详情',
onClick: () => {
goDetailById(record.id);
},
},
{
action: 'visit',
show: record['#oakLegalActions']?.includes('visit'),
onClick: async () => {
methods.updateItem({}, record.id, 'visit');
await methods.execute();
},
},
] }));
},
fixed: 'right',
},
], pagination: {
total: total,
pageSize: pageSize,
current: currentPage,
onShowSizeChange: (current, pageSize) => {
setPageSize(pageSize);
},
onChange: (page, pageSize) => {
setCurrentPage(page);
},
} }) }) }));
}

View File

@ -1,4 +0,0 @@
/// <reference types="wechat-miniprogram" />
/// <reference types="react" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../oak-app-domain").EntityDict, keyof import("../../oak-app-domain").EntityDict, false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
export default _default;

View File

@ -1,3 +0,0 @@
export default OakComponent({
isList: false,
});

View File

@ -1 +0,0 @@
export default function Render(): import("react/jsx-runtime").JSX.Element;

View File

@ -1,5 +0,0 @@
import { jsx as _jsx } from "react/jsx-runtime";
import MyInfo from '../../components/my/info';
export default function Render() {
return (_jsx(MyInfo, {}));
}

View File

@ -1 +0,0 @@
export default function Render(): import("react/jsx-runtime").JSX.Element;

View File

@ -1,8 +0,0 @@
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Layout } from 'antd';
const { Header, Footer, Sider, Content } = Layout;
import MyInfo from '../../components/my/info';
import Styles from './web.pc.module.less';
export default function Render() {
return (_jsx(Layout, { children: _jsxs(Layout, { children: [_jsx(Sider, { children: _jsx(MyInfo, {}) }), _jsx(Content, { className: Styles.content, children: "\u6839\u636E\u4E1A\u52A1\u5B9A\u5236\uFF08\u8BF7\u5C06\u8FD9\u4E2A\u9875\u9762\u7684\u903B\u8F91\u590D\u5236\u5230project\u4E0B\u5904\u7406\uFF09" })] }) }));
}

View File

@ -1,5 +0,0 @@
.content {
display: flex;
align-items: center;
justify-content: center;
}

View File

@ -1,4 +0,0 @@
/// <reference types="wechat-miniprogram" />
/// <reference types="react" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "user", false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
export default _default;

View File

@ -1,348 +0,0 @@
import { OakUserInvisibleException } from 'oak-domain/lib/types';
import dayjs from 'dayjs';
import { LOCAL_STORAGE_KEYS } from '../../../config/constants';
const SEND_KEY = LOCAL_STORAGE_KEYS.captchaSendAt;
const SEND_CAPTCHA_LATENCY = process.env.NODE_ENV === 'development' ? 10 : 60;
export default OakComponent({
entity: 'user',
projection: {
id: 1,
name: 1,
nickname: 1,
birth: 1,
gender: 1,
idState: 1,
userState: 1,
mobile$user: {
$entity: 'mobile',
data: {
id: 1,
mobile: 1,
userId: 1,
user: {
id: 1,
userState: 1,
refId: 1,
},
},
},
user$ref: {
$entity: 'user',
data: {
mobile$user: {
$entity: 'mobile',
data: {
id: 1,
mobile: 1,
userId: 1,
user: {
id: 1,
userState: 1,
refId: 1,
},
},
},
},
},
extraFile$entity: {
$entity: 'extraFile',
data: {
id: 1,
tag1: 1,
origin: 1,
bucket: 1,
objectId: 1,
filename: 1,
extra1: 1,
extension: 1,
type: 1,
entity: 1,
entityId: 1,
},
filter: {
tag1: 'avatar',
},
indexFrom: 0,
count: 1,
},
wechatUser$user: {
$entity: 'wechatUser',
data: {
id: 1,
openId: 1,
unionId: 1,
userId: 1,
origin: 1,
nickname: 1,
user: {
id: 1,
userState: 1,
refId: 1,
},
},
},
},
isList: false,
formData({ data: user, features }) {
const avatar = user?.extraFile$entity && user?.extraFile$entity[0];
const avatarUrl = features.extraFile.getUrl(avatar);
const { mobile } = (user?.mobile$user && user?.mobile$user[0]) ||
(user?.user$ref &&
user?.user$ref[0] &&
user?.user$ref[0].mobile$user &&
user?.user$ref[0].mobile$user[0]) ||
{};
const genderOption = user?.gender &&
this.state.genderOptions.find((ele) => ele.value === user?.gender);
const lastSendAt = features.localStorage.load(SEND_KEY);
const now = Date.now();
let counter = 0;
if (typeof lastSendAt === 'number') {
counter = Math.max(SEND_CAPTCHA_LATENCY - Math.ceil((now - lastSendAt) / 1000), 0);
if (counter > 0) {
this.counterHandler = setTimeout(() => this.reRender(), 1000);
}
else if (this.counterHandler) {
clearTimeout(this.counterHandler);
this.counterHandler = undefined;
}
}
const isRoot = features.token.isReallyRoot();
return {
id: user?.id,
name: user?.name,
nickname: user?.nickname,
gender: user?.gender,
genderStr: genderOption?.label,
birthText: user?.birth
? dayjs(user.birth).format('YYYY-MM-DD')
: '',
birth: user?.birth,
avatarUrl,
mobile,
userState: user?.userState,
idState: user?.idState,
wechatUser: user?.wechatUser$user?.[0],
counter,
isRoot,
};
},
data: {
stateColor: {
shadow: 'primary',
normal: 'success',
disabled: 'danger',
},
idStateColor: {
verifying: 'primary',
verified: 'success',
unverified: 'warning',
},
genderOptions: [
{
value: 'male',
label: '男',
},
{
value: 'female',
label: '女',
},
],
visible: false,
attr: '',
attrs: {
nickname: '昵称',
gender: '性别',
birth: '出生日期',
},
birthEnd: '',
refreshing: false,
},
lifetimes: {
async ready() {
const { oakId } = this.props;
const userId = this.features.token.getUserId();
if (userId !== oakId) {
throw new OakUserInvisibleException();
}
this.setState({ birthEnd: dayjs().format('YYYY-MM-DD') });
},
},
methods: {
async refreshWechatPublicUserInfo() {
this.setState({
refreshing: true,
});
try {
await this.features.token.refreshWechatPublicUserInfo();
this.setState({
refreshing: false,
});
}
catch (err) {
this.setState({
refreshing: false,
});
throw err;
}
},
goUserManage() {
this.navigateTo({
url: '/user/manage',
});
},
goAddMobile() {
this.navigateTo({
url: '/mobile/me',
}, {
showBack: true,
});
},
goChangePassword() {
this.navigateTo({
url: '/changePassword',
}, {
showBack: true,
});
},
setVisibleMp(e) {
const { target: { dataset }, } = e;
const { attr } = dataset;
this.setVisible(true, attr);
},
genderChangeMp(e) {
const { detail } = e;
const { checked, currentKey } = detail;
const { attr } = this.state;
this.setCustomData(attr, currentKey);
},
birthChangeMp(e) {
const { detail: { value }, } = e;
const birth = dayjs(dayjs(value).format('YYYY-MM-DD')).valueOf();
const { attr } = this.state;
this.setState({
birthText2: dayjs(value).format('YYYY-MM-DD'),
});
this.setCustomData(attr, birth);
},
setVisible(visible, attr) {
this.setState({
visible,
attr: visible ? attr : '',
[`new_${attr}`]: '',
birthText2: '',
});
},
setCustomData(attr, value) {
this.setState({
[`new_${attr}`]: value,
});
},
setCustomDataMp(e) {
const { detail, target: { dataset }, } = e;
const { value } = detail;
const { attr } = this.state;
this.setCustomData(attr, value);
},
updateData(attr, value) {
this.update({
[attr]: this.state[`new_${attr}`],
});
},
async onConfirmMp() {
const { attr } = this.state;
await this.onConfirm(attr);
},
async onConfirm(attr) {
const { oakId } = this.props;
if (!this.state[`new_${attr}`]) {
this.setMessage({
type: 'warning',
content: `${this.state.attrs[attr]}不能为空`,
});
return;
}
this.update({
[attr]: this.state[`new_${attr}`],
});
await this.execute();
this.setVisible(false, attr);
},
onPupopCloseMp() {
const { attr } = this.state;
this.clean();
this.setVisible(false, attr);
},
async updateMyInfo() {
if (!this.state.name) {
this.setMessage({
type: 'error',
content: '请输入姓名',
});
return;
}
if (!this.state.nickname) {
this.setMessage({
type: 'error',
content: '请输入昵称',
});
return;
}
// if (!this.state.gender) {
// this.setMessage({
// type: 'error',
// content: '请选择性别',
// });
// return;
// }
// if (!this.state.birth) {
// this.setMessage({
// type: 'error',
// content: '请选择生日',
// });
// return;
// }
await this.execute('update');
},
async sendCaptcha() {
const { mobile } = this.state;
try {
const result = await this.features.token.sendCaptcha(mobile, 'login');
// 显示返回消息
this.setMessage({
type: 'success',
content: result,
});
this.save(SEND_KEY, Date.now());
this.reRender();
}
catch (err) {
this.setMessage({
type: 'error',
content: err.message,
});
}
},
async unbindingWechat(captcha) {
const { mobile, wechatUser } = this.state;
try {
await this.features.cache.exec('unbindingWechat', {
wechatUserId: wechatUser.id,
mobile,
captcha,
});
this.refresh();
this.setMessage({
content: '解绑成功',
type: 'success',
});
}
catch (err) {
this.setMessage({
content: '解绑失败',
type: 'warning',
});
}
},
},
});

View File

@ -1,17 +0,0 @@
{
"navigationBarTitleText": "个人设置",
"enablePullDownRefresh": false,
"usingComponents": {
"l-button": "@oak-frontend-base/miniprogram_npm/lin-ui/button/index",
"l-avatar": "@oak-frontend-base/miniprogram_npm/lin-ui/avatar/index",
"l-list": "@oak-frontend-base/miniprogram_npm/lin-ui/list/index",
"l-icon": "@oak-frontend-base/miniprogram_npm/lin-ui/icon/index",
"l-tag": "@oak-frontend-base/miniprogram_npm/lin-ui/tag/index",
"l-popup": "@oak-frontend-base/miniprogram_npm/lin-ui/popup/index",
"l-input": "@oak-frontend-base/miniprogram_npm/lin-ui/input/index",
"l-radio-group": "@oak-frontend-base/miniprogram_npm/lin-ui/radio-group/index",
"l-radio": "@oak-frontend-base/miniprogram_npm/lin-ui/radio/index",
"l-form-item": "@oak-frontend-base/miniprogram_npm/lin-ui/form-item/index",
"oak-extraFile-avatar": "../../../components/extraFile/avatar/index"
}
}

View File

@ -1,90 +0,0 @@
/** index.wxss **/
@import "../../../config/styles/mp/index.less";
@import "../../../config/styles/mp/mixins.less";
.page-body {
height: 100vh;
display: flex;
flex: 1;
flex-direction: column;
background-color: @oak-bg-color-page;
box-sizing: border-box;
.safe-area-inset-bottom();
}
.avatar {
margin: 10rpx 0;
}
.col {
margin-top: 20rpx;
display: flex;
flex-direction: column;
padding: 0rpx 10rpx;
background-color: #fff;
.left {
display: flex;
flex-direction: row;
}
.icon {
width: 16rpx;
margin-left: 6rpx;
margin-right: 26rpx;
text-align: center;
}
.label {
color: @oak-text-color-primary;
}
.value {
color: @oak-text-color-secondary;
margin-right: 16rpx;
.primary {
background-color: @oak-color-primary;
}
.success {
background-color: @oak-color-success;
}
.danger {
background-color: @oak-color-error;
}
.warning {
background-color: @oak-color-warning;
}
}
}
.pupop-content {
display: flex;
flex-direction: column;
background-color: #fff;
min-height: 300rpx;
.safe-area-inset-bottom();
.pupop-header {
padding: 20rpx;
display: flex;
flex-direction: column;
align-items: flex-end;
.close {
display: block;
}
}
.pupop-form {
display: flex;
flex-direction: column;
flex: 1;
}
}

View File

@ -1,82 +0,0 @@
<view class="page-body">
<view class="col">
<l-list title="头像">
<view slot="right-section" class="avatar">
<oak-extraFile-avatar oakAutoUnmount="{{true}}" oakPath="{{ oakFullpath ? oakFullpath + '.extraFile$entity' : undefined }}" entity="user" entityId="{{id}}" autoUpload="{{true}}"/>
</view>
</l-list>
<l-list title="昵称" data-attr="nickname" bind:lintap="setVisibleMp">
<view slot="right-section" class="value">{{nickname || '未设置'}}</view>
</l-list>
<l-list title="姓名" data-attr="name" bind:lintap="setVisibleMp">
<view slot="right-section" class="value">{{name || '未设置'}}</view>
</l-list>
<l-list title="性别" data-attr="gender" bind:lintap="setVisibleMp">
<view slot="right-section" class="value">{{genderStr || '未设置'}}</view>
</l-list>
<l-list title="生日" data-attr="birth" bind:lintap="setVisibleMp">
<view slot="right-section" class="value">{{birthText || '未设置'}}</view>
</l-list>
<l-list title="手机号" bind:lintap="goAddMobile">
<view slot="right-section" class="value">{{mobile || '未绑定'}}</view>
</l-list>
<!-- <l-list tag-position="right" is-link="{{false}}" title="用户状态">
<view slot="right-section" class="value">
<l-tag l-class="{{stateColor[userState]}}" size="mini" shape="circle">
{{userState || '未设置'}}
</l-tag>
</view>
</l-list> -->
<l-list tag-position="right" is-link="{{false}}" title="认证状态">
<view slot="right-section" class="value">
<l-tag l-class="{{idStateColor[idState]}}" size="mini" shape="circle">
{{t('user:v.idState.' + idState) || '未设置'}}
</l-tag>
</view>
</l-list>
</view>
<view style="flex:1" />
<l-popup show="{{visible}}" content-align="bottom" locked="{{false}}">
<view class='pupop-content'>
<view class="pupop-header">
<view class="close" bind:tap="onPupopCloseMp">
<l-icon name="close" size="24"></l-icon>
</view>
</view>
<view class='pupop-form'>
<block wx:if="{{ attr === 'nickname' }}">
<l-input label="昵称" value="{{nickname}}" placeholder="请输入昵称" bind:lininput="setCustomDataMp" />
</block>
<block wx:elif="{{ attr === 'name' }}">
<l-input label="姓名" value="{{name}}" placeholder="请输入姓名" bind:lininput="setCustomDataMp" />
</block>
<block wx:elif="{{ attr === 'gender' }}">
<l-form-item label="性别" label-width="100rpx">
<l-radio-group current="{{gender}}" placement="row" length="2" bind:linchange="genderChangeMp">
<l-radio l-class="l-radio" wx:for="{{genderOptions}}" wx:key="id" key="{{item.value}}" placement="left">
{{item.label}}
</l-radio>
</l-radio-group>
</l-form-item>
</block>
</block>
<block wx:elif="{{ attr === 'birth' }}">
<picker mode="date" end="{{birthEnd}}" value="{{birthText}}" bind:change="birthChangeMp">
<l-input label="出生日期" value="{{birthText2 || birthText || '选择日期'}}" disabled="{{true}}" l-label-class="label">
<l-icon slot="right" name="right" size="20" />
</l-input>
</picker>
</block>
</view>
<l-button size="long" bind:lintap="onConfirmMp">
提交
</l-button>
</view>
</l-popup>
</view>

View File

@ -1,16 +0,0 @@
{
"avatar": "头像",
"mobile": "手机号",
"password": "密码",
"manage": "管理",
"bind": "绑定",
"syncWeChat": "同步微信信息",
"send": "发送验证码",
"cancel": "取消",
"unbind": "解绑",
"Mobile-Number-Verification": "手机号验证",
"unbindingWechat": "确定解绑微信账号",
"placeholder": {
"Captcha": "输入4位短信验证码"
}
}

View File

@ -1,38 +0,0 @@
.container {
background: var(--oak-bg-color-page);
display: flex;
flex-direction: column;
flex: 1;
height: 100vh;
}
.syncWeChat {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
margin-top: 10px;
}
.avatar_container {
height: 220px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
.avatar {
width: 84px;
height: 84px;
border-radius: 42px;
margin-bottom: 10px;
}
}
.list {
flex: 1;
margin-top: 10px;
margin-bottom: 10px;
background: var(--oak-bg-color-container);
}

View File

@ -1,32 +0,0 @@
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../oak-app-domain';
type DataProps = {
visible: boolean;
nickname: string;
name: string;
birth: string;
gender: string;
mobile: string;
avatarUrl: string;
attr: string;
genderOptions: Array<{
label: string;
value: string;
}>;
attrs: Record<string, string>;
id: string;
refreshing: boolean;
isSupportSyncWeChat: boolean;
appId: string;
};
type MethodsProps = {
goAddMobile: () => void;
goChangePassword: () => void;
setAvatar: () => void;
setVisible: (visible: boolean, attr: string) => void;
setCustomData: (attr: string, value: string | number) => void;
onConfirm: (attr: string) => Promise<void>;
refreshWechatPublicUserInfo: () => void;
};
export default function render(props: WebComponentProps<EntityDict, 'user', false, DataProps, MethodsProps>): import("react/jsx-runtime").JSX.Element;
export {};

View File

@ -1,49 +0,0 @@
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { List, DatePicker, Popup, Form, Button, Input, Radio, Space, } from 'antd-mobile';
import dayjs from 'dayjs';
import OakAvatar from '../../../components/extraFile/avatar';
import Style from './mobile.module.less';
export default function render(props) {
const { data, methods } = props;
const { t, clean, setAvatar, setVisible, goAddMobile, refreshWechatPublicUserInfo, goChangePassword, } = methods;
const { oakFullpath, visible, nickname, name, birth, gender, mobile, avatarUrl, attr, id, isSupportSyncWeChat, refreshing, } = data;
return (_jsxs("div", { className: Style.container, children: [_jsxs(List, { className: Style.list, children: [_jsx(List.Item, { extra: _jsx("div", { style: { marginTop: 5, marginBottom: 5 }, children: _jsx(OakAvatar, { oakAutoUnmount: true, oakPath: oakFullpath
? oakFullpath + '.extraFile$entity'
: undefined, entity: "user", entityId: id, autoUpload: true }) }), children: "\u5934\u50CF" }), _jsx(List.Item, { extra: nickname ? nickname : '未设置', onClick: () => {
setVisible(true, 'nickname');
}, children: t('user:attr.nickname') }), _jsx(List.Item, { extra: gender ? t(`user:v.gender.${gender}`) : '未设置', onClick: () => {
setVisible(true, 'gender');
}, children: t('user:attr.gender') }), _jsx(List.Item, { extra: birth ? dayjs(birth).format('YYYY-MM-DD') : '未设置', onClick: () => {
setVisible(true, 'birth');
}, children: t('user:attr.birth') }), _jsx(List.Item, { extra: mobile ? mobile : '未设置', onClick: () => {
goAddMobile();
}, children: t('mobile') }), _jsx(List.Item, { extra: '********', onClick: () => {
goChangePassword();
}, children: t('password') })] }), _jsx(Popup, { visible: visible, onMaskClick: () => {
clean();
setVisible(false, attr);
}, bodyStyle: {
borderTopLeftRadius: '8px',
borderTopRightRadius: '8px',
minHeight: '20vh',
}, children: _jsx(AttrUpsert, { data: data, methods: methods }) })] }));
}
function AttrUpsert(props) {
const { data, methods } = props;
const { attr, genderOptions, attrs } = data;
const { setCustomData, onConfirm, setVisible } = methods;
const label = attrs[attr];
return (_jsx("div", { children: _jsxs(Form, { footer: _jsx(Button, { block: true, type: "submit", color: "primary", size: "large", onClick: async () => {
await onConfirm(attr);
}, children: "\u63D0\u4EA4" }), children: [_jsx(Form.Header, { children: "\u4FEE\u6539\u4FE1\u606F" }), attr === 'nickname' && (_jsx(Form.Item, { name: attr, label: label, rules: [{ required: true }], children: _jsx(Input, { placeholder: `请输入${label}`, defaultValue: data[attr], onChange: (value) => {
setCustomData(attr, value);
} }) })), attr === 'gender' && (_jsx(Form.Item, { name: attr, label: label, rules: [{ required: true }], children: _jsx(Radio.Group, { defaultValue: data[attr], onChange: (value) => {
setCustomData(attr, value);
}, children: _jsx(Space, { direction: "vertical", children: genderOptions.map((ele) => (_jsx(Radio, { value: ele.value, children: ele.label }))) }) }) })), attr === 'birth' && (_jsx(Form.Item, { name: attr, label: label, onClick: (e, datePickerRef) => {
datePickerRef.current?.open();
}, children: _jsx(DatePicker, { defaultValue: data[attr] ? dayjs(data[attr]).toDate() : null, onConfirm: (value) => {
setCustomData(attr, dayjs(value).startOf('day').valueOf());
}, max: dayjs().toDate(), children: (value) => value
? dayjs(value).format('YYYY-MM-DD')
: '请选择日期' }) }))] }) }));
}

View File

@ -1,7 +0,0 @@
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
}

View File

@ -1,27 +0,0 @@
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../oak-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {
visible: boolean;
nickname: string;
name: string;
birth: string;
gender: string;
mobile: string;
avatarUrl: string;
attr: string;
showBack: boolean;
genderOptions: Array<{
label: string;
value: string;
}>;
wechatUser: EntityDict['wechatUser']['Schema'];
counter: number;
isRoot: boolean;
}, {
goUserManage: () => void;
goAddMobile: () => void;
sendCaptcha: () => void;
goChangePassword: () => void;
updateMyInfo: () => void;
unbindingWechat: (captcha?: string) => void;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -1,89 +0,0 @@
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { useState } from 'react';
import { Space, Button, Input, Radio, DatePicker, Form, Typography, Modal, Descriptions } from 'antd';
import dayjs from 'dayjs';
import PageHeader from '../../../components/common/pageHeader';
import OakAvatar from '../../../components/extraFile/avatar';
import ExtraFileCommit from '../../../components/extraFile/commit';
import MobileLogin from '../../../components/mobile/login';
import WechatLoginQrCode from '../../../components/wechatLogin/qrCode';
import WechatUserList from '../../../components/wechatUser/bindingList';
import { isCaptcha, } from 'oak-domain/lib/utils/validator';
import Style from './web.module.less';
export default function Render(props) {
const { data, methods } = props;
const { t, updateMyInfo, goAddMobile, sendCaptcha, unbindingWechat, goChangePassword, goUserManage, } = methods;
const { nickname, name, birth, gender, mobile, avatarUrl, showBack, oakExecuting, genderOptions, oakFullpath, oakDirty, wechatUser, counter, isRoot, } = data;
const [open, setOpen] = useState(false);
const [open2, setOpen2] = useState(false);
const [open3, setOpen3] = useState(false);
const [captcha, setCaptcha] = useState('');
return (_jsxs(PageHeader, { title: "\u4E2A\u4EBA\u4FE1\u606F", showBack: showBack, children: [_jsxs("div", { className: Style.container, children: [_jsx(Descriptions, { title: '基本信息' }), _jsxs(Form, { labelCol: { xs: { span: 4 }, md: { span: 6 } }, wrapperCol: { xs: { span: 16 }, md: { span: 12 } }, children: [_jsx(Form.Item, { label: t('avatar'), name: "extraFile$entity", children: _jsx(_Fragment, { children: _jsx(OakAvatar, { oakAutoUnmount: true, oakPath: oakFullpath
? oakFullpath + '.extraFile$entity'
: undefined, entity: "user" }) }) }), _jsx(Form.Item, { label: t('user:attr.name'), rules: [
{
required: true,
},
], children: _jsx(_Fragment, { children: _jsx(Input, { placeholder: "", onChange: (e) => methods.update({
name: e.target.value,
}), value: name }) }) }), _jsx(Form.Item, { label: t('user:attr.nickname'), rules: [
{
required: true,
},
], children: _jsx(_Fragment, { children: _jsx(Input, { placeholder: "", onChange: (e) => methods.update({
nickname: e.target.value,
}), value: nickname }) }) }), _jsx(Form.Item, { label: t('user:attr.gender'), children: _jsx(Space, { direction: "vertical", children: _jsx(Radio.Group, { value: data.gender, options: genderOptions, onChange: ({ target: { value } }) => {
methods.update({ gender: value });
} }) }) }), _jsx(Form.Item, { label: t('user:attr.birth'), children: _jsx(_Fragment, { children: _jsx(DatePicker, { placeholder: "\u8BF7\u9009\u62E9", format: "YYYY-MM-DD", inputReadOnly: true, allowClear: false, value: birth ? dayjs(birth) : undefined, disabledDate: (current) => {
if (dayjs(current).valueOf() >
dayjs().valueOf()) {
return true;
}
return false;
}, onChange: (value) => {
if (value) {
methods.update({
birth: dayjs(value).valueOf(),
});
}
} }) }) }), _jsx(Form.Item, { wrapperCol: {
xs: { offset: 4 },
md: { offset: 6 },
}, children: _jsx(Space, { children: _jsx(ExtraFileCommit, { oakPath: oakFullpath }) }) })] })] }), _jsx("div", { style: { marginTop: '10px' } }), _jsxs("div", { className: Style.container, children: [_jsx(Descriptions, { title: '安全信息' }), _jsxs(Form, { labelCol: { xs: { span: 4 }, md: { span: 6 } }, wrapperCol: { xs: { span: 16 }, md: { span: 12 } }, children: [_jsx(Form.Item, { label: t('mobile'), children: _jsxs(Space, { children: [_jsx(Typography, { children: mobile || '未设置' }), _jsx(Button, { size: "small", onClick: () => {
if (mobile) {
goAddMobile();
return;
}
setOpen(true);
}, children: mobile ? t('manage') : t('bind') })] }) }), _jsx(Form.Item, { label: t('user:attr.password'), children: _jsxs(Space, { children: [_jsx(Typography, { children: '********' }), _jsx(Button, { size: "small", onClick: () => {
goChangePassword();
return;
}, children: t('manage') })] }) }), process.env.NODE_ENV === 'development' && (_jsx(Form.Item, { label: "\u5FAE\u4FE1\u5E10\u53F7", children: _jsx(_Fragment, { children: wechatUser ? (_jsxs(Space, { children: [_jsx(Typography, { children: wechatUser.nickname }), _jsx(WechatUserList, { oakPath: oakFullpath
? `${oakFullpath}.wechatUser$user`
: undefined })] })) : (_jsx(Button, { size: "small", onClick: () => {
setOpen2(true);
}, children: "\u7ED1\u5B9A" })) }) })), isRoot && (_jsx(Form.Item, { label: '系统用户', tooltip: "\u8D85\u7EA7\u7BA1\u7406\u5458\u53EF\u5BF9\u7CFB\u7EDF\u7528\u6237\u8FDB\u884C\u7BA1\u7406", children: _jsx(Button, { size: "small", onClick: () => {
goUserManage();
}, children: t('manage') }) }))] })] }), _jsx(Modal, { title: "\u7ED1\u5B9A\u624B\u673A\u53F7", open: open, destroyOnClose: true, footer: null, onCancel: () => {
setOpen(false);
}, children: _jsx(MobileLogin, { callback: () => {
setOpen(false);
}, oakPath: "$user/info-mobile/login", oakAutoUnmount: true }) }), _jsx(Modal, { title: "\u7ED1\u5B9A\u5FAE\u4FE1", open: open2, destroyOnClose: true, footer: null, maskClosable: false, onCancel: () => {
setOpen2(false);
}, children: _jsx(WechatLoginQrCode, { oakPath: "$user/info-wechatLogin/qrCode", oakAutoUnmount: true }) }), _jsx(Modal, { title: t('Mobile-Number-Verification'), open: open3, destroyOnClose: true, footer: [
_jsx(Button, { onClick: () => setOpen3(false), children: t('cancel') }, "cancel"),
_jsx(Button, { type: "primary", disabled: !isCaptcha(captcha), onClick: () => {
unbindingWechat(captcha);
setOpen3(false);
}, children: t('unbind') }, "send"),
], maskClosable: false, onCancel: () => {
setOpen3(false);
}, children: _jsxs(Space, { direction: "vertical", style: { width: '100%' }, children: [_jsxs(Typography, { children: ["\u8BF7\u8F93\u5165", mobile &&
mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2'), "\u6536\u5230\u7684\u9A8C\u8BC1\u7801"] }), _jsx(Form.Item, { name: "captcha", children: _jsx(Input, { allowClear: true, value: captcha, "data-attr": "captcha",
// type="number"
maxLength: 4, placeholder: t('placeholder.Captcha'), size: "large", onChange: (e) => {
setCaptcha(e.target.value);
}, className: Style['loginbox-input'], suffix: _jsx(Button, { type: "link", disabled: counter > 0, onClick: () => sendCaptcha(), children: counter > 0
? `${counter}秒后可重发`
: t('send') }) }) })] }) })] }));
}

Some files were not shown because too many files have changed in this diff Show More