build
This commit is contained in:
parent
5b9dee2768
commit
4f7d5f3f08
|
|
@ -113,6 +113,17 @@ const i18ns = [
|
|||
"avatar": "头像"
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "ce120594bf9738e2092b3c7bf4da71e9",
|
||||
namespace: "oak-general-business-p-wechatUser-login",
|
||||
language: "zh-CN",
|
||||
module: "oak-general-business",
|
||||
position: "src/pages/wechatUser/login",
|
||||
data: {
|
||||
"missingCodeParameter": "缺少code参数",
|
||||
"weChatLoginFailed": "微信登录失败"
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "d790bd454c420a031bbde799c83bbe71",
|
||||
namespace: "oak-general-business-c-common-qrCode",
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|||
import { Tag, Avatar, Descriptions } from 'antd';
|
||||
import Style from './web.module.less';
|
||||
import ActionPanel from '../../../../components/func/actionPanel';
|
||||
import PageHeader from '../../../../components/common/pageHeader';
|
||||
export default function render(props) {
|
||||
const { nickname, avatar, name, userState, idState, gender, stateColor, idStateColor, mobileText, executableActions, actionDescriptions, birth, } = props.data;
|
||||
const { t, onActionClick } = props.methods;
|
||||
return (_jsx("div", { className: Style.container, children: _jsxs(Descriptions, { extra: _jsx(ActionPanel, { actions: executableActions, actionDescriptions: actionDescriptions, onActionClick: (action) => onActionClick(action) }), children: [_jsx(Descriptions.Item, { label: t('avatar'), children: avatar ? _jsx(Avatar, { src: avatar }) : t('unset') }), _jsx(Descriptions.Item, { label: t('user:attr.nickname'), children: nickname || t('unset') }), _jsx(Descriptions.Item, { label: t('user:attr.name'), children: name || t('unset') }), _jsx(Descriptions.Item, { label: t('user:attr.gender'), children: gender ? t(`user:v.gender.${gender}`) : t('unset') }), _jsx(Descriptions.Item, { label: t('user:attr.birth'), children: birth || t('unset') }), _jsx(Descriptions.Item, { label: t('mobile'), children: mobileText || t('unset') }), _jsx(Descriptions.Item, { label: t('user:attr.userState'), children: _jsx(Tag, { color: stateColor[userState], children: t(`user:v.userState.${userState}`) }) }), _jsx(Descriptions.Item, { label: t('user:attr.idState'), children: _jsx(Tag, { color: idStateColor[idState], children: t(`user:v.idState.${idState}`) }) })] }) }));
|
||||
return (_jsx(PageHeader, { children: _jsx("div", { className: Style.container, children: _jsxs(Descriptions, { extra: _jsx(ActionPanel, { actions: executableActions, actionDescriptions: actionDescriptions, onActionClick: (action) => onActionClick(action) }), children: [_jsx(Descriptions.Item, { label: t('avatar'), children: avatar ? _jsx(Avatar, { src: avatar }) : t('unset') }), _jsx(Descriptions.Item, { label: t('user:attr.nickname'), children: nickname || t('unset') }), _jsx(Descriptions.Item, { label: t('user:attr.name'), children: name || t('unset') }), _jsx(Descriptions.Item, { label: t('user:attr.gender'), children: gender ? t(`user:v.gender.${gender}`) : t('unset') }), _jsx(Descriptions.Item, { label: t('user:attr.birth'), children: birth || t('unset') }), _jsx(Descriptions.Item, { label: t('mobile'), children: mobileText || t('unset') }), _jsx(Descriptions.Item, { label: t('user:attr.userState'), children: _jsx(Tag, { color: stateColor[userState], children: t(`user:v.userState.${userState}`) }) }), _jsx(Descriptions.Item, { label: t('user:attr.idState'), children: _jsx(Tag, { color: idStateColor[idState], children: t(`user:v.idState.${idState}`) }) })] }) }) }));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { EntityDict } from '../../../../oak-app-domain';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict } from '../../../../oak-app-domain';
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {
|
||||
nickname?: string;
|
||||
name?: string;
|
||||
|
|
|
|||
|
|
@ -1,20 +1,21 @@
|
|||
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
||||
import { Button, Input, Form, Radio, DatePicker } from 'antd';
|
||||
import dayjs from 'dayjs';
|
||||
import PageHeader from '../../../../components/common/pageHeader';
|
||||
import Style from './web.module.less';
|
||||
export default function Render(props) {
|
||||
const { data, methods } = props;
|
||||
const { GenderOptions, IDCardTypeOptions } = data;
|
||||
const { t, update, confirm } = methods;
|
||||
return (_jsx("div", { className: Style.container, children: _jsxs(Form, { layout: "horizontal", labelCol: { span: 8 }, wrapperCol: { span: 16 }, style: { maxWidth: 600 }, children: [_jsx(Form.Item, { label: t('user:attr.nickname'), required: true, children: _jsx(Input, { onChange: (e) => update({ nickname: e.target.value }), value: data.nickname || '' }) }), _jsx(Form.Item, { label: t('user:attr.name'), children: _jsx(Input, { onChange: (e) => update({ name: e.target.value }), value: data.name || '' }) }), _jsx(Form.Item, { label: t('user:attr.birth'), children: _jsx(DatePicker, { value: data.birth ? dayjs(data.birth) : undefined, format: 'YYYY/MM/DD', onChange: (value) => update({ birth: dayjs(value).valueOf() }) }) }), _jsx(Form.Item, { label: t('user:attr.gender'), children: _jsx(Radio.Group, { onChange: (e) => {
|
||||
update({
|
||||
gender: e.target
|
||||
.value,
|
||||
});
|
||||
}, value: data.gender, children: GenderOptions.map((ele, idx) => (_jsx(Radio, { value: ele.value, children: ele.label }, idx))) }) }), _jsx(Form.Item, { label: t('user:attr.idCardType'), children: _jsx(Radio.Group, { onChange: (e) => {
|
||||
update({
|
||||
idCardType: e.target
|
||||
.value,
|
||||
});
|
||||
}, value: data.idCardType, children: IDCardTypeOptions.map((ele, idx) => (_jsx(Radio, { value: ele.value, className: Style.radio, children: ele.label }, idx))) }) }), _jsx(Form.Item, { label: t('user:attr.idNumber'), children: _jsx(Input, { onChange: (e) => update({ idNumber: e.target.value }), value: data.idNumber || '' }) }), _jsx(Form.Item, { wrapperCol: { offset: 8, span: 16 }, children: _jsx(Button, { type: "primary", color: "primary", onClick: () => confirm(), children: t('common::action.confirm') }) })] }) }));
|
||||
return (_jsx(PageHeader, { children: _jsx("div", { className: Style.container, children: _jsxs(Form, { layout: "horizontal", labelCol: { span: 8 }, wrapperCol: { span: 16 }, style: { maxWidth: 600 }, children: [_jsx(Form.Item, { label: t('user:attr.nickname'), required: true, children: _jsx(Input, { onChange: (e) => update({ nickname: e.target.value }), value: data.nickname || '' }) }), _jsx(Form.Item, { label: t('user:attr.name'), children: _jsx(Input, { onChange: (e) => update({ name: e.target.value }), value: data.name || '' }) }), _jsx(Form.Item, { label: t('user:attr.birth'), children: _jsx(DatePicker, { value: data.birth ? dayjs(data.birth) : undefined, format: 'YYYY/MM/DD', onChange: (value) => update({ birth: dayjs(value).valueOf() }) }) }), _jsx(Form.Item, { label: t('user:attr.gender'), children: _jsx(Radio.Group, { onChange: (e) => {
|
||||
update({
|
||||
gender: e.target
|
||||
.value,
|
||||
});
|
||||
}, value: data.gender, children: GenderOptions.map((ele, idx) => (_jsx(Radio, { value: ele.value, children: ele.label }, idx))) }) }), _jsx(Form.Item, { label: t('user:attr.idCardType'), children: _jsx(Radio.Group, { onChange: (e) => {
|
||||
update({
|
||||
idCardType: e.target
|
||||
.value,
|
||||
});
|
||||
}, value: data.idCardType, children: IDCardTypeOptions.map((ele, idx) => (_jsx(Radio, { value: ele.value, className: Style.radio, children: ele.label }, idx))) }) }), _jsx(Form.Item, { label: t('user:attr.idNumber'), children: _jsx(Input, { onChange: (e) => update({ idNumber: e.target.value }), value: data.idNumber || '' }) }), _jsx(Form.Item, { wrapperCol: { offset: 8, span: 16 }, children: _jsx(Button, { type: "primary", color: "primary", onClick: () => confirm(), children: t('common::action.confirm') }) })] }) }) }));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,85 +2,86 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|||
import { Table, Tag, Button, Space, Avatar } from 'antd';
|
||||
import { UserOutlined } from '@ant-design/icons';
|
||||
import FilterPanel from 'oak-frontend-base/es/components/filterPanel';
|
||||
import PageHeader from '../../../components/common/pageHeader';
|
||||
import Style from './web.module.less';
|
||||
export default function Render(props) {
|
||||
const { methods, data } = props;
|
||||
const { t, setPageSize, setCurrentPage, goNewUser, onCellClicked } = methods;
|
||||
const { oakFullpath, oakLoading, oakPagination, userArr = [], stateColor, isRoot, } = data;
|
||||
const { pageSize, total, currentPage } = oakPagination || {};
|
||||
return (_jsxs("div", { className: Style.container, children: [isRoot && (_jsx(Space, { style: { marginBottom: 16 }, children: _jsx(Button, { type: "primary", onClick: () => {
|
||||
goNewUser();
|
||||
}, children: "\u6DFB\u52A0\u7528\u6237" }) })), _jsx(FilterPanel, { entity: "user", oakPath: oakFullpath, columns: [
|
||||
{
|
||||
attr: 'nickname',
|
||||
op: '$includes',
|
||||
},
|
||||
{
|
||||
attr: 'name',
|
||||
op: '$includes',
|
||||
},
|
||||
{
|
||||
attr: 'userState',
|
||||
},
|
||||
] }), _jsx(Table, { loading: oakLoading, dataSource: userArr, rowKey: "id", columns: [
|
||||
{
|
||||
dataIndex: 'id',
|
||||
title: '#',
|
||||
render: (value, record, index) => {
|
||||
return index + 1;
|
||||
return (_jsx(PageHeader, { children: _jsxs("div", { className: Style.container, children: [isRoot && (_jsx(Space, { style: { marginBottom: 16 }, children: _jsx(Button, { type: "primary", onClick: () => {
|
||||
goNewUser();
|
||||
}, children: "\u6DFB\u52A0\u7528\u6237" }) })), _jsx(FilterPanel, { entity: "user", oakPath: oakFullpath, columns: [
|
||||
{
|
||||
attr: 'nickname',
|
||||
op: '$includes',
|
||||
},
|
||||
},
|
||||
{
|
||||
width: 100,
|
||||
dataIndex: 'avatar',
|
||||
title: '头像',
|
||||
render: (value, record, index) => {
|
||||
if (!value) {
|
||||
return (_jsx(Avatar, { icon: _jsx(UserOutlined, {}) }));
|
||||
}
|
||||
return _jsx(Avatar, { src: value, shape: "circle" });
|
||||
{
|
||||
attr: 'name',
|
||||
op: '$includes',
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'nickname',
|
||||
title: '昵称',
|
||||
},
|
||||
{
|
||||
dataIndex: 'name',
|
||||
title: '姓名',
|
||||
},
|
||||
{
|
||||
dataIndex: 'mobile',
|
||||
title: '手机号',
|
||||
},
|
||||
{
|
||||
dataIndex: 'userState',
|
||||
title: '状态',
|
||||
render: (value, record, index) => {
|
||||
return (_jsx(Tag, { color: stateColor[value], children: t(`user:v.userState.${value}`) }));
|
||||
{
|
||||
attr: 'userState',
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'op',
|
||||
width: 200,
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
render: (value, record, index) => {
|
||||
return (_jsx(_Fragment, { children: _jsx(Button, { type: "link", onClick: () => {
|
||||
onCellClicked(record.id);
|
||||
}, children: "\u8BE6\u60C5" }) }));
|
||||
] }), _jsx(Table, { loading: oakLoading, dataSource: userArr, rowKey: "id", columns: [
|
||||
{
|
||||
dataIndex: 'id',
|
||||
title: '#',
|
||||
render: (value, record, index) => {
|
||||
return index + 1;
|
||||
},
|
||||
},
|
||||
fixed: 'right',
|
||||
},
|
||||
], pagination: {
|
||||
total: total,
|
||||
pageSize: pageSize,
|
||||
current: currentPage,
|
||||
onShowSizeChange: (pageSize) => {
|
||||
setPageSize(pageSize);
|
||||
},
|
||||
onChange: (page) => {
|
||||
setCurrentPage(page);
|
||||
},
|
||||
} })] }));
|
||||
{
|
||||
width: 100,
|
||||
dataIndex: 'avatar',
|
||||
title: '头像',
|
||||
render: (value, record, index) => {
|
||||
if (!value) {
|
||||
return (_jsx(Avatar, { icon: _jsx(UserOutlined, {}) }));
|
||||
}
|
||||
return _jsx(Avatar, { src: value, shape: "circle" });
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'nickname',
|
||||
title: '昵称',
|
||||
},
|
||||
{
|
||||
dataIndex: 'name',
|
||||
title: '姓名',
|
||||
},
|
||||
{
|
||||
dataIndex: 'mobile',
|
||||
title: '手机号',
|
||||
},
|
||||
{
|
||||
dataIndex: 'userState',
|
||||
title: '状态',
|
||||
render: (value, record, index) => {
|
||||
return (_jsx(Tag, { color: stateColor[value], children: t(`user:v.userState.${value}`) }));
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'op',
|
||||
width: 200,
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
render: (value, record, index) => {
|
||||
return (_jsx(_Fragment, { children: _jsx(Button, { type: "link", onClick: () => {
|
||||
onCellClicked(record.id);
|
||||
}, children: "\u8BE6\u60C5" }) }));
|
||||
},
|
||||
fixed: 'right',
|
||||
},
|
||||
], pagination: {
|
||||
total: total,
|
||||
pageSize: pageSize,
|
||||
current: currentPage,
|
||||
onShowSizeChange: (pageSize) => {
|
||||
setPageSize(pageSize);
|
||||
},
|
||||
onChange: (page) => {
|
||||
setCurrentPage(page);
|
||||
},
|
||||
} })] }) }));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ export default function render(props) {
|
|||
const { pageSize, total, currentPage } = oakPagination || {};
|
||||
const { t, setPageSize, setCurrentPage } = props.methods;
|
||||
return (_jsx(Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [
|
||||
// {
|
||||
// dataIndex: 'id',
|
||||
// title: '序号',
|
||||
// render: (value, record, index) => {
|
||||
// return index + 1;
|
||||
// },
|
||||
// },
|
||||
{
|
||||
dataIndex: 'id',
|
||||
title: '#',
|
||||
render: (value, record, index) => {
|
||||
return index + 1;
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'name',
|
||||
title: '授权人',
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
/// <reference types="react" />
|
||||
import { EntityDict } from '../../../oak-app-domain';
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "wechatLogin", false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "wechatLogin", false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export default OakComponent({
|
|||
listeners: {},
|
||||
methods: {
|
||||
getCodeAndRedirect() {
|
||||
const state = encodeURIComponent(`?backUrl=/wechatLogin/confirm?oakId=${this.props.oakId}`);
|
||||
const state = encodeURIComponent(`/wechatLogin/confirm?oakId=${this.props.oakId}`);
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
this.navigateTo({
|
||||
url: '/wechatUser/login',
|
||||
|
|
@ -42,7 +42,7 @@ export default OakComponent({
|
|||
}
|
||||
else {
|
||||
const { appId } = this.state;
|
||||
const redirectUrl = `${window.location.host}/wechaUser/login?wechatLoginId=${this.props.oakId}`;
|
||||
const redirectUrl = `${window.location.host}/wechatUser/login?wechatLoginId=${this.props.oakId}`;
|
||||
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&state=${state}&redirect_uri=${redirectUrl}&response_type=code&scope=SCOPE#wechat_redirect`;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict } from '../../../../oak-app-domain';
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'user', true, {
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'wechatPublicTag', true, {
|
||||
showBack: boolean;
|
||||
list: Partial<EntityDict['wechatPublicTag']['Schema']>[];
|
||||
}, {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import dayjs from 'dayjs';
|
|||
export default function Render(props) {
|
||||
const { data, methods } = props;
|
||||
const { t, setPageSize, setCurrentPage, goCreate, goDetail, goUpdate, goDelete, } = methods;
|
||||
const { list, showBack = true, oakLoading, oakPagination, } = data;
|
||||
const { list, showBack = true, oakLoading, oakPagination } = data;
|
||||
const { pageSize, total, currentPage } = oakPagination || {};
|
||||
return (_jsx(PageHeader, { title: "\u5FAE\u4FE1\u516C\u4F17\u53F7\u6807\u7B7E", showBack: showBack, children: _jsxs("div", { className: Style.container, children: [_jsx(Space, { children: _jsx(Button, { type: "primary", onClick: () => {
|
||||
goCreate();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export default OakComponent({
|
|||
this.setState({
|
||||
loading: true,
|
||||
});
|
||||
const { features } = this;
|
||||
const { features, t } = this;
|
||||
const token = features.token.getToken(true);
|
||||
const url = window.location.href;
|
||||
const urlParse = URL.parse(url, true);
|
||||
|
|
@ -29,25 +29,23 @@ export default OakComponent({
|
|||
const wechatLoginId = query?.wechatLoginId;
|
||||
if (!code) {
|
||||
this.setState({
|
||||
error: '缺少code参数',
|
||||
error: t('missingCodeParameter'),
|
||||
loading: false,
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (process.env.NODE_ENV === 'production' && token) {
|
||||
//token有效 不调用登录
|
||||
console.log('token有效');
|
||||
if (process.env.NODE_ENV === 'production' &&
|
||||
token?.ableState === 'enabled') {
|
||||
this.setState({
|
||||
loading: false,
|
||||
});
|
||||
this.go(state);
|
||||
}
|
||||
else {
|
||||
console.log('token不存在或失效');
|
||||
try {
|
||||
// web微信扫码跟公众号授权
|
||||
await features.token.loginWechat(code, {
|
||||
wechatLoginId: wechatLoginId,
|
||||
wechatLoginId,
|
||||
});
|
||||
this.setState({
|
||||
loading: false,
|
||||
|
|
@ -56,7 +54,7 @@ export default OakComponent({
|
|||
}
|
||||
catch (err) {
|
||||
this.setState({
|
||||
error: '微信登录失败',
|
||||
error: t('weChatLoginFailed'),
|
||||
loading: false,
|
||||
});
|
||||
throw err;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"missingCodeParameter": "缺少code参数",
|
||||
"weChatLoginFailed": "微信登录失败"
|
||||
}
|
||||
|
|
@ -115,6 +115,17 @@ var i18ns = [
|
|||
"avatar": "头像"
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "ce120594bf9738e2092b3c7bf4da71e9",
|
||||
namespace: "oak-general-business-p-wechatUser-login",
|
||||
language: "zh-CN",
|
||||
module: "oak-general-business",
|
||||
position: "src/pages/wechatUser/login",
|
||||
data: {
|
||||
"missingCodeParameter": "缺少code参数",
|
||||
"weChatLoginFailed": "微信登录失败"
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "d790bd454c420a031bbde799c83bbe71",
|
||||
namespace: "oak-general-business-c-common-qrCode",
|
||||
|
|
|
|||
|
|
@ -5,11 +5,12 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|||
var antd_1 = require("antd");
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
var actionPanel_1 = tslib_1.__importDefault(require("../../../../components/func/actionPanel"));
|
||||
var pageHeader_1 = tslib_1.__importDefault(require("../../../../components/common/pageHeader"));
|
||||
function render(props) {
|
||||
var _a = props.data, nickname = _a.nickname, avatar = _a.avatar, name = _a.name, userState = _a.userState, idState = _a.idState, gender = _a.gender, stateColor = _a.stateColor, idStateColor = _a.idStateColor, mobileText = _a.mobileText, executableActions = _a.executableActions, actionDescriptions = _a.actionDescriptions, birth = _a.birth;
|
||||
var _b = props.methods, t = _b.t, onActionClick = _b.onActionClick;
|
||||
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Descriptions, tslib_1.__assign({ extra: (0, jsx_runtime_1.jsx)(actionPanel_1.default, { actions: executableActions, actionDescriptions: actionDescriptions, onActionClick: function (action) {
|
||||
return onActionClick(action);
|
||||
} }) }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('avatar') }, { children: avatar ? (0, jsx_runtime_1.jsx)(antd_1.Avatar, { src: avatar }) : t('unset') })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('user:attr.nickname') }, { children: nickname || t('unset') })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('user:attr.name') }, { children: name || t('unset') })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('user:attr.gender') }, { children: gender ? t("user:v.gender.".concat(gender)) : t('unset') })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('user:attr.birth') }, { children: birth || t('unset') })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('mobile') }, { children: mobileText || t('unset') })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('user:attr.userState') }, { children: (0, jsx_runtime_1.jsx)(antd_1.Tag, tslib_1.__assign({ color: stateColor[userState] }, { children: t("user:v.userState.".concat(userState)) })) })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('user:attr.idState') }, { children: (0, jsx_runtime_1.jsx)(antd_1.Tag, tslib_1.__assign({ color: idStateColor[idState] }, { children: t("user:v.idState.".concat(idState)) })) }))] })) })));
|
||||
return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Descriptions, tslib_1.__assign({ extra: (0, jsx_runtime_1.jsx)(actionPanel_1.default, { actions: executableActions, actionDescriptions: actionDescriptions, onActionClick: function (action) {
|
||||
return onActionClick(action);
|
||||
} }) }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('avatar') }, { children: avatar ? (0, jsx_runtime_1.jsx)(antd_1.Avatar, { src: avatar }) : t('unset') })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('user:attr.nickname') }, { children: nickname || t('unset') })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('user:attr.name') }, { children: name || t('unset') })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('user:attr.gender') }, { children: gender ? t("user:v.gender.".concat(gender)) : t('unset') })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('user:attr.birth') }, { children: birth || t('unset') })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('mobile') }, { children: mobileText || t('unset') })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('user:attr.userState') }, { children: (0, jsx_runtime_1.jsx)(antd_1.Tag, tslib_1.__assign({ color: stateColor[userState] }, { children: t("user:v.userState.".concat(userState)) })) })), (0, jsx_runtime_1.jsx)(antd_1.Descriptions.Item, tslib_1.__assign({ label: t('user:attr.idState') }, { children: (0, jsx_runtime_1.jsx)(antd_1.Tag, tslib_1.__assign({ color: idStateColor[idState] }, { children: t("user:v.idState.".concat(idState)) })) }))] })) })) }));
|
||||
}
|
||||
exports.default = render;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { EntityDict } from '../../../../oak-app-domain';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict } from '../../../../oak-app-domain';
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {
|
||||
nickname?: string;
|
||||
name?: string;
|
||||
|
|
|
|||
|
|
@ -4,23 +4,28 @@ var tslib_1 = require("tslib");
|
|||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var antd_1 = require("antd");
|
||||
var dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
||||
var pageHeader_1 = tslib_1.__importDefault(require("../../../../components/common/pageHeader"));
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
function Render(props) {
|
||||
var data = props.data, methods = props.methods;
|
||||
var GenderOptions = data.GenderOptions, IDCardTypeOptions = data.IDCardTypeOptions;
|
||||
var t = methods.t, update = methods.update, confirm = methods.confirm;
|
||||
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ layout: "horizontal", labelCol: { span: 8 }, wrapperCol: { span: 16 }, style: { maxWidth: 600 } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.nickname'), required: true }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { onChange: function (e) { return update({ nickname: e.target.value }); }, value: data.nickname || '' }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.name') }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { onChange: function (e) { return update({ name: e.target.value }); }, value: data.name || '' }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.birth') }, { children: (0, jsx_runtime_1.jsx)(antd_1.DatePicker, { value: data.birth ? (0, dayjs_1.default)(data.birth) : undefined, format: 'YYYY/MM/DD', onChange: function (value) {
|
||||
return update({ birth: (0, dayjs_1.default)(value).valueOf() });
|
||||
} }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.gender') }, { children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, tslib_1.__assign({ onChange: function (e) {
|
||||
update({
|
||||
gender: e.target
|
||||
.value,
|
||||
});
|
||||
}, value: data.gender }, { children: GenderOptions.map(function (ele, idx) { return ((0, jsx_runtime_1.jsx)(antd_1.Radio, tslib_1.__assign({ value: ele.value }, { children: ele.label }), idx)); }) })) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.idCardType') }, { children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, tslib_1.__assign({ onChange: function (e) {
|
||||
update({
|
||||
idCardType: e.target
|
||||
.value,
|
||||
});
|
||||
}, value: data.idCardType }, { children: IDCardTypeOptions.map(function (ele, idx) { return ((0, jsx_runtime_1.jsx)(antd_1.Radio, tslib_1.__assign({ value: ele.value, className: web_module_less_1.default.radio }, { children: ele.label }), idx)); }) })) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.idNumber') }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { onChange: function (e) { return update({ idNumber: e.target.value }); }, value: data.idNumber || '' }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 8, span: 16 } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", color: "primary", onClick: function () { return confirm(); } }, { children: t('common::action.confirm') })) }))] })) })));
|
||||
return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ layout: "horizontal", labelCol: { span: 8 }, wrapperCol: { span: 16 }, style: { maxWidth: 600 } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.nickname'), required: true }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { onChange: function (e) {
|
||||
return update({ nickname: e.target.value });
|
||||
}, value: data.nickname || '' }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.name') }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { onChange: function (e) { return update({ name: e.target.value }); }, value: data.name || '' }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.birth') }, { children: (0, jsx_runtime_1.jsx)(antd_1.DatePicker, { value: data.birth ? (0, dayjs_1.default)(data.birth) : undefined, format: 'YYYY/MM/DD', onChange: function (value) {
|
||||
return update({ birth: (0, dayjs_1.default)(value).valueOf() });
|
||||
} }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.gender') }, { children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, tslib_1.__assign({ onChange: function (e) {
|
||||
update({
|
||||
gender: e.target
|
||||
.value,
|
||||
});
|
||||
}, value: data.gender }, { children: GenderOptions.map(function (ele, idx) { return ((0, jsx_runtime_1.jsx)(antd_1.Radio, tslib_1.__assign({ value: ele.value }, { children: ele.label }), idx)); }) })) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.idCardType') }, { children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, tslib_1.__assign({ onChange: function (e) {
|
||||
update({
|
||||
idCardType: e.target
|
||||
.value,
|
||||
});
|
||||
}, value: data.idCardType }, { children: IDCardTypeOptions.map(function (ele, idx) { return ((0, jsx_runtime_1.jsx)(antd_1.Radio, tslib_1.__assign({ value: ele.value, className: web_module_less_1.default.radio }, { children: ele.label }), idx)); }) })) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.idNumber') }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { onChange: function (e) {
|
||||
return update({ idNumber: e.target.value });
|
||||
}, value: data.idNumber || '' }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 8, span: 16 } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", color: "primary", onClick: function () { return confirm(); } }, { children: t('common::action.confirm') })) }))] })) })) }));
|
||||
}
|
||||
exports.default = Render;
|
||||
|
|
|
|||
|
|
@ -5,86 +5,87 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|||
var antd_1 = require("antd");
|
||||
var icons_1 = require("@ant-design/icons");
|
||||
var filterPanel_1 = tslib_1.__importDefault(require("oak-frontend-base/es/components/filterPanel"));
|
||||
var pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/pageHeader"));
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
function Render(props) {
|
||||
var methods = props.methods, data = props.data;
|
||||
var t = methods.t, setPageSize = methods.setPageSize, setCurrentPage = methods.setCurrentPage, goNewUser = methods.goNewUser, onCellClicked = methods.onCellClicked;
|
||||
var oakFullpath = data.oakFullpath, oakLoading = data.oakLoading, oakPagination = data.oakPagination, _a = data.userArr, userArr = _a === void 0 ? [] : _a, stateColor = data.stateColor, isRoot = data.isRoot;
|
||||
var _b = oakPagination || {}, pageSize = _b.pageSize, total = _b.total, currentPage = _b.currentPage;
|
||||
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [isRoot && ((0, jsx_runtime_1.jsx)(antd_1.Space, tslib_1.__assign({ style: { marginBottom: 16 } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () {
|
||||
goNewUser();
|
||||
} }, { children: "\u6DFB\u52A0\u7528\u6237" })) }))), (0, jsx_runtime_1.jsx)(filterPanel_1.default, { entity: "user", oakPath: oakFullpath, columns: [
|
||||
{
|
||||
attr: 'nickname',
|
||||
op: '$includes',
|
||||
},
|
||||
{
|
||||
attr: 'name',
|
||||
op: '$includes',
|
||||
},
|
||||
{
|
||||
attr: 'userState',
|
||||
},
|
||||
] }), (0, jsx_runtime_1.jsx)(antd_1.Table, { loading: oakLoading, dataSource: userArr, rowKey: "id", columns: [
|
||||
{
|
||||
dataIndex: 'id',
|
||||
title: '#',
|
||||
render: function (value, record, index) {
|
||||
return index + 1;
|
||||
return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [isRoot && ((0, jsx_runtime_1.jsx)(antd_1.Space, tslib_1.__assign({ style: { marginBottom: 16 } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () {
|
||||
goNewUser();
|
||||
} }, { children: "\u6DFB\u52A0\u7528\u6237" })) }))), (0, jsx_runtime_1.jsx)(filterPanel_1.default, { entity: "user", oakPath: oakFullpath, columns: [
|
||||
{
|
||||
attr: 'nickname',
|
||||
op: '$includes',
|
||||
},
|
||||
},
|
||||
{
|
||||
width: 100,
|
||||
dataIndex: 'avatar',
|
||||
title: '头像',
|
||||
render: function (value, record, index) {
|
||||
if (!value) {
|
||||
return ((0, jsx_runtime_1.jsx)(antd_1.Avatar, { icon: (0, jsx_runtime_1.jsx)(icons_1.UserOutlined, {}) }));
|
||||
}
|
||||
return (0, jsx_runtime_1.jsx)(antd_1.Avatar, { src: value, shape: "circle" });
|
||||
{
|
||||
attr: 'name',
|
||||
op: '$includes',
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'nickname',
|
||||
title: '昵称',
|
||||
},
|
||||
{
|
||||
dataIndex: 'name',
|
||||
title: '姓名',
|
||||
},
|
||||
{
|
||||
dataIndex: 'mobile',
|
||||
title: '手机号',
|
||||
},
|
||||
{
|
||||
dataIndex: 'userState',
|
||||
title: '状态',
|
||||
render: function (value, record, index) {
|
||||
return ((0, jsx_runtime_1.jsx)(antd_1.Tag, tslib_1.__assign({ color: stateColor[value] }, { children: t("user:v.userState.".concat(value)) })));
|
||||
{
|
||||
attr: 'userState',
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'op',
|
||||
width: 200,
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
render: function (value, record, index) {
|
||||
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function () {
|
||||
onCellClicked(record.id);
|
||||
} }, { children: "\u8BE6\u60C5" })) }));
|
||||
] }), (0, jsx_runtime_1.jsx)(antd_1.Table, { loading: oakLoading, dataSource: userArr, rowKey: "id", columns: [
|
||||
{
|
||||
dataIndex: 'id',
|
||||
title: '#',
|
||||
render: function (value, record, index) {
|
||||
return index + 1;
|
||||
},
|
||||
},
|
||||
fixed: 'right',
|
||||
},
|
||||
], pagination: {
|
||||
total: total,
|
||||
pageSize: pageSize,
|
||||
current: currentPage,
|
||||
onShowSizeChange: function (pageSize) {
|
||||
setPageSize(pageSize);
|
||||
},
|
||||
onChange: function (page) {
|
||||
setCurrentPage(page);
|
||||
},
|
||||
} })] })));
|
||||
{
|
||||
width: 100,
|
||||
dataIndex: 'avatar',
|
||||
title: '头像',
|
||||
render: function (value, record, index) {
|
||||
if (!value) {
|
||||
return ((0, jsx_runtime_1.jsx)(antd_1.Avatar, { icon: (0, jsx_runtime_1.jsx)(icons_1.UserOutlined, {}) }));
|
||||
}
|
||||
return (0, jsx_runtime_1.jsx)(antd_1.Avatar, { src: value, shape: "circle" });
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'nickname',
|
||||
title: '昵称',
|
||||
},
|
||||
{
|
||||
dataIndex: 'name',
|
||||
title: '姓名',
|
||||
},
|
||||
{
|
||||
dataIndex: 'mobile',
|
||||
title: '手机号',
|
||||
},
|
||||
{
|
||||
dataIndex: 'userState',
|
||||
title: '状态',
|
||||
render: function (value, record, index) {
|
||||
return ((0, jsx_runtime_1.jsx)(antd_1.Tag, tslib_1.__assign({ color: stateColor[value] }, { children: t("user:v.userState.".concat(value)) })));
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'op',
|
||||
width: 200,
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
render: function (value, record, index) {
|
||||
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function () {
|
||||
onCellClicked(record.id);
|
||||
} }, { children: "\u8BE6\u60C5" })) }));
|
||||
},
|
||||
fixed: 'right',
|
||||
},
|
||||
], pagination: {
|
||||
total: total,
|
||||
pageSize: pageSize,
|
||||
current: currentPage,
|
||||
onShowSizeChange: function (pageSize) {
|
||||
setPageSize(pageSize);
|
||||
},
|
||||
onChange: function (page) {
|
||||
setCurrentPage(page);
|
||||
},
|
||||
} })] })) }));
|
||||
}
|
||||
exports.default = Render;
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ function render(props) {
|
|||
var _c = oakPagination || {}, pageSize = _c.pageSize, total = _c.total, currentPage = _c.currentPage;
|
||||
var _d = props.methods, t = _d.t, setPageSize = _d.setPageSize, setCurrentPage = _d.setCurrentPage;
|
||||
return ((0, jsx_runtime_1.jsx)(antd_1.Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [
|
||||
// {
|
||||
// dataIndex: 'id',
|
||||
// title: '序号',
|
||||
// render: (value, record, index) => {
|
||||
// return index + 1;
|
||||
// },
|
||||
// },
|
||||
{
|
||||
dataIndex: 'id',
|
||||
title: '#',
|
||||
render: function (value, record, index) {
|
||||
return index + 1;
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'name',
|
||||
title: '授权人',
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
/// <reference types="react" />
|
||||
import { EntityDict } from '../../../oak-app-domain';
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "wechatLogin", false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "wechatLogin", false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ exports.default = OakComponent({
|
|||
listeners: {},
|
||||
methods: {
|
||||
getCodeAndRedirect: function () {
|
||||
var state = encodeURIComponent("?backUrl=/wechatLogin/confirm?oakId=".concat(this.props.oakId));
|
||||
var state = encodeURIComponent("/wechatLogin/confirm?oakId=".concat(this.props.oakId));
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
this.navigateTo({
|
||||
url: '/wechatUser/login',
|
||||
|
|
@ -45,7 +45,7 @@ exports.default = OakComponent({
|
|||
}
|
||||
else {
|
||||
var appId = this.state.appId;
|
||||
var redirectUrl = "".concat(window.location.host, "/wechaUser/login?wechatLoginId=").concat(this.props.oakId);
|
||||
var redirectUrl = "".concat(window.location.host, "/wechatUser/login?wechatLoginId=").concat(this.props.oakId);
|
||||
window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=".concat(appId, "&state=").concat(state, "&redirect_uri=").concat(redirectUrl, "&response_type=code&scope=SCOPE#wechat_redirect");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict } from '../../../../oak-app-domain';
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'user', true, {
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'wechatPublicTag', true, {
|
||||
showBack: boolean;
|
||||
list: Partial<EntityDict['wechatPublicTag']['Schema']>[];
|
||||
}, {
|
||||
|
|
|
|||
|
|
@ -19,14 +19,14 @@ exports.default = OakComponent({
|
|||
methods: {
|
||||
login: function () {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var features, token, url, urlParse, query, code, state, wechatLoginId, err_1;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
var _a, features, t, token, url, urlParse, query, code, state, wechatLoginId, err_1;
|
||||
return tslib_1.__generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
this.setState({
|
||||
loading: true,
|
||||
});
|
||||
features = this.features;
|
||||
_a = this, features = _a.features, t = _a.t;
|
||||
token = features.token.getToken(true);
|
||||
url = window.location.href;
|
||||
urlParse = url_1.default.parse(url, true);
|
||||
|
|
@ -36,44 +36,40 @@ exports.default = OakComponent({
|
|||
wechatLoginId = query === null || query === void 0 ? void 0 : query.wechatLoginId;
|
||||
if (!code) {
|
||||
this.setState({
|
||||
error: '缺少code参数',
|
||||
error: t('missingCodeParameter'),
|
||||
loading: false,
|
||||
});
|
||||
return [2 /*return*/];
|
||||
}
|
||||
if (!(process.env.NODE_ENV === 'production' && token)) return [3 /*break*/, 1];
|
||||
//token有效 不调用登录
|
||||
console.log('token有效');
|
||||
if (!(process.env.NODE_ENV === 'production' &&
|
||||
(token === null || token === void 0 ? void 0 : token.ableState) === 'enabled')) return [3 /*break*/, 1];
|
||||
this.setState({
|
||||
loading: false,
|
||||
});
|
||||
this.go(state);
|
||||
return [3 /*break*/, 5];
|
||||
return [3 /*break*/, 4];
|
||||
case 1:
|
||||
console.log('token不存在或失效');
|
||||
_a.label = 2;
|
||||
case 2:
|
||||
_a.trys.push([2, 4, , 5]);
|
||||
_b.trys.push([1, 3, , 4]);
|
||||
// web微信扫码跟公众号授权
|
||||
return [4 /*yield*/, features.token.loginWechat(code, {
|
||||
wechatLoginId: wechatLoginId,
|
||||
})];
|
||||
case 3:
|
||||
case 2:
|
||||
// web微信扫码跟公众号授权
|
||||
_a.sent();
|
||||
_b.sent();
|
||||
this.setState({
|
||||
loading: false,
|
||||
});
|
||||
this.go(state);
|
||||
return [3 /*break*/, 5];
|
||||
case 4:
|
||||
err_1 = _a.sent();
|
||||
return [3 /*break*/, 4];
|
||||
case 3:
|
||||
err_1 = _b.sent();
|
||||
this.setState({
|
||||
error: '微信登录失败',
|
||||
error: t('weChatLoginFailed'),
|
||||
loading: false,
|
||||
});
|
||||
throw err_1;
|
||||
case 5: return [2 /*return*/];
|
||||
case 4: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"missingCodeParameter": "缺少code参数",
|
||||
"weChatLoginFailed": "微信登录失败"
|
||||
}
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
"x2js": "^3.4.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@ant-design/icons": "^4.7.0",
|
||||
"@ant-design/icons": "^5.2.6",
|
||||
"antd": "^5.8.3",
|
||||
"antd-mobile": "^5.32.0",
|
||||
"antd-mobile-icons": "^0.3.0",
|
||||
|
|
@ -45,6 +45,7 @@
|
|||
"react-router-dom": "^6.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ant-design/icons": "^5.2.6",
|
||||
"@babel/cli": "^7.12.13",
|
||||
"@babel/core": "^7.12.13",
|
||||
"@babel/plugin-proposal-class-properties": "^7.12.13",
|
||||
|
|
|
|||
|
|
@ -115,6 +115,17 @@ const i18ns: I18n[] = [
|
|||
"avatar": "头像"
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "ce120594bf9738e2092b3c7bf4da71e9",
|
||||
namespace: "oak-general-business-p-wechatUser-login",
|
||||
language: "zh-CN",
|
||||
module: "oak-general-business",
|
||||
position: "src/pages/wechatUser/login",
|
||||
data: {
|
||||
"missingCodeParameter": "缺少code参数",
|
||||
"weChatLoginFailed": "微信登录失败"
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "d790bd454c420a031bbde799c83bbe71",
|
||||
namespace: "oak-general-business-c-common-qrCode",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import * as React from 'react';
|
||||
import React from 'react';
|
||||
import { Table, Button, Space, Typography } from 'antd';
|
||||
import PageHeader from '../../../components/common/pageHeader';
|
||||
import ActionBtnPanel from 'oak-frontend-base/es/components/actionBtnPanel';
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
import { OakUserInvisibleException } from 'oak-domain/lib/types';
|
||||
import dayjs from 'dayjs';
|
||||
import {
|
||||
AppType,
|
||||
WechatPublicConfig,
|
||||
} from '../../../oak-app-domain/Application/Schema';
|
||||
import { LOCAL_STORAGE_KEYS } from '../../../config/constants';
|
||||
|
||||
type Attr = 'nickname' | 'gender' | 'birth';
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
import React from 'react';
|
||||
|
||||
import { List, Tag, Avatar, Descriptions } from 'antd';
|
||||
import { Tag, Avatar, Descriptions } from 'antd';
|
||||
|
||||
import Style from './web.module.less';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict } from '../../../../oak-app-domain';
|
||||
import ActionPanel from '../../../../components/func/actionPanel';
|
||||
import PageHeader from '../../../../components/common/pageHeader';
|
||||
|
||||
|
||||
export default function render(
|
||||
|
|
@ -57,53 +58,55 @@ export default function render(
|
|||
const { t, onActionClick } = props.methods;
|
||||
|
||||
return (
|
||||
<div className={Style.container}>
|
||||
<Descriptions
|
||||
extra={
|
||||
<ActionPanel
|
||||
actions={executableActions}
|
||||
actionDescriptions={actionDescriptions}
|
||||
onActionClick={(action: string) =>
|
||||
onActionClick(action)
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Descriptions.Item label={t('avatar')}>
|
||||
{avatar ? <Avatar src={avatar} /> : t('unset')}
|
||||
</Descriptions.Item>
|
||||
<PageHeader>
|
||||
<div className={Style.container}>
|
||||
<Descriptions
|
||||
extra={
|
||||
<ActionPanel
|
||||
actions={executableActions}
|
||||
actionDescriptions={actionDescriptions}
|
||||
onActionClick={(action: string) =>
|
||||
onActionClick(action)
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Descriptions.Item label={t('avatar')}>
|
||||
{avatar ? <Avatar src={avatar} /> : t('unset')}
|
||||
</Descriptions.Item>
|
||||
|
||||
<Descriptions.Item label={t('user:attr.nickname')}>
|
||||
{nickname || t('unset')}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={t('user:attr.nickname')}>
|
||||
{nickname || t('unset')}
|
||||
</Descriptions.Item>
|
||||
|
||||
<Descriptions.Item label={t('user:attr.name')}>
|
||||
{name || t('unset')}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={t('user:attr.name')}>
|
||||
{name || t('unset')}
|
||||
</Descriptions.Item>
|
||||
|
||||
<Descriptions.Item label={t('user:attr.gender')}>
|
||||
{gender ? t(`user:v.gender.${gender}`) : t('unset')}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={t('user:attr.gender')}>
|
||||
{gender ? t(`user:v.gender.${gender}`) : t('unset')}
|
||||
</Descriptions.Item>
|
||||
|
||||
<Descriptions.Item label={t('user:attr.birth')}>
|
||||
{birth || t('unset')}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={t('user:attr.birth')}>
|
||||
{birth || t('unset')}
|
||||
</Descriptions.Item>
|
||||
|
||||
<Descriptions.Item label={t('mobile')}>
|
||||
{mobileText || t('unset')}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={t('mobile')}>
|
||||
{mobileText || t('unset')}
|
||||
</Descriptions.Item>
|
||||
|
||||
<Descriptions.Item label={t('user:attr.userState')}>
|
||||
<Tag color={stateColor[userState!]}>
|
||||
{t(`user:v.userState.${userState}`)}
|
||||
</Tag>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={t('user:attr.idState')}>
|
||||
<Tag color={idStateColor[idState!]}>
|
||||
{t(`user:v.idState.${idState}`)}
|
||||
</Tag>
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
</div>
|
||||
<Descriptions.Item label={t('user:attr.userState')}>
|
||||
<Tag color={stateColor[userState!]}>
|
||||
{t(`user:v.userState.${userState}`)}
|
||||
</Tag>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={t('user:attr.idState')}>
|
||||
<Tag color={idStateColor[idState!]}>
|
||||
{t(`user:v.idState.${idState}`)}
|
||||
</Tag>
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
</div>
|
||||
</PageHeader>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import React, { useState } from 'react';
|
||||
import React from 'react';
|
||||
import { Button, Checkbox, Input, Form, Radio, DatePicker, Space } from 'antd';
|
||||
import dayjs from 'dayjs';
|
||||
import Style from './web.module.less';
|
||||
import { EntityDict } from '../../../../oak-app-domain';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import type { DatePickerProps } from 'antd';
|
||||
import { EntityDict } from '../../../../oak-app-domain';
|
||||
import PageHeader from '../../../../components/common/pageHeader';
|
||||
import Style from './web.module.less';
|
||||
|
||||
|
||||
export default function Render(
|
||||
|
|
@ -33,90 +33,96 @@ export default function Render(
|
|||
const { t, update, confirm } = methods;
|
||||
|
||||
return (
|
||||
<div className={Style.container}>
|
||||
<Form
|
||||
layout="horizontal"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}
|
||||
style={{ maxWidth: 600 }}
|
||||
>
|
||||
<Form.Item label={t('user:attr.nickname')} required>
|
||||
<Input
|
||||
onChange={(e) => update({ nickname: e.target.value })}
|
||||
value={data.nickname || ''}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('user:attr.name')}>
|
||||
<Input
|
||||
onChange={(e) => update({ name: e.target.value })}
|
||||
value={data.name || ''}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('user:attr.birth')}>
|
||||
<DatePicker
|
||||
value={data.birth ? dayjs(data.birth) : undefined}
|
||||
format={'YYYY/MM/DD'}
|
||||
onChange={(value) =>
|
||||
update({ birth: dayjs(value).valueOf() })
|
||||
}
|
||||
/>
|
||||
</Form.Item>
|
||||
<PageHeader>
|
||||
<div className={Style.container}>
|
||||
<Form
|
||||
layout="horizontal"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}
|
||||
style={{ maxWidth: 600 }}
|
||||
>
|
||||
<Form.Item label={t('user:attr.nickname')} required>
|
||||
<Input
|
||||
onChange={(e) =>
|
||||
update({ nickname: e.target.value })
|
||||
}
|
||||
value={data.nickname || ''}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('user:attr.name')}>
|
||||
<Input
|
||||
onChange={(e) => update({ name: e.target.value })}
|
||||
value={data.name || ''}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('user:attr.birth')}>
|
||||
<DatePicker
|
||||
value={data.birth ? dayjs(data.birth) : undefined}
|
||||
format={'YYYY/MM/DD'}
|
||||
onChange={(value) =>
|
||||
update({ birth: dayjs(value).valueOf() })
|
||||
}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label={t('user:attr.gender')}>
|
||||
<Radio.Group
|
||||
onChange={(e) => {
|
||||
update({
|
||||
gender: e.target
|
||||
.value as EntityDict['user']['OpSchema']['gender'],
|
||||
});
|
||||
}}
|
||||
value={data.gender}
|
||||
>
|
||||
{GenderOptions.map((ele, idx) => (
|
||||
<Radio value={ele.value} key={idx}>
|
||||
{ele.label}
|
||||
</Radio>
|
||||
))}
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('user:attr.idCardType')}>
|
||||
<Radio.Group
|
||||
onChange={(e) => {
|
||||
update({
|
||||
idCardType: e.target
|
||||
.value as EntityDict['user']['OpSchema']['idCardType'],
|
||||
});
|
||||
}}
|
||||
value={data.idCardType}
|
||||
>
|
||||
{IDCardTypeOptions.map((ele, idx) => (
|
||||
<Radio
|
||||
value={ele.value}
|
||||
key={idx}
|
||||
className={Style.radio}
|
||||
>
|
||||
{ele.label}
|
||||
</Radio>
|
||||
))}
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('user:attr.idNumber')}>
|
||||
<Input
|
||||
onChange={(e) => update({ idNumber: e.target.value })}
|
||||
value={data.idNumber || ''}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('user:attr.gender')}>
|
||||
<Radio.Group
|
||||
onChange={(e) => {
|
||||
update({
|
||||
gender: e.target
|
||||
.value as EntityDict['user']['OpSchema']['gender'],
|
||||
});
|
||||
}}
|
||||
value={data.gender}
|
||||
>
|
||||
{GenderOptions.map((ele, idx) => (
|
||||
<Radio value={ele.value} key={idx}>
|
||||
{ele.label}
|
||||
</Radio>
|
||||
))}
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('user:attr.idCardType')}>
|
||||
<Radio.Group
|
||||
onChange={(e) => {
|
||||
update({
|
||||
idCardType: e.target
|
||||
.value as EntityDict['user']['OpSchema']['idCardType'],
|
||||
});
|
||||
}}
|
||||
value={data.idCardType}
|
||||
>
|
||||
{IDCardTypeOptions.map((ele, idx) => (
|
||||
<Radio
|
||||
value={ele.value}
|
||||
key={idx}
|
||||
className={Style.radio}
|
||||
>
|
||||
{ele.label}
|
||||
</Radio>
|
||||
))}
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('user:attr.idNumber')}>
|
||||
<Input
|
||||
onChange={(e) =>
|
||||
update({ idNumber: e.target.value })
|
||||
}
|
||||
value={data.idNumber || ''}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item wrapperCol={{ offset: 8, span: 16 }}>
|
||||
<Button
|
||||
type="primary"
|
||||
color="primary"
|
||||
onClick={() => confirm()}
|
||||
>
|
||||
{t('common::action.confirm')}
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
<Form.Item wrapperCol={{ offset: 8, span: 16 }}>
|
||||
<Button
|
||||
type="primary"
|
||||
color="primary"
|
||||
onClick={() => confirm()}
|
||||
>
|
||||
{t('common::action.confirm')}
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
</PageHeader>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { UserOutlined } from '@ant-design/icons';
|
|||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import FilterPanel from 'oak-frontend-base/es/components/filterPanel';
|
||||
import { EntityDict } from '../../../oak-app-domain';
|
||||
import PageHeader from '../../../components/common/pageHeader';
|
||||
import Style from './web.module.less';
|
||||
|
||||
export default function Render(
|
||||
|
|
@ -41,120 +42,124 @@ export default function Render(
|
|||
const { pageSize, total, currentPage } = oakPagination || {};
|
||||
|
||||
return (
|
||||
<div className={Style.container}>
|
||||
{isRoot && (
|
||||
<Space style={{ marginBottom: 16 }}>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
goNewUser();
|
||||
}}
|
||||
>
|
||||
添加用户
|
||||
</Button>
|
||||
</Space>
|
||||
)}
|
||||
<PageHeader>
|
||||
<div className={Style.container}>
|
||||
{isRoot && (
|
||||
<Space style={{ marginBottom: 16 }}>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
goNewUser();
|
||||
}}
|
||||
>
|
||||
添加用户
|
||||
</Button>
|
||||
</Space>
|
||||
)}
|
||||
|
||||
<FilterPanel
|
||||
entity="user"
|
||||
oakPath={oakFullpath}
|
||||
columns={[
|
||||
{
|
||||
attr: 'nickname',
|
||||
op: '$includes',
|
||||
},
|
||||
{
|
||||
attr: 'name',
|
||||
op: '$includes',
|
||||
},
|
||||
{
|
||||
attr: 'userState',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
<Table
|
||||
loading={oakLoading}
|
||||
dataSource={userArr}
|
||||
rowKey="id"
|
||||
columns={[
|
||||
{
|
||||
dataIndex: 'id',
|
||||
title: '#',
|
||||
render: (value, record, index) => {
|
||||
return index + 1;
|
||||
<FilterPanel
|
||||
entity="user"
|
||||
oakPath={oakFullpath}
|
||||
columns={[
|
||||
{
|
||||
attr: 'nickname',
|
||||
op: '$includes',
|
||||
},
|
||||
},
|
||||
{
|
||||
width: 100,
|
||||
dataIndex: 'avatar',
|
||||
title: '头像',
|
||||
render: (value, record, index) => {
|
||||
if (!value) {
|
||||
{
|
||||
attr: 'name',
|
||||
op: '$includes',
|
||||
},
|
||||
{
|
||||
attr: 'userState',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
<Table
|
||||
loading={oakLoading}
|
||||
dataSource={userArr}
|
||||
rowKey="id"
|
||||
columns={[
|
||||
{
|
||||
dataIndex: 'id',
|
||||
title: '#',
|
||||
render: (value, record, index) => {
|
||||
return index + 1;
|
||||
},
|
||||
},
|
||||
{
|
||||
width: 100,
|
||||
dataIndex: 'avatar',
|
||||
title: '头像',
|
||||
render: (value, record, index) => {
|
||||
if (!value) {
|
||||
return (
|
||||
<Avatar
|
||||
icon={<UserOutlined />}
|
||||
></Avatar>
|
||||
);
|
||||
}
|
||||
return <Avatar src={value} shape="circle" />;
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'nickname',
|
||||
title: '昵称',
|
||||
},
|
||||
{
|
||||
dataIndex: 'name',
|
||||
title: '姓名',
|
||||
},
|
||||
{
|
||||
dataIndex: 'mobile',
|
||||
title: '手机号',
|
||||
},
|
||||
{
|
||||
dataIndex: 'userState',
|
||||
title: '状态',
|
||||
render: (value, record, index) => {
|
||||
return (
|
||||
<Avatar icon={<UserOutlined />}></Avatar>
|
||||
<Tag color={stateColor[value]}>
|
||||
{t(`user:v.userState.${value}`)}
|
||||
</Tag>
|
||||
);
|
||||
}
|
||||
return <Avatar src={value} shape="circle" />;
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'nickname',
|
||||
title: '昵称',
|
||||
},
|
||||
{
|
||||
dataIndex: 'name',
|
||||
title: '姓名',
|
||||
},
|
||||
{
|
||||
dataIndex: 'mobile',
|
||||
title: '手机号',
|
||||
},
|
||||
{
|
||||
dataIndex: 'userState',
|
||||
title: '状态',
|
||||
render: (value, record, index) => {
|
||||
return (
|
||||
<Tag color={stateColor[value]}>
|
||||
{t(`user:v.userState.${value}`)}
|
||||
</Tag>
|
||||
);
|
||||
{
|
||||
dataIndex: 'op',
|
||||
width: 200,
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
render: (value, record, index) => {
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() => {
|
||||
onCellClicked(record.id!);
|
||||
}}
|
||||
>
|
||||
详情
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
},
|
||||
fixed: 'right',
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'op',
|
||||
width: 200,
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
render: (value, record, index) => {
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() => {
|
||||
onCellClicked(record.id!);
|
||||
}}
|
||||
>
|
||||
详情
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
]}
|
||||
pagination={{
|
||||
total: total,
|
||||
pageSize: pageSize,
|
||||
current: currentPage,
|
||||
onShowSizeChange: (pageSize: number) => {
|
||||
setPageSize(pageSize);
|
||||
},
|
||||
fixed: 'right',
|
||||
},
|
||||
]}
|
||||
pagination={{
|
||||
total: total,
|
||||
pageSize: pageSize,
|
||||
current: currentPage,
|
||||
onShowSizeChange: (pageSize: number) => {
|
||||
setPageSize(pageSize);
|
||||
},
|
||||
onChange: (page: number) => {
|
||||
setCurrentPage(page);
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
onChange: (page: number) => {
|
||||
setCurrentPage(page);
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</PageHeader>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { firstLetterUpperCase } from 'oak-domain/lib/utils/string';
|
||||
import { EntityDict } from '../../../oak-app-domain';
|
||||
|
||||
export default OakComponent({
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import * as React from 'react';
|
||||
import React from 'react';
|
||||
import { Table, Space, Typography } from 'antd';
|
||||
import dayjs from 'dayjs';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
|
|
@ -33,13 +33,13 @@ export default function render(
|
|||
dataSource={list}
|
||||
rowKey="id"
|
||||
columns={[
|
||||
// {
|
||||
// dataIndex: 'id',
|
||||
// title: '序号',
|
||||
// render: (value, record, index) => {
|
||||
// return index + 1;
|
||||
// },
|
||||
// },
|
||||
{
|
||||
dataIndex: 'id',
|
||||
title: '#',
|
||||
render: (value, record, index) => {
|
||||
return index + 1;
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'name',
|
||||
title: '授权人',
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { EntityDict } from '../../../oak-app-domain';
|
||||
import { WebConfig } from "../../../entities/Application";
|
||||
import { WebConfig } from "../../../oak-app-domain/Application/Schema";
|
||||
|
||||
|
||||
export default OakComponent({
|
||||
|
|
@ -20,7 +19,7 @@ export default OakComponent({
|
|||
const userId = wechatLogin?.userId;
|
||||
const type = wechatLogin?.type;
|
||||
const application = features.application.getApplication();
|
||||
const appId = (application?.config as WebConfig | undefined)?.wechat
|
||||
const appId = (application?.config as WebConfig)?.wechat
|
||||
?.appId;
|
||||
return {
|
||||
type,
|
||||
|
|
@ -35,7 +34,7 @@ export default OakComponent({
|
|||
listeners: {},
|
||||
methods: {
|
||||
getCodeAndRedirect() {
|
||||
const state = encodeURIComponent(`?backUrl=/wechatLogin/confirm?oakId=${this.props.oakId}`);
|
||||
const state = encodeURIComponent(`/wechatLogin/confirm?oakId=${this.props.oakId}`);
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
this.navigateTo(
|
||||
{
|
||||
|
|
@ -48,7 +47,7 @@ export default OakComponent({
|
|||
}
|
||||
else {
|
||||
const { appId } = this.state;
|
||||
const redirectUrl = `${window.location.host}/wechaUser/login?wechatLoginId=${this.props.oakId}`;
|
||||
const redirectUrl = `${window.location.host}/wechatUser/login?wechatLoginId=${this.props.oakId}`;
|
||||
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&state=${state}&redirect_uri=${redirectUrl}&response_type=code&scope=SCOPE#wechat_redirect`
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React, { Component } from 'react';
|
||||
import React from 'react';
|
||||
import { Button, Space, Typography, Result } from 'antd';
|
||||
import Style from './web.module.less';
|
||||
import { UserAddOutlined, WechatOutlined, MehOutlined } from '@ant-design/icons';
|
||||
import { WechatOutlined, MehOutlined } from '@ant-design/icons';
|
||||
|
||||
import { isWeiXin } from 'oak-frontend-base/es/utils/utils';
|
||||
|
||||
|
|
@ -96,10 +96,6 @@ export default function Render(
|
|||
else if (type === 'login') {
|
||||
V = (
|
||||
<Space direction="vertical" align='center' size={16}>
|
||||
{/* <img src={`${process.env.PUBLIC_URL}/assets/svg/logo-simple-circular.svg`} alt="logo" />
|
||||
<Title level={4}>
|
||||
集创盒子
|
||||
</Title> */}
|
||||
<Button
|
||||
disabled={oakExecuting || oakLoading}
|
||||
type="primary"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import dayjs from 'dayjs';
|
|||
export default function Render(
|
||||
props: WebComponentProps<
|
||||
EntityDict,
|
||||
'user',
|
||||
'wechatPublicTag',
|
||||
true,
|
||||
{
|
||||
showBack: boolean;
|
||||
|
|
@ -42,15 +42,10 @@ export default function Render(
|
|||
goUpdate,
|
||||
goDelete,
|
||||
} = methods;
|
||||
const {
|
||||
list,
|
||||
showBack = true,
|
||||
oakLoading,
|
||||
oakPagination,
|
||||
} = data;
|
||||
const { list, showBack = true, oakLoading, oakPagination } = data;
|
||||
|
||||
const { pageSize, total, currentPage } = oakPagination || {};
|
||||
|
||||
|
||||
return (
|
||||
<PageHeader title="微信公众号标签" showBack={showBack}>
|
||||
<div className={Style.container}>
|
||||
|
|
|
|||
|
|
@ -19,44 +19,44 @@ export default OakComponent({
|
|||
this.setState({
|
||||
loading: true,
|
||||
});
|
||||
const { features } = this;
|
||||
const { features, t } = this;
|
||||
const token = features.token.getToken(true);
|
||||
const url = window.location.href;
|
||||
const urlParse = URL.parse(url, true);
|
||||
//格式 xx?code=xx&state=/xx/xx?d=xx
|
||||
const query = urlParse?.query;
|
||||
const code = query?.code;
|
||||
const state = query?.state;
|
||||
const wechatLoginId = query?.wechatLoginId;
|
||||
const code = query?.code as string;
|
||||
const state = query?.state as string;
|
||||
const wechatLoginId = query?.wechatLoginId as string;
|
||||
if (!code) {
|
||||
this.setState({
|
||||
error: '缺少code参数',
|
||||
error: t('missingCodeParameter'),
|
||||
loading: false,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV === 'production' && token) {
|
||||
//token有效 不调用登录
|
||||
console.log('token有效');
|
||||
if (
|
||||
process.env.NODE_ENV === 'production' &&
|
||||
token?.ableState === 'enabled'
|
||||
) {
|
||||
this.setState({
|
||||
loading: false,
|
||||
});
|
||||
this.go(state as string);
|
||||
this.go(state);
|
||||
} else {
|
||||
console.log('token不存在或失效');
|
||||
try {
|
||||
// web微信扫码跟公众号授权
|
||||
await features.token.loginWechat(code as string, {
|
||||
wechatLoginId: wechatLoginId as string,
|
||||
await features.token.loginWechat(code, {
|
||||
wechatLoginId,
|
||||
});
|
||||
this.setState({
|
||||
loading: false,
|
||||
});
|
||||
this.go(state as string);
|
||||
this.go(state);
|
||||
} catch (err) {
|
||||
this.setState({
|
||||
error: '微信登录失败',
|
||||
error: t('weChatLoginFailed'),
|
||||
loading: false,
|
||||
});
|
||||
throw err;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"missingCodeParameter": "缺少code参数",
|
||||
"weChatLoginFailed": "微信登录失败"
|
||||
}
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
import { generateNewId, generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
||||
import { CreateTrigger, Trigger } from 'oak-domain/lib/types/Trigger';
|
||||
import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
||||
import { Trigger } from 'oak-domain/lib/types/Trigger';
|
||||
import { EntityDict } from '../oak-app-domain/EntityDict';
|
||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||
import {
|
||||
AppType,
|
||||
WechatPublicConfig,
|
||||
} from '../oak-app-domain/Application/Schema';
|
||||
import { set } from 'oak-domain/lib/utils/lodash';
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue