index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  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. .name {
  390. width: 200px;
  391. font-size: 18px;
  392. color: #101010;
  393. font-weight: bold;
  394. margin-bottom: 24px;
  395. text-overflow: ellipsis;
  396. white-space: nowrap;
  397. overflow: hidden;
  398. }
  399. .mobile,
  400. .address {
  401. width: 268px;
  402. position: relative;
  403. font-size: 14px;
  404. color: #404040;
  405. padding-left: 24px;
  406. line-height: 24px;
  407. text-overflow: ellipsis;
  408. white-space: nowrap;
  409. margin-top: 6px;
  410. overflow: hidden;
  411. &::after {
  412. content: '';
  413. display: block;
  414. width: 16px;
  415. height: 16px;
  416. position: absolute;
  417. left: 0;
  418. top: 50%;
  419. transform: translateY(-50%);
  420. background-size: 16px;
  421. background-repeat: no-repeat;
  422. }
  423. }
  424. .mobile {
  425. &::after {
  426. background-image: url(~assets/theme-images/common/pc-icon-mobile.png);
  427. }
  428. }
  429. .address {
  430. &::after {
  431. background-image: url(~assets/theme-images/common/pc-icon-address.png);
  432. }
  433. }
  434. .distance {
  435. position: absolute;
  436. font-size: 14px;
  437. color: #404040;
  438. top: 2px;
  439. right: 0;
  440. }
  441. }
  442. }
  443. }
  444. }
  445. }
  446. // 移动 端
  447. @media screen and (max-width: 768px) {
  448. .page-top {
  449. height: 100vw;
  450. background-image: url(~assets/theme-images/hyt/h5/banner-club.png);
  451. background-size: 100vw 100vw !important;
  452. background-position: center;
  453. .logo {
  454. display: block;
  455. width: 14.8vw;
  456. height: 14.8vw;
  457. border-radius: 50%;
  458. background: #fff;
  459. }
  460. .name {
  461. font-size: 4vw;
  462. color: #fff;
  463. }
  464. }
  465. .page-content {
  466. position: relative;
  467. .title {
  468. font-size: 3.4vw;
  469. color: #404040;
  470. span {
  471. color: #4093b5;
  472. }
  473. }
  474. .filter {
  475. padding: 6.4vw 3.2vw 12.8vw;
  476. }
  477. .navbar {
  478. position: fixed;
  479. top: 50% !important;
  480. right: 3.2vw;
  481. left: unset !important;
  482. width: 14vw;
  483. border-radius: 1.6vw;
  484. background: #fff;
  485. box-shadow: 0px 0.6vw 2vw rgba(40, 40, 40, 0.1);
  486. padding: 2.8vw 0;
  487. box-sizing: border-box;
  488. z-index: 2;
  489. span {
  490. display: block;
  491. }
  492. .icon {
  493. position: relative;
  494. width: 7.2vw;
  495. height: 7.2vw;
  496. border-radius: 1.2vw;
  497. background: linear-gradient(180deg, #4bb9e6 0%, #4093b5 100%);
  498. &.icon-device,
  499. &.icon-doctor {
  500. &::after {
  501. content: '';
  502. display: block;
  503. width: 4.8vw;
  504. height: 4.8vw;
  505. position: absolute;
  506. left: 50%;
  507. top: 50%;
  508. transform: translate(-50%, -50%);
  509. background-size: 4.8vw !important;
  510. }
  511. }
  512. &.icon-device {
  513. &::after {
  514. background: url(~assets/theme-images/hyt/pc/nav-entry-device-active.png)
  515. no-repeat center;
  516. }
  517. }
  518. &.icon-doctor {
  519. &::after {
  520. background: url(~assets/theme-images/hyt/pc/nav-entry-doctor-active.png)
  521. no-repeat center;
  522. }
  523. }
  524. }
  525. .text {
  526. font-size: 2.4vw;
  527. color: #4093b5;
  528. margin-top: 1.2vw;
  529. }
  530. }
  531. }
  532. .list {
  533. display: flex;
  534. align-items: center;
  535. flex-direction: column;
  536. .section {
  537. width: 93.6vw;
  538. height: 26vw;
  539. background-color: #f3f5f6;
  540. border-radius: 4px;
  541. box-sizing: border-box;
  542. padding: 3.2vw;
  543. .cover {
  544. display: block;
  545. width: 19.6vw;
  546. height: 19.6vw;
  547. }
  548. .info {
  549. position: relative;
  550. margin-left: 3.2vw;
  551. .name {
  552. width: 48vw;
  553. font-size: 4vw;
  554. color: #101010;
  555. font-weight: bold;
  556. margin-bottom: 4vw;
  557. text-overflow: ellipsis;
  558. white-space: nowrap;
  559. overflow: hidden;
  560. }
  561. .mobile,
  562. .address {
  563. width: 66vw;
  564. position: relative;
  565. font-size: 3vw;
  566. color: #404040;
  567. padding-left: 5vw;
  568. line-height: 5vw;
  569. text-overflow: ellipsis;
  570. white-space: nowrap;
  571. overflow: hidden;
  572. &::after {
  573. content: '';
  574. display: block;
  575. width: 4vw;
  576. height: 4vw;
  577. position: absolute;
  578. left: 0;
  579. top: 50%;
  580. transform: translateY(-50%);
  581. background-size: 4vw 4vw;
  582. background-repeat: no-repeat;
  583. }
  584. }
  585. .mobile {
  586. &::after {
  587. background-image: url(~assets/theme-images/common/h5-icon-mobile.png);
  588. }
  589. }
  590. .address {
  591. &::after {
  592. background-image: url(~assets/theme-images/common/h5-icon-address.png);
  593. }
  594. }
  595. .distance {
  596. position: absolute;
  597. font-size: 3vw;
  598. color: #404040;
  599. top: 0.8vw;
  600. right: 0;
  601. }
  602. }
  603. }
  604. }
  605. }
  606. </style>