Commit 8b942e3d authored by LeeJiancong's avatar LeeJiancong

完善支付策略

parents 5b66ab80 e9e3714b
......@@ -127,29 +127,7 @@ const router = [
component: '@/pages/member/memberLevel/addEquity',
},
],
},
{
path: '/authConfig',
name: 'authConfig',
icon: 'SmileOutlined',
routes: [
{
path: '/authConfig/organ',
name: 'organ',
component: '@/pages/authConfig/organ',
},
{
path: '/authConfig/memberSystem',
name: 'memberSystem',
component: '@/pages/authConfig/memberSystem',
},
{
path: '/authConfig/userSystem',
name: 'userSystem',
component: '@/pages/authConfig/userSystem',
},
],
},
}
],
},
];
......
......@@ -17,6 +17,8 @@ export default {
path: '/authConfig/memberSystem/memberDetail',
name: 'memberDetail',
component: '@/pages/authConfig/memberSystem/memberDetail',
hideInMenu: true,
hidePageHeader: true
},
{
path: '/authConfig/userSystem',
......@@ -27,6 +29,8 @@ export default {
path: '/authConfig/userSystem/userDetail',
name: 'userSystem',
component: '@/pages/authConfig/userSystem/userDetail',
hideInMenu: true,
hidePageHeader: true
},
],
}
\ No newline at end of file
const MAIN_COLOR = '#00B37A'
const MAIN_FONT_BOLD_COLOR = '#172B4D'
const MAIN_FONT_TINY_COLOR = '#6B778C'
/**
* 定制antd主题样式
......@@ -7,6 +9,12 @@ const MAIN_COLOR = '#00B37A'
export default {
"layout-header-background": "#38414A",
'primary-color': MAIN_COLOR,
// tabs
'tabs-card-active-color': MAIN_FONT_BOLD_COLOR,
'tabs-highlight-color': MAIN_FONT_BOLD_COLOR,
'tabs-hover-color': MAIN_FONT_BOLD_COLOR,
'tabs-active-color': MAIN_FONT_BOLD_COLOR,
'tabs-card-head-background': '#fff',
// 'link-color': MAIN_COLOR,
// 'link-hover-color': MAIN_COLOR,
// 'link-active-color': MAIN_COLOR,
......
......@@ -4,9 +4,11 @@
"api": "god-ytt",
"start:analyze": "ANALYZE=1 umi dev",
"scripts:build": "node scripts/run",
"scripts:build-yxc": "node scripts/run http://yxc-web-demo.shushangyun.com/api",
"start": "yarn api && yarn scripts:build && umi dev",
"start:dev": "umi dev",
"build": "yarn api && yarn scripts:build && umi build",
"build:yxc": "yarn api && yarn scripts:build-yxc && umi build",
"build:dev": "pm2 start scripts/devServer.js",
"build:analyze": "ANALYZE=1 umi build",
"postinstall": "umi generate tmp",
......@@ -35,7 +37,7 @@
"braft-editor": "^2.3.9",
"classnames": "^2.2.6",
"core-js": "^3.6.5",
"god": "^0.1.18",
"god": "0.1.20",
"lint-staged": "^10.0.7",
"mobx": "^5.15.4",
"mobx-react": "^6.2.2",
......@@ -53,6 +55,11 @@
"gulp": "^4.0.2",
"http-proxy-middleware": "^1.0.5",
"json2ts": "^0.0.7",
<<<<<<< HEAD
"ora": "^4.0.4"
=======
"ora": "^4.0.4",
"typescript": "^3.9.7"
>>>>>>> e9e3714b8dc4dc712b9e6ecc39e1d59cde20bb12
}
}
......@@ -17,8 +17,10 @@ const demoFetch = require('../../demo').fetchConfig
const isDemo = true
const remoteUrl = process.argv[2] || 'http://10.0.0.25:8100'
const axios = Axios.create({
baseURL: 'http://10.0.0.25:8100',
baseURL: remoteUrl,
responseType: 'json',
})
......@@ -33,8 +35,6 @@ const serviceConfig = {
url: '/member/menu/register/detail',
method: 'get'
},
},
//初始化会员支付策略配置
payConfig:{
......@@ -55,9 +55,14 @@ async function batchAxiosHttps() {
for (const item in serviceConfig) {
if(JSON.stringify(item) !== '{}'){
for (const subItem in serviceConfig[item]) {
const data = await axios(serviceConfig[item][subItem])
asyncHttpQueue[item][subItem] = data.data.data
}
try {
const data = await axios(serviceConfig[item][subItem])
asyncHttpQueue[item][subItem] = data.data.data
} catch(err) {
console.log(serviceConfig[item][subItem].url)
console.log(err.response.data)
}
}
}
}
......
.common_detail_page {
margin: -24px;
// margin: -24px;
.common_header {
display: flex;
......
import React, { useState } from 'react'
import { Tag, Row } from 'antd'
import { useFormEffects } from '@formily/antd'
const TableTagList = (props) => {
const { value = [], mutators } = props
const { extra = null, callback = null } = props.props['x-component-props'] ? props.props['x-component-props'] : {}
const handleClose = (id) => {
callback && callback(id)
mutators.remove(value.findIndex(v => v.id === id))
}
return (
<div className="table-tag-list" style={{width: '100%'}}>
<Row style={{flexWrap: 'wrap'}}>
{
value.map(v => <Tag closable onClose={() => handleClose(v.id)} color="#4279DF" key={v.id} style={{marginBottom: 8}}>{v.roleName}</Tag>)
}
</Row>
{extra}
</div>
)
}
TableTagList.defaultProps = {}
TableTagList.isFieldComponent = true;
export default TableTagList
\ No newline at end of file
......@@ -23,4 +23,27 @@
box-shadow: none;
border-bottom: 1px solid #DFE1E6;
}
}
.flex-layout-label-required {
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
height: 32px;
color: rgba(0, 0, 0, 0.85);
font-size: 14px;
&::before {
display: inline-block;
margin-right: 4px;
color: #ff4d4f;
font-size: 14px;
font-family: SimSun, sans-serif;
line-height: 1;
content: '*';
}
}
\ No newline at end of file
import React from 'react';
import SchemaForm, {
IAntdSchemaFormProps, createVirtualBox, registerVirtualBox, Schema, SchemaField, FormButtonGroup, Reset, createControllerBox,
IAntdSchemaFormProps, createVirtualBox, registerVirtualBox, Schema, SchemaField, FormButtonGroup, Reset, createControllerBox, FormItem,
} from '@formily/antd';
import { Button, Space, Row, Col } from 'antd';
import styled from 'styled-components'
......@@ -17,9 +17,9 @@ import CustomRegistryPhone from './components/CustomRegistryPhone';
import CustomRelevance from './components/CustomRelevance';
import Children from './components/Children';
import CircleBox from './components/CircleBox';
import TableTagList from './components/TableTagList';
import './index.less'
import { Input } from '@formily/antd-components';
import cx from 'classnames'
export interface NiceFormProps extends IAntdSchemaFormProps {}
const RowLayout = styled(props => <Row justify='end' {...props}/>)`
......@@ -74,6 +74,28 @@ const schemaLayout = createControllerBox("schemaLayout", (_props) => {
</NiceForm>
);
});
const renderCol = (schema, isLast) => {
const { flexcol = {} } = schema['x-component-props']
return <Col style={isLast ? {} : {marginRight: 24}} {...flexcol} key={schema.path}>
<SchemaField schema={schema.toJSON()} path={schema.path}/>
</Col>
}
registerVirtualBox('flex-box', props => {
const childProperties = props.schema.getOrderProperties()
const { title, required } = props.props
const {labelcol, wrappercol} = props.schema.getExtendsComponentProps()
return <Row>
{ title && <Col span={labelcol} className={cx(required ? 'flex-layout-label-required' : '')}>{title}</Col>}
<Col span={wrappercol}>
<Row>
{
childProperties.map((v, i, arr) => renderCol(v.schema, arr.length - 1 === i))
}
</Row>
</Col>
</Row>
})
const NiceForm: React.FC<NiceFormProps> = props => {
const { children, components, ...reset } = props;
const customComponents = {
......@@ -91,7 +113,8 @@ const NiceForm: React.FC<NiceFormProps> = props => {
Children,
CircleBox,
SchemaFormButtonGroup,
FlexBox
FlexBox,
TableTagList
};
const defineComponents = Object.assign(customComponents, components);
......
import React, { useState, ReactText, useImperativeHandle, useEffect, useRef } from 'react'
import { Tree, Space, Tooltip, Button } from 'antd'
import { findItemAndDelete, findTreeKeys } from '@/utils'
import { findItemAndDelete, findTreeKeys, treeReduction, getParentTreeTitles } from '@/utils'
import './index.less'
import deepClone from 'clone'
import { TreeProps } from 'antd/lib/tree'
......@@ -17,6 +17,7 @@ export interface TabTreeActions {
setExpandedKeys: (keys: ReactText[]) => void,
setSelectKey: (key: ReactText) => void
setSelectKeys: (keys: ReactText[]) => void
getParentPath: (id: ReactText) => string
}
export interface toolsRenderProps {
......@@ -63,6 +64,7 @@ export const createTreeActions = () => {
setSelectKey(){},
setSelectKeys(){},
setExpandedKeys(){},
getParentPath(id){return ''},
}
return actions
}
......@@ -163,6 +165,8 @@ const TabTree:React.FC<TabTreeProps> = (props) => {
checkedKeys,
[]
);
console.log(treeReduction(treeData))
useEffect(() => {
if (getMenuSelectData) {
getMenuSelectData().then(res => {
......@@ -193,6 +197,10 @@ const TabTree:React.FC<TabTreeProps> = (props) => {
selfActions.setSelectKey = (key: ReactText) => {
setSelectKey(key)
}
selfActions.getParentPath = (id: ReactText) => {
return getParentTreeTitles(treeData, id)
}
}
const batchSelect = (items: any[]) => {
......@@ -224,6 +232,7 @@ const TabTree:React.FC<TabTreeProps> = (props) => {
const { node, selected } = e
// 用户自定义的选择后触发事件
if (props.handleSelect) {
console.log(node)
const result = props.handleSelect(node.key, node)
// 存在返回值则不执行选中事件, 一般用于切换node时,不希望离开当前页面
if (result !== undefined) {
......
export const NOT_CHANGE_VALUE = 'hello, world'
export const isDev = true
\ No newline at end of file
// 本地环境跳过权限校验
export const isDev = process.env.NODE_ENV === "development"
\ No newline at end of file
/*
* @Author: LeeJiancong
* @Date: 2020-07-22 09:54:50
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-30 19:28:23
*/
/**
* 正则表达式集合
*/
export const PATTERN_MAPS = {
// 8-20位, 大小写字幕 + 数字组合
password: /^(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d]{8,20}$/,
email: /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/,
phone: /^1[3|4|5|6|7|8|9][0-9]{9}$/,
smsCode: /^\d{6}$/,
money:/^\d*(?:\.\d{0,2})?$/,
weight:/^\d*(?:\.\d{0,3})?$/,
}
\ No newline at end of file
......@@ -15,12 +15,33 @@ body,
min-height: 100vh !important;
}
.wrapper-white {
background: #fff;
border-radius: 8px;
padding: 24px;
}
.connectBtn {
width: 80px;
height: 32px;
line-height: 32px;
background: #6B778C;
color: #fff;
text-align: center;
cursor: pointer;
}
// 内嵌页公共wrapper
.common-wrapper {
background-color: #fff;
padding: 32px 24px;
border-radius: 5px;
}
.common-wrapper-gray {
background-color: #F5F6FA;
padding: 32px 24px;
border-radius: 5px;
}
// 公共显示隐藏处理
.commonShowBlock {
......
export interface MemberType {
id: number;
typeName: string;
}
export interface BusinessType {
id: number;
typeName: string;
}
export interface UseType {
memberType: MemberType[];
businessType: BusinessType[];
}
export interface UserRegister {
useType: UseType;
useDetail?: any;
}
export interface RuleConfiguration {
value: number;
label: string;
platformType: number;
}
export interface PayWayResponse {
payType: number;
value: number;
label: string;
}
export interface PayInitializeConfig {
payType: number;
ruleConfigurations: RuleConfiguration[];
payWayResponses: PayWayResponse[];
}
export interface PayPlatformPayConfig {
id: number;
payType: number;
way: string;
isPitchOn: number;
}
export interface PayConfig {
payInitializeConfig: PayInitializeConfig[];
payPlatformPayConfig: PayPlatformPayConfig[];
}
export interface CountryList {
name: string;
key: string;
icon: string;
}
export interface Children {
code: string;
}
export interface MenuList {
code: string;
children: Children[];
}
export interface Global {
logo: string;
countryList: CountryList[];
menuList: MenuList[];
}
export interface RootObject {
userRegister: UserRegister;
payConfig: PayConfig;
global: Global;
}
\ No newline at end of file
export interface MemberType {
id: number;
typeName: string;
}
export interface BusinessType {
id: number;
typeName: string;
}
export interface UseType {
memberType: MemberType[];
businessType: BusinessType[];
}
export interface UserRegister {
useType: UseType;
useDetail?: any;
}
export interface PayConfig {
payInitializeConfig?: any;
payPlatformPayConfig?: any;
}
export interface CountryList {
name: string;
key: string;
icon: string;
}
export interface Children {
code: string;
}
export interface MenuList {
code: string;
children: Children[];
}
export interface Global {
logo: string;
countryList: CountryList[];
menuList: MenuList[];
}
export interface RootObject {
userRegister: UserRegister;
payConfig: PayConfig;
global: Global;
}
\ No newline at end of file
......@@ -23,7 +23,7 @@ export function useHttpRequest<T>(api: (params?, config?) => Promise<T>, config?
setLoading(true)
api(params).then((res: any) => {
setData(res.data)
if (config && config.back) {
if (res.code === 1000 && config && config.back) {
setTimeout(() => {
goBack()
}, 1000)
......
......@@ -57,11 +57,19 @@ export const useRowSelectionTable = (options: useRowSelectionOptions = {}): [Tab
onSelect: (record, selects, selectedRows, nativeEvent) => {
if (type === 'radio') {
// 单选情况下
<<<<<<< HEAD
setSelectedRowKeys([record[customKey]])
setSelectRow([record])
return ;
}
const findIds = selectedRowKeys.indexOf(record[customKey])
=======
setSelectedRowKeys([record.id])
setSelectRow([record])
return ;
}
const findIds = selectedRowKeys.indexOf(record.id)
>>>>>>> e9e3714b8dc4dc712b9e6ecc39e1d59cde20bb12
if (findIds === -1) {
mergeRowKeys(record[customKey])
mergeRow(record)
......
......@@ -38,6 +38,8 @@
}
.lx-page-header {
display: flex;
justify-content: space-between;
background: #fff;
padding: 0 24px;
height: 64px;
......@@ -52,6 +54,7 @@
min-height: calc(100vh - 200px);
&.noHeader {
padding: 0;
min-height: calc(100vh - 156px);
}
}
......
......@@ -52,6 +52,7 @@ export default {
'menu.authConfig': '平台权限',
'menu.authConfig.organ': '组织机构',
'menu.authConfig.memberSystem': '角色管理',
'menu.authConfig.memberDetail': '角色详情',
'menu.authConfig.userSystem': '用户管理',
// 会员能力
'menu.memberAbility': '会员管理',
......
......@@ -32,7 +32,7 @@ const MemberSystem: React.FC<{}> = () => {
}
const updateItem = (record) => {
history.push(`/authorityManage/roleManage/addRole?id=${record.id}&preview=0`)
history.push(`/authConfig/memberSystem/memberDetail?id=${record.id}&preview=0`)
}
const handleStatus = async (record) => {
......@@ -94,7 +94,7 @@ const MemberSystem: React.FC<{}> = () => {
}
];
return (<div className="common-wrapper">
return (<div className="common-wrapper-gray">
<StandardTable
columns={columns}
currentRef={ref}
......@@ -106,7 +106,7 @@ const MemberSystem: React.FC<{}> = () => {
layouts: {
order: 2
},
children: <Button style={{width: 140}} icon={<PlusOutlined/>} onClick={() => history.push('/authorityManage/roleManage/addRole')} type='primary'>新建</Button>
children: <Button style={{width: 140}} icon={<PlusOutlined/>} onClick={() => history.push('/authConfig/memberSystem/memberDetail')} type='primary'>新建</Button>
}}
formilyProps={{
layouts: {
......@@ -116,7 +116,7 @@ const MemberSystem: React.FC<{}> = () => {
schema: {
type: 'object',
properties: {
name: {
roleName: {
type: 'Search',
"x-component-props": {
placeholder: '请输入角色名称'
......
......@@ -12,22 +12,12 @@ import CheckboxTree from '@/components/CheckBoxTree';
import { useTreeTabs } from '@/hooks/useTreeTabs';
import { createFormActions } from '@formily/antd';
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus';
// import { UserOutlined } from '@ant-design/icons';
const { TextArea } = Input;
const pageTitles = [
'新增',
'编辑',
'预览'
]
const layout = {
labelCol: {
span: 24,
},
wrapperCol: {
span: 24,
},
};
const TabFormErrors = (props) => {
return (
......@@ -76,7 +66,7 @@ const MemberDetail: React.FC<{}> = () => {
// 编辑和预览模式下需回显数据
const fetchRoleMenuDetail = async (id) => {
// 10秒缓存
const res = await PublicApi.getMemberRoleAuthTreeCheck({
const res = await PublicApi.getMemberRoleGet({
memberRoleId: id
}, { useCache: true, ttl: 10 * 1000 })
return res
......@@ -171,12 +161,12 @@ const MemberDetail: React.FC<{}> = () => {
schema={{
type: 'object',
properties: {
name: {
roleName: {
type: 'string',
title: '角色名称',
required: true
},
described: {
remark: {
type: 'textarea',
title: '备注',
"x-component-props": {
......
......@@ -12,6 +12,7 @@ import { PublicApi } from '@/services/api';
import { omit } from '@/utils';
import { useMap, useBoolean } from '@umijs/hooks';
import { useTreeTabs } from '@/hooks/useTreeTabs';
import { isObject } from '@antv/util';
// import "./index.less"
const { ON_FORM_INPUT_CHANGE } = LifeCycleTypes
......@@ -56,7 +57,7 @@ const Organ: React.FC<{}> = () => {
const handleDeleteMenu = (id) => {
PublicApi.postMemberOrgDelete({
id: id || nodeRecord.key
id: isObject(id) ? nodeRecord.key : id
}).then(() => {
setTreeStatus(FormState.FREE)
setNodeRecord(undefined)
......@@ -66,7 +67,7 @@ const Organ: React.FC<{}> = () => {
// 保存设置提交
const handleSubmit = (value) => {
// 去掉模拟的key
// 去掉模拟的key, 为true的时候是编辑
const editOrAdd = nodeRecord && treeStatus === FormState.EDIT
const params = editOrAdd ? { ...value, parentId: nodeRecord.id } : {
...value,
......@@ -86,6 +87,7 @@ const Organ: React.FC<{}> = () => {
const toolsRender = {
addNode(node) {
formActions.reset({ validate: false })
setNodeRecord(undefined)
setTreeStatus(FormState.ADD)
},
addChildNode(node) {
......@@ -112,6 +114,7 @@ const Organ: React.FC<{}> = () => {
fetchData = {params => fetchMenuData(params)}
treeData={treeData}
toolsRender={toolsRender}
customKey='id'
handleSelect={(key, node) => handleSelect(key, node)}
/>
:
......
.user-system {
.ant-input-group-addon {
padding: 0;
border: none;
}
}
......@@ -15,10 +15,6 @@ import { PublicApi } from '@/services/api';
import EyePreview from '@/components/EyePreview';
import StatusSwitch from '@/components/StatusSwitch';
const setInformation = (props:string) => {
history.push(`/authorityManage/userManage/addUser?id=${props}&preview=0`)
}
// 模拟请求
const fetchData = async (params) => {
const { data } = await PublicApi.getMemberUserPage(params)
......@@ -29,24 +25,24 @@ const UserSystem: React.FC<{}> = () => {
const ref = useRef<any>({})
const addItem = () => {
history.push('/authorityManage/userManage/addUser?preview=0')
history.push('/authConfig/userSystem/userDetail?preview=0')
}
const deleteItem = (record) => {
// 删除该项
PublicApi.postMemberUserDelete({
userId: record.id
userId: record.userId
}).then(() => {
ref.current.reload()
})
}
const updateItem = (record) => {
history.push(`/authorityManage/userManage/addUser?id=${record.id}&preview=0`)
history.push(`/authConfig/userSystem/userDetail?id=${record.userId}&preview=0`)
}
const handleStatus = (record) => {
PublicApi.postMemberUserUpdatestatus({
userId: record.id,
userId: record.userId,
status: record.status === 1 ? 0 : 1
}).then(res => {
ref.current.reload()
......@@ -59,7 +55,7 @@ const UserSystem: React.FC<{}> = () => {
align: 'center',
key: 'account',
className: 'commonPickColor',
render: (text, record) => <EyePreview url={`/authConfig/userSystem/userDetail?id=${record.id}&preview=1`}>{text}</EyePreview>
render: (text, record) => <EyePreview url={`/authConfig/userSystem/userDetail?id=${record.userId}&preview=1`}>{text}</EyePreview>
},
{
title: '用户姓名',
......@@ -71,26 +67,26 @@ const UserSystem: React.FC<{}> = () => {
{
title: '绑定手机号码',
align: 'center',
dataIndex: 'tel',
key: 'tel',
dataIndex: 'phone',
key: 'phone',
},
{
title: '所属角色',
align: 'center',
dataIndex: 'roleNames',
key: 'roleNames',
dataIndex: 'roleName',
key: 'roleName',
},
{
title: '最后登录时间',
align: 'center',
dataIndex: 'updateTime',
key: 'updateTime',
dataIndex: 'lastLoginTime',
key: 'lastLoginTime',
},
{
title: '外部状态',
align: 'center',
dataIndex: 'state',
key: 'state',
dataIndex: 'status',
key: 'status',
render: (text: any, record:any) => <StatusSwitch handleConfirm={() => handleStatus(record)} record={record}/>
},
{
......@@ -98,7 +94,7 @@ const UserSystem: React.FC<{}> = () => {
dataIndex: 'option',
align: 'center',
render: (text:any, record:any) => {
return record.state === 0 && (
return record.status === 0 && (
<>
<Popconfirm
title="确定要执行这个操作?"
......
import { ISchema } from '@formily/antd';
import { PATTERN_MAPS } from '@/constants/regExp';
export const UserDetailSchema:ISchema = {
type: 'object',
properties: {
MEGA_LAYOUT: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
labelCol: 6,
labelAlign: 'left',
full: true,
wrapperCol: 12
},
properties: {
account: {
type: 'string',
title: '登录账号',
required: true
},
password: {
type: 'password',
title: '登录密码',
"x-rules": [
{
pattern: PATTERN_MAPS.password,
message: '请输入由大小写字母和数字组成的8位密码'
}
],
required: true
},
name: {
type: 'string',
title: '姓名',
required: true
},
phoneLayout: {
type: 'object',
"x-component": 'flex-box',
title: '手机号',
"x-component-props": {
labelcol: 6,
wrappercol: 12
},
required: true,
properties: {
countryCode: {
required: true,
type: 'string',
enum: ['+86'],
"x-mega-props": {
wrapperCol: 24
},
"x-component-props": {
flexcol: {
span: 6
}
}
},
phone: {
type: 'number',
required: true,
"x-mega-props": {
wrapperCol: 24,
full: true
},
"x-rules": [
{
pattern: PATTERN_MAPS.phone,
message: '请输入正确的手机号'
}
],
"x-component-props": {
flexcol: {
flex: 1
}
}
}
}
},
idCardNo: {
type: 'string',
title: '身份证号'
},
email: {
type: 'string',
title: '邮箱',
"x-rules": [
{
pattern: PATTERN_MAPS.email,
message: '请输入正确的邮箱'
}
]
},
jobTitle: {
type: 'string',
title: '职位'
},
orgName: {
type: 'string',
title: '所属组织机构',
required: true,
'x-component-props': {
disabled: true,
addonAfter: "{{connectCategory}}"
},
},
orgId: {
type: 'string',
visible: false
},
memberRoleIds: {
required: true,
type: 'array:string',
"x-component": 'tableTagList',
"x-component-props": {
extra: "{{addRoles}}",
callback: "{{callback}}"
},
title: '关联角色'
},
}
}
}
}
\ No newline at end of file
......@@ -622,7 +622,7 @@ const viewProducts: React.FC<{}> = () => {
{/* 视频区块 */}
<div className={styles.descriptionBox}>
{
productDetail?.commodityRemark?.video.length>0 ? productDetail?.commodityRemark?.video.map((_item, _index)=> <div key={_index} className={styles.videoItem}>
productDetail?.commodityRemark?.video?.length>0 ? productDetail?.commodityRemark?.video.map((_item, _index)=> <div key={_index} className={styles.videoItem}>
<video src={_item} controls={true}>
您的浏览器不支持视频标签,请及时升级。
</video>
......
......@@ -174,6 +174,41 @@ export const findTreeKeys = (arr: any[], keyword?: string) => {
return results
}
// 树形结构降为一维对象处理
export const treeReduction = (data: any[]) => {
const hashMaps = {}
const selfData: any[] = deepClone(data)
while (selfData.length > 0) {
const useItem = selfData.shift()
// 存在子集
if (useItem.children && useItem.children.length > 0) {
useItem.children = useItem.children.map(v => {
v.parentId = useItem.id
return v
})
selfData.push(...useItem.children)
}
hashMaps[useItem.id] = useItem
}
return hashMaps
}
// 获取某一节点的title路径
export const getParentTreeTitles = (dataSouce, key) => {
const hashMaps = treeReduction(dataSouce)
let targetKey = key
let targetPath = ''
while (targetKey !== '') {
const title = hashMaps[targetKey].title
targetPath = targetPath === '' ? title : `${title}-${targetPath}`
targetKey = hashMaps[targetKey].parentId || ''
}
return targetPath
}
// 数组通过某个key进行去重合并, 并返回一个新数组
export const mergeArrByKey = (preArr: any[], nextArr: any[], target?: string) => {
const mergeArr = preArr.concat(nextArr)
......
......@@ -37,20 +37,6 @@ const errorMessage: httpStatus = {
504: "网关超时。",
};
const errorHandler = (error: ResponseError): IRequestError => {
const { response } = error
// http状态码非200的错误处理
const messageText = errorMessage[response.status]
if (response) {
message.error('http请求错误: ' + response.status + '->' + messageText, 3)
}
// throw可令响应promise走catch, 如需走resolve需直接return
throw {
message: messageText,
...error
}
}
const defaultHeaders = {
'Content-Type': 'Application/json',
'token': '21954519911775ff2c65fa5887b9b11b',
......@@ -69,7 +55,6 @@ const baseRequest = extend({
// 请求拦截器
baseRequest.interceptors.request.use((url: string, options: RequestOptionsInit): { url: string, options: RequestOptionsInit } => {
// 判断是否有权限
const loginAfterHeaders = getAuth()
const headers = {
......@@ -106,13 +91,12 @@ class ApiRequest {
baseRequest<IRequestSuccess<T>>(url, options).then(res => {
// 登录验证
if (res.code === 1101) {
message.error(res.message)
if (isDev) {
return ;
}
removeAuth()
history.replace('/login')
message.error(res.message)
return false
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment