Commit 54deb98b authored by xiexiuxing's avatar xiexiuxing

完成店铺按钮权限

parent c54cd283
This diff is collapsed.
......@@ -3,6 +3,7 @@ import { PlayCircleOutlined } from '@ant-design/icons'
import cx from 'classnames'
import { Link, useIntl } from 'umi'
import styles from './index.less'
import AuthButton from '@/components/AuthButton'
interface TemplateItemPropsType {
templateInfo: any;
......@@ -34,7 +35,10 @@ const TemplateItem: React.FC<TemplateItemPropsType> = (props) => {
<div className={styles.template_item}>
<div className={styles.img_box} style={{ backgroundImage: `url(${templateInfo.templatePicUrl})` }}>
<div className={styles.img_box_mask}>
<Link to={`/memberCenter/shopAbility/template/detail?type=${type}&id=${templateInfo.id}`} className={styles.detail_btn}>{intl.formatMessage({ id: 'common.button.view.details' })}</Link>
<AuthButton btnCode='shopAbility.template.see' menuCode='shopAbility'>
<Link to={`/memberCenter/shopAbility/template/detail?type=${type}&id=${templateInfo.id}`} className={styles.detail_btn}>{intl.formatMessage({ id: 'common.button.view.details' })}</Link>
</AuthButton>
</div>
<div className={cx(styles.type_tag, templateInfo.environment === 2 ? styles.h5 : '')}>{Environment_Status[templateInfo.environment].name}</div>
</div>
......
......@@ -15,7 +15,7 @@ import styles from './index.less'
import { getAuth } from '@/utils/auth'
import { isEmpty } from '@formily/antd/esm/shared'
import { UPLOAD_TYPE, REQUEST_HEADER, TOP_DOMAIN, ENTERPRISE_CENTER_URL } from '@/constants'
import AuthButton from '@/components/AuthButton'
interface ShopInfoPropsType {
SiteStore: {
siteUrl: string;
......@@ -48,7 +48,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
const PDFList = ['application/pdf']
const isPDF = PDFList.includes(file.type)
if (!isLt50M) {
message.error(intl.formatMessage({ id: 'shop.form.upload.size.limit'}));
message.error(intl.formatMessage({ id: 'shop.form.upload.size.limit' }));
}
if (!isPDF) {
......@@ -83,8 +83,8 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
// 根据站点获取商城信息
const fetchAllShop = () => {
const params: any = {
doorType: 1
const params: any = {
doorType: 1
}
getManageShopFindByDoorType(params).then(res => {
if (res.code === 1000) {
......@@ -488,7 +488,10 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
<Form.Item
label={<RequireItem label="" />}
>
<Button loading={confirmLoading} type="primary" style={{ marginRight: 16 }} onClick={handleSave}>{intl.formatMessage({ id: 'common.button.save' })}</Button>
<AuthButton btnCode='hopAbility.Submit' menuCode='shopAbility'>
<Button loading={confirmLoading} type="primary" style={{ marginRight: 16 }} onClick={handleSave}>{intl.formatMessage({ id: 'common.button.save' })}</Button>
</AuthButton>
</Form.Item>
</Form>
</div>
......
......@@ -7,6 +7,7 @@ import RequireItem from '@/components/RequireItem';
import { QuestionCircleOutlined } from '@ant-design/icons';
import { SELECT_NAME, DOORTYPE } from '@/constants/procurement';
import { getTemplateWebSeoWebGet, postTemplateWebSeoWebAdd, postTemplateWebSeoWebUpdate } from '@/services/TemplateV2Api';
import AuthButton from '@/components/AuthButton'
const { TabPane } = Tabs
const layout: any = {
colon: false,
......@@ -60,7 +61,7 @@ const ShopSeoAdded = () => {
if (res.code !== 1000) {
return
}
form.setFieldsValue({...res.data})
form.setFieldsValue({ ...res.data })
})
}
}, [])
......@@ -70,7 +71,11 @@ const ShopSeoAdded = () => {
onBack={() => history.goBack()}
backIcon={<ReutrnEle description={intl.formatMessage({ id: 'common.button.back' })} />}
extra={
link !== 'detail' && <Button type="primary" loading={confirmLoading} onClick={handleSave}>{intl.formatMessage({ id: 'common.button.save' })}</Button>
link !== 'detail' &&
<AuthButton menuCode='shopAbility' btnCode={id ? 'hopSeodetail.edit' : 'shopSeodetail.add'} >
<Button type="primary" loading={confirmLoading} onClick={handleSave}>{intl.formatMessage({ id: 'common.button.save' })}</Button>
</AuthButton>
}
>
<Prompt when={formIsHalfFilledOut} message={intl.formatMessage({ id: 'common.tip.save.confirm' })} />
......@@ -106,21 +111,21 @@ const ShopSeoAdded = () => {
label={<RequireItem label={intl.formatMessage({ id: 'shop.seo.table.title' })} isRequire={true} brief={<Tooltip placement="top" title={intl.formatMessage({ id: 'shop.seo.table.title.tip' })}><QuestionCircleOutlined /></Tooltip>} />}
rules={[{ required: true, message: intl.formatMessage({ id: 'shop.seo.form.title.required' }) }]}
>
<Input maxLength={50} disabled={link === 'detail'} placeholder={`${intl.formatMessage({ id: 'common.text.longest' })}50${intl.formatMessage({ id: 'common.unit.individual.chinese'})}`} />
<Input maxLength={50} disabled={link === 'detail'} placeholder={`${intl.formatMessage({ id: 'common.text.longest' })}50${intl.formatMessage({ id: 'common.unit.individual.chinese' })}`} />
</Form.Item>
<Form.Item
name='description'
label={<RequireItem label={intl.formatMessage({ id: 'shop.seo.table.description' })} isRequire={true} brief={<Tooltip placement="top" title={intl.formatMessage({ id: 'shop.seo.table.description.tip' })}><QuestionCircleOutlined /></Tooltip>} />}
rules={[{ required: true, message: intl.formatMessage({ id: 'shop.seo.form.description.required' }) }]}
>
<Input.TextArea disabled={link === 'detail'} rows={5} placeholder={`${intl.formatMessage({ id: 'common.text.longest' })}200${intl.formatMessage({ id: 'common.unit.individual.chinese'})}`} maxLength={200} />
<Input.TextArea disabled={link === 'detail'} rows={5} placeholder={`${intl.formatMessage({ id: 'common.text.longest' })}200${intl.formatMessage({ id: 'common.unit.individual.chinese' })}`} maxLength={200} />
</Form.Item>
<Form.Item
name='keywords'
label={<RequireItem label={intl.formatMessage({ id: 'shop.seo.table.keywords' })} isRequire={true} brief={<Tooltip placement="top" title={intl.formatMessage({ id: 'shop.seo.table.keywords.tip' })}><QuestionCircleOutlined /></Tooltip>} />}
rules={[{ required: true, message: intl.formatMessage({ id: 'shop.seo.form.keywords.required' }) }]}
>
<Input.TextArea disabled={link === 'detail'} rows={5} placeholder={`${intl.formatMessage({ id: 'common.text.longest' })}100${intl.formatMessage({ id: 'common.unit.individual.chinese'})}`} maxLength={100} />
<Input.TextArea disabled={link === 'detail'} rows={5} placeholder={`${intl.formatMessage({ id: 'common.text.longest' })}100${intl.formatMessage({ id: 'common.unit.individual.chinese' })}`} maxLength={100} />
</Form.Item>
</Form>
</TabPane>
......
......@@ -12,6 +12,7 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import { searchSelectGetSelectCategoryOptionEffect } from '@/pages/transaction/effect/index';
import { PauseCircleOutlined, PlayCircleOutlined, PlusOutlined } from '@ant-design/icons';
import { getTemplateWebSeoWebPage, postTemplateWebSeoWebDelete, postTemplateWebSeoWebUpdateStatus } from '@/services/TemplateV2Api';
import AuthButton from '@/components/AuthButton'
const ShopSeo = () => {
const ref = useRef<any>({});
......@@ -48,7 +49,11 @@ const ShopSeo = () => {
title: intl.formatMessage({ id: 'shop.seo.table.name' }),
key: 'name',
dataIndex: 'name',
render: (text: any,record: any) => <Typography.Link href={`/memberCenter/shopAbility/shopSeo/detail?id=${record.id}`}>{text}</Typography.Link>
render: (text: any, record: any) =>
<AuthButton btnCode='shopSeo.see' menuCode='shopAbility'>
<Typography.Link href={`/memberCenter/shopAbility/shopSeo/detail?id=${record.id}`}>{text}</Typography.Link>
</AuthButton>
},
{
title: intl.formatMessage({ id: 'shop.seo.table.link' }),
......@@ -63,18 +68,21 @@ const ShopSeo = () => {
render: (text: any, record: any) => {
let component: ReactNode = null
component = (
<Popconfirm
title={intl.formatMessage({ id: 'common.tip.option.confirm' })}
onConfirm={() => confirm(record)}
okText={intl.formatMessage({ id: 'common.button.yes' })}
cancelText={intl.formatMessage({ id: 'common.button.no' })}
>
<Button
type="link"
style={record.status === 1 ? { color: '#00B37A' } : { color: 'red' }}>
{record.status === 1 ? <>{intl.formatMessage({ id: 'common.status.effective' })} <PlayCircleOutlined /></> : <>{intl.formatMessage({ id: 'common.status.invalid' })} <PauseCircleOutlined /></>}
</Button>
</Popconfirm>
<AuthButton btnCode='shopSeo.state' menuCode='shopAbility'>
<Popconfirm
title={intl.formatMessage({ id: 'common.tip.option.confirm' })}
onConfirm={() => confirm(record)}
okText={intl.formatMessage({ id: 'common.button.yes' })}
cancelText={intl.formatMessage({ id: 'common.button.no' })}
>
<Button
type="link"
style={record.status === 1 ? { color: '#00B37A' } : { color: 'red' }}>
{record.status === 1 ? <>{intl.formatMessage({ id: 'common.status.effective' })} <PlayCircleOutlined /></> : <>{intl.formatMessage({ id: 'common.status.invalid' })} <PauseCircleOutlined /></>}
</Button>
</Popconfirm>
</AuthButton>
)
return component
}
......@@ -86,16 +94,22 @@ const ShopSeo = () => {
width: 256,
render: (_text: any, record: any) => (
<>
<Popconfirm
title={intl.formatMessage({ id: 'common.tip.option.confirm' })}
onConfirm={() => handleDelete(record.id)}
disabled={record.status === 1}
okText={intl.formatMessage({ id: 'common.button.yes' })}
cancelText={intl.formatMessage({ id: 'common.button.no' })}
>
<Button disabled={record.status === 1} type='link'>{intl.formatMessage({ id: 'common.button.delete' })}</Button>
</Popconfirm>
<Button disabled={record.status === 1} type='link' onClick={() => history.push(`/memberCenter/shopAbility/shopSeo/edit?id=${record.id}`)}>{intl.formatMessage({ id: 'common.button.modify' })}</Button>
<AuthButton btnCode='shopSeo.del' menuCode='shopAbility'>
<Popconfirm
title={intl.formatMessage({ id: 'common.tip.option.confirm' })}
onConfirm={() => handleDelete(record.id)}
disabled={record.status === 1}
okText={intl.formatMessage({ id: 'common.button.yes' })}
cancelText={intl.formatMessage({ id: 'common.button.no' })}
>
<Button disabled={record.status === 1} type='link'>{intl.formatMessage({ id: 'common.button.delete' })}</Button>
</Popconfirm>
</AuthButton>
<AuthButton btnCode='shopSeo.edit' menuCode='shopAbility'>
<Button disabled={record.status === 1} type='link' onClick={() => history.push(`/memberCenter/shopAbility/shopSeo/edit?id=${record.id}`)}>{intl.formatMessage({ id: 'common.button.modify' })}</Button>
</AuthButton>
</>
)
}
......@@ -116,13 +130,16 @@ const ShopSeo = () => {
const controllerBtns = <Row>
<Col span={6}>
<Button
onClick={() => history.push('/memberCenter/shopAbility/shopSeo/add')}
type="primary"
icon={<PlusOutlined />}
>
{intl.formatMessage({ id: 'common.button.add' })}
</Button>
<AuthButton btnCode='shopSeo.add' menuCode='shopAbility'>
<Button
onClick={() => history.push('/memberCenter/shopAbility/shopSeo/add')}
type="primary"
icon={<PlusOutlined />}
>
{intl.formatMessage({ id: 'common.button.add' })}
</Button>
</AuthButton>
</Col>
</Row>
......
......@@ -8,7 +8,7 @@ import UseModal from '../components/useModal'
// import { Environment_Status } from '@/constants'
import styles from './index.less'
import { getTemplateWebPageTemplateWebFindShopTemplateDetails, postTemplateWebPageTemplateWebUseShopTemplate } from '@/services/TemplateV2Api'
import AuthButton from '@/components/AuthButton'
interface TemplateDetailPropsType {
location: {
query: {
......@@ -118,18 +118,26 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
</div>
</div>
</div>
<div className={styles.btn} onClick={() => handleLinkPreview()}>
<EyeOutlined />
<label>{intl.formatMessage({ id: 'common.button.preview' })}</label>
</div>
<div className={cx(styles.btn, styles.fit)} onClick={() => handleLinkEdit()}>
<LayoutOutlined />
<label>{intl.formatMessage({ id: 'shop.template.button.edit' })}</label>
</div>
<div className={cx(styles.btn, detailInfo?.use === 1 ? styles.use : '')} onClick={() => detailInfo?.use !== 1 ? setUseModalVisible(true) : {}}>
<PushpinOutlined />
<label>{detailInfo?.use === 1 ? intl.formatMessage({ id: 'shop.template.button.state.using' }) : intl.formatMessage({ id: 'shop.template.button.state.use' })}</label>
</div>
<AuthButton btnCode='shopAbility.template.detail.see' menuCode='shopAbility'>
<div className={styles.btn} onClick={() => handleLinkPreview()}>
<EyeOutlined />
<label>{intl.formatMessage({ id: 'common.button.preview' })}</label>
</div>
</AuthButton>
<AuthButton btnCode='shopAbility.template.detail.detailInfo' menuCode='shopAbility'>
<div className={cx(styles.btn, styles.fit)} onClick={() => handleLinkEdit()}>
<LayoutOutlined />
<label>{intl.formatMessage({ id: 'shop.template.button.edit' })}</label>
</div>
</AuthButton>
<AuthButton btnCode='shopAbility.template.detail.state' menuCode='shopAbility'>
<div className={cx(styles.btn, detailInfo?.use === 1 ? styles.use : '')} onClick={() => detailInfo?.use !== 1 ? setUseModalVisible(true) : {}}>
<PushpinOutlined />
<label>{detailInfo?.use === 1 ? intl.formatMessage({ id: 'shop.template.button.state.using' }) : intl.formatMessage({ id: 'shop.template.button.state.use' })}</label>
</div>
</AuthButton>
<UseModal
title={intl.formatMessage({ id: 'shop.template.modal.title.use' })}
......
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