import { reactive } from 'vue'; import axios from 'axios'; import { rootDomain } from './defaults'; import i18n from '../i18n'; const $t = i18n.global.t; 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: $t('乐吾乐'), home: `https://${rootDomain.slice(1)}`, account: getUrl('account'), v: getUrl('v'), '3d': getUrl('3d'), '2d': getUrl('2d'), admin: getUrl('admin'), helps_v: [ { name: $t('产品介绍'), url: `https://doc${rootDomain}/document/118756411`, }, { name: $t('快速上手'), url: `https://doc${rootDomain}/document/119363000`, }, { name: $t('使用手册'), url: `https://doc${rootDomain}/document/118764244`, }, { name: $t('快捷键'), url: `https://doc${rootDomain}/document/119620214`, divider: true, }, { name: $t('企业服务与支持'), url: `https://doc${rootDomain}/document/120608083`, divider: true, }, { name: $t('关于我们'), 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, }; };