enterprise.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import { reactive } from 'vue';
  2. import axios from 'axios';
  3. import { rootDomain } from './defaults';
  4. import i18n from '../i18n';
  5. const $t = i18n.global.t;
  6. const getUrl = (path: string) => {
  7. if (import.meta.env.BASE_URL[0] === '/') {
  8. return location.protocol + '//' + location.host + '/' + path;
  9. }else{
  10. return 'https://' + path + rootDomain;
  11. }
  12. }
  13. const enterprise = reactive({
  14. name: $t('乐吾乐'),
  15. home: `https://${rootDomain.slice(1)}`,
  16. account: getUrl('account'),
  17. v: getUrl('v'),
  18. '3d': getUrl('3d'),
  19. '2d': getUrl('2d'),
  20. admin: getUrl('admin'),
  21. helps_v: [
  22. {
  23. name: $t('产品介绍'),
  24. url: `https://doc${rootDomain}/document/118756411`,
  25. },
  26. {
  27. name: $t('快速上手'),
  28. url: `https://doc${rootDomain}/document/119363000`,
  29. },
  30. {
  31. name: $t('使用手册'),
  32. url: `https://doc${rootDomain}/document/118764244`,
  33. },
  34. {
  35. name: $t('快捷键'),
  36. url: `https://doc${rootDomain}/document/119620214`,
  37. divider: true,
  38. },
  39. {
  40. name: $t('企业服务与支持'),
  41. url: `https://doc${rootDomain}/document/120608083`,
  42. divider: true,
  43. },
  44. {
  45. name: $t('关于我们'),
  46. url: `https://${rootDomain.slice(1)}/us`,
  47. },
  48. ],
  49. });
  50. export const useEnterprise = () => {
  51. const getEnterprise = async () => {
  52. // 官网或安装包版本
  53. // if (import.meta.env.VITE_TRIAL != 1) {
  54. // return;
  55. // }
  56. // 企业版
  57. const ret = await axios.get('/api/enterprise');
  58. if (ret) {
  59. Object.assign(enterprise, ret);
  60. }
  61. };
  62. return {
  63. enterprise,
  64. getEnterprise,
  65. };
  66. };