configs.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*
  2. * @Author: Rindy
  3. * @Date: 2021-04-25 16:49:05
  4. * @LastEditors: Rindy
  5. * @LastEditTime: 2021-09-15 11:31:00
  6. * @Description: 注释
  7. */
  8. /**
  9. * 配置对象
  10. */
  11. const lang_zh = {
  12. 'common.about': '约',
  13. 'common.meter': '米',
  14. 'cad.input': '请输入名称',
  15. 'model.enter': '入户门',
  16. }
  17. const config = {
  18. num: null,
  19. dom: null,
  20. /**
  21. * 运行环境
  22. */
  23. env: __ENV__,
  24. /**
  25. * SDK版本号
  26. */
  27. version: __VERSION__,
  28. lang: 'zh',
  29. langs: {},
  30. /**
  31. * SDK展示模式
  32. */
  33. view: true,
  34. /**
  35. * 移动端模式
  36. */
  37. mobile: false,
  38. /**
  39. * 部署方式,本地版为local
  40. */
  41. deploy: '',
  42. /**
  43. * 区域
  44. */
  45. region: '',
  46. /**
  47. * 服务器地址
  48. */
  49. server: '', //'https://www.4dkankan.com/',
  50. /**
  51. * 场景资源地址
  52. */
  53. resource: 'https://4dkk.4dage.com/',
  54. /**
  55. * 显示SDK信息
  56. */
  57. showSDKInfo: true,
  58. /**
  59. * 是否使用场景控制快捷键
  60. */
  61. useShortcutKeys: false,
  62. /**
  63. * statistics
  64. */
  65. useStatistics: true,
  66. /**
  67. * 是否需要用户鉴权
  68. */
  69. useAuth: false,
  70. /**
  71. * 抗锯齿
  72. */
  73. antialias: true,
  74. /**
  75. * 全景关联设置
  76. */
  77. link: {
  78. onAction: null,
  79. target: 'self',
  80. },
  81. /**
  82. * 模型设置
  83. */
  84. model: {
  85. /**
  86. * 模型名称
  87. */
  88. name: '',
  89. },
  90. /**
  91. * 场景设置
  92. */
  93. scene: {
  94. /**
  95. * 图片质量
  96. */
  97. quality: null,
  98. /**
  99. * 自定义marker图片地址
  100. */
  101. markerURL: null,
  102. /**
  103. * 自定义marker透明的
  104. */
  105. markerOpacity: null,
  106. /**
  107. * 自定义当前点位颜色
  108. */
  109. pathEndColor: null,
  110. },
  111. vr: {
  112. markerHeight: null,
  113. },
  114. tag: {
  115. showIn: null,
  116. },
  117. /**
  118. * 获取服务器资源
  119. */
  120. getServerURL(path) {
  121. return this.server + path
  122. },
  123. /**
  124. * 获取场景资源地址
  125. * @param {String} path 资源路径
  126. */
  127. getResourceURL(path) {
  128. return this.resource + path
  129. },
  130. /**
  131. * 获取场景图片地址
  132. * @param {*} path 图片路径
  133. */
  134. getResourceImageURL(path) {
  135. return this.getResourceURL(`scene_view_data/${this.num}/images/${path}`)
  136. },
  137. /**
  138. * 获取场景数据地址
  139. * @param {*} path 数据路径
  140. */
  141. getResourceDataURL(path) {
  142. return this.getResourceURL(`scene_view_data/${this.num}/data/${path}`)
  143. },
  144. i18n(key) {
  145. if (this.langs[this.lang] && this.langs[this.lang][key]) {
  146. return this.langs[this.lang][key]
  147. }
  148. if (!this.langs['zh']) {
  149. this.langs['zh'] = lang_zh
  150. }
  151. return this.langs['zh'][key] || ''
  152. },
  153. /**
  154. * 是否加载热点
  155. */
  156. isLoadTags: true,
  157. }
  158. export const merge = function (options) {
  159. if (typeof options != 'object') {
  160. return
  161. }
  162. for (let key in config) {
  163. if (['env', 'version', 'num'].indexOf(key) != -1) {
  164. continue
  165. }
  166. if (!options.hasOwnProperty(key)) {
  167. options[key] = config[key]
  168. }
  169. }
  170. return options
  171. }
  172. export default config