index.vue 17 KB

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