Commit aa6034ac by zhaochengxiang

bug fix

parent 7d68342d
......@@ -2,6 +2,7 @@
export const AnchorId = 'id';
export const AnchorTimestamp = 'timestamp';
export const AnchorDirId = 'did';
export const AnchorTemplateType = 'templateType';
//编辑模型
export const Action = 'action';
......
......@@ -10,7 +10,7 @@ import ImportDirectory from './ImportDirectory';
import UpdateDirectoryModal from './UpdateDirectoryModal';
import CustomDirectoryModal from './CustomDirectoryModal';
import { showMessage, getQueryParam } from '../../../../util';
import { AnchorTimestamp, AnchorId, AssetManageReference, AssetBrowseReference, ResourceBrowseReference, AssetMountReference, AnchorDirId } from '../../../../util/constant';
import { AnchorTimestamp, AnchorId, AssetManageReference, AssetBrowseReference, ResourceBrowseReference, AssetMountReference, AnchorDirId, AnchorTemplateType } from '../../../../util/constant';
import { highlightSearchContentByTerms } from '../../../../util';
import { listSubject } from './AssetTable';
......@@ -138,8 +138,16 @@ const AssetManageTree = (props) => {
setLoadingTemplates(false)
setTemplates(data)
if ((data??[]).length > 0) {
const _templateType = getQueryParam(AnchorTemplateType, props?.location?.search);
console.log('_templateType', _templateType)
if (_templateType) {
setTemplateType(_templateType)
LocalStorage.set(`templateType-${appId}`, _templateType)
} else {
setTemplateType(data[0].type)
LocalStorage.set(`templateType-${appId}`, data[0].type)
}
listSubject.next({ msg: 'templateChange' })
onSelect?.('', '')
getAllDirectoryAsTree(false)
......
......@@ -7,7 +7,7 @@ import LocalStorage from 'local-storage';
import { dispatch } from '../../../../model';
import CustomDirectoryModal from './CustomDirectoryModal';
import { showMessage, getQueryParam } from '../../../../util';
import { AnchorTimestamp, AnchorId, AssetBrowseReference, ResourceBrowseReference, AnchorDirId } from '../../../../util/constant';
import { AnchorTimestamp, AnchorId, AssetBrowseReference, ResourceBrowseReference, AnchorDirId, AnchorTemplateType } from '../../../../util/constant';
import { highlightSearchContentByTerms } from '../../../../util';
import UpdateDirectoryModal from './UpdateDirectoryModal';
......@@ -125,14 +125,15 @@ const AssetTree = (props) => {
setLoadingTemplates(false)
setTemplates(data)
if ((data??[]).length > 0) {
setTemplateType(data[0].type)
const _templateType = getQueryParam('templateType', props?.location?.search)
const _templateType = getQueryParam(AnchorTemplateType, props?.location?.search)
const _dirId = getQueryParam(AnchorDirId, props?.location?.search)
if (_templateType) {
setTemplateType(_templateType)
LocalStorage.set(`templateType-${appId}`, _templateType)
listSubject.next({ msg: 'templateChange' })
} else {
setTemplateType(data[0].type)
LocalStorage.set(`templateType-${appId}`, data[0].type)
listSubject.next({ msg: 'templateChange' })
}
......
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