import {toPage} from "../utils/uils.js";
import useXFunModal from "../hooks/useXFunModal.js";

const OpenTypeFun = async (options) => {
    console.log('OpenTypeFun打开', options);
    const {type, url, single_id} = options;
    switch (type) {
        case 0: { // 空
            break;
        }
        case 1: { // 站内url
            await toPage(url);
            break;
        }
        case 2: { // 站内富文本
            await toPage(`/pages/richPage/index?id=${single_id}`);
            break;
        }
        case 3: { // 微信连接
            window.open(url);
            break;
        }
        case 4: { // 外部连接
            window.open(url);
            break;
        }
        case 5: { // 弹窗
            console.log('弹窗', options);
            useXFunModal(options);
            break;
        }
    }
}

export default OpenTypeFun;
