index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  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. this.initAppMessageShareData() // 公众号分享授权页面
  158. window.addEventListener('scroll', () => {
  159. this.scrollTop = document.documentElement.scrollTop
  160. })
  161. window.addEventListener('scroll', () => {
  162. this.scrollTop = document.documentElement.scrollTop
  163. })
  164. this.getBanner() // 获取轮播图
  165. // 监听页面尺寸变化
  166. this.screenWidth = document.body.clientWidth
  167. window.onresize = () => {
  168. return (() => {
  169. this.screenWidth = document.body.clientWidth
  170. })()
  171. }
  172. },
  173. created() {
  174. document.title = '官方正品授权查询'
  175. },
  176. beforeDestroy() {
  177. window.removeEventListener('scroll', () => {})
  178. },
  179. methods: {
  180. // 抖音挑战赛
  181. toActivity() {
  182. if(this.screenWidth > 768) {
  183. this.banner.jumpLink && window.open(this.banner.jumpLink)
  184. this.banner.jumpPcPicture && window.open(this.banner.jumpPcPicture)
  185. } else {
  186. this.banner.jumpLink && window.open(this.banner.jumpLink)
  187. this.banner.jumpAppPicture && window.open(this.banner.jumpAppPicture)
  188. }
  189. },
  190. // 从缓存中获取数据
  191. initFromCache(cacheData) {
  192. const data = objectCover(this, cacheData)
  193. console.log(data)
  194. this.$nextTick(() => {
  195. this.$refs.citySelect.initSelectValue({
  196. provinceId: data.provinceId,
  197. cityId: data.cityId,
  198. townId: data.townId,
  199. })
  200. })
  201. },
  202. // 城市变化
  203. onCityChange(valueMap) {
  204. const { provinceId, cityId, townId } = valueMap
  205. this.listQuery.provinceId = provinceId
  206. this.listQuery.cityId = cityId
  207. this.listQuery.townId = townId
  208. this.filterClubList()
  209. },
  210. // banner
  211. async getBanner() {
  212. const { data } = await this.$http.api.bannerImg(this.authUserId)
  213. this.banner = data
  214. const changeBanner = document.getElementsByClassName('page-top')[0]
  215. if (this.screenWidth > 768) {
  216. this.banner.headPcBanner && (changeBanner.style.backgroundImage = 'url('+ this.banner.headPcBanner+ ')')
  217. }else {
  218. this.banner.headAppBanner && (changeBanner.style.backgroundImage = 'url('+ this.banner.headAppBanner+ ')')
  219. }
  220. },
  221. // 分享当前页面
  222. initAppMessageShareData() {
  223. console.log(window.location.href, window.location.origin)
  224. // 重试次数
  225. let retryCount = 1
  226. this.$wxReady((wx) => {
  227. //需在用户可能点击分享按钮前就先调用
  228. wx.updateAppMessageShareData({
  229. title: '官方正品授权查询', // 分享标题
  230. desc: '官方正品授权', // 分享描述
  231. link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
  232. imgUrl: this.banner.headAppBanner, // 分享图标
  233. fail: () => {
  234. if (retryCount === 0) return
  235. this.initAppMessageShareData()
  236. retryCount--
  237. },
  238. })
  239. })
  240. },
  241. },
  242. }
  243. </script>
  244. <style scoped lang="scss">
  245. .el-input {
  246. ::v-deep {
  247. & > {
  248. .el-input.is-active .el-input__inner,
  249. .el-input__inner:focus {
  250. border-color: #4093b5;
  251. }
  252. }
  253. }
  254. }
  255. // pc 端
  256. @media screen and (min-width: 768px) {
  257. .page {
  258. position: relative;
  259. // min-height: calc(100vh - 80px);
  260. min-height: 120vh;
  261. background-color: #fff;
  262. }
  263. .page-top {
  264. height: 530px;
  265. background-image: url(~assets/theme-images/hyt/pc/banner-club.jpg);
  266. background-size: cover;
  267. background-position: center;
  268. }
  269. .page-content {
  270. position: relative;
  271. width: 1000px;
  272. margin: 0 auto;
  273. .title {
  274. font-size: 16px;
  275. color: #404040;
  276. span {
  277. color: #4093b5;
  278. }
  279. }
  280. .filter {
  281. padding: 48px 0 105px;
  282. .search {
  283. width: 640px;
  284. margin: 0 auto;
  285. .el-input {
  286. height: 46px;
  287. font-size: 16px;
  288. .el-input__icon {
  289. font-size: 24px;
  290. line-height: 46px;
  291. margin-left: 12px;
  292. }
  293. ::v-deep {
  294. & > .el-input__inner {
  295. height: 46px;
  296. padding-left: 55px;
  297. }
  298. }
  299. }
  300. }
  301. }
  302. .navbar {
  303. position: absolute;
  304. top: 240px;
  305. right: -168px;
  306. width: 120px;
  307. border-radius: 16px;
  308. background: #fff;
  309. box-shadow: 0px 6px 20px rgba(40, 40, 40, 0.1);
  310. padding: 24px 0;
  311. box-sizing: border-box;
  312. z-index: 2;
  313. .link {
  314. &:hover {
  315. .icon {
  316. &.icon-device {
  317. background: url(~assets/theme-images/hyt/pc/nav-entry-device-active.png)
  318. no-repeat center center,
  319. linear-gradient(180deg, #4bb9e6 0%, #4093b5 100%);
  320. background-size: 48px, 100%;
  321. }
  322. &.icon-doctor {
  323. background: url(~assets/theme-images/hyt/pc/nav-entry-doctor-active.png)
  324. no-repeat center center,
  325. linear-gradient(180deg, #4bb9e6 0%, #4093b5 100%);
  326. background-size: 48px, 100%;
  327. }
  328. }
  329. .text {
  330. color: #4093b5;
  331. }
  332. }
  333. span {
  334. display: block;
  335. }
  336. .icon {
  337. width: 72px;
  338. height: 72px;
  339. background: linear-gradient(180deg, #f6f6f7 0%, #f6f6f7 100%);
  340. border-radius: 12px;
  341. transition: all 0.2s;
  342. &.icon-device {
  343. background: url(~assets/theme-images/hyt/pc/nav-entry-device.png)
  344. no-repeat center center #f6f6f7;
  345. background-size: 48px;
  346. }
  347. &.icon-doctor {
  348. background: url(~assets/theme-images/hyt/pc/nav-entry-doctor.png)
  349. no-repeat center center #f6f6f7;
  350. background-size: 48px;
  351. }
  352. }
  353. .text {
  354. font-size: 16px;
  355. color: #404040;
  356. margin-top: 8px;
  357. }
  358. }
  359. }
  360. .list {
  361. display: flex;
  362. align-items: center;
  363. justify-content: space-between;
  364. flex-wrap: wrap;
  365. .empty {
  366. width: 390px;
  367. }
  368. .section {
  369. width: 490px;
  370. height: 136px;
  371. background-color: #f3f5f6;
  372. border-radius: 4px;
  373. box-sizing: border-box;
  374. padding: 16px;
  375. cursor: pointer;
  376. transition: all 0.4s;
  377. &:hover {
  378. box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
  379. }
  380. .cover {
  381. display: block;
  382. width: 104px;
  383. height: 104px;
  384. }
  385. .info {
  386. position: relative;
  387. margin-left: 12px;
  388. width: 330px;
  389. @include flex-column-between;
  390. .name {
  391. width: 200px;
  392. font-size: 18px;
  393. color: #101010;
  394. font-weight: bold;
  395. margin-bottom: 24px;
  396. text-overflow: ellipsis;
  397. white-space: nowrap;
  398. overflow: hidden;
  399. }
  400. .mobile,
  401. .address {
  402. width: 268px;
  403. position: relative;
  404. font-size: 14px;
  405. color: #404040;
  406. padding-left: 24px;
  407. line-height: 24px;
  408. text-overflow: ellipsis;
  409. white-space: nowrap;
  410. margin-top: 6px;
  411. overflow: hidden;
  412. &::after {
  413. content: '';
  414. display: block;
  415. width: 16px;
  416. height: 16px;
  417. position: absolute;
  418. left: 0;
  419. top: 50%;
  420. transform: translateY(-50%);
  421. background-size: 16px;
  422. background-repeat: no-repeat;
  423. }
  424. }
  425. .mobile {
  426. &::after {
  427. background-image: url(~assets/theme-images/common/pc-icon-mobile.png);
  428. }
  429. }
  430. .address {
  431. &::after {
  432. background-image: url(~assets/theme-images/common/pc-icon-address.png);
  433. }
  434. }
  435. .distance {
  436. position: absolute;
  437. font-size: 14px;
  438. color: #404040;
  439. top: 2px;
  440. right: 0;
  441. }
  442. }
  443. }
  444. }
  445. }
  446. }
  447. // 移动 端
  448. @media screen and (max-width: 768px) {
  449. .page-top {
  450. height: 100vw;
  451. background-image: url(~assets/theme-images/hyt/h5/banner-club.png);
  452. background-size: 100vw 100vw !important;
  453. background-position: center;
  454. .logo {
  455. display: block;
  456. width: 14.8vw;
  457. height: 14.8vw;
  458. border-radius: 50%;
  459. background: #fff;
  460. }
  461. .name {
  462. font-size: 4vw;
  463. color: #fff;
  464. }
  465. }
  466. .page-content {
  467. position: relative;
  468. .title {
  469. font-size: 3.4vw;
  470. color: #404040;
  471. span {
  472. color: #4093b5;
  473. }
  474. }
  475. .filter {
  476. padding: 6.4vw 3.2vw 12.8vw;
  477. }
  478. .navbar {
  479. position: fixed;
  480. top: 50% !important;
  481. right: 3.2vw;
  482. left: unset !important;
  483. width: 14vw;
  484. border-radius: 1.6vw;
  485. background: #fff;
  486. box-shadow: 0px 0.6vw 2vw rgba(40, 40, 40, 0.1);
  487. padding: 2.8vw 0;
  488. box-sizing: border-box;
  489. z-index: 2;
  490. span {
  491. display: block;
  492. }
  493. .icon {
  494. position: relative;
  495. width: 7.2vw;
  496. height: 7.2vw;
  497. border-radius: 1.2vw;
  498. background: linear-gradient(180deg, #4bb9e6 0%, #4093b5 100%);
  499. &.icon-device,
  500. &.icon-doctor {
  501. &::after {
  502. content: '';
  503. display: block;
  504. width: 4.8vw;
  505. height: 4.8vw;
  506. position: absolute;
  507. left: 50%;
  508. top: 50%;
  509. transform: translate(-50%, -50%);
  510. background-size: 4.8vw !important;
  511. }
  512. }
  513. &.icon-device {
  514. &::after {
  515. background: url(~assets/theme-images/hyt/pc/nav-entry-device-active.png)
  516. no-repeat center;
  517. }
  518. }
  519. &.icon-doctor {
  520. &::after {
  521. background: url(~assets/theme-images/hyt/pc/nav-entry-doctor-active.png)
  522. no-repeat center;
  523. }
  524. }
  525. }
  526. .text {
  527. font-size: 2.4vw;
  528. color: #4093b5;
  529. margin-top: 1.2vw;
  530. }
  531. }
  532. }
  533. .list {
  534. display: flex;
  535. align-items: center;
  536. flex-direction: column;
  537. .section {
  538. width: 93.6vw;
  539. height: 26vw;
  540. background-color: #f3f5f6;
  541. border-radius: 4px;
  542. box-sizing: border-box;
  543. padding: 3.2vw;
  544. .cover {
  545. display: block;
  546. width: 19.6vw;
  547. height: 19.6vw;
  548. }
  549. .info {
  550. position: relative;
  551. margin-left: 3.2vw;
  552. @include flex-column-between;
  553. .name {
  554. width: 48vw;
  555. font-size: 4vw;
  556. color: #101010;
  557. font-weight: bold;
  558. margin-bottom: 4vw;
  559. text-overflow: ellipsis;
  560. white-space: nowrap;
  561. overflow: hidden;
  562. }
  563. .mobile,
  564. .address {
  565. width: 66vw;
  566. position: relative;
  567. font-size: 3vw;
  568. color: #404040;
  569. padding-left: 5vw;
  570. line-height: 5vw;
  571. text-overflow: ellipsis;
  572. white-space: nowrap;
  573. overflow: hidden;
  574. &::after {
  575. content: '';
  576. display: block;
  577. width: 4vw;
  578. height: 4vw;
  579. position: absolute;
  580. left: 0;
  581. top: 50%;
  582. transform: translateY(-50%);
  583. background-size: 4vw 4vw;
  584. background-repeat: no-repeat;
  585. }
  586. }
  587. .mobile {
  588. &::after {
  589. background-image: url(~assets/theme-images/common/h5-icon-mobile.png);
  590. }
  591. }
  592. .address {
  593. &::after {
  594. background-image: url(~assets/theme-images/common/h5-icon-address.png);
  595. }
  596. }
  597. .distance {
  598. position: absolute;
  599. font-size: 3vw;
  600. color: #404040;
  601. top: 0.8vw;
  602. right: 0;
  603. }
  604. }
  605. }
  606. }
  607. }
  608. </style>