Commit f1cc21d5 by zhaochengxiang

草稿分享

parent 82780f73
...@@ -851,7 +851,7 @@ const AssetAction = (props) => { ...@@ -851,7 +851,7 @@ const AssetAction = (props) => {
const shareAsset = () => { const shareAsset = () => {
if ((assets?.dirIds??[]).length > 0) { if ((assets?.dirIds??[]).length > 0) {
copy(`${window.location.origin}/center-home/asset-detail?id=${id}&dirId=${assets?.dirIds[0]}`); copy(`${window.location.origin}/center-home/asset-detail?id=${id}&dirId=${assets?.dirIds[0]}&isDraft=${reference===AssetDraftReference}`);
showMessage('success', '已复制到剪贴板'); showMessage('success', '已复制到剪贴板');
} }
} }
......
...@@ -9,19 +9,22 @@ import { dispatch } from '../../../../model'; ...@@ -9,19 +9,22 @@ import { dispatch } from '../../../../model';
import './AssetDetailPage.less'; import './AssetDetailPage.less';
import { getDataAssetDetail } from "../../../../service/dataassetmanager"; import { getDataAssetDetail } from "../../../../service/dataassetmanager";
import { appId } from "../../../../App"; import { appId } from "../../../../App";
import { AssetBrowseReference, AssetDraftReference } from "../../../../util/constant";
const AssetDetailPage = (props)=>{ const AssetDetailPage = (props)=>{
const [ data, setData ] = useState({ id: '', dirId: '' }); const [ data, setData ] = useState({ id: '', dirId: '', isDraft: '' });
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
const [templateType, setTemplateType] = useState() const [templateType, setTemplateType] = useState()
const { id, dirId } = data; const { id, dirId, isDraft } = data;
useEffect(() => { useEffect(() => {
const _id = getQueryParam('id', props.location.search); const _id = getQueryParam('id', props.location.search);
const _dirId = getQueryParam('dirId', props.location.search); const _dirId = getQueryParam('dirId', props.location.search);
setData({ id: _id, dirId: _dirId }); const _isDraft = getQueryParam('isDraft', props.location.search);
setData({ id: _id, dirId: _dirId, isDraft: _isDraft });
getDataAssetDetail() getDataAssetDetail()
//eslint-disable-next-line react-hooks/exhaustive-deps //eslint-disable-next-line react-hooks/exhaustive-deps
...@@ -30,14 +33,27 @@ const AssetDetailPage = (props)=>{ ...@@ -30,14 +33,27 @@ const AssetDetailPage = (props)=>{
const getDataAssetDetail = () => { const getDataAssetDetail = () => {
const _id = getQueryParam('id', props.location.search); const _id = getQueryParam('id', props.location.search);
const _dirId = getQueryParam('dirId', props.location.search); const _dirId = getQueryParam('dirId', props.location.search);
const _isDraft = getQueryParam('isDraft', props.location.search);
dispatch({ let url = 'assetmanage.getDataAssetDetail';
type: 'assetmanage.getDataAssetDetail', let payload = {
payload: {
dataAssetId: _id, dataAssetId: _id,
dirId: _dirId||'', dirId: _dirId||'',
checkPermission: true checkPermission: true
}, };
if (_isDraft === 'true') {
url = 'assetmanage.getDraftDetail';
payload = {
params: {
draftId: _id,
}
}
}
dispatch({
type: url,
payload: payload,
callback: data => { callback: data => {
setLoading(false); setLoading(false);
LocalStorage.set(`templateType-${appId}`, data?.templateType) LocalStorage.set(`templateType-${appId}`, data?.templateType)
...@@ -59,7 +75,7 @@ const AssetDetailPage = (props)=>{ ...@@ -59,7 +75,7 @@ const AssetDetailPage = (props)=>{
<div className='detail-container'> <div className='detail-container'>
<div className='detail-container-card'> <div className='detail-container-card'>
{ {
templateType && <AssetAction id={id} dirId={dirId} action='detail' /> templateType && <AssetAction id={id} dirId={dirId} reference={(isDraft==='true')?AssetDraftReference:AssetBrowseReference} action='detail' />
} }
</div> </div>
</div> </div>
......
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