index.vue 17 KB

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