|
@@ -10,7 +10,7 @@ import editorStyle from "../editor.module.less";
|
|
|
import style from "./index.module.less";
|
|
|
|
|
|
import BottomBar from "@/components/BottomBar";
|
|
|
-import LinkPick from './components/LinkPicker'
|
|
|
+import KnowledgePicker from '@/components/KnowledgePicker'
|
|
|
import { useComponentStore } from "@/store/componentStore";
|
|
|
import { uploadImage } from "@/utils/http";
|
|
|
import { EComponentType, EKnowlegeTypes } from "@/consts/enum";
|
|
@@ -34,30 +34,7 @@ export default function Index() {
|
|
|
const [showPopup, setShowPopup] = useState(false);
|
|
|
|
|
|
|
|
|
- const handleSubmit = async () => {
|
|
|
- if(!data?.id){
|
|
|
- return;
|
|
|
- }
|
|
|
- if (loading) {
|
|
|
- return;
|
|
|
- }
|
|
|
- const c = {
|
|
|
- data: {
|
|
|
- link: linkValue,
|
|
|
- text: linkText,
|
|
|
- layout: layout ?? 'center',
|
|
|
- poster: linkPoster,
|
|
|
- linkType: data.linkType,
|
|
|
- id: currentComponent?.data.id,
|
|
|
- index: currentComponent?.data?.index,
|
|
|
- },
|
|
|
- enabled: currentComponent?.enabled ?? true,
|
|
|
- type: EComponentType.link,
|
|
|
- };
|
|
|
-
|
|
|
- await saveComponent(c);
|
|
|
- Taro.navigateBack();
|
|
|
- };
|
|
|
+
|
|
|
|
|
|
const handleAddPoster = () => {
|
|
|
Taro.chooseImage({
|
|
@@ -74,6 +51,7 @@ export default function Index() {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ // 选择知识库导入
|
|
|
const onPicked = (pickedArr?: TKnowledgeItem[]) => {
|
|
|
const picked = pickedArr?.[0]
|
|
|
if(picked){
|
|
@@ -85,11 +63,38 @@ export default function Index() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 显示知识库导入弹层
|
|
|
const showKnowlegePopup = ()=> {
|
|
|
setShowPopup(true)
|
|
|
}
|
|
|
|
|
|
+ const handleSubmit = async () => {
|
|
|
+ if(!data?.id){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (loading) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const c = {
|
|
|
+ data: {
|
|
|
+ link: linkValue,
|
|
|
+ text: linkText,
|
|
|
+ layout: layout ?? 'center',
|
|
|
+ poster: linkPoster,
|
|
|
+ linkType: data.linkType,
|
|
|
+ id: currentComponent?.data.id,
|
|
|
+ index: currentComponent?.data?.index,
|
|
|
+ },
|
|
|
+ enabled: currentComponent?.enabled ?? true,
|
|
|
+ type: EComponentType.link,
|
|
|
+ };
|
|
|
+
|
|
|
+ await saveComponent(c);
|
|
|
+ Taro.navigateBack();
|
|
|
+ };
|
|
|
+
|
|
|
|
|
|
+ // 渲染封面
|
|
|
const renderPoster = (src?: string) => {
|
|
|
if (src) {
|
|
|
return (
|
|
@@ -168,7 +173,7 @@ export default function Index() {
|
|
|
</BottomBar>
|
|
|
</View>
|
|
|
|
|
|
- <LinkPick types={[EKnowlegeTypes.web]} onPicked={onPicked} setShow={setShowPopup} show={showPopup}></LinkPick>
|
|
|
+ <KnowledgePicker types={[EKnowlegeTypes.web]} onPicked={onPicked} setShow={setShowPopup} show={showPopup}></KnowledgePicker>
|
|
|
|
|
|
</PageCustom>
|
|
|
);
|