Commit fb1e7180 authored by tjy's avatar tjy

merge

parents e51a07a3 77a79119
import { default as routes } from './routes'
import memberCenterRoute from './routes'
import shopRoute from './shopRoutes'
/**
* @description 路由配置页, 更多配置可查看 https://umijs.org/zh-CN/docs/routing#routes
......@@ -29,21 +30,10 @@ const router = [
},
{
path: '/',
component: '@/layouts/BasicLayout',
component: '@/wrappers/getSiteConfig',
routes: [
{
path: '/',
redirect: '/home'
},
{
// 首页
path: '/home',
name: 'home',
icon: 'smile',
key: 'home',
component: '@/pages/index',
},
...routes,
memberCenterRoute,
shopRoute,
{
component: '@/pages/404',
},
......
......@@ -8,55 +8,55 @@
const CommodityRoute = {
// 商品能力
path: '/commodityAbility',
path: '/memberCenter/commodityAbility',
name: 'commodityAbility',
key: 'commodityAbility',
routes: [
{
path: '/commodityAbility/classAndProperty',
path: '/memberCenter/commodityAbility/classAndProperty',
name: 'classAndProperty',
key: 'classAndProperty',
routes: [
{
path: '/commodityAbility/classAndProperty/class',
path: '/memberCenter/commodityAbility/classAndProperty/class',
name: 'class',
icon: 'smile',
component: '@/pages/classAndProperty/class',
},
{
path: '/commodityAbility/classAndProperty/attribute',
path: '/memberCenter/commodityAbility/classAndProperty/attribute',
name: 'attribute',
icon: 'smile',
component: '@/pages/classAndProperty/attribute',
},
{
path: '/commodityAbility/classAndProperty/attribute/addAttribute',
path: '/memberCenter/commodityAbility/classAndProperty/attribute/addAttribute',
name: 'addAttribute',
icon: 'smile',
component: '@/pages/classAndProperty/attribute/addAttribute',
hideInMenu: true,
},
{
path: '/commodityAbility/classAndProperty/propertyValue',
path: '/memberCenter/commodityAbility/classAndProperty/propertyValue',
name: 'propertyValue',
icon: 'smile',
component: '@/pages/classAndProperty/propertyValue',
},
{
path: '/commodityAbility/classAndProperty/propertyValue/addPropertyValue',
path: '/memberCenter/commodityAbility/classAndProperty/propertyValue/addPropertyValue',
name: 'addPropertyValue',
icon: 'smile',
component: '@/pages/classAndProperty/propertyValue/addPropertyValue',
hideInMenu: true,
},
{
path: '/commodityAbility/classAndProperty/categoryAttributes',
path: '/memberCenter/commodityAbility/classAndProperty/categoryAttributes',
name: 'categoryAttributes',
icon: 'smile',
component: '@/pages/classAndProperty/categoryAttributes',
},
{
path: '/commodityAbility/classAndProperty/categoryAttributes/viewAttributes',
path: '/memberCenter/commodityAbility/classAndProperty/categoryAttributes/viewAttributes',
name: 'viewAttributes',
hideInMenu: true,
icon: 'smile',
......@@ -65,84 +65,84 @@ const CommodityRoute = {
]
},
{
path: '/commodityAbility/trademark',
path: '/memberCenter/commodityAbility/trademark',
name: 'trademark',
icon: 'smile',
component: '@/pages/trademark',
},
{
path: '/commodityAbility/trademark/addBrand',
path: '/memberCenter/commodityAbility/trademark/addBrand',
name: 'addBrand',
icon: 'smile',
hideInMenu: true,
component: '@/pages/trademark/addBrand',
},
{
path: '/commodityAbility/trademark/viewBrand',
path: '/memberCenter/commodityAbility/trademark/viewBrand',
name: 'viewBrand',
hideInMenu: true,
icon: 'smile',
component: '@/pages/trademark/viewBrand',
},
{
path: '/commodityAbility/commodity',
path: '/memberCenter/commodityAbility/commodity',
name: 'commodity',
icon: 'smile',
routes: [
{
path: '/commodityAbility/commodity/goods',
path: '/memberCenter/commodityAbility/commodity/goods',
name: 'goods',
icon: 'smile',
component: '@/pages/commodity/goods',
},
{
path: '/commodityAbility/commodity/goods/addGoods',
path: '/memberCenter/commodityAbility/commodity/goods/addGoods',
name: 'addGoods',
hideInMenu: true,
icon: 'smile',
component: '@/pages/commodity/goods/addGoods',
},
{
path: '/commodityAbility/commodity/products',
path: '/memberCenter/commodityAbility/commodity/products',
name: 'products',
icon: 'smile',
component: '@/pages/commodity/products',
},
{
path: '/commodityAbility/commodity/products/addProducts',
path: '/memberCenter/commodityAbility/commodity/products/addProducts',
name: 'addProducts',
hideInMenu: true,
icon: 'smile',
component: '@/pages/commodity/products/addProducts',
},
{
path: '/commodityAbility/commodity/products/viewProducts',
path: '/memberCenter/commodityAbility/commodity/products/viewProducts',
name: 'viewProducts',
hideInMenu: true,
icon: 'smile',
component: '@/pages/commodity/products/viewProducts',
},
{
path: '/commodityAbility/commodity/products/fastModifyPrice',
path: '/memberCenter/commodityAbility/commodity/products/fastModifyPrice',
name: 'fastModifyPrice',
icon: 'smile',
component: '@/pages/commodity/products/fastModifyPrice',
},
{
path: '/commodityAbility/commodity/products/directChannel',
path: '/memberCenter/commodityAbility/commodity/products/directChannel',
name: 'directChannel',
icon: 'smile',
component: '@/pages/commodity/products/directChannel',
},
{
path: '/commodityAbility/commodity/products/addDirectChannel',
path: '/memberCenter/commodityAbility/commodity/products/addDirectChannel',
name: 'addDirectChannel',
hideInMenu: true,
icon: 'smile',
component: '@/pages/commodity/products/addDirectChannel',
},
{
path: '/commodityAbility/commodity/products/viewDirectChannel',
path: '/memberCenter/commodityAbility/commodity/products/viewDirectChannel',
name: 'viewDirectChannel',
hideInMenu: true,
icon: 'smile',
......@@ -152,27 +152,27 @@ const CommodityRoute = {
]
},
{
path: '/commodityAbility/repositories',
path: '/memberCenter/commodityAbility/repositories',
name: 'repositories',
icon: 'smile',
component: './repositories',
},
{
path: '/commodityAbility/repositories/addRepository',
path: '/memberCenter/commodityAbility/repositories/addRepository',
name: 'addRepository',
icon: 'smile',
hideInMenu: true,
component: './repositories/addRepository',
},
{
path: '/commodityAbility/repositories/adjustRepository',
path: '/memberCenter/commodityAbility/repositories/adjustRepository',
name: 'adjustRepository',
icon: 'smile',
hideInMenu: true,
component: './repositories/adjustRepository',
},
{
path: '/commodityAbility/repositories/viewRepository',
path: '/memberCenter/commodityAbility/repositories/viewRepository',
name: 'viewRepository',
icon: 'smile',
hideInMenu: true,
......
import CommodityRoute from './commodityRoute'
import MemberRoute from './memberRoute'
import ShopRoute from './shopRoute'
import LogisticsRoute from './logisticsRoutes'
import CommodityRoute from './commodityRoute' // 商品能力路由
import MemberRoute from './memberRoute' // 会员能力路由
import ShopRoute from './shopRoute' // 店铺能力路由
import LogisticsRoute from './logisticsRoutes' // 物流能力路由
const routes = [CommodityRoute, MemberRoute, ShopRoute,LogisticsRoute]
const routes = [CommodityRoute, MemberRoute, ShopRoute, LogisticsRoute]
export default routes
\ No newline at end of file
const memberCenterRoute = {
path: '/memberCenter',
component: '@/layouts/BasicLayout',
routes: [
{
path: '/memberCenter',
redirect: '/memberCenter/home'
},
{
path: '/memberCenter/shopAbility',
redirect: '/memberCenter/shopAbility/infoManage'
},
{
// 首页
path: `/memberCenter/home`,
name: 'home',
icon: 'smile',
key: 'home',
component: '@/pages/index',
},
...routes,
{
component: '@/pages/404',
},
],
}
export default memberCenterRoute
\ No newline at end of file
......@@ -5,56 +5,56 @@
* @Last Modified time: 2020-07-10 16:15:28
*/
const LogisticsRoute = {
path: '/logisticsAbility',
path: '/memberCenter/logisticsAbility',
name: 'logisticsAbility',
key: 'logisticsAbility',
icon: 'smile',
routes: [
{
path: '/logisticsAbility/logistics',
path: '/memberCenter/logisticsAbility/logistics',
name: 'logistics',
key: 'logistics',
routes: [
{
path: '/logisticsAbility/logistics/list/company',
path: '/memberCenter/logisticsAbility/logistics/list/company',
name: 'company',
component: '@/pages/logistics/list/company'
},
{
path: '/logisticsAbility/logistics/list/addCompany',
path: '/memberCenter/logisticsAbility/logistics/list/addCompany',
name: 'addCompany',
component: '@/pages/logistics/list/addCompany',
hideInMenu: true
},
//送货地址
{
path: '/logisticsAbility/logistics/list/deliveryAddress',
path: '/memberCenter/logisticsAbility/logistics/list/deliveryAddress',
name: 'deliveryAddress',
component: '@/pages/logistics/list/deliveryAddress'
},
{
path: '/logisticsAbility/logistics/list/addressForm',
path: '/memberCenter/logisticsAbility/logistics/list/addressForm',
name: 'addressForm',
component: '@/pages/logistics/list/components/addressForm',
hideInMenu: true
},
{
path: '/logisticsAbility/logistics/list/receivingAddress',
path: '/memberCenter/logisticsAbility/logistics/list/receivingAddress',
name: 'receivingAddress',
component: '@/pages/logistics/list/receivingAddress'
},
{
path: '/logisticsAbility/logistics/list/template',
path: '/memberCenter/logisticsAbility/logistics/list/template',
name: 'template',
component: '@/pages/logistics/list/template'
},
{
path: '/logisticsAbility/logistics/list/templateForm',
path: '/memberCenter/logisticsAbility/logistics/list/templateForm',
name: 'templateForm',
component: '@/pages/logistics/list/components/templateForm',
hideInMenu: true
}
]
}
]
......
......@@ -7,49 +7,49 @@
*/
const MemberRoute = {
path: '/memberAbility',
path: '/memberCenter/memberAbility',
name: 'memberAbility',
key: 'memberAbility',
icon: 'smile',
routes: [
{
path: '/memberAbility/manage',
path: '/memberCenter/memberAbility/manage',
name: 'memberManage',
key: 'memberManage',
routes: [
{
path: '/memberAbility/manage/import',
path: '/memberCenter/memberAbility/manage/import',
name: 'memberImport',
key: 'memberImport',
component: '@/pages/member/memberImport/index',
},
{
path: '/memberAbility/manage/addMember',
path: '/memberCenter/memberAbility/manage/addMember',
name: 'addMember',
key: 'addMember',
hideInMenu: true,
component: '@/pages/member/memberImport/addMember',
},
{
path: '/memberAbility/manage/maintian',
path: '/memberCenter/memberAbility/manage/maintian',
name: 'memberMaintain',
key: 'memberMaintain',
component: '@/pages/member/memberMaintain/index',
},
{
path: '/memberAbility/manage/upgradeRule',
path: '/memberCenter/memberAbility/manage/upgradeRule',
name: 'memberUpgradeRule',
key: 'memberUpgradeRule',
component: '@/pages/member/memberUpgradeRule/index',
},
{
path: '/memberAbility/manage/level',
path: '/memberCenter/memberAbility/manage/level',
name: 'memberLevel',
key: 'memberLevel',
component: '@/pages/member/memberLevel/index'
},
{
path: '/memberAbility/manage/level/addEquity',
path: '/memberCenter/memberAbility/manage/level/addEquity',
name: 'addEquity',
key: 'addEquity',
hideInMenu: true,
......
......@@ -7,25 +7,25 @@
*/
const ShopRoute = {
path: '/shopAbility',
path: '/memberCenter/shopAbility',
name: 'shopAbility',
key: 'shopAbility',
icon: 'smile',
routes: [
{
path: '/shopAbility/infoManage',
path: '/memberCenter/shopAbility/infoManage',
name: 'shopInfoManage',
key: 'shopInfoManage',
component: '@/pages/shop/shopInfo',
},
{
path: '/shopAbility/template',
path: '/memberCenter/shopAbility/template',
name: 'shopTemplate',
key: 'shopTemplate',
component: '@/pages/shop/shopTemplate',
},
{
path: '/shopAbility/template/detail',
path: '/memberCenter/shopAbility/template/detail',
name: 'shopTemplate',
key: 'shopTemplate',
hideInMenu: true,
......
const shopRoute = {
path: '/',
routes: [
{
// 首页
path: `/`,
name: 'home',
key: 'home',
component: '@/pages/index',
},
{
// 资讯
path: `/information`,
name: 'home',
key: 'home',
component: '@/pages/index',
},
],
}
export default shopRoute
\ No newline at end of file
......@@ -23,14 +23,16 @@
"dependencies": {
"@ant-design/icons": "^4.2.1",
"@ant-design/pro-layout": "^5.0.16",
"@formily/antd-components": "^1.2.6",
"@formily/antd": "^1.2.7",
"@formily/antd-components": "^1.2.7",
"@umijs/preset-react": "1.x",
"@umijs/test": "^3.2.0",
"bizcharts": "^4.0.7",
"god": "0.1.12",
"god": "^0.1.7",
"lint-staged": "^10.0.7",
"mobx": "^5.15.4",
"mobx-react": "^6.2.2",
"moment": "^2.27.0",
"prettier": "^1.19.1",
"qrcode": "^1.4.4",
"react": "^16.12.0",
......
......@@ -2,7 +2,7 @@ import { IRoutes } from '.';
import { history, RequestConfig } from 'umi';
import React from 'react'
import MobxProvider from './store'
import 'antd/es/form/style/index.less';
import '@/global/styles/global.less'; // 导入全局样式
// 默认引入所有的ant样式, 不引入css因为无法做到变量覆盖
......
import React, { Component } from 'react'
import { Spin } from 'antd'
class Loading extends Component {
render() {
return (
<div>loading</div>
<Spin />
)
}
}
......
......@@ -86,12 +86,16 @@ h1, h2, h3, h4, h5, h6 {
background-color: @status-invalid; // 无效、未生成
}
.mb-30{
margin-bottom: 30px;
}
.sc-fzpans {
display: block;
width: 100%;
}
// 间距
.mr_t-40 {
margin-top: 40px;
}
\ No newline at end of file
......@@ -3,4 +3,4 @@ import menu from './zh-CN/menu'
export default {
'global.siteName': '瓴犀',
...menu,
}
\ No newline at end of file
}
.commonSearchBtn {
border-left: none;
border-radius: 0 2px 2px 0;
background-color: #EBECF0FF;
&:hover, &:focus, &:active{
text-decoration: none;
color: rgba(0, 0, 0, 0.65);
background: #EBECF0FF;
border-color: #d9d9d9;
}
}
\ No newline at end of file
import React, { ReactNode, useRef } from 'react'
import React, { ReactNode, useRef, useState } from 'react'
import { history } from 'umi'
import { Button, Popconfirm, Card } from 'antd'
import { Button, Popconfirm, Card, message } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
PlusOutlined,
PlayCircleOutlined,
EyeOutlined
EyeOutlined,
PauseCircleOutlined
} from '@ant-design/icons'
import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
import { IFormFilter, IButtonFilter } from 'god/dist/src/standard-table/TableController'
const data = [
{
key: '1',
attrName: '采购商',
attrGroup: '采购',
displayType: '单选',
required: '是',
status: 1,
},
{
key: '2',
attrName: '供应商',
attrGroup: '供应',
displayType: '双选',
required: '否',
status: 0,
},
]
// 模拟请求
const fetchData = (params:any) => {
return new Promise((resolve, reject) => {
const queryResult = data.find(v => v.key === params.keywords)
setTimeout(() => {
resolve({
code: 200,
message: '',
data: queryResult ? [queryResult] : data
})
}, 1000)
})
}
import { getAttributeLists, updateAttributeStatus, deleteAttribute } from '@/services/classAndProperty/attribute'
// import styles from './index.less'
const Attribute: React.FC<{}> = () => {
const ref = useRef({})
const fetchData = (params?: any) => {
console.log(params, '搜索参数')
return new Promise((resolve, reject) => {
getAttributeLists({ current: params.page, name: params.name || '', pageSize: params.rows }).then(res => {
resolve(res.data)
})
})
}
const columns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'key',
align: 'center',
key: 'key',
dataIndex: 'id',
key: 'id',
},
{
title: '属性名称',
dataIndex: 'attrName',
align: 'center',
key: 'attrName',
render: (text:any, record:any) => <span className="commonPickColor" onClick={()=>handleSee(record)}>{text}&nbsp;<EyeOutlined /></span>
dataIndex: 'name',
key: 'name',
render: (text: any, record: any) => <span className="commonPickColor" onClick={() => handleSee(record)}>{text}&nbsp;<EyeOutlined /></span>
},
{
title: '属性组名',
align: 'center',
dataIndex: 'attrGroup',
key: 'attrGroup',
dataIndex: 'groupName',
key: 'groupName',
},
{
title: '展示方式',
align: 'center',
dataIndex: 'displayType',
key: 'displayType',
dataIndex: 'type',
key: 'type',
render: (text: number) => {
let txt = new Map([[1, '单选'], [2, '多选'], [3, '输入']])
return txt.get(text)
}
},
{
title: '是否必填',
align: 'center',
dataIndex: 'required',
key: 'required',
dataIndex: 'isEmpty',
key: 'isEmpty',
render: (text: any) => text ? '是' : '否'
},
{
title: '状态',
align: 'center',
dataIndex: 'status',
key: 'status',
render: (text: any, record:any) => {
let component: ReactNode = null
component = (
<Popconfirm
title="确定要执行这个操作?"
onConfirm={confirm}
onCancel={cancel}
okText="是"
cancelText="否"
>
<Button type="link" onClick={()=>handleModify(record)} style={record.status===1?{color:'#00B37A'}:{color:'red'}}>{record.status===1?'有效':'无效'} <PlayCircleOutlined /></Button>
</Popconfirm>
)
return component
}
dataIndex: 'isEnable',
key: 'isEnable',
render: (text: any, record: any) => (
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => confirm(record)}
onCancel={cancel}
okText="是"
cancelText="否"
>
<Button
type="link"
style={record.isEnable ? { color: '#00B37A' } : { color: 'red' }}>
{record.isEnable ? <>有效 <PlayCircleOutlined /></> : <>无效 <PauseCircleOutlined /></>}
</Button>
</Popconfirm>
)
},
{
title: '操作',
dataIndex: 'option',
align: 'center',
render: (text:any, record:any) => {
return (
<>
{
record.status === 0 ? <><Button type='link'>编辑</Button><Button type='link'>删除</Button></>:''
}
{/* <Button type='link'>编辑</Button>
<Button type='link'>删除</Button> */}
</>
)
}
render: (text: any, record: any) => record.isEnable ? '' : <>
<Button type='link' onClick={() => handleEdit(record)}>编辑</Button>
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => clickDelete(record)}
onCancel={cancel}
okText="是"
cancelText="否"
>
<Button type='link'>删除</Button>
</Popconfirm>
</>
}
];
const search: IFormFilter[] = [
{
type: 'Input',
value: 'keywords',
col: 4,
placeHolder: '输入属性名称'
}
]
const handleSee = (record: any) => {
history.push(`/memberCenter/commodityAbility/classAndProperty/attribute/addAttribute?id=${record.id}&isSee=true`)
}
const searchBarActions: IButtonFilter[] = [
{
text: '查询',
handler: () => {
console.log('查询')
}
},
{
type: 'primary',
text: '新建',
icon: <PlusOutlined />,
handler: ()=>{
history.push('/classAndProperty/attribute/addAttribute')
const confirm = (record: any) => {
console.log(record, 'record')
updateAttributeStatus({ id: record.id, status: !record.isEnable }).then(res => {
if (res.code === 1000) {
message.success(res.message)
//@ts-ignore
ref.current.reload()
}
}
]
})
}
const handleSee = (record:any) => {
console.log('see')
history.push(`/trademark/viewBrand?id=${record.id}`)
const clickDelete = (record: any) => {
deleteAttribute({ id: record.id }).then(res => {
if (res.code === 1000) {
message.success(res.message)
//@ts-ignore
ref.current.reload()
}
})
}
const confirm = () => {
console.log('confirm')
const handleEdit = (record: any) => {
history.push(`/memberCenter/commodityAbility/classAndProperty/attribute/addAttribute?id=${record.id}`)
}
const cancel = () => {
console.log('cancel')
}
const handleModify = (record: object) => {
// 通过传入的params字符串判断是修改那种类型的数据
console.log('执行状态修改', record)
}
return (
<PageHeaderWrapper>
<Card>
<StandardTable
columns={columns}
currentRef={ref}
fetchTableData={(params:any) => fetchData(params)}
formFilters={search}
buttonFilters={searchBarActions}
fetchTableData={(params: any) => fetchData(params)}
formilyLayouts={{
justify: 'space-between'
}}
formilyProps={{
layouts: {
order: 1
},
ctx: {
schema: {
type: 'object',
properties: {
name: {
type: 'string',
'x-component-props': {
placeHolder: '属性名称'
},
'x-component': 'Search'
}
}
}
}
}}
formilyChilds={{
layouts: {
order: 0
},
children: (
<>
<Button type="primary" icon={<PlusOutlined />} onClick={() => { history.push('/memberCenter/commodityAbility/classAndProperty/attribute/addAttribute') }}>
新建
</Button>
</>
)
}}
/>
</Card>
</PageHeaderWrapper>
......
import React from 'react'
import React, { useState, useEffect } from 'react'
import { Row, Col, Form, Input, Select, Popconfirm, Button, Card, Checkbox, Tooltip } from 'antd';
import { history } from 'umi';
import { InfoCircleOutlined } from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import ReutrnEle from '@/components/ReturnEle';
import { getAttributeDetail } from '@/services/classAndProperty/attribute'
const { Option } = Select;
......@@ -15,28 +16,23 @@ const layout = {
span: 16,
},
};
const tailLayout = {
wrapperCol: {
offset: 6,
span: 12,
},
};
const viewAtttributes: React.FC<{}> = () => {
const [menuForm] = Form.useForm();
const [queryId, setQueryId] = useState('')
const [formValue, setFormValue] = useState<any>({})
const handleSubmitAllSetting = () => {
menuForm.validateFields().then(values => {
console.log(values, 'menu values')
}).catch(error => {
console.error(error)
})
}
const handleDeleteMenu = () => {
console.log('delete')
}
useEffect(() => {
const { location } = history
if(location.query.id) {
setQueryId(location.query.id)
getAttributeDetail({id: location.query.id}).then(res=>{
const { data } = res
setFormValue(data)
menuForm.setFieldsValue(data)
})
}
}, [])
return <PageHeaderWrapper
onBack={() => history.goBack()}
......@@ -52,111 +48,88 @@ const viewAtttributes: React.FC<{}> = () => {
layout="horizontal"
labelAlign="left"
{...layout}
initialValues={formValue}
>
<Row gutter={24}>
<Col span={18}>
<Form.Item
name='classGroupName'
name='id'
label='属性ID'
>
<Input disabled />
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
name='groupName'
label='属性组名'
rules={[
{
required: true,
message: '输入属性组名!',
},
]}
>
<Input disabled placeholder="输入属性组名" />
<Input disabled />
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
name='className'
name='name'
label='属性名称'
rules={[
{
required: true,
message: '输入属性名称!',
},
]}
>
<Input disabled placeholder="输入属性名称" />
<Input disabled />
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
name='displayType'
name='type'
label='展示方式'
rules={[
{
required: true,
message: '展示方式为必须项!',
},
]}
>
<Select defaultValue="duo" disabled>
<Option value="duo">多选</Option>
<Option value="dan">单选</Option>
<Option value="shu">输入</Option>
<Select disabled>
<Option value={2}>多选</Option>
<Option value={1}>单选</Option>
<Option value={3}>输入</Option>
</Select>
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
name='attrSetting'
label='属性设置'
>
<Checkbox.Group disabled style={{ width: '100%' }}>
<Row>
<Col span={24}>
<Checkbox value="required">必填</Checkbox>
</Col>
<Col span={24}>
<Checkbox value="upload">上传图片</Checkbox>
<Tooltip title="这是一条描述文字!">
<InfoCircleOutlined />
</Tooltip>
</Col>
<Col span={24}>
<Checkbox value="name">名称属性</Checkbox>
<Tooltip title="这是一条描述文字!">
<InfoCircleOutlined />
</Tooltip>
</Col>
<Col span={24}>
<Checkbox value="price">价格属性</Checkbox>
<Tooltip title="这是一条描述文字!">
<InfoCircleOutlined />
</Tooltip>
</Col>
<Col span={24}>
<Checkbox value="search">搜索属性</Checkbox>
<Tooltip title="这是一条描述文字!">
<InfoCircleOutlined />
</Tooltip>
</Col>
</Row>
</Checkbox.Group>
<Row>
<Col span={24}>
<Form.Item name="isEmpty" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled>必填</Checkbox></Form.Item>
</Col>
<Col span={24}>
<Form.Item name="isImage" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled>上传图片</Checkbox></Form.Item>
<Tooltip title="勾选后对于此属性的属性值可以上传属性值的对应图片!">
<InfoCircleOutlined />
</Tooltip>
</Col>
<Col span={24}>
<Form.Item name="isName" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled>名称属性</Checkbox></Form.Item>
<Tooltip title="勾选后对于此属性的属性值会将属性值添加到商品名称之后,中间以/区隔!">
<InfoCircleOutlined />
</Tooltip>
</Col>
<Col span={24}>
<Form.Item name="isPrice" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled>价格属性</Checkbox></Form.Item>
<Tooltip title="勾选后对于此属性的每个属性值会在商品发布时按属性设置不同的价格!">
<InfoCircleOutlined />
</Tooltip>
</Col>
<Col span={24}>
<Form.Item name="isSearch" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled>搜索属性</Checkbox></Form.Item>
<Tooltip title="勾选后对于此属性会在商城店铺商品列表进行筛选操作时作为筛选项!">
<InfoCircleOutlined />
</Tooltip>
</Col>
</Row>
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
label='状态'
name="isEnable"
>
<span className="commonStatusValid"></span>有效
{formValue.isEnable?<><span className="commonStatusValid"></span>有效</>:<><span className="commonStatusInvalid"></span>无效</>}
</Form.Item>
</Col>
{/* <Col span={18}>
<Form.Item {...tailLayout}>
<Button onClick={handleSubmitAllSetting} type="primary" style={{ marginTop: 32, marginBottom: 16, marginRight: 24}}>
保存
</Button>
<Popconfirm title="确定要取消吗?" okText="是" cancelText="否" onConfirm={handleDeleteMenu}>
<Button style={{ marginTop: 32, marginBottom: 16}}>
取消
</Button>
</Popconfirm>
</Form.Item>
</Col> */}
</Row>
</Form>
</Col>
......
This diff is collapsed.
......@@ -48,7 +48,7 @@ const data = [
]
// 模拟请求
const fetchData = (params:any) => {
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
const queryResult = data.find(v => v.key === params.keywords)
setTimeout(() => {
......@@ -85,7 +85,7 @@ const Goods: React.FC<{}> = () => {
align: 'center',
key: 'role',
className: 'commonPickColor',
render: (text:any, record:any) => <span className="commonPickColor" onClick={()=>handleSee(record)}>{text}&nbsp;<EyeOutlined /></span>
render: (text: any, record: any) => <span className="commonPickColor" onClick={() => handleSee(record)}>{text}&nbsp;<EyeOutlined /></span>
},
{
title: '规格型号',
......@@ -127,10 +127,10 @@ const Goods: React.FC<{}> = () => {
title: '操作',
dataIndex: 'option',
align: 'center',
render: (text:any, record:any) => {
render: (text: any, record: any) => {
return (
<>
<Button type='link' onClick={()=>history.push(`/commodity/goods/addGoods?id=${record.key}`)}>修改</Button>
<Button type='link' onClick={() => history.push(`/memberCenter/commodityAbility/commodity/goods/addGoods?id=${record.key}`)}>修改</Button>
<Button type='link'>删除</Button>
</>
)
......@@ -188,8 +188,8 @@ const Goods: React.FC<{}> = () => {
type: 'primary',
text: '新建',
icon: <PlusOutlined />,
handler: ()=>{
history.push('/commodity/goods/addGoods')
handler: () => {
history.push('/memberCenter/commodityAbility/commodity/goods/addGoods')
}
},
{
......@@ -214,7 +214,7 @@ const Goods: React.FC<{}> = () => {
},
]
const handleSee = (record:any) => {
const handleSee = (record: any) => {
console.log('see')
// history.push(`/trademark/viewBrand?id=${record.id}`)
}
......@@ -270,7 +270,7 @@ const Goods: React.FC<{}> = () => {
<h4>正在进行数据导入检查</h4>
<p>请稍后…</p>
</div>
const step1DescripSuccess = <div className={styles.step1Description}>
<h4>无错误格式数据</h4>
<p>继续导入请按下一步</p>
......@@ -301,7 +301,7 @@ const Goods: React.FC<{}> = () => {
// 导入的时候的描述文字
const [step1DescriptState, setStep1DescriptState] = useState(step1Description)
const [step2DescriptState, setStep2DescriptState] = useState(step2Description)
// timer 计时器模拟导入过程
const [exceptionCheck, setExceptionCheck] = useState(false); // 默认无异常
......@@ -312,21 +312,21 @@ const Goods: React.FC<{}> = () => {
}, [])
useEffect(() => {
console.log(modalStep)
if(modalStep === 1) runTimer()
if(modalStep === 2) runTimer()
if (modalStep === 1) runTimer()
if (modalStep === 2) runTimer()
}, [modalStep])
useEffect(() => {
if(time >= 100){
if (time >= 100) {
clearInterval(timeChange)
setTime(100)
if(modalStep === 1) setStep1DescriptState(step1DescripSuccess)
if(modalStep === 2) setStep2DescriptState(step2DescripSuccess)
if (modalStep === 1) setStep1DescriptState(step1DescripSuccess)
if (modalStep === 2) setStep2DescriptState(step2DescripSuccess)
console.log('倒计时完毕!', modalStep)
}
}, [time])
const runTimer = () => {
setTime(0)
timeChange = setInterval(() => setTime(t => t+Math.floor(Math.random()*10)), 200)
timeChange = setInterval(() => setTime(t => t + Math.floor(Math.random() * 10)), 200)
}
//timer end
......@@ -370,7 +370,7 @@ const Goods: React.FC<{}> = () => {
columns={columns}
currentRef={ref}
rowSelection={rowSelection}
fetchTableData={(params:any) => fetchData(params)}
fetchTableData={(params: any) => fetchData(params)}
formFilters={search}
buttonFilters={searchBarActions}
/>
......@@ -387,7 +387,7 @@ const Goods: React.FC<{}> = () => {
<Result
icon={<FileExcelOutlined />}
title={step0Description}
extra={<Button style={{width:'100%'}} type="primary" onClick={modalUpload}>上传</Button>}
extra={<Button style={{ width: '100%' }} type="primary" onClick={modalUpload}>上传</Button>}
/>
</>
}
......@@ -427,21 +427,21 @@ const Goods: React.FC<{}> = () => {
}
</Modal>
<Modal
title="删除导入批次"
visible={deleteBatchModal}
onOk={handleOkDeleteBatch}
onCancel={handleCancelDelete}
okButtonProps={{danger: true}}
title="删除导入批次"
visible={deleteBatchModal}
onOk={handleOkDeleteBatch}
onCancel={handleCancelDelete}
okButtonProps={{ danger: true }}
>
<Form
layout="vertical"
>
<Form
layout="vertical"
>
<Form.Item label="选择要删除的批次">
<Select placeholder="请选择批次号">
<Select.Option value="542424">4245242452</Select.Option>
</Select>
</Form.Item>
</Form>
<Form.Item label="选择要删除的批次">
<Select placeholder="请选择批次号">
<Select.Option value="542424">4245242452</Select.Option>
</Select>
</Form.Item>
</Form>
</Modal>
</PageHeaderWrapper>
)
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* @Date: 2020-07-13 15:01:40
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-17 15:13:08
*/
*/
import React, { ReactNode, useRef } from 'react'
import { history } from 'umi'
......@@ -38,7 +38,7 @@ const data = [
]
// 模拟请求
const fetchData = (params:any) => {
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
const queryResult = data.find(v => v.key === params.keywords)
setTimeout(() => {
......@@ -72,25 +72,25 @@ const Company: React.FC<{}> = () => {
dataIndex: 'attrName',
align: 'center',
key: 'attrName',
render: (text:any, record:any) => <span className="commonPickColor" onClick={()=>handleSee(record)}>{text}&nbsp;<EyeOutlined /></span>
render: (text: any, record: any) => <span className="commonPickColor" onClick={() => handleSee(record)}>{text}&nbsp;<EyeOutlined /></span>
},
{
title: '合作类型',
align: 'center',
dataIndex: 'cooperateType',
key: 'cooperateType',
render: (value:any,recode: any) =>
render: (value: any, recode: any) =>
<>
{value == 1? '平台物流服务商':'商户合作物流公司'}
{value == 1 ? '平台物流服务商' : '商户合作物流公司'}
</>
},
{
title: '状态',
align: 'center',
dataIndex: 'status',
key: 'status',
render: (text: any, record:any) => {
render: (text: any, record: any) => {
let component: ReactNode = null
component = (
<Popconfirm
......@@ -100,8 +100,8 @@ const Company: React.FC<{}> = () => {
okText="是"
cancelText="否"
>
<Button type="link" onClick={()=>handleModify(record)} style={record.status===1?{color:'#00B37A'}:{color:'red'}}>{record.status===1?'有效':'无效'}
{record.status===1?<PlayCircleOutlined />:<PauseCircleOutlined/>}
<Button type="link" onClick={() => handleModify(record)} style={record.status === 1 ? { color: '#00B37A' } : { color: 'red' }}>{record.status === 1 ? '有效' : '无效'}
{record.status === 1 ? <PlayCircleOutlined /> : <PauseCircleOutlined />}
</Button>
</Popconfirm>
)
......@@ -112,13 +112,13 @@ const Company: React.FC<{}> = () => {
title: '操作',
dataIndex: 'option',
align: 'center',
render: (text:any, record:any) => {
render: (text: any, record: any) => {
return (
<>
<Button type='link'>启用</Button>
{
record.status === 0 ? <><Button type='link'>编辑</Button><Button type='link'>删除</Button></>:''
}
<Button type='link'>启用</Button>
{
record.status === 0 ? <><Button type='link'>编辑</Button><Button type='link'>删除</Button></> : ''
}
<Button type='link'>查看</Button>
</>
)
......@@ -140,13 +140,13 @@ const Company: React.FC<{}> = () => {
type: 'primary',
text: '新建',
icon: <PlusOutlined />,
handler: ()=>{
history.push('/logisticsAbility/logistics/list/addCompany')
handler: () => {
history.push('/memberCenter/logisticsAbility/logistics/list/addCompany')
}
}
]
const handleSee = (record:any) => {
const handleSee = (record: any) => {
console.log('see')
}
......@@ -169,12 +169,12 @@ const Company: React.FC<{}> = () => {
<StandardTable
columns={columns}
currentRef={ref}
fetchTableData={(params:any) => fetchData(params)}
formilyChilds = {
fetchTableData={(params: any) => fetchData(params)}
formilyChilds={
<>
<Button type="primary" onClick={() => history.push('/logisticsAbility/logistics/list/addCompany')}>
新建 <PlusOutlined />
</Button>
<Button type="primary" onClick={() => history.push('/memberCenter/logisticsAbility/logistics/list/addCompany')}>
新建 <PlusOutlined />
</Button>
</>
}
/>
......
......@@ -3,10 +3,10 @@
* @Date: 2020-07-14 15:07:34
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-16 19:54:11
*/
import React, { Component, ReactNode,useRef,useState } from 'react'
*/
import React, { Component, ReactNode, useRef, useState } from 'react'
import { history } from 'umi'
import { Modal,Card ,Button, Form,InputNumber, Radio, Popconfirm,Switch, Input } from 'antd';
import { Modal, Card, Button, Form, InputNumber, Radio, Popconfirm, Switch, Input } from 'antd';
import {
PlayCircleOutlined,
PauseCircleOutlined,
......@@ -15,7 +15,7 @@ import {
PlusCircleOutlined
} from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {StandardTable} from 'god'
import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
import { IFormFilter, IButtonFilter } from 'god/dist/src/standard-table/TableController'
......@@ -26,7 +26,7 @@ const data = [
pricingMode: '计价方式',
transportMode: '运费方式',
explain: '运费说明',
code:252525,
code: 252525,
status: 1
},
{
......@@ -35,14 +35,14 @@ const data = [
pricingMode: '计价方式',
transportMode: '运费方式',
explain: '运费说明',
code:252525,
code: 252525,
status: 2
}
]
// 模拟请求
const fetchData = (params:any) => {
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
const queryResult = data.find(v => v.key === params.keywords)
setTimeout(() => {
......@@ -64,12 +64,12 @@ const fetchData = (params:any) => {
// })
// })
// }
interface Item{
interface Item {
key: string
}
//父页面传递来的参数
export interface ListProps{
title?:React.ReactNode,
export interface ListProps {
title?: React.ReactNode,
type: string
}
export interface ListType {
......@@ -86,7 +86,7 @@ interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
children: React.ReactNode;
}
const EditableCell : React.FC<EditableCellProps> = ({
const EditableCell: React.FC<EditableCellProps> = ({
editing,
dataIndex,
title,
......@@ -113,8 +113,8 @@ const EditableCell : React.FC<EditableCellProps> = ({
{inputNode}
</Form.Item>
) : (
children
)}
children
)}
</td>
);
};
......@@ -164,7 +164,7 @@ const Template: React.FC<ListProps> = (props) => {
align: 'center',
dataIndex: 'status',
key: 'status',
render: (text: any, record:any) => {
render: (text: any, record: any) => {
let component: ReactNode = null
component = (
<Popconfirm
......@@ -174,9 +174,9 @@ const Template: React.FC<ListProps> = (props) => {
okText="是"
cancelText="否"
>
<Button type="link" onClick={()=>handleModify(record)} style={record.status===1?{color:'#00B37A'}:{color:'red'}}>{record.status===1?'有效':'无效'}
{record.status===1?<PlayCircleOutlined />:<PauseCircleOutlined/>}
<Button type="link" onClick={() => handleModify(record)} style={record.status === 1 ? { color: '#00B37A' } : { color: 'red' }}>{record.status === 1 ? '有效' : '无效'}
{record.status === 1 ? <PlayCircleOutlined /> : <PauseCircleOutlined />}
</Button>
</Popconfirm>
)
......@@ -187,20 +187,20 @@ const Template: React.FC<ListProps> = (props) => {
title: '操作',
dataIndex: 'option',
align: 'center',
render: (_:any, record:any) => {
render: (_: any, record: any) => {
return (
<>
<Button type='link'>启用</Button>
{
record.status === 0 ?
<><Button type="link" onClick={() => edit(record)}>编辑</Button>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={handleDelete}>
<Button type='link'>
删除
{
record.status === 0 ?
<><Button type="link" onClick={() => edit(record)}>编辑</Button>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={handleDelete}>
<Button type='link'>
删除
</Button>
</Popconfirm>
</>:''
}
</Popconfirm>
</> : ''
}
<Button type='link'>查看</Button>
</>
)
......@@ -216,9 +216,9 @@ const Template: React.FC<ListProps> = (props) => {
// }
// }, [input])
const onDefaultChange = (id:any,checked: boolean) => {
console.log(id,checked)
columns.forEach((v,index) => {
const onDefaultChange = (id: any, checked: boolean) => {
console.log(id, checked)
columns.forEach((v, index) => {
})
}
......@@ -239,13 +239,13 @@ const Template: React.FC<ListProps> = (props) => {
type: 'primary',
text: '新建',
icon: <PlusOutlined />,
handler: ()=>{
history.push('/logisticsAbility/logistics/list/addCompany')
handler: () => {
history.push('/memberCenter/logisticsAbility/logistics/list/addCompany')
}
}
]
const handleSee = (record:any) => {
const handleSee = (record: any) => {
console.log('see')
}
......@@ -268,12 +268,12 @@ const Template: React.FC<ListProps> = (props) => {
<StandardTable
columns={columns}
currentRef={ref}
fetchTableData={(params:any) => fetchData(params)}
fetchTableData={(params: any) => fetchData(params)}
rowClassName="editable-row"
formilyChilds = {
formilyChilds={
<>
<Button type="primary" icon={<PlusOutlined />} onClick={() => history.push(`/logisticsAbility/logistics/list/templateForm?addType=${props.type}`)}>
新建
<Button type="primary" icon={<PlusOutlined />} onClick={() => history.push(`/memberCenter/logisticsAbility/logistics/list/templateForm?addType=${props.type}`)}>
新建
</Button>
</>
}
......@@ -283,6 +283,6 @@ const Template: React.FC<ListProps> = (props) => {
)
}
Template.defaultProps = {
}
export default Template
\ No newline at end of file
......@@ -208,7 +208,7 @@ const memberImport: React.FC<{}> = () => {
<>
<Button
type='primary'
onClick={() => history.push('/memberAbility/manage/addMember')}
onClick={() => history.push('/memberCenter/memberAbility/manage/addMember')}
>
<PlusOutlined />新建
</Button>
......
......@@ -211,7 +211,7 @@ const memberLevel: React.FC<[]> = () => {
}
const handleSet = (record: any) => {
history.push('/memberAbility/manage/level/addEquity')
history.push('/memberCenter/memberAbility/manage/level/addEquity')
}
return (
......
......@@ -17,7 +17,7 @@ const TemplateItem: React.FC<TemplateItemPropsType> = (props) => {
<div className={styles.template_item}>
<div className={styles.img_box} style={{ backgroundImage: `url(${default_img})` }}>
<div className={styles.img_box_mask}>
<Link to={`/shopAbility/template/detail?type=${type}`} className={styles.detail_btn}>查看详情</Link>
<Link to={`/memberCenter/shopAbility/template/detail?type=${type}`} className={styles.detail_btn}>查看详情</Link>
</div>
<div className={cx(styles.type_tag, templateInfo.platform === 'H5' ? styles.h5 : '')}>{templateInfo.platform}</div>
</div>
......
......@@ -14,6 +14,7 @@
.form_item {
width: 572px;
resize: none;
}
.form_item_wrap {
......@@ -21,13 +22,17 @@
align-items: center;
.size_require {
margin-left: 24px;
color: #97A0AF;
}
}
.upload_btn {
.img_list {
display: flex;
}
.upload_btn {
position: relative;
width: 104px;
height: 104px;
display: flex;
......@@ -39,6 +44,24 @@
border-radius: 2px;
border: 1px dashed rgba(223, 225, 230, 1);
cursor: pointer;
margin-right: 24px;
&.upload {
border: 1px solid rgba(223, 225, 230, 1);
background: #ffffff;
}
.upload_img {
height: 100%;
width: auto;
display: block;
margin: 0 auto;
}
&>img {
width: 100%;
height: 100%;
}
&.large {
width: 175px;
......@@ -48,5 +71,23 @@
&>p {
margin-top: 12px;
}
.delete_btn {
position: absolute;
width: 24px;
height: 24px;
border-radius: 4px;
background: rgba(0, 0, 0, 0.45);
top: 8px;
right: 8px;
color: #ffffff;
text-align: center;
line-height: 24px;
&:hover {
cursor: pointer;
opacity: .8;
}
}
}
}
\ No newline at end of file
import React, { useState } from 'react'
import React, { useState, Fragment, useEffect } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Form, Input, Select, Button, Upload } from 'antd'
import { PlusOutlined } from '@ant-design/icons'
import { Prompt } from 'umi';
import { PlusOutlined, DeleteOutlined } from '@ant-design/icons'
import CitySelect from '../components/citySelect'
import RequireItem from '@/components/RequireItem'
import default_logo from '@/assets/imgs/default_logo.png'
import cx from 'classnames'
import styles from './index.less'
const ShopInfo: React.FC = () => {
const [formIsHalfFilledOut, setFormIsHalfFilledOut] = useState(false)
const [selectCityData, setSelectCityData] = useState([{ index: 0, provinceId: 0, cityId: 0 }])
const [workShopImgList, setWorkShopImgList] = useState([default_logo])
const uploadProps = {
name: 'file',
......@@ -44,8 +48,15 @@ const ShopInfo: React.FC = () => {
setSelectCityData(data)
}
const handleDeleteWorkShopImgItem = (itemInfo: any) => {
let result = [...workShopImgList]
result = result.filter(item => item !== itemInfo)
setWorkShopImgList(result)
}
return (
<PageHeaderWrapper>
<Prompt when={formIsHalfFilledOut} message="您还有未保存的内容,是否确定要离开?" />
<div className={styles.shop_info}>
<Form
className={styles.add_template_form}
......@@ -69,10 +80,14 @@ const ShopInfo: React.FC = () => {
label={<RequireItem label="公司LOGO" isRequire={true} />}
>
<div className={styles.form_item_wrap}>
<Upload {...uploadProps}>
<div className={styles.upload_btn}>
<PlusOutlined />
<p>点击上传</p>
<div className={cx(styles.upload_btn, styles.upload)}>
<Fragment>
<PlusOutlined />
<p>点击上传</p>
</Fragment>
{/* <img src={default_logo} /> */}
</div>
</Upload>
<div className={styles.size_require}>
......@@ -86,7 +101,7 @@ const ShopInfo: React.FC = () => {
label={<RequireItem label="公司简介" isRequire={true} />}
rules={[{ required: true, message: "请输入公司简介" }]}
>
<Input.TextArea allowClear rows={4} className={styles.form_item} placeholder="最长400个字条,200个汉字" maxLength={100} />
<Input.TextArea allowClear rows={5} className={styles.form_item} placeholder="最长400个字条,200个汉字" maxLength={100} />
</Form.Item>
<Form.Item
labelAlign="left"
......@@ -94,6 +109,18 @@ const ShopInfo: React.FC = () => {
label={<RequireItem label="厂房照片" />}
>
<div className={styles.form_item_wrap}>
<div className={styles.img_list}>
{
workShopImgList.map((item, index) => (
<div key={index} className={cx(styles.upload_btn, styles.large, styles.upload)}>
<div className={styles.delete_btn} onClick={() => handleDeleteWorkShopImgItem(item)}><DeleteOutlined /></div>
<img className={styles.upload_img} src={item} />
</div>
))
}
</div>
<Upload {...uploadProps}>
<div className={cx(styles.upload_btn, styles.large)}>
<PlusOutlined />
......@@ -128,7 +155,6 @@ const ShopInfo: React.FC = () => {
label={<RequireItem label="" />}
>
<Button type="primary" style={{ marginRight: 16 }}>保存</Button>
<Button>取消</Button>
</Form.Item>
</Form>
</div>
......
This diff is collapsed.
declare namespace API {
export interface ResponseModel {
}
}
\ No newline at end of file
declare namespace AttributeApi {
export interface innerAttribute {
id: number;
groupName: string;
name: string;
}
export interface AttributeItem {
id: number;
groupName: string;
name: string;
type: number;
isEnable: boolean;
isEmpty: boolean;
isImage: boolean;
isName: boolean;
isPrice: boolean;
isSearch: boolean;
attribute: innerAttribute;
}
export interface AttributeListsModel {
totalCount: number;
data: AttributeItem[];
}
export interface AttributeListsByQueryDTO {
current: number;
pageSize: number;
name: string;
}
// 查询 删除共用
export interface AttributeByQueryDTO {
id: number;
}
export interface AttributeByUpdateStatusDTO {
id: number;
status: boolean;
}
interface AttributeTreeItem {
key: string;
title: string ;
checked: boolean;
}
export interface AttributeTreeModel {
key: string;
title: string ;
checked: boolean;
children: AttributeTreeItem[];
}
//关联平台后台属性
export interface PlatformAttributeItem {
id: number;
groupName: string;
name: string;
type: number;
isEnable: boolean;
isEmpty: boolean;
isImage: boolean;
isName: boolean;
isPrice: boolean;
isSearch: boolean;
}
export interface PlatformAttributeByQueryDTO {
current: number;
pageSize: number;
name: string;
groupName: string;
isEnable: boolean;
}
export interface PlatformAttributeListsModel {
totalCount: number;
data: PlatformAttributeItem[];
}
}
\ No newline at end of file
import request from '@/utils/request';
const prefix = '/product'
/**
* @description 获取属性树形列表
*/
export async function getAttributeTree() {
return request<AttributeApi.AttributeTreeModel>('/customer/getCustomerAttributeTree', {
prefix
})
}
/**
* @description 查询属性信息
* @param {AttributeApi.AttributeByQueryDTO} params
*/
export async function getAttributeDetail(params: AttributeApi.AttributeByQueryDTO) {
return request<AttributeApi.AttributeItem>('/customer/getCustomerAttribute', {
prefix,
params
})
}
/**
* @description 查询属性列表
* @param {AttributeApi.AttributeListsByQueryDTO} params
*/
export async function getAttributeLists(params: AttributeApi.AttributeListsByQueryDTO) {
return request<AttributeApi.AttributeListsModel>('/customer/getCustomerAttributeList', {
prefix,
params
})
}
/**
* @description 新增/修改属性
* @param {AttributeApi.AttributeItem} params
*/
export async function updateAttribute(params: AttributeApi.AttributeItem) {
return request('/customer/saveOrUpdateCustomerAttribute', {
prefix,
method: 'post',
data: params
})
}
/**
* @description 删除属性
* @param {AttributeApi.AttributeByQueryDTO} params
*/
export async function deleteAttribute(params: AttributeApi.AttributeByQueryDTO) {
return request('/customer/deleteCustomerAttribute', {
prefix,
params
})
}
/**
* @description 启用停用属性
* @param {AttributeApi.AttributeByUpdateStatusDTO} params
*/
export async function updateAttributeStatus(params: AttributeApi.AttributeByUpdateStatusDTO) {
return request('/customer/updateCustomerAttributeStatus', {
prefix,
params,
// ctlType: 'message'
})
}
// 关联 平台后台属性列表
/**
* @description 关联平台后台属性
* @param {AttributeApi.PlatformAttributeByQueryDTO} params
*/
export async function getPlatformAttribute(params: AttributeApi.PlatformAttributeByQueryDTO) {
return request<AttributeApi.PlatformAttributeListsModel>('/platform/getAttributeList', {
prefix,
params
})
}
\ No newline at end of file
import '../attribute/API'
declare namespace CategoyAttributeApi {
//品类下的属性列表 .Model. 使用属性API
export interface CategoyAttributeListsByQueryDTO {
current: number;
pageSize: number;
categoryId: number;
name: string;
}
// 新增 修改 解除共用
export interface CategoyAttributeByUpdateDTO {
customerCategoryId: number;
customerAttributeIds: number[];
}
// 关联的属性列表 .Model. 使用属性API
}
\ No newline at end of file
import request from '@/utils/request';
import { CategoyAttributeApi } from './API';
const prefix = '/product'
/**
* @description 查询品类下的属性列表
* @param {CategoyAttributeApi.CategoyAttributeListsByQueryDTO} params
*/
export async function getCategoyAttributeLists(params: CategoyAttributeApi.CategoyAttributeListsByQueryDTO) {
return request<AttributeApi.AttributeListsModel>('/customer/getCustomerCategoryAttributeList', {
prefix,
params
})
}
/**
* @description 新增/修改品类属性
* @param {CategoyAttributeApi.CategoyAttributeByUpdateDTO} params
*/
export async function updateCategoyAttribute(params: CategoyAttributeApi.CategoyAttributeByUpdateDTO) {
return request('/customer/saveCustomerCategoryAttribute', {
prefix,
method: 'post',
data: params
})
}
/**
* @description 解除品类属性关联
*/
export async function deleteCategoryAttribute(params: CategoyAttributeApi.CategoyAttributeByUpdateDTO) {
return request('/customer/deleteCustomerCategoryAttribute', {
prefix,
method: 'post',
data: params
})
}
\ No newline at end of file
declare namespace CategoryTreeApi {
interface CategoryTreeItem {
id: number;
key: string;
title: string ;
checked: boolean;
}
export interface CategoryTreeModel {
id: number;
key: string;
title: string ;
checked: boolean;
children: CategoryTreeItem[];
}
// 查询 删除共用
export interface CategoryByQueryDTO {
id: number;
}
// export interface CategoryDetailModel {
// id: number;
// key: string;
// name: string;
// type: number;
// imageUrl: string;
// categoryKey: string;
// }
export interface CategoryListItem {
id: number;
key: string;
name: string;
type: number;
imageUrl: string;
categoryKey: string;
}
export interface CategoryListsByQueryDTO {
current: number;
pageSize: number;
name: string;
}
export interface CategroyListsModel {
totalCount: number;
data: CategoryListItem[];
}
/**以下为参考案例 */
interface RegisterBasicDTO {
phone: string;
smsCode: string;
password: string;
email: string;
}
interface RegisterBasicModel {
id: number;
}
interface RegisterTypeDTO {
id: number;
typeId: number;
businessTypeId: number;
}
interface MemberTypeItem {
id: number;
typeName: string;
}
interface BusinessTypeItem {
id: number;
businessTypeName: string;
}
interface RegisterTypeModel {
memberType: MemberTypeItem[];
businessType: BusinessTypeItem[];
}
interface CheckRulesItem {
id: number;
ruleName: string;
ruleType: string;
rulePattern: RegExp;
msg: string;
}
interface RegisterElementItem {
id: number;
fieldName: string;
fieldCNName: string;
fieldType: string;
fieldLength: number;
fieldEmpty: number;
fieldOrder: number;
fieldRemark: string;
checkRules: CheckRulesItem[];
}
interface RegisterDetailElementModel{
groupName: string;
elements: RegisterElementItem[];
}
}
\ No newline at end of file
import request from '@/utils/request';
const prefix = '/product'
/**
* @description 获取品类树形列表
*/
export async function getCustomerCategoryTree() {
return request<CategoryTreeApi.CategoryTreeModel>('/customer/getCustomerCategoryTree', {
prefix
})
}
/**
* @description 获取平台后台品类树
*/
export async function getPlatformCategoryTree() {
return request<CategoryTreeApi.CategoryTreeModel>('/platform/getCategoryTree', {
prefix
})
}
/**
* @description 查询品类信息
* @param {CategoryTreeApi.CategoryByQueryDTO} params
*/
export async function getCategoryDetail(params: CategoryTreeApi.CategoryByQueryDTO) {
return request<CategoryTreeApi.CategoryListItem>('/customer/getCustomerCategory', {
prefix,
params
})
}
/**
* @description 查询品类列表
* @param {CategoryTreeApi.CategoryListsByQueryDTO} params
*/
export async function getCategoryLists(params: CategoryTreeApi.CategoryListsByQueryDTO) {
return request<CategoryTreeApi.CategroyListsModel>('/customer/getCustomerCategoryList', {
prefix,
params
})
}
/**
* @description 新增/修改品类信息
* @param {CategoryTreeApi.CategoryDetailModel} params
*/
export async function updateCategory(params: CategoryTreeApi.CategoryListItem) {
return request('/customer/saveOrUpdateCustomerCategory', {
prefix,
method: 'post',
data: params
})
}
/**
* @description 删除品类
* @param {CategoryTreeApi.CategoryByQueryDTO} params
*/
export async function deleteCategory(params: CategoryTreeApi.CategoryByQueryDTO) {
return request('/customer/deleteCustomerCategory', {
prefix,
params
})
}
//** 以下为参考案例 */
/**
* @description 用户基础注册接口
* @param {MemberApi.RegisterBasicModel} params
*/
export async function postMemberRegister(params: MemberApi.RegisterBasicDTO) {
return request<MemberApi.RegisterBasicModel>('/member/register/basic', {
prefix,
method: 'post',
data: params
})
}
/**
* @description 用户会员注册 获取会员/业务类型
*
*/
export async function getRegisterTypeList() {
return request<MemberApi.RegisterTypeModel>('/menu/member/register/type', {
prefix
})
}
/**
* @description 用户会员注册 提交会员类型业务类型
* @param {MemberApi.RegisterTypeDTO}
*/
export async function postMemberRegisterType(params: MemberApi.RegisterTypeDTO) {
return request('/member/register/type', {
prefix,
method: 'post',
data: params
})
}
/**
* @description 获取注册详情页 element元素数据
*
*/
export async function getRegisterElementList() {
return request<MemberApi.RegisterDetailElementModel>('/menu/member/register/detail', {
prefix
})
}
/**
* @description 用户会员注册 提交注册详情
* @param {T}
*/
export async function postMemberRegisterDetail<T>(params: T) {
return request('/member/register/detail', {
prefix,
method: 'post',
data: params
})
}
\ No newline at end of file
import '../attribute/API'
declare namespace PropertyValueApi {
export interface PropertyValueItem {
id?: number;
value: string;
imageUrl?: string;
isEnable: boolean;
customerAttribute?: AttributeApi.innerAttribute;
attributeValue?: {
id: number;
value: string;
}
}
export interface PropertyValueListsModel {
totalCount: number;
data: PropertyValueItem[];
}
export interface PropertyValueListsByQueryDTO {
current: number;
pageSize: number;
name: string;
customerAttributeId: number;
}
// 查询 删除共用
export interface PropertyValueByQueryDTO {
id: number;
}
// 新增 修改共用
export interface PropertyValueByUpdateDTO {
id?: number;
value: string;
imageUrl?: string;
isEnable: boolean;
customerAttributeId: string;
attributeValue?: {
id: number;
value: string;
}
}
export interface PropertyValueByUpdateStatusDTO {
id: number;
status: boolean;
}
// 关联平台后台属性值
export interface PlatformPropertyValueItem {
id?: number;
value: string;
imageUrl?: string;
isEnable: boolean;
attribute?: AttributeApi.innerAttribute;
}
export interface PlatformPropertyValueByQueryDTO {
current: number;
pageSize: number;
name: string;
isEnable: boolean;
}
export interface PlatformPropertyValueListsModel {
totalCount: number;
data?: PlatformPropertyValueItem[];
}
interface PropertyValueTreeItem {
id: number;
key: string;
title: string;
checked: boolean;
}
export interface PlatformPropertyValueTreeModel {
id: number;
key: string;
title: string;
checked: boolean;
children: PropertyValueTreeItem[];
}
}
\ No newline at end of file
import request from '@/utils/request';
import { PropertyValueApi } from './API';
const prefix = '/product'
/**
* @description 查询属性值信息
* @param {PropertyValueApi.PropertyValueByQueryDTO} params
*/
export async function getPropertyValueDetail(params: PropertyValueApi.PropertyValueByQueryDTO) {
return request<PropertyValueApi.PropertyValueItem>('/customer/getCustomerAttributeValue', {
prefix,
params
})
}
/**
* @description 查询属性值列表
* @param {PropertyValueApi.PropertyValueListsByQueryDTO} params
*/
export async function getPropertyValueLists(params: PropertyValueApi.PropertyValueListsByQueryDTO) {
return request<PropertyValueApi.PropertyValueListsModel>('/customer/getCustomerAttributeValueList', {
prefix,
params
})
}
/**
* @description 新增/修改属性值
* @param {PropertyValueApi.PropertyValueByUpdateDTO} params
*/
export async function updatePropertyValue(params: PropertyValueApi.PropertyValueByUpdateDTO) {
return request('/customer/saveOrUpdateCustomerAttributeValue', {
prefix,
method: 'post',
data: params
})
}
/**
* @description 删除属性值
* @param {PropertyValueApi.PropertyValueByQueryDTO} params
*/
export async function deletePropertyValue(params: PropertyValueApi.PropertyValueByQueryDTO) {
return request('/customer/deleteCustomerAttributeValue', {
prefix,
params
})
}
/**
* @description 启用停用属性值
* @param {PropertyValueApi.PropertyValueByUpdateStatusDTO} params
*/
export async function updatePropertyValueStatus(params: PropertyValueApi.PropertyValueByUpdateStatusDTO) {
return request('/customer/updateCustomerAttributeValueStatus', {
prefix,
params,
// ctlType: 'message'
})
}
// 关联 平台后台属性值列表
/**
* @description 关联平台后台属性值
* @param {PropertyValueApi.PlatformAttributeByQueryDTO} params
*/
export async function getPlatformPropertyValue(params: PropertyValueApi.PlatformPropertyValueByQueryDTO) {
return request<PropertyValueApi.PlatformPropertyValueListsModel>('/platform/getAttributeValueList', {
prefix,
params
})
}
// 关联 平台后台属性值树
/**
* @description 关联平台后台属性值树
*/
export async function getPlatformPropertyValueTree() {
return request<PropertyValueApi.PlatformPropertyValueTreeModel>('/platform/getAttributeValueTree', {
prefix,
})
}
\ No newline at end of file
declare namespace ProductsAPI {
interface customerCategoryObject {
id: number;
key: string;
level: number;
name: string;
type: number;
imageUrl: string;
categoryKey: string;
}
interface brandObject {
id: number;
name: string;
logoUrl: string;
applyTime: string
status: number;
checkTime: string;
isEnable: boolean;
}
interface goodItem {
id: number;
code: string;
name: string;
type: string;
customerCategoryId: number;
customerCategory: customerCategoryObject;
brandId: number;
brand: object;
unitId: number;
unitName: string;
costPrice: number;
batch: string;
}
export interface ProductListsByQueryDTO {
current: number;
pageSize: number;
name: string;
status: number;
}
export interface ProductItem {
id: number;
status: number;
categoryId: number;
brandId: number;
goodsList: goodItem[];
name: string;
slogan: string;
sellingPoint: string;
area: string[];
// commodityAttribute: commodityAttributeItem[];
commodityAttribute: any[];
unitId: string;
minOrder: number;
priceType: number;
// unitPriceAndPic: unitPriceAndPicItem[];
unitPriceAndPic: any[];
logistics: object;
isInvoice: boolean;
marks: string;
packing: string;
afterService: string;
}
}
\ No newline at end of file
import request from '@/utils/request';
const prefix = '/product'
/**
* @description 查询商品列表
* @param {ProductsAPI.ProductListsByQueryDTO} params
*/
export async function getProductLists(params: ProductsAPI.ProductListsByQueryDTO) {
return request<CategoryTreeApi.CategroyListsModel>('/commodity/getCommodityList', {
prefix,
params
})
}
\ No newline at end of file
declare namespace TradeMarkApi {
// export interface innerAttribute {
// id: number;
// groupName: string;
// name: string;
// }
export interface TradeMarkItem {
id?: number;
name: string;
logoUrl: string;
applyTime: string;
status: number;
checkTime: string;
isEnable: boolean;
proveUrl: {
mapkey: {},
mapValue: {}
}
}
export interface TradeMarkListsModel {
totalCount: number;
data: TradeMarkItem[];
}
export interface TradeMarkListsByQueryDTO {
current: number;
pageSize: number;
name: string;
status?: number;
}
// 查询 删除 提交审核共用
export interface TradeMarkByQueryDTO {
id: number;
}
export interface TradeMarkByUpdateStatusDTO {
id: number;
isEnable: boolean;
}
}
\ No newline at end of file
import request from '@/utils/request';
const prefix = '/product'
/**
* @description 查询品牌信息
* @param {TradeMarkApi.TradeMarkListsByQueryDTO} params
*/
export async function getTradeMarkDetail(params: TradeMarkApi.TradeMarkByQueryDTO) {
return request<TradeMarkApi.TradeMarkItem>('/brand/getBrand', {
prefix,
params
})
}
/**
* @description 查询品牌列表
* @param {TradeMarkApi.TradeMarkListsByQueryDTO} params
*/
export async function getTradeMarkLists(params: TradeMarkApi.TradeMarkListsByQueryDTO) {
return request<TradeMarkApi.TradeMarkListsModel>('/brand/getBrandList', {
prefix,
params
})
}
/**
* @description 新增/修改品牌
* @param {TradeMarkApi.TradeMarkItem} params
*/
export async function updateTradeMark(params: TradeMarkApi.TradeMarkItem) {
return request('/brand/saveOrUpdateBrand', {
prefix,
method: 'post',
data: params
})
}
/**
* @description 删除品牌
* @param {TradeMarkApi.TradeMarkByQueryDTO} params
*/
export async function deleteTradeMark(params: TradeMarkApi.TradeMarkByQueryDTO) {
return request('/brand/deleteBrand', {
prefix,
params
})
}
/**
* @description 启用停用品牌
* @param {TradeMarkApi.TradeMarkByUpdateStatusDTO} params
*/
export async function updateTradeMarkStatus(params: TradeMarkApi.TradeMarkByUpdateStatusDTO) {
return request('/brand/updateBrandEnable', {
prefix,
params,
// ctlType: 'message'
})
}
/**
* @description 提交品牌审核
* @param {TradeMarkApi.TradeMarkByQueryDTO} params
*/
export async function applyCheckTradeMark(params: TradeMarkApi.TradeMarkByQueryDTO){
return request('/brand/applyCheckBrand', {
prefix,
params
})
}
\ No newline at end of file
import UserStore from './user'
import ThemeStore from './theme'
import React from 'react';
import { Provider } from 'mobx-react'
import { IUserModule } from '@/module/userModule';
......@@ -23,10 +24,11 @@ export interface IStore {
}
const store = {
userStore: new UserStore
userStore: new UserStore,
ThemeStore: new ThemeStore,
}
const MobxProvider:React.FC = (props) => {
const MobxProvider: React.FC = (props) => {
return <Provider {...store}>{props.children}</Provider>
}
......
import { observable } from 'mobx'
import { IThemeModule } from '@/types/ThemeStoreType'
class ThemeStore implements IThemeModule {
@observable public themeName: string = 'default';
}
export default ThemeStore
@default_btn_color: green;
@default_text_color: green;
\ No newline at end of file
@import './colors.less';
.welcome_text {
color: @default_text_color;
}
// .login_theme(@default_color: red) {}
\ No newline at end of file
.theme-default {
@import './default/styles/login.less';
}
.theme-template2 {
@import './template2/styles/login.less';
}
\ No newline at end of file
@default_btn_color: red;
@default_text_color: red;
\ No newline at end of file
@import './colors.less';
.welcome_text {
color: @default_text_color;
}
// .login_theme(@default_color: red) {}
\ No newline at end of file
/**
* 定义组件的分类数据结构,目的是为了更改的在组件预览面板做,组件的展示搜索与约束
*/
interface propType {
[propName: string]: any
}
export interface ComponentCategoryType {
// 组件预览面板为grid布局通过设置span值来分配各个组件中展示组件所占位置大小,数值0-24
span?: number,
// 默认属性配置,组件预览面板会将默认属性分别展示出来,在拖拽组件时会携默认属性到页面中
props?: propType[],
}
export interface ComponentInfoType {
// 如果组件没有次级组件(次级组件定义类似Layout.Footer)
//时就可以认定,分类名称即为组件名称
span?: number,
props?: propType[],
components?: {
[componentName: string]: ComponentCategoryType | null
}
}
export interface CategoryType {
//组件分类,如果组件没有次级组件,并且无法为其设置默认属性,时可直接设置其值为null,类别名必须为组件名
[category: string]: ComponentInfoType | null
}
import { PROPS_TYPES } from '@/types/ConfigTypes';
/**
* 组件配置信息数据结构定义,组件配置信息用于组件属性可视化展示,组件约束
*/
/**
* 组件属性的配置信息
*/
export interface PropsConfigType {
[propName: string]: PropInfoType
}
/**
* 单个属性的具体配置
*/
export interface PropInfoType {
//属性展示的文字
label: string,
//属性的类型
type: PROPS_TYPES | PROPS_TYPES[],
//属性的功能的描述信息
tip?: string,
//当类型为object或者objectArray时,我们定义该类型的值为子属性值,子属性类型完全与配置完全与属性配置一样
//当类型为object时其配置信息为一个类型为PropsConfigType的对象
//当类型为objectArray时其配置为一个类型为PropsConfigType的数组对象
childPropsConfig?: PropsConfigType | PropsConfigType[],
//表示该属性是否为添加属性,在属性设置面板中类型为object的属性,可以动态添加和删除子属性,
// 只有属性面板中动态添加的属性才会有这个字段,组件原始配置信息,不需要配置此字段
isAdd?: boolean,
// 规则,其实就是antd 的form规则,属性配置面板本身就是一个纯表单,组件的属性有时会需要必填,或者做值校验等,其值完全与antd的form一样
rules?: any[],
// 当类型为function时用于做方法的展示和代码生成时方法的生成,同时设计面板与预览面板也会使用eval来执行默认方法,以防部分组件报错,
//因为无法在页面填写可执行的方法,所以function类型的属性只看已填写方法名,代码生成时会将名与方法体整合生成方法代码。
//该值必须为可执行的方法字符串,如果不填写,设计面板与预览解析时如果该属性有值,就会默认执行一个空方法
placeholder?: string,
// 当类型为enum 时用于填写可选的值
enumData?: string[],
// 属性的默认值
defaultValue?: any,
// 类型为number并且属性值为number+单位比如 12px,12%等可以设置此属性为true
hasUnit?: boolean,
// 类型为string时有时会是颜色这时设置此值为true就可以使用颜色面板
isShowColor?: boolean,
inputColProps?: any,
//类型为numberArray时设置其最大可以填写的个数
maxTagCount?: number,
//类型为number时设置number 的最小值
min?: number,
//类型为number时设置number 的最大值
max?: number,
//类型为stringArray时设置其最大可填写的个数
stringCount?: number,
//因为每个属性在属性设置面板都是以一个formItem的形式可视化的展示的,
// 所以你可以设置当前属性在属性设置面板中formItem的一些特性,可参考antd form.Item设置
formItemProps?: any
}
/**
* 节点属性配置信息,节点属性是这样定义的,一个属性的值可为html标签或者react组件的属性就是节点属性
* react的子节点嵌套实际是将子节点作为属性children的值,所以children也可以作为属性节点配置
*/
export interface NodePropsConfigType {
[propName: string]: {
// 节点属性的类型,只可以填写reactNode和functionReactNode
type: PROPS_TYPES.reactNode | PROPS_TYPES.functionReactNode,
// 节点属性的功能描述,在都dom树面板hover单属性上会显示
tip?: string,
//节点属性的文字展示,不填写默认展示属性名
label?: string,
//节点属性的组件约束,表示该节点属性只可以放入的组件
childNodesRule?: string[],
//节点属性是否必填
isRequired?: boolean,
//节点属性的值是否为单节点
isOnlyNode?: boolean,
//节点属性类型为functionReactNode,时其参数信息
params?: string[]
},
}
/**
* 弹窗类组件配置显示映射,目的是为了将弹窗类的组件展示约束到设计面板中去
*/
export interface MirrorModalFieldType {
// 控制显示的属性字段(比如:Modal的visible)
displayPropName: string,
// 挂载组件的配置信息
mounted: {
//挂载组件的属性的名 (比如Modal的getContainer)
propName: string,
//挂载组件的属性的类型
type: PROPS_TYPES.function | PROPS_TYPES.string
}
// 需要修改样式才能挂载的情况(比如antd 的Drawer组件其默认样式为 position: 'fixed',无法挂载到设计面板上,需要改成 position: 'absolute')
style?: any
}
/**
* 组件配置的数据结构
*/
export interface ComponentConfigType {
//父组件约束,许多组件只能作为特定组件的子组件,这些组件需要设置,父组件约束放置放错,导致错误显示或者报错,
//注意要明确约束到父组件的节点属性
parentNodesRule?: string[],
nodePropsConfig?: NodePropsConfigType,
mirrorModalField?: MirrorModalFieldType,
propsConfig: PropsConfigType,
}
import { CategoryType } from '@/types/CategoryType';
import { ComponentConfigType } from '@/types/ComponentConfigType';
/**
* 属性类型定义
*/
export enum PROPS_TYPES {
object = 'object',
objectArray = 'objectArray',
function = 'function',
number = 'number',
numberArray = 'numberArray',
string = 'string',
stringArray = 'stringArray',
enum = 'enum',
json = 'json',
boolean = 'boolean',
reactNode = 'reactNode',
functionReactNode = 'functionReactNode',
animate = 'animate',
}
/**
* 样式类型定义
*/
export enum CSS_TYPE {
string = 'string',
enum = 'enum',
number = 'number',
};
/**
* 全局配置类型定义
*/
export interface ConfigType {
OriginalComponents: any, //所有的React原始组件
CONTAINER_CATEGORY: CategoryType, //容器组件分类
NON_CONTAINER_CATEGORY: CategoryType, //非容器组件分类
//所有的组件配置汇总
AllComponentConfigs: { [componentName: string]: ComponentConfigType },
iframeSrcDoc: string
}
import {
SelectedComponentInfoType,
VirtualDOMType,
} from '@/types/ModelType';
export interface DesignStoreType {
componentConfigs: VirtualDOMType[];
selectedComponentInfo: SelectedComponentInfoType | {};
hoverKey: null | string
}
import { PropsConfigType } from './ComponentConfigType';
import { EffectsCommandMap } from 'dva';
import { AnyAction } from 'redux';
export interface PropsNodeType {
[propName: string]: {
childNodes: VirtualDOMType[]
}
}
export interface VirtualDOMType {
key: string,
componentName: string,
props: any,
addPropsConfig?: PropsConfigType,
childNodes?: VirtualDOMType[] | PropsNodeType
}
export interface SelectedComponentInfoType {
selectedKey: string,
style: any,
parentPath: string,
componentName: string,
propName?: string,
propPath?: string,
path: string,
isContainer?: boolean,
isOnlyNode?: boolean,
childNodesRule?: string[],
domTreeKeys?: string[],
isRequiredHasChild?: boolean
}
export interface PropsSettingType {
props: any,
propsConfig: PropsConfigType,
mergePropsConfig: PropsConfigType,
addPropsConfig: PropsConfigType,
}
interface DragDataType {
defaultProps?: any,
componentName?: string,
templateData?: VirtualDOMType,
dragPath?: string,
dragParentPath?: string
}
export interface TemplateInfoType {
img: string,
id: string,
name: string,
config: string
}
export interface DropTargetInfoType {
isContainer: boolean,
propPath: string,
path: string,
isOnlyNode?: boolean,
childNodesRule?: string[],
componentName: string,
propName: string
}
export type PlatformStyleType = number[] | string[]
export interface PlatformInfoType {
isMobile: boolean,
size: PlatformStyleType,
}
export interface StateType {
componentConfigs: VirtualDOMType[],
selectedComponentInfo: SelectedComponentInfoType | {},
propsSetting: PropsSettingType | {},
styleSetting: any,
undo: any[],
redo: any[],
templateInfos: TemplateInfoType[],
hoverKey: null | string,
dragData: DragDataType | null,
dropTargetInfo: null | DropTargetInfoType,
platformInfo: PlatformInfoType
}
export type Effect = (
action: AnyAction,
effects: EffectsCommandMap & { select: <T>(func: (state: StateType) => T) => T },
) => void;
export type Reducer = (state: StateType, action: AnyAction) => StateType
export interface ModelType {
namespace: string,
state: StateType,
effects: {
submitConfigs: Effect,
searchTemplate: Effect,
getTemplateList: Effect,
addTemplateInfo: Effect,
deleteTemplate: Effect
},
reducers: {
saveTemplateInfos: Reducer;
addComponent: Reducer,
copyComponent: Reducer,
onLayoutSortChange: Reducer,
clearSelectedStatus: Reducer,
selectComponent: Reducer,
clearChildNodes: Reducer,
deleteComponent: Reducer,
addPropsConfig: Reducer,
deletePropsConfig: Reducer,
changeStyles: Reducer,
submitProps: Reducer,
overTarget: Reducer,
clearHovered: Reducer,
getDragData: Reducer,
getDropTargetInfo: Reducer,
changePlatform: Reducer,
undo: Reducer,
redo: Reducer,
}
}
export interface IThemeModule {
themeName: string;
}
\ No newline at end of file
export interface IUserModule {
name: string;
age: number;
printNameAndAge: string;
setName(name: string):void;
getAsyncAge(): Promise<number>;
}
\ No newline at end of file
import React, { useMemo, useState, useEffect } from 'react';
import { inject, observer } from 'mobx-react'
import { IThemeModule } from '@/types/ThemeStoreType'
interface AuthComponentPropsType {
children: any;
ThemeStore: IThemeModule
}
const GetSiteConfig: React.FC<AuthComponentPropsType> = (props) => {
const [loading, setLoading] = useState<boolean>(true)
const { themeName } = props.ThemeStore
// useMemo(() => {
// console.log('当前使用模板', themeName)
// document.body.className = `theme-${themeName}`;
// }, [themeName])
useEffect(() => {
// 根据当前网站域名加载站点配置和商城配置
const domainName = location.href
setTimeout(() => {
setLoading(false)
console.log('当前使用模板', themeName)
document.body.className = `theme-${themeName}`;
}, 100);
}, [])
return !loading ? (
<>
{props.children}
</>
) : null
}
export default inject('ThemeStore')(observer(GetSiteConfig))
\ No newline at end of file
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