index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  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-normal',
  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. created() {
  137. document.title = '官方正品授权查询'
  138. },
  139. watch: {
  140. screenWidth: {
  141. handler(val) {
  142. const changeBanner = document.getElementsByClassName('page-top')[0]
  143. if (changeBanner) {
  144. if (val > 768) {
  145. if(this.banner.headPcBanner) {
  146. changeBanner.style.backgroundImage = 'url('+ this.banner.headPcBanner+ ')'
  147. }
  148. }else {
  149. if(this.banner.headAppBanner) {
  150. changeBanner.style.backgroundImage = 'url('+ this.banner.headAppBanner+ ')'
  151. }
  152. }
  153. }
  154. },
  155. immediate: true,
  156. deep: true
  157. }
  158. },
  159. mounted() {
  160. this.initAppMessageShareData() // 公众号分享授权页面
  161. window.addEventListener('scroll', () => {
  162. this.scrollTop = document.documentElement.scrollTop
  163. })
  164. window.addEventListener('scroll', () => {
  165. this.scrollTop = document.documentElement.scrollTop
  166. })
  167. this.getBanner() // 获取轮播图
  168. // 监听页面尺寸变化
  169. this.screenWidth = document.body.clientWidth
  170. window.onresize = () => {
  171. return (() => {
  172. this.screenWidth = document.body.clientWidth
  173. })()
  174. }
  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: #bc1724;
  251. }
  252. }
  253. }
  254. }
  255. // pc 端
  256. @media screen and (min-width: 768px) {
  257. .page {
  258. position: relative;
  259. min-height: calc(100vh - 80px - 80px);
  260. background-color: #fff;
  261. }
  262. .page-top {
  263. height: 530px;
  264. background-image: url(~assets/theme-images/normal/pc/banner-club.png);
  265. background-size: cover;
  266. background-position: center;
  267. }
  268. .page-content {
  269. position: relative;
  270. width: 1000px;
  271. margin: 0 auto;
  272. .title {
  273. font-size: 16px;
  274. color: #404040;
  275. span {
  276. color: #bc1724;
  277. }
  278. }
  279. .filter {
  280. padding: 48px 0 105px;
  281. .search {
  282. width: 640px;
  283. margin: 0 auto;
  284. .el-input {
  285. height: 46px;
  286. font-size: 16px;
  287. .el-input__icon {
  288. font-size: 24px;
  289. line-height: 46px;
  290. margin-left: 12px;
  291. }
  292. ::v-deep {
  293. & > .el-input__inner {
  294. height: 46px;
  295. padding-left: 55px;
  296. }
  297. }
  298. }
  299. }
  300. }
  301. .navbar {
  302. position: absolute;
  303. top: 240px;
  304. right: -168px;
  305. width: 120px;
  306. border-radius: 16px;
  307. background: #fff;
  308. box-shadow: 0px 6px 20px rgba(40, 40, 40, 0.1);
  309. padding: 24px 0;
  310. box-sizing: border-box;
  311. z-index: 2;
  312. .link {
  313. &:hover {
  314. .icon {
  315. &.icon-device {
  316. background: url(~assets/theme-images/normal/pc/nav-entry-device-active.png)
  317. no-repeat center center,
  318. linear-gradient(180deg, #e41d2d 0%, #bc1724 100%);
  319. background-size: 48px, 100%;
  320. }
  321. &.icon-doctor {
  322. background: url(~assets/theme-images/normal/pc/nav-entry-doctor-active.png)
  323. no-repeat center center,
  324. linear-gradient(180deg, #e41d2d 0%, #bc1724 100%);
  325. background-size: 48px, 100%;
  326. }
  327. }
  328. .text {
  329. color: #bc1724;
  330. }
  331. }
  332. span {
  333. display: block;
  334. }
  335. .icon {
  336. width: 72px;
  337. height: 72px;
  338. background: linear-gradient(180deg, #f6f6f7 0%, #f6f6f7 100%);
  339. border-radius: 12px;
  340. transition: all 0.2s;
  341. &.icon-device {
  342. background: url(~assets/theme-images/normal/pc/nav-entry-device.png)
  343. no-repeat center center #f6f6f7;
  344. background-size: 48px;
  345. }
  346. &.icon-doctor {
  347. background: url(~assets/theme-images/normal/pc/nav-entry-doctor.png)
  348. no-repeat center center #f6f6f7;
  349. background-size: 48px;
  350. }
  351. }
  352. .text {
  353. font-size: 16px;
  354. color: #404040;
  355. margin-top: 8px;
  356. }
  357. }
  358. }
  359. .list {
  360. display: flex;
  361. align-items: center;
  362. justify-content: space-between;
  363. flex-wrap: wrap;
  364. .empty {
  365. width: 390px;
  366. }
  367. .section {
  368. width: 490px;
  369. height: 136px;
  370. background-color: #f3f5f6;
  371. border-radius: 4px;
  372. box-sizing: border-box;
  373. padding: 16px;
  374. cursor: pointer;
  375. transition: all 0.4s;
  376. &:hover {
  377. box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
  378. }
  379. .cover {
  380. display: block;
  381. width: 104px;
  382. height: 104px;
  383. }
  384. .info {
  385. position: relative;
  386. margin-left: 12px;
  387. width: 330px;
  388. .name {
  389. width: 200px;
  390. font-size: 18px;
  391. color: #101010;
  392. font-weight: bold;
  393. margin-bottom: 24px;
  394. text-overflow: ellipsis;
  395. white-space: nowrap;
  396. overflow: hidden;
  397. }
  398. .mobile,
  399. .address {
  400. width: 268px;
  401. position: relative;
  402. font-size: 14px;
  403. color: #404040;
  404. padding-left: 24px;
  405. line-height: 24px;
  406. text-overflow: ellipsis;
  407. white-space: nowrap;
  408. margin-top: 6px;
  409. overflow: hidden;
  410. &::after {
  411. content: '';
  412. display: block;
  413. width: 16px;
  414. height: 16px;
  415. position: absolute;
  416. left: 0;
  417. top: 50%;
  418. transform: translateY(-50%);
  419. background-size: 16px;
  420. background-repeat: no-repeat;
  421. }
  422. }
  423. .mobile {
  424. &::after {
  425. background-image: url(~assets/theme-images/common/pc-icon-mobile.png);
  426. }
  427. }
  428. .address {
  429. &::after {
  430. background-image: url(~assets/theme-images/common/pc-icon-address.png);
  431. }
  432. }
  433. .distance {
  434. position: absolute;
  435. font-size: 14px;
  436. color: #404040;
  437. top: 2px;
  438. right: 0;
  439. }
  440. }
  441. }
  442. }
  443. }
  444. }
  445. // 移动 端
  446. @media screen and (max-width: 768px) {
  447. .page-top {
  448. height: 100vw;
  449. background-image: url(~assets/theme-images/normal/h5/banner-club.png);
  450. background-size: 100vw 100vw !important;
  451. background-position: center;
  452. .logo {
  453. display: block;
  454. width: 14.8vw;
  455. height: 14.8vw;
  456. border-radius: 50%;
  457. background: #fff;
  458. }
  459. .name {
  460. font-size: 4vw;
  461. color: #fff;
  462. }
  463. }
  464. .page-content {
  465. position: relative;
  466. .title {
  467. font-size: 3.4vw;
  468. color: #404040;
  469. span {
  470. color: #bc1724;
  471. }
  472. }
  473. .filter {
  474. padding: 6.4vw 3.2vw 12.8vw;
  475. }
  476. .navbar {
  477. position: fixed;
  478. top: 50% !important;
  479. right: 3.2vw;
  480. left: unset !important;
  481. width: 14vw;
  482. border-radius: 1.6vw;
  483. background: #fff;
  484. box-shadow: 0px 0.6vw 2vw rgba(40, 40, 40, 0.1);
  485. padding: 2.8vw 0;
  486. box-sizing: border-box;
  487. z-index: 2;
  488. span {
  489. display: block;
  490. }
  491. .icon {
  492. position: relative;
  493. width: 7.2vw;
  494. height: 7.2vw;
  495. border-radius: 1.2vw;
  496. background: linear-gradient(180deg, #e41d2d 0%, #bc1724 100%);
  497. &.icon-device,
  498. &.icon-doctor {
  499. &::after {
  500. content: '';
  501. display: block;
  502. width: 4.8vw;
  503. height: 4.8vw;
  504. position: absolute;
  505. left: 50%;
  506. top: 50%;
  507. transform: translate(-50%, -50%);
  508. background-size: 4.8vw !important;
  509. }
  510. }
  511. &.icon-device {
  512. &::after {
  513. background: url(~assets/theme-images/normal/pc/nav-entry-device-active.png)
  514. no-repeat center;
  515. }
  516. }
  517. &.icon-doctor {
  518. &::after {
  519. background: url(~assets/theme-images/normal/pc/nav-entry-doctor-active.png)
  520. no-repeat center;
  521. }
  522. }
  523. }
  524. .text {
  525. font-size: 2.4vw;
  526. color: #bc1724;
  527. margin-top: 1.2vw;
  528. }
  529. }
  530. }
  531. .list {
  532. display: flex;
  533. align-items: center;
  534. flex-direction: column;
  535. .section {
  536. width: 93.6vw;
  537. height: 26vw;
  538. background-color: #f3f5f6;
  539. border-radius: 4px;
  540. box-sizing: border-box;
  541. padding: 3.2vw;
  542. .cover {
  543. display: block;
  544. width: 19.6vw;
  545. height: 19.6vw;
  546. }
  547. .info {
  548. position: relative;
  549. margin-left: 3.2vw;
  550. .name {
  551. width: 48vw;
  552. font-size: 4vw;
  553. color: #101010;
  554. font-weight: bold;
  555. margin-bottom: 4vw;
  556. text-overflow: ellipsis;
  557. white-space: nowrap;
  558. overflow: hidden;
  559. }
  560. .mobile,
  561. .address {
  562. width: 66vw;
  563. position: relative;
  564. font-size: 3vw;
  565. color: #404040;
  566. padding-left: 5vw;
  567. line-height: 5vw;
  568. text-overflow: ellipsis;
  569. white-space: nowrap;
  570. overflow: hidden;
  571. &::after {
  572. content: '';
  573. display: block;
  574. width: 4vw;
  575. height: 4vw;
  576. position: absolute;
  577. left: 0;
  578. top: 50%;
  579. transform: translateY(-50%);
  580. background-size: 4vw 4vw;
  581. background-repeat: no-repeat;
  582. }
  583. }
  584. .mobile {
  585. &::after {
  586. background-image: url(~assets/theme-images/common/h5-icon-mobile.png);
  587. }
  588. }
  589. .address {
  590. &::after {
  591. background-image: url(~assets/theme-images/common/h5-icon-address.png);
  592. }
  593. }
  594. .distance {
  595. position: absolute;
  596. font-size: 3vw;
  597. color: #404040;
  598. top: 0.8vw;
  599. right: 0;
  600. }
  601. }
  602. }
  603. }
  604. }
  605. </style>