|
|
@@ -0,0 +1,48 @@
|
|
|
+import { View } from "@tarojs/components";
|
|
|
+import { useModalStore } from "@/store/modalStore";
|
|
|
+import Taro from "@tarojs/taro";
|
|
|
+export const useConfirms = () => {
|
|
|
+ const { showModal } = useModalStore((state) => state.actions);
|
|
|
+ // 回退确认
|
|
|
+ const navbackConfirm = async () => {
|
|
|
+ return await new Promise((resolve)=> {
|
|
|
+ showModal({
|
|
|
+ content: <View className="text-black font-pingfangSCMedium font-medium text-14 leading-22">确定放弃创建智能体?</View>,
|
|
|
+ confirmText: "我再想想",
|
|
|
+ onConfirm() {
|
|
|
+ Taro.showTabBar().catch(()=> {});
|
|
|
+ resolve(true)
|
|
|
+ },
|
|
|
+ onCancel() {
|
|
|
+ Taro.showTabBar().catch(()=> {});
|
|
|
+ resolve(false)
|
|
|
+ },
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ const saveAvatarConfirm = async () => {
|
|
|
+ return await new Promise((resolve)=> {
|
|
|
+ showModal({
|
|
|
+ content: <View className="text-black font-pingfangSCMedium font-medium text-14 leading-22">为你的智能体设置一个形象吧</View>,
|
|
|
+ confirmText: "继续设置",
|
|
|
+ cancelText: "暂时不设置",
|
|
|
+ onConfirm() {
|
|
|
+ Taro.showTabBar().catch(()=> {});
|
|
|
+ resolve(true)
|
|
|
+ },
|
|
|
+ onCancel() {
|
|
|
+ Taro.showTabBar().catch(()=> {});
|
|
|
+ resolve(false)
|
|
|
+ },
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return {
|
|
|
+ navbackConfirm,
|
|
|
+ saveAvatarConfirm,
|
|
|
+ }
|
|
|
+}
|