Merge branch 'dev/external_reviews', remote-tracking branch 'origin/main'

main
LiaoYijun 5 months ago
commit 5485c56d6a

@ -4,6 +4,19 @@ import 'quill/dist/quill.snow.css';
// import 'quill/dist/quill.bubble.css';
import './custom.snow.css';
function decodeEntities(str) {
const entities = {
'&': '&',
'&lt;': '<',
'&gt;': '>',
'&quot;': '"',
'&#39;': "'",
'&nbsp;': ' ',
};
return str.replace(/&amp;|&lt;|&gt;|&quot;|&#39;|&nbsp;/g, (match) => entities[match]);
}
const toolbarOptions = [
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
// [{ 'font': [] }],
@ -102,7 +115,8 @@ const Editor = forwardRef(({ readOnly, defaultValue, value, onChange, onTextChan
// const text = quill.getText();
onTextChangeRef.current?.(...args);
const html = quill.getSemanticHTML();
onChangeRef.current?.(html);
const htmlText = decodeEntities(html);
onChangeRef.current?.(htmlText);
});
quill.on(Quill.events.SELECTION_CHANGE, (...args) => {

@ -260,7 +260,7 @@ function getFields(props) {
item(
"dates", //
99,
<Form.Item noStyle1 label={t("group:ArrivalDate")} >
<Form.Item label={t("group:ArrivalDate")} {...fieldProps.dates} >
<>
<Form.Item noStyle name={"dates"} label={t("group:ArrivalDate")} {...fieldProps.dates} initialValue={at(props, "initialValue.dates")[0]}>
<RangePicker key='date1' allowClear={true} inputReadOnly={true} presets={presets} placeholder={["From", "Thru"]} {...fieldComProps.dates} />

@ -13,7 +13,7 @@ function DebounceSelect({ fetchOptions, debounceTimeout = 500, initLoad = false,
if (initLoad && defaultOptions.length===0) {
loadOptions(' ');
}
}, [initLoad]);
}, [initLoad, defaultOptions]);
const loadOptions = (value) => {
fetchRef.current += 1;
@ -50,13 +50,8 @@ function DebounceSelect({ fetchOptions, debounceTimeout = 500, initLoad = false,
onSearch={debounceFetcher}
notFoundContent={fetching ? <Spin size='small' /> : null}
optionFilterProp='label'
>
{options.map((d) => (
<Select.Option key={d.value} title={d.label}>
{d.label}
</Select.Option>
))}
</Select>
options={options}
/>
);
}

@ -20,12 +20,13 @@ const VendorSelector = ({ ...props }) => {
const { travelAgencyId: myAgencyId } = usingStorage();
const [{ travelAgencyName: myAgencyName }] = useAuthStore((state) => [state.currentUser]);
const { t } = useTranslation();
const [{ vendorList }, setCache] = useFormStore(state => [state.cache, state.setCache]);
const [{ vendorList }, setCache] = useFormStore(state => [state.cache, state.setCache]);
return (
<>
<SearchInput initLoad={false}
placeholder={t('products:Vendor')}
labelInValue
mode={'multiple'}
maxTagCount={0}
{...props}

@ -3,6 +3,7 @@ import { useParams, useNavigate } from 'react-router-dom';
import { App, Row, Col, Space, Typography, Divider, Form, Input, Select, Button, Tag } from 'antd';
import { useTranslation } from 'react-i18next';
import { fetchNotifsDetail, fetchNotifsStatusAgency, postNotifsNewOrEdit } from '@/stores/Notice';
import useFormStore from "@/stores/Form";
import BackBtn from '@/components/BackBtn';
import { usingStorage } from '@/hooks/usingStorage';
import VendorSelector from '@/components/VendorSelector';
@ -11,6 +12,21 @@ import Editor from '@/components/Editor';
const { Title, Paragraph } = Typography;
const allOverseasAgency = [
{ key: 30008, value: 30008, label: 'Luxe Voyage Tours-已签海纳协议' },
{ key: 31596, value: 31596, label: '印度Legend' },
{ key: 32531, value: 32531, label: '越南ANP TRAVEL' },
{ key: 32704, value: 32704, label: '泰北 NUT ' },
{ key: 32717, value: 32717, label: 'JCT株式会社' },
{ key: 32865, value: 32865, label: '泰国IAT' },
{ key: 32876, value: 32876, label: 'Japan Fleet' },
// { key: 33031, value: 33031, label: 'testA' },
// { key: 33032, value: 33032, label: 'testB' },
{ key: 33200, value: 33200, label: '新加坡途游' },
{ key: 33508, value: 33508, label: '日本DJ(注意加服务交通费)' },
{ key: 33796, value: 33796, label: '韩国 Halla Tour' },
];
const Edit = ({ ...props }) => {
const { t } = useTranslation();
const { message } = App.useApp();
@ -22,8 +38,10 @@ const Edit = ({ ...props }) => {
const [form] = Form.useForm();
const clickedButton = useRef('');
const quillRef = useRef();
const setCache = useFormStore(state => state.setCache);
const [showAgencySelector, setShowAgencySelector] = useState(0);
const [showAgencySelector, setShowAgencySelector] = useState(1);
const [showAgencySeleted, setShowAgencySeleted] = useState(0);
// const [noticeInfo, setNoticeInfo] = useState({});
@ -45,7 +63,10 @@ const Edit = ({ ...props }) => {
form.setFieldsValue({
agency_list: _list,
});
setCache({ vendorList: _list })
});
} else {
setCache({ vendorList: allOverseasAgency })
}
}, []);
@ -131,7 +152,7 @@ const Edit = ({ ...props }) => {
</Form.Item>
<Form.Item noStyle>
<Space.Compact className='w-full'>
<Form.Item name='target' label='公告区域' className='w-1/3' rules={[{ required: true }]}>
<Form.Item name='target' label='公告区域' initialValue={{value: '_list', label: '我自己选'}} className='w-1/3' rules={[{ required: true }]}>
<Select placeholder='请选择公告区域' labelInValue>
<Select.Option value='all'>所有</Select.Option>
<Select.Option value='domestic'>国内</Select.Option>
@ -179,7 +200,7 @@ const Edit = ({ ...props }) => {
}
</Form.Item>
<Form.Item name='body' label='公告内容' rules={[{ required: true }]}>
<Form.Item name='body' label='公告内容' rules={[{ required: true, max: 4000 }]}>
<Editor ref={quillRef} />
</Form.Item>

Loading…
Cancel
Save