Commit bbc8a35c authored by LeeJiancong's avatar LeeJiancong

'物流-去除物流静态数据'

parents 868c5ebe 1610bddb
......@@ -15,16 +15,19 @@ import { PublicApi } from './services/api';
setup()
// 与用户登录相关路由
const userLoginLists = [
'/user/login',
'/user/register',
]
// let routeAuthUrls: any[] = []
// 路由白名单
const whiteLists = [
...userLoginLists,
'/',
'/channelmall',
'/purchaseOnline',
'/pointsMall',
'/user/login',
'/user/register',
'/memberCenter',
'/memberCenter/noAuth',
'/commodity',
......@@ -103,14 +106,19 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) {
console.log('onRouteChange')
if (isDev) {
return;
}
if (whiteLists.includes(location.pathname)) return;
const routeAuthUrls = getRouters()
// 是否登录
if (getAuth()) {
const routeAuthUrls = getRouters()
const { query, pathname } = location
if (userLoginLists.includes(pathname)) {
// 当登录过, 并且尝试访问登录相关页面, 需重定向到首页
history.replace('/memberCenter/home')
return ;
}
// 固定配置, 出现此参数说明需携带参数校验权限路由
if (query.page_type && routeAuthUrls.find(authPath => {
const parseUrl = queryString.parseUrl(authPath)
......@@ -128,7 +136,11 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) {
// 无权限访问时
history.replace('/memberCenter/noAuth')
} else {
history.replace('/user/login')
if (whiteLists.includes(location.pathname)) {
// 访问路由在白名单里
} else {
history.replace('/user/login')
}
}
}
......
......@@ -16,12 +16,13 @@ const ModalTable:React.FC<ModalTableProps> = (props) => {
const { width = 704,modalTitle, confirm, cancel, visible, currentRef, resetModal, ...resetTable } = props
const selfRef = currentRef || useRef<any>({})
useEffect(() => {
if (!visible) {
if (visible) {
// 重新开启时需reload接口
selfRef.current.reload && selfRef.current.reload()
} else {
selfRef.current.resetField && selfRef.current.resetField({
validate: false
})
// 重新开启时需reload接口
selfRef.current.reload && selfRef.current.reload()
}
}, [visible, selfRef.current])
return (
......
......@@ -6,7 +6,6 @@ import deepClone from 'clone'
import { TreeProps } from 'antd/lib/tree'
import { PlusOutlined, DeleteOutlined, PlusCircleOutlined } from '@ant-design/icons'
import cx from 'classnames'
import { EventDataNode } from 'rc-tree/lib/interface'
import { useSelections } from '@umijs/hooks'
export interface TabTreeActions {
......@@ -36,7 +35,7 @@ export interface TabTreeProps extends TreeProps {
// 若传入该字段, 则会作为tree识别的节点, 默认是`key`, 传入后原有的key值将无效
customKey?: string | number;
customTitle?: string | number;
handleSelect?: (key: ReactText, node: EventDataNode) => void | Promise<any>;
handleSelect?: (key: ReactText, node: any) => void | Promise<any>;
handleSubmit?();
toolsRender?: toolsRenderProps;
getMenuSelectData?(): Promise<any>;
......@@ -281,7 +280,8 @@ const TabTree: React.FC<TabTreeProps> = props => {
const reductData = treeReduction(treeData)
const targetInfo = reductData[id]
const parentInfo = reductData[targetInfo.parentId]
return parentInfo || null
// fixbug 当选中根节点下的节点时, 由于无parentId, 需自动补充0
return parentInfo || {id: 0}
}
}
const batchSelect = (items: any) => {
......
......@@ -19,6 +19,30 @@ export const Environment_Status = {
3: "APP"
}
// 商城类型
export const SHOP_TYPES = [
{
value: 1,
label: "企业商城"
},
{
value: 2,
label: "积分商城"
},
{
value: 3,
label: "渠道商城"
},
{
value: 4,
label: "渠道自有商城"
},
{
value: 5,
label: "渠道积分商城"
},
]
// 1是阿里云oss服务器, 2是本地文件服务器
export const UPLOAD_TYPE = isDev ? 2 : 1
......
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;
}
export interface ShopInfo {
id: number;
name: string;
type: number;
environment: number;
logoUrl: string;
describe: string;
state: number;
url: string;
}
export interface Web {
shopInfo: ShopInfo[];
}
export interface PayConfig {
paymemberConfig?: any;
}
export interface CountryList {
name: string;
key: string;
icon: string;
}
export interface Global {
siteId: number;
siteUrl: string;
logo: string;
countryList: CountryList[];
}
export interface RootObject {
userRegister: UserRegister;
web: Web;
payConfig: PayConfig;
global: Global;
}
\ No newline at end of file
......@@ -14,6 +14,7 @@ import {
import { Button } from 'antd'
import NiceForm from '@/components/NiceForm'
import ModalTable from '@/components/ModalTable'
import { GlobalConfig } from '@/global/config'
export interface PositionSettingProps {
addSchemaAction: ISchemaFormActions,
......@@ -229,8 +230,16 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => {
tableAddButton,
connectProduct
}}
effects={() => {
effects={($, { setFieldState }) => {
createAddRepositoryEffect(addSchemaAction)
$('onFieldValueChange', 'shopType').subscribe(parentState => {
if (parentState.value) {
console.log('review')
setFieldState('shopIds', state => {
state.props["x-component-props"].dataSource = GlobalConfig.web.shopInfo.filter(v => v.id === parentState.value)
})
}
})
}}
onSubmit={handleSubmit}
actions={addSchemaAction}
......
......@@ -189,12 +189,6 @@ const Repositories: React.FC<{}> = () => {
'search',
FORM_FILTER_PATH,
);
$('onFieldChange', FORM_FILTER_PATH).subscribe(state => {
console.log(state)
})
// 填充下拉框
// useAsyncInitSelect(['category'], async () => (await PublicApi.getProductSelectGetSelectCategory({name: ''})).data.map(v => ({label: v.name, value: v.id})))
// useAsyncInitSelect(['brand'], async () => (await PublicApi.getProductSelectGetSelectBrand({name: ''})).data.map(v => ({label: v.name, value: v.id})))
}}
schema={repositSchema}
/>
......
......@@ -3,6 +3,20 @@ import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { GlobalConfig } from '@/global/config';
import { PublicApi } from '@/services/api';
import { SHOP_TYPES } from '@/constants';
// 将获取的商城转化为可用类型
const getShopTypeMap = (() => {
return GlobalConfig.web.shopInfo.reduce((prev, next) => {
if (!prev.find(v => v.value === next.id)) {
prev.push({
label: next.name,
value: next.id
})
}
return prev
}, [])
})()
export const repositSchema: ISchema = {
type: 'object',
......@@ -155,6 +169,12 @@ export const repositMoreSchema: ISchema = {
placeholder: '建议名称:商品名称+商城名称+渠道描述'
}
},
shopType: {
type: 'string',
enum: SHOP_TYPES,
title: '商城类型',
required: true
},
productName: {
type: 'string',
title: '商品名称',
......@@ -253,7 +273,7 @@ export const repositMoreSchema: ISchema = {
"type": "array:number",
"x-component": 'CardCheckBox',
"x-component-props": {
dataSource: GlobalConfig.web.shopInfo
dataSource: []
},
"title": "适用商城",
"x-rules": [
......@@ -352,6 +372,12 @@ export const repositDetailSchema: ISchema = {
placeholder: '建议名称:商品名称+商城名称+渠道描述'
}
},
shopType: {
type: 'string',
enum: getShopTypeMap,
title: '商城类型',
required: true
},
productName: {
type: 'string',
title: '商品名称',
......@@ -443,7 +469,7 @@ export const repositDetailSchema: ISchema = {
"type": "array:number",
"x-component": 'CardCheckBox',
"x-component-props": {
dataSource: GlobalConfig.web.shopInfo
dataSource: []
},
"title": "适用商城",
required: true,
......@@ -538,6 +564,12 @@ export const repositTabOneSchema: ISchema = {
placeholder: '建议名称:商品名称+商城名称+渠道描述'
}
},
shopType: {
type: 'string',
enum: getShopTypeMap,
title: '商城类型',
required: true
},
productName: {
type: 'string',
title: '商品名称',
......@@ -630,7 +662,7 @@ export const repositTabOneSchema: ISchema = {
"type": "array:number",
"x-component": 'CardCheckBox',
"x-component-props": {
dataSource: GlobalConfig.web.shopInfo
dataSource: []
},
"title": "适用商城",
required: true,
......
......@@ -83,7 +83,7 @@ const UserRegistry = () => {
})
useEffect(() => {
setAsyncSchema(schemas[`schema${current}`])
if(current === 3) runTimerJump()
if(current === 2) runTimerJump()
}, [current, actions])
useEffect(() => {
if(time === 0){
......
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