home.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. <template>
  2. <el-container class="h-full bg-gradient-to-br from-blue-50 to-indigo-100">
  3. <el-main class="h-full p-0">
  4. <!-- 核心业务模块 -->
  5. <div class="px-8">
  6. <div class="max-w-6xl mx-auto">
  7. <div class="text-center mb-16">
  8. <h2 class="text-4xl font-extrabold text-gray-900 mb-4">核心业务模块</h2>
  9. <p class="text-xl text-gray-600">为您提供全方位的园区服务解决方案</p>
  10. </div>
  11. <el-row :gutter="32" class="justify-center">
  12. <!-- 公租房模块 -->
  13. <el-col :xs="24" :sm="12" :md="8" class="mb-8">
  14. <el-card
  15. class="h-full shadow-xl hover:shadow-2xl transition-all duration-300 rounded-2xl border-0 overflow-hidden group"
  16. >
  17. <div class="relative">
  18. <div
  19. class="bg-gradient-to-br from-blue-500 to-blue-600 p-8 text-white text-center"
  20. >
  21. <el-icon
  22. :size="64"
  23. class="mb-4 group-hover:scale-110 transition-transform duration-300"
  24. >
  25. <Building />
  26. </el-icon>
  27. <h3 class="text-2xl font-bold mb-2">公租房管理</h3>
  28. </div>
  29. <div class="p-8">
  30. <p class="text-gray-600 mb-6 leading-relaxed">
  31. 提供便捷的公租房申请、分配、租赁和后期管理服务,助力解决住房问题。
  32. </p>
  33. <div class="space-y-3 mb-6">
  34. <div class="flex items-center text-sm text-gray-600">
  35. <el-icon class="mr-2 text-green-500">
  36. <Check />
  37. </el-icon>
  38. 在线申请与签订
  39. </div>
  40. <div class="flex items-center text-sm text-gray-600">
  41. <el-icon class="mr-2 text-green-500">
  42. <Check />
  43. </el-icon>
  44. AR全景看房
  45. </div>
  46. <div class="flex items-center text-sm text-gray-600">
  47. <el-icon class="mr-2 text-green-500">
  48. <Check />
  49. </el-icon>
  50. 24/7 维护服务
  51. </div>
  52. </div>
  53. <div class="space-y-3">
  54. <div>
  55. <el-button
  56. type="primary"
  57. round
  58. class="w-full"
  59. @click="toZflbLink('housing')"
  60. size="medium"
  61. >
  62. <el-icon class="mr-1">
  63. <ArrowRight />
  64. </el-icon>
  65. 立即申请
  66. </el-button>
  67. </div>
  68. <div>
  69. <el-button
  70. type="info"
  71. round
  72. class="w-full bg-gradient-to-r from-cyan-500 to-blue-500 border-0 text-white hover:from-cyan-600 hover:to-blue-600"
  73. @click="openARDialog('housing')"
  74. :disabled="housingTypes.length === 0"
  75. size="medium"
  76. :loading="loadingStates.housing"
  77. >
  78. <el-icon class="mr-1" v-if="!loadingStates.housing">
  79. <Camera />
  80. </el-icon>
  81. {{ loadingStates.housing ? '加载中...' : 'AR看房体验' }}
  82. </el-button>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </el-card>
  88. </el-col>
  89. <!-- 标准化厂房模块 -->
  90. <el-col :xs="24" :sm="12" :md="8" class="mb-8">
  91. <el-card
  92. class="h-full shadow-xl hover:shadow-2xl transition-all duration-300 rounded-2xl border-0 overflow-hidden group"
  93. >
  94. <div class="relative">
  95. <div
  96. class="bg-gradient-to-br from-green-500 to-green-600 p-8 text-white text-center"
  97. >
  98. <el-icon
  99. :size="64"
  100. class="mb-4 group-hover:scale-110 transition-transform duration-300"
  101. >
  102. <Factory />
  103. </el-icon>
  104. <h3 class="text-2xl font-bold mb-2">标准化厂房</h3>
  105. </div>
  106. <div class="p-8">
  107. <p class="text-gray-600 mb-6 leading-relaxed">
  108. 提供现代化、高标准的厂房租赁服务,满足各类企业的生产需求,优化营商环境。
  109. </p>
  110. <div class="space-y-3 mb-6">
  111. <div class="flex items-center text-sm text-gray-600">
  112. <el-icon class="mr-2 text-green-500">
  113. <Check />
  114. </el-icon>
  115. 标准化设计建造
  116. </div>
  117. <div class="flex items-center text-sm text-gray-600">
  118. <el-icon class="mr-2 text-green-500">
  119. <Check />
  120. </el-icon>
  121. 完善配套设施
  122. </div>
  123. <div class="flex items-center text-sm text-gray-600">
  124. <el-icon class="mr-2 text-green-500">
  125. <Check />
  126. </el-icon>
  127. 灵活租赁方案
  128. </div>
  129. </div>
  130. <div class="space-y-3">
  131. <div>
  132. <el-button
  133. type="success"
  134. round
  135. class="w-full"
  136. @click="toZflbLink('factory')"
  137. size="medium"
  138. >
  139. <el-icon class="mr-1">
  140. <ArrowRight />
  141. </el-icon>
  142. 查看厂房
  143. </el-button>
  144. </div>
  145. <div>
  146. <el-button
  147. type="info"
  148. round
  149. class="w-full bg-gradient-to-r from-emerald-500 to-green-500 border-0 text-white hover:from-emerald-600 hover:to-green-600"
  150. @click="openARDialog('factory')"
  151. :disabled="factoryTypes.length === 0"
  152. :loading="loadingStates.factory"
  153. size="medium"
  154. >
  155. <el-icon class="mr-1" v-if="!loadingStates.factory">
  156. <Camera />
  157. </el-icon>
  158. {{ loadingStates.factory ? '加载中...' : 'AR厂房参观' }}
  159. </el-button>
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. </el-card>
  165. </el-col>
  166. <!-- 创新创业基地模块 -->
  167. <el-col :xs="24" :sm="12" :md="8" class="mb-8">
  168. <el-card
  169. class="h-full shadow-xl hover:shadow-2xl transition-all duration-300 rounded-2xl border-0 overflow-hidden group"
  170. >
  171. <div class="relative">
  172. <div
  173. class="bg-gradient-to-br from-purple-500 to-purple-600 p-8 text-white text-center"
  174. >
  175. <el-icon
  176. :size="64"
  177. class="mb-4 group-hover:scale-110 transition-transform duration-300"
  178. >
  179. <Lightbulb />
  180. </el-icon>
  181. <h3 class="text-2xl font-bold mb-2">创新创业基地</h3>
  182. </div>
  183. <div class="p-8">
  184. <p class="text-gray-600 mb-6 leading-relaxed">
  185. 为初创企业和创新团队提供孵化空间、政策扶持和资源对接,助力梦想起航。
  186. </p>
  187. <div class="space-y-3 mb-6">
  188. <div class="flex items-center text-sm text-gray-600">
  189. <el-icon class="mr-2 text-green-500">
  190. <Check />
  191. </el-icon>
  192. 创业孵化服务
  193. </div>
  194. <div class="flex items-center text-sm text-gray-600">
  195. <el-icon class="mr-2 text-green-500">
  196. <Check />
  197. </el-icon>
  198. 政策扶持指导
  199. </div>
  200. <div class="flex items-center text-sm text-gray-600">
  201. <el-icon class="mr-2 text-green-500">
  202. <Check />
  203. </el-icon>
  204. 投资对接平台
  205. </div>
  206. </div>
  207. <div class="space-y-3">
  208. <div>
  209. <el-button
  210. type="warning"
  211. round
  212. class="w-full"
  213. @click="toZflbLink('innovation')"
  214. size="medium"
  215. >
  216. <el-icon class="mr-1">
  217. <ArrowRight />
  218. </el-icon>
  219. 加入孵化
  220. </el-button>
  221. </div>
  222. <div>
  223. <el-button
  224. v-if="businessModules.innovation.arEnabled && innovationTypes.length > 0"
  225. type="info"
  226. round
  227. class="w-full bg-gradient-to-r from-purple-500 to-pink-500 border-0 text-white hover:from-purple-600 hover:to-pink-600"
  228. @click="openARDialog('innovation')"
  229. :loading="loadingStates.innovation"
  230. size="medium"
  231. >
  232. <el-icon class="mr-1" v-if="!loadingStates.innovation">
  233. <Camera />
  234. </el-icon>
  235. {{ loadingStates.innovation ? '加载中...' : 'AR空间体验' }}
  236. </el-button>
  237. <el-button v-else type="info" round class="w-full" size="medium" disabled>
  238. <el-icon class="mr-1">
  239. <Clock />
  240. </el-icon>
  241. {{ innovationTypes.length === 0 ? '暂无可用户型' : 'AR功能即将上线' }}
  242. </el-button>
  243. </div>
  244. </div>
  245. </div>
  246. </div>
  247. </el-card>
  248. </el-col>
  249. </el-row>
  250. </div>
  251. </div>
  252. </el-main>
  253. <!-- AR看房对话框 -->
  254. <el-dialog
  255. v-model="arDialogVisible"
  256. :title="arDialogTitle"
  257. width="600px"
  258. align-center
  259. class="ar-dialog"
  260. >
  261. <div class="text-center">
  262. <div class="mb-6">
  263. <el-icon :size="80" class="text-blue-500 mb-4">
  264. <Camera />
  265. </el-icon>
  266. <h3 class="text-2xl font-bold text-gray-800 mb-2">选择户型进行AR体验</h3>
  267. <p class="text-gray-600">沉浸式全景体验,让您身临其境</p>
  268. </div>
  269. <!-- 加载状态 -->
  270. <div v-if="loadingStates[currentARType]" class="py-8">
  271. <el-icon class="animate-spin text-4xl text-blue-500 mb-4">
  272. <Loader />
  273. </el-icon>
  274. <p class="text-gray-600">正在加载户型数据...</p>
  275. </div>
  276. <!-- 无数据状态 -->
  277. <div v-else-if="getCurrentTypeData().length === 0" class="py-8">
  278. <el-icon class="text-4xl text-gray-400 mb-4">
  279. <House />
  280. </el-icon>
  281. <p class="text-gray-600">暂无可用的户型数据</p>
  282. </div>
  283. <!-- 公租房户型选择 -->
  284. <div v-else-if="currentARType === 'housing'" class="space-y-4">
  285. <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
  286. <el-card
  287. v-for="type in housingTypes"
  288. :key="type.id"
  289. class="cursor-pointer hover:shadow-lg transition-all duration-300 border-2 hover:border-blue-400"
  290. @click="startARExperience('housing', type.id)"
  291. >
  292. <div class="text-center p-4">
  293. <el-icon :size="48" class="text-blue-500 mb-3">
  294. <component :is="getHouseTypeIcon(type)" />
  295. </el-icon>
  296. <h4 class="text-lg font-semibold mb-2">{{ type.accountNumber || '未命名户型' }}</h4>
  297. <p class="text-sm text-gray-600 mb-2">面积:{{ type.area || '待定' }}</p>
  298. <p class="text-xs text-gray-500 mb-3">地址:{{ type.address || '待定' }}</p>
  299. <div class="flex items-center justify-center text-sm text-gray-500">
  300. <el-icon class="mr-1">
  301. <Eye />
  302. </el-icon>
  303. <span>360°全景体验</span>
  304. </div>
  305. </div>
  306. </el-card>
  307. </div>
  308. </div>
  309. <!-- 厂房户型选择 -->
  310. <div v-else-if="currentARType === 'factory'" class="space-y-4">
  311. <el-card
  312. v-for="type in factoryTypes"
  313. :key="type.id"
  314. class="cursor-pointer hover:shadow-lg transition-all duration-300 border-2 hover:border-green-400"
  315. @click="startARExperience('factory', type.id)"
  316. >
  317. <div class="text-center p-6">
  318. <el-icon :size="64" class="text-green-500 mb-4">
  319. <Factory />
  320. </el-icon>
  321. <h4 class="text-xl font-semibold mb-3">{{ type.accountNumber || '标准化厂房' }}</h4>
  322. <p class="text-gray-600 mb-2">面积:{{ type.area || '待定' }}</p>
  323. <p class="text-sm text-gray-500 mb-4">地址:{{ type.address || '待定' }}</p>
  324. <div class="grid grid-cols-2 gap-4 text-sm text-gray-600 mb-4">
  325. <div class="flex items-center">
  326. <el-icon class="mr-2 text-green-500">
  327. <Check />
  328. </el-icon>
  329. <span>完善电力配套</span>
  330. </div>
  331. <div class="flex items-center">
  332. <el-icon class="mr-2 text-green-500">
  333. <Check />
  334. </el-icon>
  335. <span>货运通道便利</span>
  336. </div>
  337. <div class="flex items-center">
  338. <el-icon class="mr-2 text-green-500">
  339. <Check />
  340. </el-icon>
  341. <span>消防设施齐全</span>
  342. </div>
  343. <div class="flex items-center">
  344. <el-icon class="mr-2 text-green-500">
  345. <Check />
  346. </el-icon>
  347. <span>环保标准达标</span>
  348. </div>
  349. </div>
  350. <div class="flex items-center justify-center text-sm text-gray-500">
  351. <el-icon class="mr-1">
  352. <Eye />
  353. </el-icon>
  354. <span>沉浸式厂房体验</span>
  355. </div>
  356. </div>
  357. </el-card>
  358. </div>
  359. <!-- 创新创业基地户型选择 -->
  360. <div v-else-if="currentARType === 'innovation'" class="space-y-4">
  361. <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
  362. <el-card
  363. v-for="type in innovationTypes"
  364. :key="type.id"
  365. class="cursor-pointer hover:shadow-lg transition-all duration-300 border-2 hover:border-purple-400"
  366. @click="startARExperience('innovation', type.id)"
  367. >
  368. <div class="text-center p-4">
  369. <el-icon :size="48" class="text-purple-500 mb-3">
  370. <component :is="getHouseTypeIcon(type)" />
  371. </el-icon>
  372. <h4 class="text-lg font-semibold mb-2">{{ type.accountNumber || '创新空间' }}</h4>
  373. <p class="text-sm text-gray-600 mb-2">面积:{{ type.area || '待定' }}</p>
  374. <p class="text-xs text-gray-500 mb-3">地址:{{ type.address || '待定' }}</p>
  375. <div class="grid grid-cols-1 gap-2 text-xs text-gray-600 mb-3">
  376. <div class="flex items-center">
  377. <el-icon class="mr-1 text-purple-500">
  378. <Check />
  379. </el-icon>
  380. <span>创新孵化环境</span>
  381. </div>
  382. <div class="flex items-center">
  383. <el-icon class="mr-1 text-purple-500">
  384. <Check />
  385. </el-icon>
  386. <span>政策扶持服务</span>
  387. </div>
  388. </div>
  389. <div class="flex items-center justify-center text-sm text-gray-500">
  390. <el-icon class="mr-1">
  391. <Eye />
  392. </el-icon>
  393. <span>360°创业环境体验</span>
  394. </div>
  395. </div>
  396. </el-card>
  397. </div>
  398. </div>
  399. </div>
  400. <template #footer>
  401. <div class="text-center">
  402. <el-button @click="arDialogVisible = false">取消</el-button>
  403. </div>
  404. </template>
  405. </el-dialog>
  406. </el-container>
  407. </template>
  408. <script setup lang="ts">
  409. import { onMounted, ref } from 'vue'
  410. import {
  411. ElButton,
  412. ElCard,
  413. ElCol,
  414. ElContainer,
  415. ElDialog,
  416. ElIcon,
  417. ElMain,
  418. ElMessage,
  419. ElRow,
  420. } from 'element-plus'
  421. import {
  422. ArrowRight,
  423. Building,
  424. Building2,
  425. Camera,
  426. Check,
  427. Clock,
  428. Eye,
  429. Factory,
  430. Home,
  431. House,
  432. Lightbulb,
  433. Loader,
  434. } from 'lucide-vue-next'
  435. import { useRouter } from 'vue-router'
  436. import { clientGet } from '@/utils/request.ts'
  437. interface HouseType {
  438. id: string
  439. accountNumber?: string //户型名字
  440. address?: string //地址
  441. area?: string //面积
  442. roomType?: number // 户型类型:1-公租房,2-厂房,3-创新创业基地
  443. }
  444. interface HouseTypeReponse extends BaseResponse {
  445. data: HouseType[]
  446. }
  447. const router = useRouter()
  448. // AR对话框相关状态
  449. const arDialogVisible = ref(false)
  450. const arDialogTitle = ref('')
  451. const currentARType = ref<'housing' | 'factory' | 'innovation'>('housing')
  452. // 加载状态
  453. const loadingStates = ref({
  454. housing: false,
  455. factory: false,
  456. innovation: false,
  457. })
  458. // 业务模块配置
  459. const businessModules = ref({
  460. housing: {
  461. enabled: true,
  462. arEnabled: true,
  463. },
  464. factory: {
  465. enabled: true,
  466. arEnabled: true,
  467. },
  468. innovation: {
  469. enabled: true,
  470. arEnabled: true,
  471. },
  472. })
  473. // 户型数据 - 改为从接口获取
  474. const housingTypes = ref<HouseType[]>([])
  475. const factoryTypes = ref<HouseType[]>([])
  476. const innovationTypes = ref<HouseType[]>([])
  477. // 获取户型数据
  478. const getHouseType = async (roomType: number) => {
  479. const typeMap = {
  480. 1: 'housing',
  481. 2: 'factory',
  482. 3: 'innovation',
  483. } as const
  484. const currentType = typeMap[roomType as keyof typeof typeMap]
  485. if (!currentType) return
  486. loadingStates.value[currentType] = true
  487. try {
  488. const res = await clientGet<
  489. {
  490. roomType: number
  491. },
  492. HouseTypeReponse
  493. >('/houseType/getByRoomType', {
  494. params: {
  495. roomType,
  496. },
  497. })
  498. if (res.code !== 200) {
  499. ElMessage.error(res.msg || '获取户型数据失败')
  500. return
  501. }
  502. // 根据类型存储数据
  503. switch (roomType) {
  504. case 1:
  505. housingTypes.value = res.data || []
  506. break
  507. case 2:
  508. factoryTypes.value = res.data || []
  509. break
  510. case 3:
  511. innovationTypes.value = res.data || []
  512. break
  513. }
  514. // console.log(`${currentType} 户型数据:`, res.data)
  515. } catch (error) {
  516. console.error(`获取${currentType}户型数据失败:`, error)
  517. ElMessage.error('网络请求失败,请稍后重试')
  518. } finally {
  519. loadingStates.value[currentType] = false
  520. }
  521. }
  522. // 获取当前类型的数据
  523. const getCurrentTypeData = () => {
  524. switch (currentARType.value) {
  525. case 'housing':
  526. return housingTypes.value
  527. case 'factory':
  528. return factoryTypes.value
  529. case 'innovation':
  530. return innovationTypes.value
  531. default:
  532. return []
  533. }
  534. }
  535. // 根据户型获取图标
  536. const getHouseTypeIcon = (type: HouseType) => {
  537. // 可以根据户型名称或其他字段来判断图标
  538. if (type.accountNumber?.includes('一室') || type.accountNumber?.includes('单间')) {
  539. return Home
  540. }
  541. if (type.accountNumber?.includes('两室') || type.accountNumber?.includes('多室')) {
  542. return Building2
  543. }
  544. if (type.roomType === 2) {
  545. return Factory
  546. }
  547. if (type.roomType === 3) {
  548. return Lightbulb
  549. }
  550. return Building
  551. }
  552. const toZflbLink = (currentActive: string) => {
  553. router.push({
  554. path: '/zf/zflb',
  555. query: {
  556. currentActive,
  557. },
  558. })
  559. }
  560. // 打开AR对话框
  561. const openARDialog = (type: 'housing' | 'factory' | 'innovation') => {
  562. currentARType.value = type
  563. const titles = {
  564. housing: 'AR看房体验',
  565. factory: 'AR厂房参观',
  566. innovation: 'AR创新空间体验',
  567. }
  568. arDialogTitle.value = titles[type]
  569. arDialogVisible.value = true
  570. }
  571. // 开始AR体验
  572. const startARExperience = (type: 'housing' | 'factory' | 'innovation', houseId: string) => {
  573. // const selectedHouse = getCurrentTypeData().find(house => house.id === houseId)
  574. // console.log(`开始AR体验: ${type} - ${houseId}`, selectedHouse)
  575. router.push({
  576. path: '/ar/preview',
  577. query: {
  578. houseTypeId: houseId,
  579. isTourist: 1,
  580. },
  581. })
  582. arDialogVisible.value = false
  583. }
  584. // 组件挂载时获取所有户型数据
  585. onMounted(async () => {
  586. // 并发获取所有类型的户型数据
  587. await Promise.all([
  588. getHouseType(1), // 公租房
  589. getHouseType(2), // 厂房
  590. getHouseType(3), // 创新创业基地
  591. ])
  592. })
  593. </script>
  594. <style scoped>
  595. /* 自定义样式覆盖 */
  596. .el-card {
  597. border: none;
  598. }
  599. .el-button {
  600. font-weight: 600;
  601. }
  602. /* AR对话框样式 */
  603. .ar-dialog .el-dialog__body {
  604. padding: 30px;
  605. }
  606. /* 渐变背景动画 */
  607. @keyframes gradient {
  608. 0% {
  609. background-position: 0% 50%;
  610. }
  611. 50% {
  612. background-position: 100% 50%;
  613. }
  614. 100% {
  615. background-position: 0% 50%;
  616. }
  617. }
  618. /* 卡片悬停效果增强 */
  619. .el-card:hover {
  620. transform: translateY(-2px);
  621. }
  622. /* 按钮渐变效果 */
  623. .el-button[type='info'] {
  624. transition: all 0.3s ease;
  625. }
  626. .el-button[type='info']:hover {
  627. transform: translateY(-1px);
  628. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  629. }
  630. /* 加载动画 */
  631. .animate-spin {
  632. animation: spin 1s linear infinite;
  633. }
  634. @keyframes spin {
  635. from {
  636. transform: rotate(0deg);
  637. }
  638. to {
  639. transform: rotate(360deg);
  640. }
  641. }
  642. </style>