Commit afd91f7a authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

feat: 定义0318SAAS需求

parent 59c041ef
......@@ -2,7 +2,7 @@ module.exports = [
{ name: 'LogisticsV2', token: '732fb8e33970ff5dee830423a630e8e85c3ef3293abba7581b16749dfce8608b', categoryIds: [0], }, // 物流能力v2
{ name: 'ProductV2', token: 'fb618349dba7b6f41008bb42d2a5776090dff0492f132f7e59a37ea7c78c7d1f', categoryIds: [0], }, // 商品服务V2-318
{ name: 'TemplateV2', token: '7bb5578bc50e4e7935cbc146a2192e978053d5380cc96fcfdc0a754cfe885ec5', categoryIds: [0], }, // 页面模板服务V2
{ name: 'PayV2', token: '4b5f2f2d42f0774b61074d69d5d756c725ba067d9dafe2c3785f592ae85d1696', categoryIds: [0], }, // 支付服务
{ name: 'PayV2', token: '16d2fb2a65a7ddee5f29f7a97d09c918f6c24c6f75c33615049ce042a726d5d9', categoryIds: [0], }, // 支付服务V2-318
{ name: 'SearchV2', token: 'f3e6ec26764f54d06ba33f487ff42d7debeaef397e51dc395040447737eb2e66', categoryIds: [0], }, // 搜索服务V2
{ name: 'PurchaseV2', token: '84c81ef877863ad4e2c0ebb2c3b3e80f9539420f2fc0828ef33f5159e8423b2c', categoryIds: [0] }, // 采购服务V2
{ name: 'SettleV2', token: 'fed8d45aa92e7f0e382a3dcc5e0ef63f13f0badeabab76d6a6e2db49aa403346', categoryIds: [0] },
......@@ -15,5 +15,5 @@ module.exports = [
{ name: 'MessageV2', token: '69a667ec9861e8bdc25b89238d0b908a2123d9fce26e72fec3cdf6cd0b1f2681', categoryIds: [0], }, // 消息中心v2
{ name: 'MarketingV2', token: 'f6d5cee2383ca203dfa2882b84dfa02a1d79de3c3ad892b42f030437fdc5ea21', categoryIds: [0], }, // 营销能力
{ name: 'AfterServiceV2', token: '58748fc89dcdb33ec5cac520c00293ba92abca362a8ddb979df589effd0db9bd', categoryIds: [0], }, // 售后能力V2
{ name: 'ManageV2', token: '9ee3a1cb5a73ca02935e70debeda5bde0464f2fe1eb32c25855fd8acff9f68f2', categoryIds: [0] }, // 平台后台v2
{ name: 'ManageV2', token: 'b6857e18170e89cbd13e00edfdb62a539330c7c2427b07dc1c787fcdcb7de36c', categoryIds: [0] }, // 平台后台V2-318
]
......@@ -77,32 +77,32 @@ const AuthConfigRoute: RouterChild = {
component: '@/pages/authConfig/userSystem/userDetail',
hideInMenu: true,
},
// 门管理
// 门管理
{
path: '/memberCenter/systemSetting/authConfig/portalSystem',
name: '门管理',
name: '门管理',
component: '@/pages/authConfig/portalSystem',
},
// 新增门管理
// 新增门管理
{
path: '/memberCenter/systemSetting/authConfig/portalSystem/add',
name: '新增门管理',
name: '新增门管理',
component: '@/pages/authConfig/portalSystem/add',
hideInMenu: true,
noMargin: true,
},
// 编辑门管理
// 编辑门管理
{
path: '/memberCenter/systemSetting/authConfig/portalSystem/edit',
name: '编辑门管理',
name: '编辑门管理',
component: '@/pages/authConfig/portalSystem/add',
hideInMenu: true,
noMargin: true,
},
// 门管理详情
// 门管理详情
{
path: '/memberCenter/systemSetting/authConfig/portalSystem/detail',
name: '门管理详情',
name: '门管理详情',
component: '@/pages/authConfig/portalSystem/detail',
hideInMenu: true,
noMargin: true,
......
......@@ -9,11 +9,13 @@ import '@/global/styles/global.less'; // 导入全局样式
import 'antd/dist/antd.less'
import { isDev } from '@/constants'
import { setup } from '@formily/antd-components';
import { getRouters, getAuth, asyncRouter, setAuth, setRouters, removeAuth, removeRouters } from './utils/auth';
import { getRouters, getAuth, asyncRouter, setAuth, setRouters, removeAuth, removeRouters, setEnableMultiTenancy, removeEnableMultiTenancy } from './utils/auth';
// 全局注册虚拟组件
import '@/components/NiceForm/public'
import LRU from '@/utils/lru';
import { getMemberLoginReget } from './services/MemberV2Api';
import { getManagePaasSiteEnableMultiTenancy } from './services/ManageV2Api';
import { GlobalConfig } from './global/config';
const recent = new LRU(6);
recent.init();
......@@ -109,9 +111,16 @@ export function render(oldRender: Function) {
}).catch(() => {
oldRender()
})
getManagePaasSiteEnableMultiTenancy({siteId: GlobalConfig.global.siteInfo.id.toString()}).then(res => {
if (res.code !== 1000) {
return
}
setEnableMultiTenancy(res.data);
})
} else {
removeAuth()
removeRouters()
removeEnableMultiTenancy()
oldRender()
}
}
......
......@@ -60,10 +60,10 @@ export default {
'logistics.pingtaiwuliufuwushang': 'Platform logistics service provider',
'logistics.shanghuhezuowuliugongsi': 'Merchant cooperative logistics company',
'logistics.qingxuanzehezuoleixing': 'Please select the type of cooperation',
'logistics.wuliugongsidaimaping': 'logistics company code/platform member ID',
'logistics.wuliugongsidaimaping': 'logistics company code',
'logistics.wuliugongsidaima': 'logistics company code',
'logistics.qingshuruwuliugongsidai': 'Please enter the logistics company code',
'logistics.pingtaihuiyuanID': 'Platform member ID',
'logistics.pingtaihuiyuanID': 'Platform member',
'logistics.qingxuanzepingtaihuiyuanID': 'Please select platform member ID',
'logistics.wuliugongsimingcheng': 'logistics company name',
'logistics.zuichang60gezifu30ge': 'The longest is 60 characters, 30 Chinese characters',
......
......@@ -60,10 +60,10 @@ export default {
'logistics.pingtaiwuliufuwushang': '플랫폼 물류 서비스 업체',
'logistics.shanghuhezuowuliugongsi': '상인 합작 물류 회사',
'logistics.qingxuanzehezuoleixing': '파트너 유형 선택',
'logistics.wuliugongsidaimaping': '물류 회사 코드/플랫폼 회원 ID',
'logistics.wuliugongsidaimaping': '물류 회사 코드',
'logistics.wuliugongsidaima': '물류 회사 코드',
'logistics.qingshuruwuliugongsidai': '물류 회사 코드를 입력하십시오.',
'logistics.pingtaihuiyuanID': '플랫폼 회원 ID',
'logistics.pingtaihuiyuanID': '플랫폼 회원',
'logistics.qingxuanzepingtaihuiyuanID': '플랫폼 회원 ID 선택',
'logistics.wuliugongsimingcheng': '물류 회사 이름',
'logistics.zuichang60gezifu30ge': '최장 60자, 한자 30자',
......
......@@ -60,10 +60,10 @@ export default {
'logistics.pingtaiwuliufuwushang': '平台物流服务商',
'logistics.shanghuhezuowuliugongsi': '商户合作物流公司',
'logistics.qingxuanzehezuoleixing': '请选择合作类型',
'logistics.wuliugongsidaimaping': '物流公司代码/平台会员ID',
'logistics.wuliugongsidaimaping': '物流公司代码',
'logistics.wuliugongsidaima': '物流公司代码',
'logistics.qingshuruwuliugongsidai': '请输入物流公司代码',
'logistics.pingtaihuiyuanID': '平台会员ID',
'logistics.pingtaihuiyuanID': '平台会员',
'logistics.qingxuanzepingtaihuiyuanID': '请选择平台会员ID',
'logistics.wuliugongsimingcheng': '物流公司名称',
'logistics.zuichang60gezifu30ge': '最长60个字符,30个汉字',
......
......@@ -9,6 +9,7 @@ import useViewRequest from '../../hooks/useViewRequest';
import { getReportMemberHomeGetSettleAccountTally, GetReportMemberHomeGetSettleAccountTallyResponse } from '@/services/ReportV2Api';
import Layout from './layout';
import useGetAuth from '../../hooks/useGetAuth';
import { getEnableMultiTenancy } from '@/utils/auth';
interface Iprops { };
......@@ -31,34 +32,41 @@ const SettlementCenter: React.FC<Iprops> = () => {
const intl = useIntl();
const { hasAbilityFunc, userAuth } = useGetAuth();
const hasAbility = hasAbilityFunc('balance');
const enableMultiTenancy = getEnableMultiTenancy()
const tagsList = useMemo(() => {
return [
{
icon: settlement_platformCollection,
title: intl.formatMessage({ id: 'home.settlementCenter.title1' }),
url: '/memberCenter/balance/platformSettlement/accountReceivable'
url: '/memberCenter/balance/platformSettlement/accountReceivable',
enableMulti: enableMultiTenancy
},
{
icon: settlement_integrate,
title: intl.formatMessage({ id: 'home.settlementCenter.title2' }),
url: '/memberCenter/balance/platformSettlement/integral'
url: '/memberCenter/balance/platformSettlement/integral',
enableMulti: enableMultiTenancy
},
{
icon: settlement_accountReceive,
title: intl.formatMessage({ id: 'home.settlementCenter.title3' }),
url: '/memberCenter/balance/accountsReceivable/settlementList'
url: '/memberCenter/balance/accountsReceivable/settlementList',
enableMulti: false
},
{
icon: settlement_accountPayable,
title: intl.formatMessage({ id: 'home.settlementCenter.title4' }),
url: '/memberCenter/balance/accountsPayable/settlementList'
url: '/memberCenter/balance/accountsPayable/settlementList',
enableMulti: false
},
{
icon: settlement_invoice,
title: intl.formatMessage({ id: 'home.settlementCenter.title5' }),
url: '/memberCenter/balance/accountsReceivable/invoice'
url: '/memberCenter/balance/accountsReceivable/invoice',
enableMulti: false
}
].filter((_item) => userAuth.urls?.includes(_item.url))
}, [userAuth])
......
......@@ -155,19 +155,21 @@ interface TagProps {
url: string,
title: string,
hasAuth?: boolean,
count?: number
count?: number,
enableMulti?: boolean
}[]
}
const Tags = (props: TagProps) => {
const { tagList } = props;
console.log(tagList, 11086)
const list = useMemo(() => {
return tagList.filter((_item) => {
if (typeof _item.hasAuth === 'undefined' || _item.hasAuth) {
return true
}
return false
})
}).filter(item => !item.enableMulti)
}, [tagList])
return (
......
......@@ -140,7 +140,8 @@
.link {
width: 88px;
text-align: center;
flex: 1;
text-align: right;
}
.divider {
......
......@@ -3,7 +3,7 @@ import styles from './index.less';
import moment from 'moment';
import { Badge, message, Spin, Tooltip } from 'antd';
import { Link, useIntl } from 'umi';
import { getAuth } from '@/utils/auth';
import { getAuth, getEnableMultiTenancy } from '@/utils/auth';
import StatusTag from '@/components/StatusTag';
import home_user from '@/assets/imgs/home_user.png';
import { observer, inject } from 'mobx-react';
......@@ -21,6 +21,7 @@ const WEEKDAYS = ["天", "一", "二", "三", "四", "五", "六"];
const EDIT_USER_URL = '/memberCenter/editMySelf';
const USER_CENTER_URL = '/memberCenter/memberAbility/profile/query';
const STATUS_COLOR: ("default" | "processing" | "error" | "success")[] = ["default", "processing", "error", "success", "error"]
const enableMultiTenancy = getEnableMultiTenancy()
function reducer(state, action) {
switch (action.type) {
......@@ -116,7 +117,7 @@ const UserCenter: React.FC<Iprops> = (props) => {
</div>
<div style={{ marginTop: '13px' }}>
<Tooltip placement="top" title={userAuth.validateMsg || ''}>
<Badge status={STATUS_COLOR[userAuth.validateStatus]} text={userAuth.validateStatusDesc} />
{!enableMultiTenancy && <Badge status={STATUS_COLOR[userAuth.validateStatus]} text={userAuth.validateStatusDesc} />}
{
isVerifyFail && (
<span style={{ marginLeft: '4px' }}>
......@@ -135,12 +136,16 @@ const UserCenter: React.FC<Iprops> = (props) => {
</div>
<div className={styles.otherValues}>
<div className={styles.divider}>
<div className={styles.level}>
{intl.formatMessage({ id: 'home.userCenter.level' })}<StatusTag type={'primary'} title={userAuth.levelTag} />
</div>
<div className={styles.score}>
{intl.formatMessage({ id: 'home.userCenter.score' })}<strong>{userAuth.score}</strong>
</div>
{!enableMultiTenancy && (
<>
<div className={styles.level}>
{intl.formatMessage({ id: 'home.userCenter.level' })}<StatusTag type={'primary'} title={userAuth.levelTag} />
</div>
<div className={styles.score}>
{intl.formatMessage({ id: 'home.userCenter.score' })}<strong>{userAuth.score}</strong>
</div>
</>
)}
{
userAuth.urls.includes(USER_CENTER_URL) && (
<Link to={USER_CENTER_URL} className={styles.link}>{intl.formatMessage({ id: 'home.userCenter.userAuth.link' })}</Link>
......
......@@ -14,6 +14,7 @@ import StatusTag from '@/components/StatusTag'
import { accountStatusMap, memberStatusMap, memberLevelTypeMap, accountMemberType } from '../../constant'
import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix'
import { getPayAssetAccountGetAssetAccountList } from '@/services/PayV2Api'
import { getEnableMultiTenancy } from '@/utils/auth';
const formActions = createFormActions();
......@@ -91,7 +92,8 @@ const AccountLists: React.FC<{}> = () => {
const fetchData = (params: any) => {
console.log(params)
return new Promise((resolve, reject) => {
let obj = { ...params }
const enableMultiTenancy = getEnableMultiTenancy()
let obj = { ...params, enableMultiTenancy }
getPayAssetAccountGetAssetAccountList(obj).then(res => {
resolve(res.data)
})
......
......@@ -13,9 +13,12 @@ import { FORM_FILTER_PATH } from '@/formSchema/const';
import { ColumnType } from 'antd/lib/table/interface';
import { getLogisticsCompanyGet, getLogisticsSelectListMemberCompanySelected, postLogisticsCompanyAdd, postLogisticsCompanyUpdate } from '@/services/LogisticsV2Api';
import { postMemberManageLogisticsPage } from '@/services/MemberV2Api';
import { useLinkageUtils } from '@/utils/formEffectUtils';
import { getEnableMultiTenancy } from '@/utils/auth';
const intl = getIntl();
const formActions = createFormActions();
const {
onFormMount$,
onFieldChange$,
onFormInputChange$,
} = FormEffectHooks;
......@@ -160,6 +163,22 @@ const LogisticsCompanyManageAdded = (props: any) => {
return initialValue
}, [initialValue])
const useBusinessEffects = () => {
const linkage = useLinkageUtils();
const enableMultiTenancy = getEnableMultiTenancy();
const _enum = [
{
label: intl.formatMessage({ id: 'logistics.shanghuhezuowuliugongsi' }),
value: 2
}
]
!enableMultiTenancy && _enum.push({ label: intl.formatMessage({ id: 'logistics.pingtaiwuliufuwushang' }), value: 1 })
onFormMount$().subscribe(() => {
linkage.enum('cooperateType', _enum)
})
}
return (
<Spin spinning={infoLoading}>
<PageHeaderWrapper
......@@ -193,6 +212,7 @@ const LogisticsCompanyManageAdded = (props: any) => {
}}
effects={() => {
useFormEffects();
useBusinessEffects();
onFormInputChange$().subscribe(() => {
if (!unsaved) {
setUnsaved(true);
......
......@@ -36,10 +36,7 @@ export const formSchema: ISchema = {
cooperateType: {
type: 'string',
title: intl.formatMessage({ id: 'logistics.hezuoleixing' }),
enum: [
{ label: intl.formatMessage({ id: 'logistics.pingtaiwuliufuwushang' }), value: 1 },
{ label: intl.formatMessage({ id: 'logistics.shanghuhezuowuliugongsi' }), value: 2 },
],
enum: [],
'x-component-props': {
placeholder: intl.formatMessage({ id: 'logistics.qingxuanzehezuoleixing' })
},
......
......@@ -95,6 +95,24 @@ export const getRouters = (): string[] => {
}
}
/** 判断站点是否开启SAAS多租户 */
export const setEnableMultiTenancy = (info: boolean) => {
window.localStorage.setItem("SITE", JSON.stringify(info))
}
export const removeEnableMultiTenancy = () => {
window.localStorage.removeItem("SITE")
}
export const getEnableMultiTenancy = () => {
try {
const enableMultiTenancy = JSON.parse(window.localStorage.getItem("SITE"))
return (enableMultiTenancy || {} ) as boolean
} catch (error) {
return null as boolean
}
}
export const removeRouters = () => {
window.sessionStorage.removeItem('rt')
}
......@@ -103,11 +121,14 @@ export const removeAuth = () => {
removeCookie(AUTH_KEY, { path: '/', domain: getTopDomainByHost(TOP_DOMAIN_NO_PORT, true) })
removeCookie(AUTH_ROLES_KEY, { path: '/', domain: getTopDomainByHost(TOP_DOMAIN_NO_PORT, true) })
window.localStorage.removeItem(AUTH_KEY)
removeEnableMultiTenancy()
removeRouters()
const _window: any = window
_window?.ysf && _window.ysf('logoff')
}
const HOME_URL = [
'/',
'/memberCenter/home'
......
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