feat: NTRP测试入口接入
This commit is contained in:
@@ -1,9 +1,16 @@
|
||||
import React, { useState } from "react";
|
||||
import React, { useState, useRef } from "react";
|
||||
import { View, Text, Image } from "@tarojs/components";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { useUserInfo } from "@/store/userStore";
|
||||
import {
|
||||
useEvaluate,
|
||||
EvaluateCallback,
|
||||
EvaluateScene,
|
||||
} from "@/store/evaluateStore";
|
||||
import styles from "./index.module.scss";
|
||||
import images from "@/config/images";
|
||||
import AiImportPopup from "@/publish_pages/publishBall/components/AiImportPopup";
|
||||
import NTRPEvaluatePopup from "../NTRPEvaluatePopup";
|
||||
|
||||
export interface PublishMenuProps {
|
||||
onPersonalPublish?: () => void;
|
||||
@@ -13,6 +20,10 @@ export interface PublishMenuProps {
|
||||
const PublishMenu: React.FC<PublishMenuProps> = () => {
|
||||
const [isVisible, setIsVisible] = useState(false);
|
||||
const [aiImportVisible, setAiImportVisible] = useState(false);
|
||||
const userInfo = useUserInfo();
|
||||
const ntrpRef = useRef<{
|
||||
show: (evaluateCallback: EvaluateCallback) => void;
|
||||
}>({ show: () => {} });
|
||||
|
||||
const handleIconClick = () => {
|
||||
setIsVisible(!isVisible);
|
||||
@@ -20,18 +31,42 @@ const PublishMenu: React.FC<PublishMenuProps> = () => {
|
||||
const handleOverlayClick = () => {
|
||||
setIsVisible(false);
|
||||
};
|
||||
const handleMenuItemClick = (type: "individual" | "group" | "ai") => {
|
||||
const handleMenuClick = (type: "individual" | "group" | "ai") => {
|
||||
// 跳转到publishBall页面并传递type参数
|
||||
console.log(type, "type");
|
||||
setIsVisible(false);
|
||||
if (type === "ai") {
|
||||
setAiImportVisible(true);
|
||||
setIsVisible(false);
|
||||
return;
|
||||
}
|
||||
Taro.navigateTo({
|
||||
url: `/publish_pages/publishBall/index?type=${type}`,
|
||||
});
|
||||
setIsVisible(false);
|
||||
};
|
||||
const handleMenuItemClick = (type: "individual" | "group" | "ai") => {
|
||||
if (!userInfo.ntrp_level) {
|
||||
ntrpRef.current.show({
|
||||
type: EvaluateScene.publish,
|
||||
next: (flag) => {
|
||||
if (flag) {
|
||||
handleMenuClick(type);
|
||||
} else if (type === "ai") {
|
||||
Taro.navigateBack();
|
||||
setAiImportVisible(true);
|
||||
} else {
|
||||
Taro.redirectTo({
|
||||
url: `/publish_pages/publishBall/index?type=${type}`,
|
||||
});
|
||||
}
|
||||
},
|
||||
onCancel: () => {
|
||||
Taro.navigateBack();
|
||||
},
|
||||
});
|
||||
setIsVisible(false);
|
||||
return;
|
||||
}
|
||||
handleMenuClick(type);
|
||||
};
|
||||
|
||||
const handleAiImportClose = () => {
|
||||
@@ -136,6 +171,8 @@ const PublishMenu: React.FC<PublishMenuProps> = () => {
|
||||
onClose={handleAiImportClose}
|
||||
onManualPublish={handleManualPublish}
|
||||
/>
|
||||
|
||||
<NTRPEvaluatePopup type={EvaluateScene.publish} ref={ntrpRef} showGuide />
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user