Viewer.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026
  1. <template>
  2. <Rules v-if="showRules" @close="closeRules" />
  3. <AppHeader v-show="!fscChecked" :project="project" @getUserId="getUserId" :show-adjust="showAdjust" @update="onPointsUpdate" />
  4. <article>
  5. <main>
  6. <div class="split">
  7. <iframe ref="sourceFrame" v-if="sourceURL" :src="sourceURL" frameborder="0" @load="onLoadSource"></iframe>
  8. <div class="tools" v-if="source && !showRules && !ruleChecked" v-show="showWidget && !showAdjust && !fscChecked && (dbsChecked || (!target && !bimChecked))">
  9. <div class="item-date">
  10. <calendar
  11. name="source"
  12. :count="scenes.length"
  13. :controls="controls"
  14. :value="sourceDate"
  15. :highlighted="sourceDays"
  16. @selected="onSelected"
  17. @pick="onPickDate"
  18. @prev="onPrevDate"
  19. @next="onNextDate"
  20. ></calendar>
  21. </div>
  22. <div class="item-mode" v-if="source.type == 2 || source.type == 3">
  23. <div class="iconfont icon-show_roaming" :class="{ active: mode == 0 }" @click="onModeChange(0)"></div>
  24. <div class="iconfont icon-show_plane" :class="{ active: mode == 1 }" @click="onModeChange(1)"></div>
  25. </div>
  26. <div class="item-density" v-if="(source.type == 2 && mode == 1) || (source.type == 3 && mode == 1)" :class="{ active: showDensity }" @click="showDensity = !showDensity">
  27. <span>{{ densityType.text }}</span>
  28. <i class="iconfont icon-arrows_down"></i>
  29. <ul>
  30. <li v-for="density in densityTypes" @click="onDensityChange(density)">{{ density.text }}</li>
  31. </ul>
  32. </div>
  33. </div>
  34. <div class="points" v-if="showAdjust">
  35. <div :class="{ active: points.p1 }" @click="onP1Click('left')">
  36. <i class="iconfont" :class="[points.p1 ? 'icon-positioning01' : 'icon-positioning02']"></i>
  37. <span>P1</span>
  38. </div>
  39. <div :class="{ active: points.p2 }" @click="onP2Click('left')">
  40. <i class="iconfont" :class="[points.p2 ? 'icon-positioning01' : 'icon-positioning02']"></i>
  41. <span>P2</span>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="split" v-if="target">
  46. <iframe ref="targetFrame" :src="targetURL" frameborder="0" @load="onLoadTarget"></iframe>
  47. <div class="tools" v-show="!fscChecked && !bimChecked">
  48. <div class="item-date target">
  49. <calendar
  50. name="target"
  51. :count="scenes.length"
  52. :controls="controls"
  53. :value="targetDate"
  54. :highlighted="targetDays"
  55. @selected="onSelected"
  56. @pick="onPickDate"
  57. @prev="onPrevDate"
  58. @next="onNextDate"
  59. ></calendar>
  60. </div>
  61. </div>
  62. <div class="points" v-if="showAdjust">
  63. <div :class="{ active: points.p1 }" @click="onP1Click('right')">
  64. <i class="iconfont" :class="[points.p1 ? 'icon-positioning01' : 'icon-positioning02']"></i>
  65. <span>P1</span>
  66. </div>
  67. <div :class="{ active: points.p2 }" @click="onP2Click('right')">
  68. <i class="iconfont" :class="[points.p2 ? 'icon-positioning01' : 'icon-positioning02']"></i>
  69. <span>P2</span>
  70. </div>
  71. </div>
  72. </div>
  73. <div class="model" v-show="showWidget && !showAdjust && !showRules">
  74. <div class="rule" :class="{ active: ruleChecked, disable: fileDisable }" v-show="!fscChecked && !showBim && !dbsChecked && !bimChecked">
  75. <div @click="onRuleChecked">
  76. <i class="iconfont icon-measurement"></i>
  77. <span>{{ $t('common.measure') }}</span>
  78. </div>
  79. </div>
  80. <div v-if="isLogin && isAuth" class="file" :class="{ active: fileChecked, disable: fileDisable }" v-show="!fscChecked && !showBim && !dbsChecked && !bimChecked && !ruleChecked">
  81. <div @click="onFileChecked">
  82. <i class="iconfont icon-note1"></i>
  83. <span>{{ $t('home.tag') }}</span>
  84. </div>
  85. </div>
  86. <div class="bim" :class="{ active: bimChecked, disable: bimDisable }" v-show="!fscChecked && !showBim && !ruleChecked">
  87. <div @click="onBimChecked">
  88. <i class="iconfont icon-BIM"></i>
  89. <span>BIM</span>
  90. </div>
  91. </div>
  92. <div class="dbs" :class="{ active: dbsChecked, disable: dbsDisable }" v-show="!fscChecked && !showBim && !ruleChecked">
  93. <div @click="onDbsChecked">
  94. <i class="iconfont icon-split_screen"></i>
  95. <span>{{ $t('home.splitScreen') }}</span>
  96. </div>
  97. </div>
  98. <div class="fsc" :class="{ active: fscChecked }" @click="onFscChecked">
  99. <i class="iconfont" :class="[fscChecked ? 'icon-full_screen_selected' : 'icon-full_screen_normal']"></i>
  100. <span>{{ $t('home.fullScreen') }}</span>
  101. </div>
  102. </div>
  103. <TagManager />
  104. </main>
  105. </article>
  106. <Toast v-if="showTips" type="warn" :content="showTips" :close="() => (showTips = null)" />
  107. <Files :show="fileChecked" @exit="() => (fileChecked = false)" />
  108. </template>
  109. <script setup>
  110. import { ref, onMounted, computed, nextTick, provide, watch } from 'vue'
  111. import { http } from '@/utils/request'
  112. import axios from 'axios'
  113. import browser from '@/utils/browser'
  114. import Toast from '@/components/dialog/Toast'
  115. import AppHeader from '@/components/header'
  116. import Calendar from '@/components/calendar'
  117. import Files from '@/components/files'
  118. import TagManager from '@/components/files/TagManager'
  119. import sync, { beforeChangeURL, loadSourceScene, loadTargetScene, setPanoWithBim, flyToP1P2 } from '@/utils/sync'
  120. import i18n, { getLocale, useI18n, useScope, setI18nLanguage, loadLocaleMessages } from '@/i18n'
  121. import Rules from './Rules'
  122. const { t } = useI18n({ useScope: 'global' })
  123. const isDev = process.env.VUE_APP_TEST == 1
  124. const rules = []
  125. const tags = ref([])
  126. const notify = ref(null)
  127. const isEdit = ref(false)
  128. const isLogin = ref(false)
  129. const isFlying = ref(false)
  130. const editTagId = ref(null)
  131. const isAuth = ref(false)
  132. const source = ref(null)
  133. provide('tags', tags)
  134. provide('notify', notify)
  135. provide('isEdit', isEdit)
  136. provide('editTagId', editTagId)
  137. provide('isLogin', isLogin)
  138. provide('isFlying', isFlying)
  139. provide('isAuth', isAuth)
  140. provide('source', source)
  141. const userId = ref(localStorage.getItem('userId') || null)
  142. const getUserId = id => {
  143. userId.value = id
  144. }
  145. const showRules = ref(false)
  146. const closeRules = () => {
  147. showRules.value = false
  148. window.kankan.TagManager.cancelMeasure()
  149. }
  150. // 是否BIM模式
  151. const showBim = ref(browser.urlHasValue('bim'))
  152. // 是否校准模式
  153. const showSplit = ref(browser.urlHasValue('split'))
  154. const showAdjust = ref(browser.urlHasValue('adjust'))
  155. const bimChecked = ref()
  156. const dbsChecked = ref(null)
  157. const fscChecked = ref(null)
  158. const fileChecked = ref(false)
  159. const ruleChecked = ref(false)
  160. const datepickName = ref(null)
  161. const sourceFrame = ref(null)
  162. const targetFrame = ref(null)
  163. const mode = ref(0)
  164. const target = ref(null)
  165. const project = ref(null)
  166. const points = ref({ p1: null, p2: null })
  167. const densityTypes = ref([
  168. { type: 'high', text: t('common.high') },
  169. { type: 'middle', text: t('common.middle') },
  170. { type: 'low', text: t('common.low') },
  171. ])
  172. const densityType = ref(densityTypes.value[0])
  173. const showTips = ref(null)
  174. const showDensity = ref(false)
  175. const showWidget = computed(() => {
  176. if (fileChecked.value) {
  177. return false
  178. }
  179. return true
  180. })
  181. const scenes = computed(() => {
  182. if (!project.value) {
  183. return []
  184. }
  185. return project.value.sceneList.map(item => {
  186. return {
  187. num: item.num,
  188. type: item.type,
  189. createTime: item.createTime,
  190. }
  191. })
  192. })
  193. const controls = computed(() => {
  194. if (bimChecked.value) {
  195. return scenes.value.length > 1
  196. }
  197. return dbsChecked.value ? scenes.value.length > 2 : scenes.value.length > 1
  198. })
  199. const sourceURL = computed(() => {
  200. beforeChangeURL('source')
  201. if (bimChecked.value && !dbsChecked.value) {
  202. return `smart-bim.html?m=${project.value.bimData.bimOssFilePath}&lang=${getLocale()}`
  203. }
  204. if (!source.value) {
  205. return
  206. }
  207. getTagList(source.value.num)
  208. if (source.value.type < 2) {
  209. // 看看、看见场景
  210. return `smart-kankan.html?m=${source.value.num}${isDev ? '&dev' : ''}&lang=${getLocale()}`
  211. } else {
  212. getLaserInfo(source.value.num)
  213. // 深时场景
  214. return `smart-laser.html?m=${source.value.num}${isDev ? '&dev' : ''}&lang=${getLocale()}`
  215. }
  216. })
  217. const noPanorama = ref(true)
  218. const getLaserInfo = num => {
  219. axios
  220. .get(process.env.VUE_APP_LASER_URL + `laser/dataset/${num}/getDataSet`)
  221. .then(res => {
  222. if (res.data.code == 200) {
  223. let list = res.data.data
  224. list.forEach(item => {
  225. if (item.pointCount) {
  226. noPanorama.value = false
  227. } else {
  228. noPanorama.value = true
  229. }
  230. })
  231. if (noPanorama.value) {
  232. // onModeChange(1)
  233. mode.value = 1
  234. }
  235. } else {
  236. }
  237. })
  238. .catch(() => {
  239. // showTips.value = t('code.failed')
  240. })
  241. }
  242. const targetURL = computed(() => {
  243. if (bimChecked.value) {
  244. return `smart-bim.html?m=${project.value.bimData.bimOssFilePath}&lang=${getLocale()}`
  245. }
  246. // getTagList(target.value.num)
  247. if (target.value.type < 2) {
  248. // 看看、看见场景
  249. return `smart-kankan.html?m=${target.value.num}${isDev ? '&dev' : ''}&lang=${getLocale()}`
  250. } else {
  251. // 深时场景
  252. return `smart-laser.html?m=${target.value.num}${isDev ? '&dev' : ''}&lang=${getLocale()}`
  253. }
  254. })
  255. const sourceDate = computed(() => {
  256. if (source.value) {
  257. return source.value.createTime.toDate()
  258. }
  259. })
  260. const targetDate = computed(() => {
  261. if (target.value) {
  262. return target.value.createTime.toDate()
  263. }
  264. })
  265. const sourceDays = computed(() => {
  266. let dates = []
  267. if (datepickName.value == 'source') {
  268. if (dbsChecked.value) {
  269. // 分屏模式
  270. if (bimChecked.value) {
  271. // BIM模式
  272. dates = scenes.value.map(item => item.createTime.toDate())
  273. } else {
  274. // 非BIM模式
  275. dates = scenes.value.filter(item => item.createTime != target.value.createTime).map(item => item.createTime.toDate())
  276. }
  277. } else {
  278. // 非分屏模式
  279. dates = scenes.value.map(item => item.createTime.toDate())
  280. }
  281. }
  282. return {
  283. dates: dates,
  284. }
  285. })
  286. const targetDays = computed(() => {
  287. let dates = []
  288. if (datepickName.value == 'target') {
  289. dates = scenes.value.filter(item => item.createTime != source.value.createTime).map(item => item.createTime.toDate())
  290. }
  291. return {
  292. dates: dates,
  293. }
  294. })
  295. const fileDisable = computed(() => {
  296. return false
  297. })
  298. const bimDisable = computed(() => {
  299. if (!project.value || !project.value.bimData) {
  300. return true
  301. }
  302. })
  303. const dbsDisable = computed(() => {
  304. if (scenes.value.length == 0) {
  305. // 没有场景的情况
  306. return 1
  307. }
  308. if (!bimChecked.value && scenes.value.length == 1) {
  309. // 只有1个场景的情况
  310. return 2
  311. }
  312. })
  313. const onLoadSource = () => {
  314. if (bimChecked.value && !dbsChecked.value) {
  315. // BIM单屏模式
  316. return
  317. }
  318. if (source.value.type < 2) {
  319. window['laser'] = null
  320. window['kankan'] = sourceFrame.value.contentWindow.app
  321. window['kankan'].TagManager.load(tags.value)
  322. window['kankan'].Camera.on('flying.started', pano => {
  323. isFlying.value = true
  324. })
  325. window['kankan'].Camera.on('flying.ended', pano => {
  326. isFlying.value = false
  327. })
  328. } else {
  329. window['kankan'] = null
  330. window['laser'] = sourceFrame.value.contentWindow.loaded
  331. window.laser.then(sdk => {
  332. sdk.scene.on('posChange', cameraPos => {
  333. tags.value.forEach(tag => {
  334. const info2d = sdk.scene.getScreenByPoint(tag.position)
  335. tag.x = info2d.pos.x
  336. tag.y = info2d.pos.y
  337. tag.visible = info2d.trueSide
  338. })
  339. })
  340. window[0].viewer.images360.addEventListener('flyToPano', () => {
  341. isFlying.value = true
  342. })
  343. window[0].viewer.images360.addEventListener('flyToPanoDone', () => {
  344. isFlying.value = false
  345. })
  346. })
  347. }
  348. loadSourceScene(sourceFrame, source.value.type < 2 ? 'kankan' : 'laser', mode.value)
  349. }
  350. const onLoadTarget = () => {
  351. if (bimChecked.value) {
  352. loadTargetScene(targetFrame, 'bim')
  353. } else {
  354. loadTargetScene(targetFrame, target.value.type < 2 ? 'kankan' : 'laser', mode.value)
  355. }
  356. }
  357. const onModeChange = targetMode => {
  358. if (targetMode == 0 && noPanorama.value) {
  359. showTips.value = t('home.noPanorama')
  360. return
  361. }
  362. window.Log('changeMode:' + targetMode, '#3cffff')
  363. if (sync.sourceInst) {
  364. sync.sourceInst.loaded.then(sdk => sdk.scene.changeMode(targetMode))
  365. mode.value = targetMode
  366. sync.views.laserChangeMode(mode.value)
  367. }
  368. }
  369. const onDensityChange = density => {
  370. if (sync.sourceInst) {
  371. sync.sourceInst.loaded.then(sdk => {
  372. //console.log('onDensityChange',sync.sourceInst.sceneName, density.type)
  373. let data = sdk.scene.changePointDensity(density.type)
  374. sdk.scene.changeDensityPercent(data.percent)
  375. sync.sourceInst.viewer.dispatchEvent('densityChange')
  376. })
  377. densityType.value = density
  378. }
  379. }
  380. const onPickDate = name => {
  381. datepickName.value = name
  382. }
  383. const onSelected = data => {
  384. if (!data.payload) {
  385. return
  386. }
  387. let { name, payload } = data
  388. let date = payload.format('YYYY-mm-dd')
  389. let dates = (name == 'source' ? sourceDays : targetDays).value.dates.map(item => item.format('YYYY-mm-dd'))
  390. if (dates.indexOf(date) != -1) {
  391. let time = payload.format('YYYY-mm-dd HH:MM')
  392. let find = scenes.value.find(c => c.createTime.indexOf(time) != -1)
  393. if (find) {
  394. if (name == 'source') {
  395. if (find.num != source.value.num) {
  396. source.value = find
  397. }
  398. } else {
  399. if (find.num != target.value.num) {
  400. target.value = find
  401. }
  402. }
  403. }
  404. } else {
  405. showTips.value = t('home.dateScene')
  406. }
  407. datepickName.value = null
  408. }
  409. const onPrevDate = name => {
  410. let scene = null
  411. if (name == 'source') {
  412. scene = source
  413. } else {
  414. scene = target
  415. }
  416. let index = scenes.value.findIndex(item => item.num == scene.value.num)
  417. if (index == -1) {
  418. return
  419. }
  420. if (--index == -1) {
  421. index = scenes.value.length - 1
  422. }
  423. if (target.value && !bimChecked.value) {
  424. // 分屏模式判断
  425. if (name == 'source') {
  426. if (scenes.value[index].createTime == target.value.createTime) {
  427. index--
  428. }
  429. } else {
  430. if (scenes.value[index].createTime == source.value.createTime) {
  431. index--
  432. }
  433. }
  434. if (index == -1) {
  435. index = scenes.value.length - 1
  436. }
  437. }
  438. scene.value = scenes.value[index]
  439. }
  440. const onNextDate = name => {
  441. let scene = null
  442. if (name == 'source') {
  443. scene = source
  444. } else {
  445. scene = target
  446. }
  447. let index = scenes.value.findIndex(item => item.num == scene.value.num)
  448. if (index == -1) {
  449. return
  450. }
  451. if (++index > scenes.value.length - 1) {
  452. index = 0
  453. }
  454. if (target.value && !bimChecked.value) {
  455. // 分屏模式判断
  456. if (name == 'source') {
  457. if (scenes.value[index].createTime == target.value.createTime) {
  458. index++
  459. }
  460. } else {
  461. if (scenes.value[index].createTime == source.value.createTime) {
  462. index++
  463. }
  464. }
  465. if (index > scenes.value.length - 1) {
  466. index = 0
  467. }
  468. }
  469. scene.value = scenes.value[index]
  470. }
  471. const onFileChecked = () => {
  472. fileChecked.value = !fileChecked.value
  473. }
  474. // bim点击
  475. const onBimChecked = () => {
  476. if (bimDisable.value) {
  477. return (showTips.value = t('home.notFindFile'))
  478. }
  479. if (bimChecked.value) {
  480. bimChecked.value = false
  481. if (dbsChecked.value) {
  482. // 如果没有多场景数据,取消分屏
  483. if (scenes.value.length < 2) {
  484. onDbsChecked()
  485. return
  486. }
  487. // 判断是否分屏状态
  488. let index = scenes.value.findIndex(item => item.num == source.value.num)
  489. if (index == -1) {
  490. return
  491. }
  492. if (++index > scenes.value.length - 1) {
  493. index = 0
  494. }
  495. target.value = scenes.value[index]
  496. }
  497. } else {
  498. bimChecked.value = true
  499. }
  500. }
  501. // 分屏点击
  502. const onDbsChecked = () => {
  503. if (dbsDisable.value && !dbsChecked.value) {
  504. return (showTips.value = t('home.notFindScene'))
  505. }
  506. dbsChecked.value = !dbsChecked.value
  507. if (dbsChecked.value) {
  508. if (bimChecked.value) {
  509. // BIM分屏
  510. source.value = scenes.value[scenes.value.length - 1]
  511. target.value = project.value.bimData
  512. } else {
  513. // 四维看看、激光场景分屏
  514. let index = scenes.value.findIndex(item => item.num == source.value.num)
  515. if (index == -1) {
  516. return
  517. }
  518. if (++index > scenes.value.length - 1) {
  519. index = 0
  520. }
  521. target.value = scenes.value[index]
  522. }
  523. } else {
  524. target.value = null
  525. }
  526. }
  527. // 全屏点击
  528. const onFscChecked = () => {
  529. let element = document.documentElement
  530. fscChecked.value = !fscChecked.value
  531. if (fscChecked.value) {
  532. if (element.requestFullscreen) {
  533. element.requestFullscreen()
  534. } else if (element.webkitRequestFullScreen) {
  535. element.webkitRequestFullScreen()
  536. } else if (element.mozRequestFullScreen) {
  537. element.mozRequestFullScreen()
  538. } else if (element.msRequestFullscreen) {
  539. element.msRequestFullscreen()
  540. }
  541. } else {
  542. if (document.exitFullscreen) {
  543. document.exitFullscreen()
  544. } else if (document.webkitCancelFullScreen) {
  545. document.webkitCancelFullScreen()
  546. } else if (document.mozCancelFullScreen) {
  547. document.mozCancelFullScreen()
  548. } else if (document.msExitFullscreen) {
  549. document.msExitFullscreen()
  550. }
  551. }
  552. }
  553. const onPointsUpdate = (type, data) => {
  554. points.value[type] = data
  555. }
  556. const onP1Click = type => {
  557. if (!points.value.p1) {
  558. showTips.value = t('home.notChoosePoint')
  559. return
  560. }
  561. console.log(points.value.p1)
  562. // todo 定位
  563. flyToP1P2(points.value.p1)
  564. }
  565. const onP2Click = type => {
  566. if (!points.value.p2) {
  567. showTips.value = t('home.notChoosePoint')
  568. return
  569. }
  570. // todo 定位
  571. flyToP1P2(points.value.p2)
  572. }
  573. const onRuleHandler = sdk => {
  574. let rule = sdk.startMeasure()
  575. rule.bus.on('end', () => {
  576. setTimeout(() => {
  577. onRuleHandler(sdk)
  578. }, 1)
  579. })
  580. rules.push(rule)
  581. }
  582. const onRuleChecked = () => {
  583. if (ruleChecked.value) {
  584. ruleChecked.value = false
  585. rules.forEach(rule => {
  586. rule.clear()
  587. })
  588. return
  589. }
  590. if (source.value.type < 2) {
  591. showRules.value = true
  592. window.kankan.TagManager.startMeasure()
  593. } else {
  594. sync.sourceInst.loaded.then(sdk => {
  595. onRuleHandler(sdk)
  596. })
  597. ruleChecked.value = true
  598. }
  599. }
  600. const getTagList = num => {
  601. http.post(`smart-site/marking/list`, {
  602. projectId: projectId,
  603. pageNum: 1,
  604. pageSize: 200,
  605. num: num ? num : browser.getURLParam('m'),
  606. }).then(response => {
  607. if (response.data && response.data.list) {
  608. tags.value = response.data.list.map(item => {
  609. item.hotData.visible = false
  610. item.hotData.id = item.markingId
  611. item.hotData.createTime = item.createTime
  612. item.hotData.createBy = item.createBy
  613. return item.hotData
  614. })
  615. }
  616. })
  617. }
  618. const getInfo = () => {
  619. http.get(`smart-site/project/info?projectId=${projectId}&sceneOrder=asc`)
  620. .then(response => {
  621. if (response.success) {
  622. if (response.data) {
  623. document.title = response.data.projectName
  624. if (response.data.panos) {
  625. try {
  626. response.data.panos = JSON.parse(response.data.panos)
  627. points.value.p1 = response.data.panos.p1
  628. points.value.p2 = response.data.panos.p2
  629. setPanoWithBim(response.data.panos)
  630. } catch (error) {
  631. console.error(error)
  632. }
  633. }
  634. project.value = response.data
  635. if (showBim.value) {
  636. onBimChecked()
  637. } else if (project.value.sceneList.length) {
  638. if (num) {
  639. source.value = project.value.sceneList.find(c => c.num == num)
  640. } else {
  641. source.value = project.value.sceneList[project.value.sceneList.length - 1]
  642. }
  643. if (!source.value) {
  644. return (showTips.value = t('home.sceneDelete'))
  645. }
  646. // mode.value = source.value?.location == 6 ? 1 : 0
  647. if (showAdjust.value || showSplit.value) {
  648. onBimChecked()
  649. nextTick(() => onDbsChecked())
  650. }
  651. } else {
  652. return (showTips.value = t('home.sceneDelete'))
  653. }
  654. }
  655. } else {
  656. if (response.code == 4008) {
  657. // 未登录
  658. localStorage.removeItem('token')
  659. } else {
  660. showTips.value = response.message
  661. }
  662. }
  663. })
  664. .catch(() => {
  665. showTips.value = t('code.failed')
  666. })
  667. }
  668. const num = browser.valueFromUrl('m') || ''
  669. const projectId = browser.valueFromUrl('projectId') || 1
  670. onMounted(() => {
  671. getInfo()
  672. // getTagList()
  673. document.addEventListener('fullscreenchange', () => {
  674. if (document.fullscreenElement) {
  675. if (!fscChecked.value) {
  676. fscChecked.value = true
  677. }
  678. } else {
  679. if (fscChecked.value) {
  680. fscChecked.value = false
  681. }
  682. }
  683. })
  684. })
  685. </script>
  686. <style lang="scss" scoped>
  687. article {
  688. display: flex;
  689. width: 100%;
  690. height: 100%;
  691. overflow: hidden;
  692. }
  693. aside {
  694. width: 160px;
  695. height: 100%;
  696. background-color: rgba(0, 0, 0, 0.8);
  697. h4 {
  698. font-size: 16px;
  699. text-align: center;
  700. }
  701. ul {
  702. margin-top: 20px;
  703. }
  704. li {
  705. margin: 0;
  706. padding: 0;
  707. font-size: 16px;
  708. margin-left: 20px;
  709. cursor: pointer;
  710. &:hover,
  711. &.active {
  712. color: #00c8af;
  713. }
  714. }
  715. }
  716. main {
  717. flex: 1;
  718. width: 100%;
  719. height: 100%;
  720. position: relative;
  721. display: flex;
  722. &.full {
  723. .split {
  724. width: 50%;
  725. }
  726. }
  727. iframe {
  728. position: absolute;
  729. left: 0;
  730. top: 0;
  731. z-index: 1000;
  732. width: 100%;
  733. height: 100%;
  734. border: none;
  735. outline: none;
  736. }
  737. .split {
  738. margin-left: 2px;
  739. width: 100%;
  740. height: 100%;
  741. overflow: hidden;
  742. position: relative;
  743. &:first-child,
  744. &:last-child {
  745. margin-left: 0;
  746. }
  747. .points {
  748. position: absolute;
  749. left: 50%;
  750. top: 64px;
  751. z-index: 9999;
  752. display: flex;
  753. transform: translateX(-50%);
  754. div {
  755. cursor: pointer;
  756. margin-left: 20px;
  757. width: 70px;
  758. height: 88px;
  759. background: rgba(27, 27, 28, 0.8);
  760. box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25), inset 0px 0px 0px 2px rgba(255, 255, 255, 0.1);
  761. border-radius: 8px 8px 8px 8px;
  762. opacity: 1;
  763. border: 1px solid #000000;
  764. display: flex;
  765. flex-direction: column;
  766. align-items: center;
  767. justify-content: center;
  768. &.active {
  769. color: #0076f6;
  770. }
  771. i {
  772. font-size: 24px;
  773. }
  774. span {
  775. font-size: 16px;
  776. margin-top: 10px;
  777. }
  778. }
  779. }
  780. }
  781. .model {
  782. position: absolute;
  783. left: 50px;
  784. bottom: 40px;
  785. z-index: 1000;
  786. display: flex;
  787. flex-direction: column;
  788. > div {
  789. cursor: pointer;
  790. width: 50px;
  791. height: 50px;
  792. margin-top: 16px;
  793. background: rgba(27, 27, 28, 0.8);
  794. box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
  795. border-radius: 47px 47px 47px 47px;
  796. border: 1px solid #000000;
  797. display: flex;
  798. flex-direction: column;
  799. align-items: center;
  800. justify-content: center;
  801. > div {
  802. width: 100%;
  803. height: 100%;
  804. display: flex;
  805. flex-direction: column;
  806. align-items: center;
  807. justify-content: center;
  808. }
  809. &.active {
  810. color: #0076f6;
  811. }
  812. &.disable {
  813. opacity: 0.5;
  814. }
  815. span {
  816. font-size: 12px;
  817. padding-top: 1px;
  818. transform: scale(0.8);
  819. text-align: center;
  820. }
  821. }
  822. }
  823. .tools {
  824. position: absolute;
  825. width: 100%;
  826. bottom: 40px;
  827. z-index: 2000;
  828. display: flex;
  829. justify-content: center;
  830. align-items: center;
  831. color: #fff;
  832. pointer-events: none;
  833. > div {
  834. pointer-events: all;
  835. }
  836. .item-mode {
  837. height: 50px;
  838. background: rgba(27, 27, 28, 0.8);
  839. box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
  840. border-radius: 47px 47px 47px 47px;
  841. border: 1px solid #000000;
  842. display: flex;
  843. justify-content: center;
  844. align-items: center;
  845. margin-left: 10px;
  846. margin-right: 10px;
  847. font-size: 16px;
  848. padding: 0 16px;
  849. div {
  850. cursor: pointer;
  851. font-size: 18px;
  852. }
  853. div:last-child {
  854. margin-left: 20px;
  855. }
  856. div.active {
  857. color: #0076f6;
  858. }
  859. }
  860. .item-density {
  861. position: relative;
  862. cursor: pointer;
  863. height: 50px;
  864. width: 68px;
  865. background: rgba(27, 27, 28, 0.8);
  866. box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
  867. border-radius: 47px 47px 47px 47px;
  868. border: 1px solid #000000;
  869. display: flex;
  870. justify-content: center;
  871. align-items: center;
  872. margin-left: 10px;
  873. margin-right: 10px;
  874. font-size: 16px;
  875. padding: 0 16px;
  876. &.active {
  877. ul {
  878. display: block;
  879. }
  880. i {
  881. transform: scale(0.8) rotate(180deg);
  882. }
  883. }
  884. span {
  885. margin-right: 4px;
  886. }
  887. i {
  888. transform: scale(0.8);
  889. font-size: 14px;
  890. }
  891. ul {
  892. display: none;
  893. position: absolute;
  894. left: 0;
  895. bottom: calc(100% + 10px);
  896. width: 68px;
  897. padding: 10px 0;
  898. border-radius: 12px;
  899. text-align: center;
  900. background: rgba(27, 27, 28, 0.8);
  901. box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
  902. border: 1px solid #000000;
  903. list-style: none;
  904. li {
  905. padding: 5px 0;
  906. &:hover {
  907. color: #0076f6;
  908. }
  909. }
  910. }
  911. }
  912. }
  913. }
  914. </style>
  915. <style lang="scss">
  916. #app {
  917. background-color: rgba(0, 0, 0, 0.8);
  918. display: flex;
  919. flex-direction: column;
  920. }
  921. .vuejs3-datepicker__calendar {
  922. background: rgba(27, 27, 28, 0.8);
  923. box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
  924. border-radius: 4px 4px 4px 4px;
  925. opacity: 1;
  926. border: 1px solid #000000;
  927. filter: blur(undefinedpx);
  928. color: #fff;
  929. }
  930. .vuejs3-datepicker__calendar-topbar {
  931. display: none !important;
  932. }
  933. .vuejs3-datepicker__calendar header .up:not(.disabled):hover {
  934. background: rgba(0, 0, 0, 0.3);
  935. color: #fff;
  936. }
  937. .vuejs3-datepicker__calendar header .prev:after {
  938. border-left: 1px solid #fff;
  939. border-bottom: 1px solid #fff;
  940. }
  941. .vuejs3-datepicker__calendar header .prev:not(.disabled):hover {
  942. background: rgba(0, 0, 0, 0.3);
  943. }
  944. .vuejs3-datepicker__calendar header .next:after {
  945. border-top: 1px solid #fff;
  946. border-right: 1px solid #fff;
  947. }
  948. .vuejs3-datepicker__calendar header .next:not(.disabled):hover {
  949. background: rgba(0, 0, 0, 0.3);
  950. }
  951. .vuejs3-datepicker__calendar .cell {
  952. font-size: 16px !important;
  953. border-radius: 4px;
  954. }
  955. .highlighted {
  956. color: #076ede !important;
  957. background: transparent !important;
  958. }
  959. .selected {
  960. color: #fff !important;
  961. background: #0076f6 !important;
  962. }
  963. </style>