index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  1. <template>
  2. <div class="page">
  3. <van-list
  4. v-model="loadingMore"
  5. :finished="finished"
  6. :immediate-check="false"
  7. :finished-text="total ? '没有更多了' : ''"
  8. @load="fetchClubList"
  9. >
  10. <div class="page-top flex flex-col justify-center items-center" @click="toActivity"></div>
  11. <div class="page-content">
  12. <div
  13. class="navbar flex items-center flex-col"
  14. :style="{ top: offsetTop }"
  15. >
  16. <nuxt-link
  17. :to="routePrefix + '/approve/device'"
  18. class="link flex items-center flex-col"
  19. >
  20. <span class="icon icon-device"></span>
  21. <span class="text">设备认证</span>
  22. </nuxt-link>
  23. <!-- <nuxt-link
  24. :to="routePrefix + '/approve/personnel/operate'"
  25. class="link flex items-center flex-col md:mt-6 mt-4"
  26. >
  27. <span class="icon icon-doctor"></span>
  28. <span class="text">体疗师认证</span>
  29. </nuxt-link> -->
  30. </div>
  31. <div class="filter">
  32. <div class="search">
  33. <el-input
  34. placeholder="搜索机构"
  35. v-model="listQuery.authParty"
  36. @change="filterClubList"
  37. >
  38. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  39. </el-input>
  40. </div>
  41. <div class="area">
  42. <RossSelectGroup @change="onCityChange" ref="citySelect" />
  43. </div>
  44. </div>
  45. <!-- 明星机构 -->
  46. <template v-if="starList.length > 0">
  47. <div class="title flex justify-between px-4 pt-8 pb-6 md:px-0">
  48. <div>明星机构</div>
  49. <nuxt-link :to="routePrefix + '/approve/club/star-list'"
  50. >更多<i class="el-icon-arrow-right"></i
  51. ></nuxt-link>
  52. </div>
  53. <!-- 列表 -->
  54. <div class="list">
  55. <template v-for="item in starList">
  56. <div
  57. class="section flex justify-between mb-4"
  58. :key="item.authId"
  59. @click="toDetail(item)"
  60. >
  61. <img
  62. class="cover"
  63. :src="item.logo || drawLogo(item.authParty)"
  64. />
  65. <div class="info">
  66. <div class="name" v-text="item.authParty"></div>
  67. <div class="mobile">{{ item.mobile || '暂无' }}</div>
  68. <div class="address">
  69. {{ formatAddress(item.area, item.address) }}
  70. </div>
  71. </div>
  72. </div>
  73. </template>
  74. </div>
  75. </template>
  76. <!-- 标题 -->
  77. <div class="title flex justify-between px-4 pt-8 pb-6 md:px-0">
  78. <div>距您最近...</div>
  79. <div>共<span v-text="total" class="font-bold"></span>家授权机构</div>
  80. </div>
  81. <!-- 列表 -->
  82. <div class="list">
  83. <template v-for="item in list">
  84. <div
  85. class="section flex justify-between mb-4"
  86. :key="item.authId"
  87. @click="toDetail(item)"
  88. >
  89. <img class="cover" :src="item.logo || drawLogo(item.authParty)" />
  90. <div class="info">
  91. <div class="name" v-text="item.authParty"></div>
  92. <div class="mobile">{{ item.mobile || '暂无' }}</div>
  93. <div class="address">
  94. {{ formatAddress(item.area, item.address) }}
  95. </div>
  96. <div
  97. class="distance"
  98. v-text="formatDistance(item.distance)"
  99. v-if="item.distance && item.distance !== 99999"
  100. ></div>
  101. </div>
  102. </div>
  103. </template>
  104. </div>
  105. <!-- 列表为空 -->
  106. <SimpleEmpty
  107. v-if="!total && !isRequest"
  108. name="icon-empty-club.png"
  109. description="敬请期待~"
  110. ></SimpleEmpty>
  111. </div>
  112. </van-list>
  113. </div>
  114. </template>
  115. <script>
  116. import { mapGetters } from 'vuex'
  117. import clubListMixin from '@/mixins/clubList'
  118. import { objectCover } from '@/utils'
  119. export default {
  120. layout: 'app-hyt',
  121. mixins: [clubListMixin],
  122. data() {
  123. return {
  124. scrollTop: 0,
  125. banner: {},
  126. screenWidth: ""
  127. }
  128. },
  129. computed: {
  130. ...mapGetters(['screenWidth', 'isPc']),
  131. offsetTop() {
  132. if (this.scrollTop <= window.innerHeight / 2) return '240px'
  133. return 240 + this.scrollTop - window.innerHeight / 2 + 'px'
  134. },
  135. },
  136. watch: {
  137. screenWidth: {
  138. handler(val) {
  139. const changeBanner = document.getElementsByClassName('page-top')[0]
  140. if (changeBanner) {
  141. if (val > 768) {
  142. if(this.banner.headPcBanner) {
  143. changeBanner.style.backgroundImage = 'url('+ this.banner.headPcBanner+ ')'
  144. }
  145. }else {
  146. if(this.banner.headAppBanner) {
  147. changeBanner.style.backgroundImage = 'url('+ this.banner.headAppBanner+ ')'
  148. }
  149. }
  150. }
  151. },
  152. immediate: true,
  153. deep: true
  154. }
  155. },
  156. mounted() {
  157. window.addEventListener('scroll', () => {
  158. this.scrollTop = document.documentElement.scrollTop
  159. })
  160. window.addEventListener('scroll', () => {
  161. this.scrollTop = document.documentElement.scrollTop
  162. })
  163. this.getBanner() // 获取轮播图
  164. // 监听页面尺寸变化
  165. this.screenWidth = document.body.clientWidth
  166. window.onresize = () => {
  167. return (() => {
  168. this.screenWidth = document.body.clientWidth
  169. })()
  170. }
  171. },
  172. beforeDestroy() {
  173. window.removeEventListener('scroll', () => {})
  174. },
  175. methods: {
  176. // 抖音挑战赛
  177. toActivity() {
  178. if(this.screenWidth > 768) {
  179. this.banner.jumpLink && window.open(this.banner.jumpLink)
  180. this.banner.jumpPcPicture && window.open(this.banner.jumpPcPicture)
  181. } else {
  182. this.banner.jumpLink && window.open(this.banner.jumpLink)
  183. this.banner.jumpAppPicture && window.open(this.banner.jumpAppPicture)
  184. }
  185. },
  186. // 从缓存中获取数据
  187. initFromCache(cacheData) {
  188. const data = objectCover(this, cacheData)
  189. console.log(data)
  190. this.$nextTick(() => {
  191. this.$refs.citySelect.initSelectValue({
  192. provinceId: data.provinceId,
  193. cityId: data.cityId,
  194. townId: data.townId,
  195. })
  196. })
  197. },
  198. // 城市变化
  199. onCityChange(valueMap) {
  200. const { provinceId, cityId, townId } = valueMap
  201. this.listQuery.provinceId = provinceId
  202. this.listQuery.cityId = cityId
  203. this.listQuery.townId = townId
  204. this.filterClubList()
  205. },
  206. // banner
  207. async getBanner() {
  208. const { data } = await this.$http.api.bannerImg(this.authUserId)
  209. this.banner = data
  210. const changeBanner = document.getElementsByClassName('page-top')[0]
  211. if (this.screenWidth > 768) {
  212. this.banner.headPcBanner && (changeBanner.style.backgroundImage = 'url('+ this.banner.headPcBanner+ ')')
  213. }else {
  214. this.banner.headAppBanner && (changeBanner.style.backgroundImage = 'url('+ this.banner.headAppBanner+ ')')
  215. }
  216. },
  217. },
  218. }
  219. </script>
  220. <style scoped lang="scss">
  221. .el-input {
  222. ::v-deep {
  223. & > {
  224. .el-input.is-active .el-input__inner,
  225. .el-input__inner:focus {
  226. border-color: #4093b5;
  227. }
  228. }
  229. }
  230. }
  231. // pc 端
  232. @media screen and (min-width: 768px) {
  233. .page {
  234. position: relative;
  235. // min-height: calc(100vh - 80px);
  236. min-height: 120vh;
  237. background-color: #fff;
  238. }
  239. .page-top {
  240. height: 530px;
  241. background-image: url(~assets/theme-images/hyt/pc/banner-club.jpg);
  242. background-size: cover;
  243. background-position: center;
  244. }
  245. .page-content {
  246. position: relative;
  247. width: 1000px;
  248. margin: 0 auto;
  249. .title {
  250. font-size: 16px;
  251. color: #404040;
  252. span {
  253. color: #4093b5;
  254. }
  255. }
  256. .filter {
  257. padding: 48px 0 105px;
  258. .search {
  259. width: 640px;
  260. margin: 0 auto;
  261. .el-input {
  262. height: 46px;
  263. font-size: 16px;
  264. .el-input__icon {
  265. font-size: 24px;
  266. line-height: 46px;
  267. margin-left: 12px;
  268. }
  269. ::v-deep {
  270. & > .el-input__inner {
  271. height: 46px;
  272. padding-left: 55px;
  273. }
  274. }
  275. }
  276. }
  277. }
  278. .navbar {
  279. position: absolute;
  280. top: 240px;
  281. right: -168px;
  282. width: 120px;
  283. border-radius: 16px;
  284. background: #fff;
  285. box-shadow: 0px 6px 20px rgba(40, 40, 40, 0.1);
  286. padding: 24px 0;
  287. box-sizing: border-box;
  288. z-index: 2;
  289. .link {
  290. &:hover {
  291. .icon {
  292. &.icon-device {
  293. background: url(~assets/theme-images/hyt/pc/nav-entry-device-active.png)
  294. no-repeat center center,
  295. linear-gradient(180deg, #4bb9e6 0%, #4093b5 100%);
  296. background-size: 48px, 100%;
  297. }
  298. &.icon-doctor {
  299. background: url(~assets/theme-images/hyt/pc/nav-entry-doctor-active.png)
  300. no-repeat center center,
  301. linear-gradient(180deg, #4bb9e6 0%, #4093b5 100%);
  302. background-size: 48px, 100%;
  303. }
  304. }
  305. .text {
  306. color: #4093b5;
  307. }
  308. }
  309. span {
  310. display: block;
  311. }
  312. .icon {
  313. width: 72px;
  314. height: 72px;
  315. background: linear-gradient(180deg, #f6f6f7 0%, #f6f6f7 100%);
  316. border-radius: 12px;
  317. transition: all 0.2s;
  318. &.icon-device {
  319. background: url(~assets/theme-images/hyt/pc/nav-entry-device.png)
  320. no-repeat center center #f6f6f7;
  321. background-size: 48px;
  322. }
  323. &.icon-doctor {
  324. background: url(~assets/theme-images/hyt/pc/nav-entry-doctor.png)
  325. no-repeat center center #f6f6f7;
  326. background-size: 48px;
  327. }
  328. }
  329. .text {
  330. font-size: 16px;
  331. color: #404040;
  332. margin-top: 8px;
  333. }
  334. }
  335. }
  336. .list {
  337. display: flex;
  338. align-items: center;
  339. justify-content: space-between;
  340. flex-wrap: wrap;
  341. .empty {
  342. width: 390px;
  343. }
  344. .section {
  345. width: 490px;
  346. height: 136px;
  347. background-color: #f3f5f6;
  348. border-radius: 4px;
  349. box-sizing: border-box;
  350. padding: 16px;
  351. cursor: pointer;
  352. transition: all 0.4s;
  353. &:hover {
  354. box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
  355. }
  356. .cover {
  357. display: block;
  358. width: 104px;
  359. height: 104px;
  360. }
  361. .info {
  362. position: relative;
  363. margin-left: 12px;
  364. width: 330px;
  365. .name {
  366. width: 200px;
  367. font-size: 18px;
  368. color: #101010;
  369. font-weight: bold;
  370. margin-bottom: 24px;
  371. text-overflow: ellipsis;
  372. white-space: nowrap;
  373. overflow: hidden;
  374. }
  375. .mobile,
  376. .address {
  377. width: 268px;
  378. position: relative;
  379. font-size: 14px;
  380. color: #404040;
  381. padding-left: 24px;
  382. line-height: 24px;
  383. text-overflow: ellipsis;
  384. white-space: nowrap;
  385. margin-top: 6px;
  386. overflow: hidden;
  387. &::after {
  388. content: '';
  389. display: block;
  390. width: 16px;
  391. height: 16px;
  392. position: absolute;
  393. left: 0;
  394. top: 50%;
  395. transform: translateY(-50%);
  396. background-size: 16px;
  397. background-repeat: no-repeat;
  398. }
  399. }
  400. .mobile {
  401. &::after {
  402. background-image: url(~assets/theme-images/common/pc-icon-mobile.png);
  403. }
  404. }
  405. .address {
  406. &::after {
  407. background-image: url(~assets/theme-images/common/pc-icon-address.png);
  408. }
  409. }
  410. .distance {
  411. position: absolute;
  412. font-size: 14px;
  413. color: #404040;
  414. top: 2px;
  415. right: 0;
  416. }
  417. }
  418. }
  419. }
  420. }
  421. }
  422. // 移动 端
  423. @media screen and (max-width: 768px) {
  424. .page-top {
  425. height: 100vw;
  426. background-image: url(~assets/theme-images/hyt/h5/banner-club.png);
  427. background-size: 100vw 100vw !important;
  428. background-position: center;
  429. .logo {
  430. display: block;
  431. width: 14.8vw;
  432. height: 14.8vw;
  433. border-radius: 50%;
  434. background: #fff;
  435. }
  436. .name {
  437. font-size: 4vw;
  438. color: #fff;
  439. }
  440. }
  441. .page-content {
  442. position: relative;
  443. .title {
  444. font-size: 3.4vw;
  445. color: #404040;
  446. span {
  447. color: #4093b5;
  448. }
  449. }
  450. .filter {
  451. padding: 6.4vw 3.2vw 12.8vw;
  452. }
  453. .navbar {
  454. position: fixed;
  455. top: 50% !important;
  456. right: 3.2vw;
  457. left: unset !important;
  458. width: 14vw;
  459. border-radius: 1.6vw;
  460. background: #fff;
  461. box-shadow: 0px 0.6vw 2vw rgba(40, 40, 40, 0.1);
  462. padding: 2.8vw 0;
  463. box-sizing: border-box;
  464. z-index: 2;
  465. span {
  466. display: block;
  467. }
  468. .icon {
  469. position: relative;
  470. width: 7.2vw;
  471. height: 7.2vw;
  472. border-radius: 1.2vw;
  473. background: linear-gradient(180deg, #4bb9e6 0%, #4093b5 100%);
  474. &.icon-device,
  475. &.icon-doctor {
  476. &::after {
  477. content: '';
  478. display: block;
  479. width: 4.8vw;
  480. height: 4.8vw;
  481. position: absolute;
  482. left: 50%;
  483. top: 50%;
  484. transform: translate(-50%, -50%);
  485. background-size: 4.8vw !important;
  486. }
  487. }
  488. &.icon-device {
  489. &::after {
  490. background: url(~assets/theme-images/hyt/pc/nav-entry-device-active.png)
  491. no-repeat center;
  492. }
  493. }
  494. &.icon-doctor {
  495. &::after {
  496. background: url(~assets/theme-images/hyt/pc/nav-entry-doctor-active.png)
  497. no-repeat center;
  498. }
  499. }
  500. }
  501. .text {
  502. font-size: 2.4vw;
  503. color: #4093b5;
  504. margin-top: 1.2vw;
  505. }
  506. }
  507. }
  508. .list {
  509. display: flex;
  510. align-items: center;
  511. flex-direction: column;
  512. .section {
  513. width: 93.6vw;
  514. height: 26vw;
  515. background-color: #f3f5f6;
  516. border-radius: 4px;
  517. box-sizing: border-box;
  518. padding: 3.2vw;
  519. .cover {
  520. display: block;
  521. width: 19.6vw;
  522. height: 19.6vw;
  523. }
  524. .info {
  525. position: relative;
  526. margin-left: 3.2vw;
  527. .name {
  528. width: 48vw;
  529. font-size: 4vw;
  530. color: #101010;
  531. font-weight: bold;
  532. margin-bottom: 4vw;
  533. text-overflow: ellipsis;
  534. white-space: nowrap;
  535. overflow: hidden;
  536. }
  537. .mobile,
  538. .address {
  539. width: 66vw;
  540. position: relative;
  541. font-size: 3vw;
  542. color: #404040;
  543. padding-left: 5vw;
  544. line-height: 5vw;
  545. text-overflow: ellipsis;
  546. white-space: nowrap;
  547. overflow: hidden;
  548. &::after {
  549. content: '';
  550. display: block;
  551. width: 4vw;
  552. height: 4vw;
  553. position: absolute;
  554. left: 0;
  555. top: 50%;
  556. transform: translateY(-50%);
  557. background-size: 4vw 4vw;
  558. background-repeat: no-repeat;
  559. }
  560. }
  561. .mobile {
  562. &::after {
  563. background-image: url(~assets/theme-images/common/h5-icon-mobile.png);
  564. }
  565. }
  566. .address {
  567. &::after {
  568. background-image: url(~assets/theme-images/common/h5-icon-address.png);
  569. }
  570. }
  571. .distance {
  572. position: absolute;
  573. font-size: 3vw;
  574. color: #404040;
  575. top: 0.8vw;
  576. right: 0;
  577. }
  578. }
  579. }
  580. }
  581. }
  582. </style>