enterprise.ts 1.5 KB

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