import { reactive } from 'vue'; import axios from 'axios'; import { rootDomain } from './defaults'; const getUrl = (path: string) => { if (import.meta.env.BASE_URL[0] === '/') { return location.protocol + '//' + location.host + '/' + path; }else{ return 'https://' + path + rootDomain; } } const enterprise = reactive({ name: '乐吾乐', home: `https://${rootDomain.slice(1)}`, account: getUrl('account'), v: getUrl('v'), '3d': getUrl('3d'), '2d': getUrl('2d'), admin: getUrl('admin'), helps: [ { name: '产品介绍', url: `https://doc${rootDomain}/document/118756411`, }, { name: '快速上手', url: `https://doc${rootDomain}/document/119363000`, }, { name: '使用手册', url: `https://doc${rootDomain}/document/118764244`, }, { name: '快捷键', url: `https://doc${rootDomain}/document/119620214`, divider: true, }, { name: '企业服务与支持', url: `https://doc${rootDomain}/document/120608083`, divider: true, }, { name: '关于我们', url: `https://${rootDomain.slice(1)}/us`, }, ], }); export const useEnterprise = () => { const getEnterprise = async () => { // 官网或安装包版本 if (import.meta.env.VITE_TRIAL != 1) { return; } // 企业版 const ret = await axios.get('/api/enterprise'); if (ret) { Object.assign(enterprise, ret); } }; return { enterprise, getEnterprise, }; };