Commit 2f187d09 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents ca988a12 b44fa795
......@@ -530,26 +530,26 @@ export const paramsShop = (
}
break;
// 底部导航
case '9':
propsData = get(pageConfig, ['9', 'props']) || {}
childNodes = get(pageConfig, ['9', 'childNodes']) || {}
_params.adornContent.bottom = {
style: propsData.styleTheme || 0,
status: true,
details: []
}
if (childNodes && Array.isArray(childNodes) && childNodes.length > 0) {
for (let key in childNodes) {
tempProps = pageConfig[childNodes[key]]?.props || {}
!isEmpty(tempProps) && _params.adornContent.bottom.details.push({
defaultIcon: tempProps.defaultIcon,
selectIcon: tempProps.selectIcon,
name: tempProps.name,
type: tempProps.type,
});
case '9':
propsData = get(pageConfig, ['9', 'props']) || {}
childNodes = get(pageConfig, ['9', 'childNodes']) || {}
_params.adornContent.bottom = {
style: propsData.styleTheme || 0,
status: true,
details: []
}
}
break
if (childNodes && Array.isArray(childNodes) && childNodes.length > 0) {
for (let key in childNodes) {
tempProps = pageConfig[childNodes[key]]?.props || {}
!isEmpty(tempProps) && _params.adornContent.bottom.details.push({
defaultIcon: tempProps.defaultIcon,
selectIcon: tempProps.selectIcon,
name: tempProps.name,
type: tempProps.type,
});
}
}
break
}
})
......
......@@ -2,7 +2,7 @@ import React, { useMemo } from 'react';
import { Input, Select } from 'antd';
import { PlusCircleOutlined, DeleteOutlined } from '@ant-design/icons';
import { changeProps } from '@lingxi-disign/core';
import { LAYOUT_TYPE } from '@/constants'
import UploadImage from '@/components/UploadImage';
import uploadImgIcon from '@/assets/icons/upload_img_icon.svg'
......@@ -22,10 +22,38 @@ interface BottomNavigationClientProps {
// 当前选中组件的key
selectedKey?: any,
// 1.B端 2.C端 3.SRM
property?: 1 | 2 | 3
property?: 1 | 2 | 3,
layoutType: LAYOUT_TYPE
}
const RedirectTypeList = [
const shopRedirectTypeList = [
{
value: 1,
label: '首页',
},
{
value: 2,
label: '全部商品',
},
{
value: 3,
label: '分类',
},
{
value: 4,
label: '积分兑换',
},
{
value: 5,
label: '店铺会员',
},
{
value: 6,
label: '商家信息',
},
];
const ChannelRedirectTypeList = [
{
value: 1,
label: '首页',
......@@ -53,7 +81,7 @@ const RedirectTypeList = [
];
const BottomNavigationClient: React.FC<BottomNavigationClientProps> = (props: BottomNavigationClientProps) => {
const { defaultIcon, selectIcon, name, type, property = 2, selectedKey } = props;
const { defaultIcon, selectIcon, name, type, layoutType, selectedKey } = props;
const _isNull = (list) => {
let _number = 0;
......@@ -91,17 +119,25 @@ const BottomNavigationClient: React.FC<BottomNavigationClientProps> = (props: Bo
});
}
const _getNavLinkType = useMemo(() => {
if (layoutType === LAYOUT_TYPE.shop) {
return shopRedirectTypeList
} else {
return ChannelRedirectTypeList
}
}, [layoutType])
return (
<div className={styles['bottomNavigationClient']}>
<div className={styles['bottomNavigationClient-box']}>
<div className={styles['bottomNavigationClient-box-label']}>名称</div>
<Input key={`${selectedKey}-name`} defaultValue={name} onBlur={_onChangeName} />
<Input key={`${selectedKey}-name`} disabled={type === 1} defaultValue={name} onBlur={_onChangeName} />
</div>
<div className={styles['bottomNavigationClient-box']}>
<div className={styles['bottomNavigationClient-box-label']}>链接</div>
<Select key={`${selectedKey}-type`} defaultValue={type} onChange={_onChangeType} style={{ width: '100%' }} >
<Select key={`${selectedKey}-type`} disabled={type === 1} defaultValue={type} onChange={_onChangeType} style={{ width: '100%' }} >
{
RedirectTypeList?.map(selectItem => <Select.Option value={selectItem.value} key={`redirect_type_${selectItem.value}`}>{selectItem.label}</Select.Option>)
_getNavLinkType?.map(selectItem => <Select.Option value={selectItem.value} key={`redirect_type_${selectItem.value}`}>{selectItem.label}</Select.Option>)
}
</Select>
</div>
......
......@@ -15,7 +15,6 @@ import { priceFormat } from '@/utils/numberFomat';
import { getAuth } from '@/utils/auth'
import styles from './index.less';
interface CardNavItemProps {
name: string,
/** 跳转类型:1-品类导航 2.活动导航 3.频道导航 4.外部链接 */
......@@ -143,6 +142,10 @@ const CardNavItem: React.FC<CardNavItemProps> = (props: CardNavItemProps) => {
}
}
if (key === 'type') {
newProps['id'] = ""
}
changeProps({
title: title ? title : name,
props: Object.assign({ ...props }, newProps)
......
......@@ -27,11 +27,11 @@ interface PropsSettingsPropsType {
}
const PropsSettings: React.FC<PropsSettingsPropsType> = (props) => {
const { selectedInfo, shopId, pageConfig } = props
const { selectedInfo, shopId, layoutType, pageConfig } = props
const renderSettingItem = () => {
const { props: initProps, propsConfig, parentKey } = selectedInfo || {};
const _props = { ...initProps, shopId, selectedKey: selectedInfo?.selectedKey }
const _props = { ...initProps, shopId, layoutType, selectedKey: selectedInfo?.selectedKey }
const componentType = propsConfig?.componentType
if (componentType) {
......
......@@ -129,25 +129,25 @@ export const defaultConfig: PageConfigType = {
canEdit: true,
canHide: false,
},
// '9': {
// title: '底部标签栏',
// componentName: 'BottomNavigation',
// props: {},
// childNodes: ['10'],
// childComponentName: 'BottomNavigation.Items',
// addBtnText: '添加标签',
// maxLength: 5,
// },
// '10': {
// loop: '${bottom}',
// title: '${item.name}',
// componentName: 'BottomNavigation.Items',
// props: {
// defaultIcon: '${item.defaultIcon}',
// selectIcon: '${item.selectIcon}',
// name: '${item.name}',
// type: '${item.type}',
// isnull: false,
// },
// },
'9': {
title: '底部标签栏',
componentName: 'BottomNavigation',
props: {},
childNodes: ['10'],
childComponentName: 'BottomNavigation.Items',
addBtnText: '添加标签',
maxLength: 5,
},
'10': {
loop: '${bottom}',
title: '${item.name}',
componentName: 'BottomNavigation.Items',
props: {
defaultIcon: '${item.defaultIcon}',
selectIcon: '${item.selectIcon}',
name: '${item.name}',
type: '${item.type}',
isnull: false,
},
},
}
......@@ -238,7 +238,13 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
navList: appConfig?.navList ? appConfig?.navList.details : [],
advert: appConfig?.advert ? appConfig?.advert.details : [],
commodityList: [],
bottom: appConfig?.bottom ? appConfig?.bottom.details : [],
bottom: appConfig?.bottom ? appConfig?.bottom.details : [{
defaultIcon: 'https://shushangyun01.oss-cn-shenzhen.aliyuncs.com/grid@2xf2a5b4c6612742759d5fcf322e2d6102.png',
selectIcon: 'https://shushangyun01.oss-cn-shenzhen.aliyuncs.com/Icon@2x(3)06695cb1e9904ae1a7a0b8ec73d29cb0.png',
name: '首页',
type: 1,
isnull: false,
}],
}
if (appConfig?.commodity) {
......@@ -1012,7 +1018,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
_other = { ..._other, ..._marketingConfig_19 };
!_mallLayoutConfig['0'].childNodes.includes('11-19') && _mallLayoutConfig['0'].childNodes.push('11-19');
}
_mallLayoutConfig['0'].childNodes = [..._mallLayoutConfig['0'].childNodes, '8', '6']
_mallLayoutConfig['0'].childNodes = [..._mallLayoutConfig['0'].childNodes, '8', '6', '9']
const config = {
..._mallLayoutConfig,
......
import React, { useRef, useState, useImperativeHandle } from 'react';
import React, { useRef, useImperativeHandle, useEffect } from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Card } from 'antd';
import { StandardTable } from 'god';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { ColumnType, TableRowSelection } from 'antd/lib/table/interface';
import { ColumnType } from 'antd/lib/table/interface';
import NiceForm from '@/components/NiceForm';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { searchSelectGetSelectCategoryOptionEffect } from '@/pages/transaction/effect/index';
import { useLinkageUtils } from '@/utils/formEffectUtils';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
const { onFormMount$ } = FormEffectHooks
interface Iprops {
......@@ -58,7 +59,12 @@ const Table: React.FC<Iprops> = (props: any) => {
getCheckboxProps
} = props;
const tableRef = useRef<any>({});
const [selectRow, selectRowFns] = useRowSelectionTable({
customKey: rowKey || 'id',
extendsSelection: {
getCheckboxProps: (record) => getCheckboxProps && getCheckboxProps(record)
}
});
/** 列表数据 */
const fetchData = (params?: any) => {
return new Promise((resolve, reject) => {
......@@ -77,20 +83,11 @@ const Table: React.FC<Iprops> = (props: any) => {
})
}
/**多选 */
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<number>>([]);
const rowSelection: TableRowSelection<any> = {
selectedRowKeys: selectedRowKeys,
onChange: (rowKeys: any) => {
fetchRowkeys(rowKeys)
setSelectedRowKeys(rowKeys);
},
getCheckboxProps: (record) => getCheckboxProps && getCheckboxProps(record)
}
useImperativeHandle(reload, () => ({
reload: () => {
tableRef.current.reload();
selectRowFns.setSelectRow([])
selectRowFns.setSelectedRowKeys([])
}
}));
......@@ -122,6 +119,10 @@ const Table: React.FC<Iprops> = (props: any) => {
}
useEffect(() => {
fetchRowkeys && fetchRowkeys(selectRowFns.selectedRowKeys)
}, [selectRowFns])
return (
<PageHeaderWrapper>
<Card>
......@@ -129,7 +130,7 @@ const Table: React.FC<Iprops> = (props: any) => {
currentRef={tableRef}
columns={columns}
tableProps={{ rowKey: rowKey ? rowKey : 'id' }}
rowSelection={selectedRow && rowSelection}
rowSelection={selectedRow && selectRow}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<NiceForm
......
......@@ -168,7 +168,7 @@ const AddedFormLayout: React.FC<AddedFormLayoutProps> = (props: any) => {
imgUrl: data.imgUrl,
productName: data.name,
category: data.category,
brand: data.brand.name,
brand: data.brand?.name,
unit: data.unitName,
purchaseCount: 1,
logistics: data.logistics,
......@@ -211,7 +211,7 @@ const AddedFormLayout: React.FC<AddedFormLayoutProps> = (props: any) => {
if (res.code !== 1000) {
return
}
res.data.commodityList.forEach(item => {
res.data.commodityList.forEach((item: any) => {
inquiryListProductRequests.push({
commodityId: item.commodityId,
productId: item.id,
......
......@@ -96,9 +96,9 @@ const columns_3 = ({
},
() => ({
validator: (_rule, value) => {
const pattern = /^(\-)?\d+(\.\d{1,3})?$/;
const pattern = /^(\d|[1-9]\d|99.999)(\.\d{1,3})?$/;
if (!pattern.test(value)) {
return Promise.reject(new Error('折扣必须大于0'));
return Promise.reject(new Error('折扣必须大于0且小于100最多保留3为小数'));
}
return Promise.resolve();
},
......
......@@ -45,16 +45,18 @@ const ProductListLayout: React.FC<ProductListProps> = (props: any) => {
const [collocation, setCollocation] = useState<any[]>([]);
const [current, setCurrent] = useState<number>(1);
const handleOnShowSizeChange = (current, _size) => {
setCurrent(current)
}
const handlesStFieldsValue = () => {
const params = [...dataSource];
const _pagination = (current - 1) * 10;
params.forEach((_item, _i) => {
const index = Number(_pagination + _i)
form.setFieldsValue({
[`plummetPrice_${index}`]: _item.plummetPrice,
[`activityPrice_${index}`]: _item.activityPrice,
[`restrictNum_${index}`]: _item.restrictNum,
[`restrictTotalNum_${index}`]: _item.restrictTotalNum,
[`plummetPrice_${_i}`]: _item.plummetPrice,
[`activityPrice_${_i}`]: _item.activityPrice,
[`restrictNum_${_i}`]: _item.restrictNum,
[`restrictTotalNum_${_i}`]: _item.restrictTotalNum,
})
})
}
......@@ -183,9 +185,6 @@ const ProductListLayout: React.FC<ProductListProps> = (props: any) => {
setDataSource(fields)
}
const handleOnShowSizeChange = (current, _size) => {
setCurrent(current)
}
return (
<CardLayout
......
import React from 'react';
import { Button, notification, message } from 'antd';
import { Button, notification, message, Typography } from 'antd';
import { GlobalConfig } from '@/global/config'
import { PublicApi } from '@/services/api';
......@@ -12,89 +12,93 @@ const COOKIEPREFIX = 'CHATROOM_';
// 主动调起聊天室 mmeberId 为接收人的memberId
export const toChatRoom = (memberId: string = '', shopType: number = 1) => {
let _curUserInfo: any = getAuth();
if (!memberId) {
if (!memberId) {
document.cookie = `${COOKIEPREFIX}curMemberId=;path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}curUserId=;path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}shopType=${shopType};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}ENTERPRISE_CENTER_URL=${ENTERPRISE_CENTER_URL};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}CHANNEL_CENTER_URL=${CHANNEL_CENTER_URL};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}ICHANNEL_CENTER_URL=${ICHANNEL_CENTER_URL};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}origin=${window.location.origin};path=/;domain=${DOMAIN}`;
window.open(CHATROOM_URL);
return;
}
const _params: any = {
memberId
}
PublicApi.getMessageImHistorySession(_params).then(res => {
if (res.code === 1000) {
let _userId = '';
const _list = res.data;
if (_list.length > 0) {
for (var i = 0; i < _list.length; i++) {
if (_list[i].userList.length > 0) {
_userId = _list[i].userList[0].userId;
break;
}
}
}
if (_userId) {
document.cookie = `${COOKIEPREFIX}curMemberId=${memberId};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}curUserId=${_userId};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}shopType=${shopType};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}ENTERPRISE_CENTER_URL=${ENTERPRISE_CENTER_URL};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}CHANNEL_CENTER_URL=${CHANNEL_CENTER_URL};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}ICHANNEL_CENTER_URL=${ICHANNEL_CENTER_URL};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}origin=${window.location.origin};path=/;domain=${DOMAIN}`;
window.open(CHATROOM_URL);
return;
} else {
message.error('该会员底下没有客服!');
}
}
PublicApi.getMessageImHistorySession({ memberId: memberId }).then(res => {
if (res.code === 1000) {
let _userId = '';
const _list = res.data;
if (_list.length > 0) {
for (var i = 0; i < _list.length; i++) {
if (_list[i].userList.length > 0) {
_userId = _list[i].userList[0].userId;
break;
}
}
}
if (_userId) {
document.cookie = `${COOKIEPREFIX}curMemberId=${memberId};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}curUserId=${_userId};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}shopType=${shopType};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}ENTERPRISE_CENTER_URL=${ENTERPRISE_CENTER_URL};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}CHANNEL_CENTER_URL=${CHANNEL_CENTER_URL};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}ICHANNEL_CENTER_URL=${ICHANNEL_CENTER_URL};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}origin=${window.location.origin};path=/;domain=${DOMAIN}`;
window.open(CHATROOM_URL);
} else {
message.error('该会员底下没有客服!');
}
}
})
})
}
// 被动从websocket调起聊天室
export const notificationChatRoom = (content: any) => {
const _curUserInfo: any = getAuth();
const close = () => {
console.log(
'Notification was closed. Either the close button was clicked or duration time elapsed.',
);
};
const key = `open${Date.now()}`;
const btn = (
<Button type="primary" size="small" onClick={() => {
document.cookie = `${COOKIEPREFIX}curMemberId=${content.desc.fromMemberId};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}curUserId=${content.desc.fromUserId};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}shopType=${content.desc.shopType};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}ENTERPRISE_CENTER_URL=${ENTERPRISE_CENTER_URL};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}CHANNEL_CENTER_URL=${CHANNEL_CENTER_URL};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}ICHANNEL_CENTER_URL=${ICHANNEL_CENTER_URL};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}origin=${window.location.origin};path=/;domain=${DOMAIN}`;
window.open(CHATROOM_URL);
notification.close(key)
}}>
查看
</Button>
const _curUserInfo: any = getAuth();
const close = () => {
console.log(
'Notification was closed. Either the close button was clicked or duration time elapsed.',
);
let _text = '';
if (content.data.text) {
_text = content.data.text;
} else if (content.data.img) {
_text = '[图片]';
} else if (content.data.file) {
_text = '[文件]';
} else if (content.data.order) {
_text = '[订单]';
} else if (content.data.goods) {
_text = '[商品]';
} else if (content.data.sale) {
_text = '[售后]';
}
notification.open({
message: '你收到一条消息',
description: _text,
btn,
key,
duration: 10,
onClose: close,
});
};
const key = `open${Date.now()}`;
const btn = (
<Button type="primary" size="small" onClick={() => {
document.cookie = `${COOKIEPREFIX}curMemberId=${content.desc.fromMemberId};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}curUserId=${content.desc.fromUserId};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}shopType=${content.desc.shopType};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}ENTERPRISE_CENTER_URL=${ENTERPRISE_CENTER_URL};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}CHANNEL_CENTER_URL=${CHANNEL_CENTER_URL};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}ICHANNEL_CENTER_URL=${ICHANNEL_CENTER_URL};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}origin=${window.location.origin};path=/;domain=${DOMAIN}`;
window.open(CHATROOM_URL);
notification.close(key)
}}>
查看
</Button>
);
let _text = '';
if (content.data.text) {
_text = content.data.text;
} else if (content.data.img) {
_text = '[图片]';
} else if (content.data.file) {
_text = '[文件]';
} else if (content.data.order) {
_text = '[订单]';
} else if (content.data.goods) {
_text = '[商品]';
} else if (content.data.sale) {
_text = '[售后]';
}
notification.open({
message: '你收到一条消息',
description: <Typography.Text style={{ width: 200 }} ellipsis>{_text}</Typography.Text>,
btn,
key,
duration: 10,
onClose: close,
});
}
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