index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  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 class="navbar-container" :style="{ top: offsetTop }">
  13. <!-- <nuxt-link :to="routePrefix + '/activity/challenge'">
  14. <div class="activity-entry"></div>
  15. </nuxt-link> -->
  16. <div class="navbar flex items-center flex-col">
  17. <nuxt-link :to="routePrefix + '/approve/device'" class="link flex items-center flex-col">
  18. <span class="icon icon-device"></span>
  19. <span class="text">设备认证</span>
  20. </nuxt-link>
  21. <nuxt-link
  22. :to="routePrefix + '/approve/personnel/operate'"
  23. class="link flex items-center flex-col md:mt-6 mt-4"
  24. >
  25. <span class="icon icon-doctor"></span>
  26. <span class="text">体疗师认证</span>
  27. </nuxt-link>
  28. <nuxt-link
  29. :to="routePrefix + '/docs/0'"
  30. class="link flex items-center flex-col md:mt-6 mt-4"
  31. >
  32. <span class="icon icon-device"></span>
  33. <span class="text">云资料库</span>
  34. </nuxt-link>
  35. </div>
  36. </div>
  37. <div class="filter">
  38. <div class="search">
  39. <el-input placeholder="搜索机构" v-model="listQuery.authParty" @change="filterClubList">
  40. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  41. </el-input>
  42. </div>
  43. <div class="area">
  44. <RossSelectGroup @change="onCityChange" ref="citySelect" />
  45. </div>
  46. </div>
  47. <!-- 明星机构 -->
  48. <template v-if="starList.length > 0">
  49. <div class="title flex justify-between px-4 pt-8 pb-6 md:px-0">
  50. <div>明星机构</div>
  51. <nuxt-link :to="routePrefix + '/approve/club/star-list'">更多<i class="el-icon-arrow-right"></i></nuxt-link>
  52. </div>
  53. <!-- 列表 -->
  54. <div class="list">
  55. <template v-for="item in starList">
  56. <div class="section flex justify-between mb-4" :key="item.authId" @click="toDetail(item)">
  57. <img class="cover" :src="item.logo || drawLogo(item.authParty)" />
  58. <div class="info">
  59. <div class="name" v-text="item.authParty"></div>
  60. <div class="mobile">{{ maskPhoneNumber(item.mobile) || '暂无' }}</div>
  61. <div class="address">
  62. {{ formatAddress(item.area, item.address) }}
  63. </div>
  64. </div>
  65. </div>
  66. </template>
  67. </div>
  68. </template>
  69. <!-- 标题 -->
  70. <div class="title flex justify-between px-4 pt-8 pb-6 md:px-0">
  71. <div>距您最近...</div>
  72. <!--<div>共<span v-text="total" class="font-bold"></span>家授权机构</div>-->
  73. </div>
  74. <!-- 列表 -->
  75. <div class="list">
  76. <template v-for="item in list">
  77. <div class="section flex justify-between mb-4" :key="item.authId" @click="toDetail(item)">
  78. <img class="cover" :src="item.logo || drawLogo(item.authParty)" />
  79. <div class="info">
  80. <div class="name" v-text="item.authParty"></div>
  81. <div class="mobile">{{ maskPhoneNumber(item.mobile) }}</div>
  82. <div class="address">
  83. {{ formatAddress(item.area, item.address) }}
  84. </div>
  85. <div
  86. class="distance"
  87. v-text="formatDistance(item.distance)"
  88. v-if="item.distance && item.distance !== 99999"
  89. ></div>
  90. </div>
  91. </div>
  92. </template>
  93. </div>
  94. <!-- 列表为空 -->
  95. <SimpleEmpty v-if="!total && !isRequest" name="icon-empty-club.png" description="敬请期待~"></SimpleEmpty>
  96. </div>
  97. </van-list>
  98. </div>
  99. </template>
  100. <script>
  101. import { mapGetters } from 'vuex'
  102. import clubListMixin from '@/mixins/clubList'
  103. import { objectCover } from '@/utils'
  104. export default {
  105. layout: 'app-ross',
  106. mixins: [clubListMixin],
  107. data() {
  108. return {
  109. scrollTop: 0,
  110. banner: {},
  111. screenWidth: ''
  112. }
  113. },
  114. computed: {
  115. ...mapGetters(['isPc', 'authUserId']),
  116. offsetTop() {
  117. if (this.scrollTop <= window.innerHeight / 2) return '10px'
  118. return 10 + this.scrollTop - window.innerHeight / 2 + 'px'
  119. },
  120. },
  121. created() {
  122. // document.title = '官方正品授权查询'
  123. },
  124. mounted() {
  125. this.initAppMessageShareData() // 公众号分享授权页面
  126. window.addEventListener('scroll', () => {
  127. this.scrollTop = document.documentElement.scrollTop
  128. })
  129. this.getBanner() // 获取轮播图
  130. // 监听页面尺寸变化
  131. this.screenWidth = document.body.clientWidth
  132. window.onresize = () => {
  133. return (() => {
  134. this.screenWidth = document.body.clientWidth
  135. })()
  136. }
  137. },
  138. beforeDestroy() {
  139. window.removeEventListener('scroll', () => {
  140. this.scrollTop = document.documentElement.scrollTop
  141. })
  142. },
  143. watch: {
  144. screenWidth: {
  145. handler(val) {
  146. const changeBanner = document.getElementsByClassName('page-top')[0]
  147. if (changeBanner) {
  148. if (val > 768) {
  149. if(this.banner.headPcBanner) {
  150. changeBanner.style.backgroundImage = 'url('+ this.banner.headPcBanner+ ')'
  151. }
  152. }else {
  153. if(this.banner.headAppBanner) {
  154. changeBanner.style.backgroundImage = 'url('+ this.banner.headAppBanner+ ')'
  155. }
  156. }
  157. }
  158. },
  159. immediate: true,
  160. deep: true
  161. }
  162. },
  163. methods: {
  164. // 抖音挑战赛
  165. toActivity() {
  166. if(this.screenWidth > 768) {
  167. this.banner.jumpLink && window.open(this.banner.jumpLink)
  168. this.banner.jumpPcPicture && window.open(this.banner.jumpPcPicture)
  169. } else {
  170. this.banner.jumpLink && window.open(this.banner.jumpLink)
  171. this.banner.jumpAppPicture && window.open(this.banner.jumpAppPicture)
  172. }
  173. },
  174. // 从缓存中获取数据
  175. initFromCache(cacheData) {
  176. const data = objectCover(this, cacheData)
  177. console.log(data)
  178. this.$nextTick(() => {
  179. this.$refs.citySelect.initSelectValue({
  180. provinceId: data.provinceId,
  181. cityId: data.cityId,
  182. townId: data.townId,
  183. })
  184. })
  185. },
  186. // banner
  187. async getBanner() {
  188. const { data } = await this.$http.api.bannerImg(this.authUserId)
  189. this.banner = data
  190. const changeBanner = document.getElementsByClassName('page-top')[0]
  191. if (this.screenWidth > 768) {
  192. this.banner.headPcBanner && (changeBanner.style.backgroundImage = 'url('+ this.banner.headPcBanner+ ')')
  193. }else {
  194. this.banner.headAppBanner && (changeBanner.style.backgroundImage = 'url('+ this.banner.headAppBanner+ ')')
  195. }
  196. },
  197. // 城市变化
  198. onCityChange(valueMap) {
  199. const { provinceId, cityId, townId } = valueMap
  200. this.listQuery.provinceId = provinceId
  201. this.listQuery.cityId = cityId
  202. this.listQuery.townId = townId
  203. this.filterClubList()
  204. },
  205. // 分享当前页面
  206. initAppMessageShareData() {
  207. console.log(window.location.href, window.location.origin)
  208. // 重试次数
  209. let retryCount = 1
  210. this.$wxReady((wx) => {
  211. //需在用户可能点击分享按钮前就先调用
  212. wx.updateAppMessageShareData({
  213. title: '官方正品授权查询', // 分享标题
  214. desc: '官方正品授权', // 分享描述
  215. link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
  216. imgUrl: this.banner.headAppBanner, // 分享图标
  217. fail: () => {
  218. if (retryCount === 0) return
  219. this.initAppMessageShareData()
  220. retryCount--
  221. },
  222. })
  223. })
  224. },
  225. maskPhoneNumber(phoneNumber) {
  226. // 检查手机号长度是否合法(假设为11位)
  227. if (!phoneNumber || phoneNumber.length !== 11) {
  228. return '暂无';
  229. }
  230. // 提取前三位和最后四位
  231. const prefix = phoneNumber.slice(0, 3);
  232. const suffix = phoneNumber.slice(-4);
  233. // 使用星号(*)替换中间的数字
  234. const maskedMiddle = '****'.repeat(Math.ceil((phoneNumber.length - prefix.length - suffix.length) / 4));
  235. // 拼接脱敏后的手机号
  236. return prefix + maskedMiddle + suffix;
  237. }
  238. },
  239. }
  240. </script>
  241. <style scoped lang="scss">
  242. .el-input {
  243. ::v-deep {
  244. @include useTheme() {
  245. & > {
  246. .el-input.is-active .el-input__inner,
  247. .el-input__inner:focus {
  248. border-color: fetch('color');
  249. }
  250. }
  251. }
  252. }
  253. }
  254. // pc 端
  255. @media screen and (min-width: 768px) {
  256. .page {
  257. @include useTheme() {
  258. position: relative;
  259. min-height: calc(100vh - 80px - 80px);
  260. background-color: #fff;
  261. .page-top {
  262. height: 530px;
  263. background-image: fetch('pc-banner-club');
  264. // background-image: url(~/assets/theme-images/app/pc-banner-club.png);
  265. background-size: cover;
  266. background-position: center;
  267. cursor: pointer;
  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: fetch('color');
  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-container {
  303. position: absolute;
  304. top: 240px;
  305. right: -180px;
  306. display: flex;
  307. justify-content: center;
  308. align-items: center;
  309. flex-direction: column;
  310. .activity-entry {
  311. width: 168px;
  312. height: 168px;
  313. background: url(~assets/theme-images/ross/pc-icon-entry.png) no-repeat center;
  314. background-size: 168px;
  315. margin-bottom: 16px;
  316. }
  317. .navbar {
  318. width: 120px;
  319. border-radius: 16px;
  320. background: #fff;
  321. box-shadow: 0px 6px 20px rgba(40, 40, 40, 0.1);
  322. padding: 24px 0;
  323. box-sizing: border-box;
  324. z-index: 2;
  325. .link {
  326. &:hover {
  327. .icon {
  328. &.icon-device {
  329. background: url(~assets/theme-images/ross/pc-nav-entry-device-active.png) no-repeat center center,
  330. linear-gradient(180deg, #ffba63 0%, #f3920d 100%);
  331. background-size: 48px, 100%;
  332. }
  333. &.icon-doctor {
  334. background: url(~assets/theme-images/ross/pc-nav-entry-doctor-active.png) no-repeat center center,
  335. linear-gradient(180deg, #ffba63 0%, #f3920d 100%);
  336. background-size: 48px, 100%;
  337. }
  338. }
  339. .text {
  340. color: fetch('color');
  341. }
  342. }
  343. span {
  344. display: block;
  345. }
  346. .icon {
  347. width: 72px;
  348. height: 72px;
  349. // background: linear-gradient(180deg, #ffba63 0%, #f3920d 100%);
  350. background-color: #f6f6f7;
  351. border-radius: 12px;
  352. &.icon-device {
  353. background: url(~assets/theme-images/ross/pc-nav-entry-device.png) no-repeat center center #f6f6f7;
  354. background-size: 48px;
  355. }
  356. &.icon-doctor {
  357. background: url(~assets/theme-images/ross/pc-nav-entry-doctor.png) no-repeat center center #f6f6f7;
  358. background-size: 48px;
  359. }
  360. }
  361. .text {
  362. font-size: 16px;
  363. color: #404040;
  364. margin-top: 8px;
  365. }
  366. }
  367. }
  368. }
  369. .list {
  370. display: flex;
  371. align-items: center;
  372. justify-content: space-between;
  373. flex-wrap: wrap;
  374. .empty {
  375. width: 390px;
  376. }
  377. .section {
  378. width: 490px;
  379. height: 136px;
  380. background-color: #f3f5f6;
  381. border-radius: 4px;
  382. box-sizing: border-box;
  383. padding: 16px;
  384. cursor: pointer;
  385. transition: all 0.4s;
  386. &:hover {
  387. box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
  388. }
  389. .cover {
  390. display: block;
  391. width: 104px;
  392. height: 104px;
  393. }
  394. .info {
  395. position: relative;
  396. margin-left: 12px;
  397. width: 330px;
  398. @include flex-column-between;
  399. .name {
  400. width: 200px;
  401. font-size: 20px;
  402. color: #101010;
  403. font-weight: bold;
  404. text-overflow: ellipsis;
  405. white-space: nowrap;
  406. overflow: hidden;
  407. }
  408. .mobile,
  409. .address {
  410. width: 268px;
  411. position: relative;
  412. font-size: 14px;
  413. color: #404040;
  414. padding-left: 24px;
  415. line-height: 24px;
  416. text-overflow: ellipsis;
  417. white-space: nowrap;
  418. margin-top: 6px;
  419. overflow: hidden;
  420. &::after {
  421. content: '';
  422. display: block;
  423. width: 16px;
  424. height: 16px;
  425. position: absolute;
  426. left: 0;
  427. top: 50%;
  428. transform: translateY(-50%);
  429. background-size: 16px;
  430. background-repeat: no-repeat;
  431. }
  432. }
  433. .mobile {
  434. &::after {
  435. background-image: url(~assets/theme-images/common/pc-icon-mobile.png);
  436. }
  437. }
  438. .address {
  439. &::after {
  440. background-image: url(~assets/theme-images/common/pc-icon-address.png);
  441. }
  442. }
  443. .distance {
  444. position: absolute;
  445. font-size: 14px;
  446. color: #404040;
  447. top: 2px;
  448. right: 0;
  449. }
  450. }
  451. }
  452. }
  453. }
  454. }
  455. }
  456. }
  457. // 移动 端
  458. @media screen and (max-width: 768px) {
  459. .page {
  460. @include useTheme() {
  461. .page-top {
  462. height: 100vw;
  463. background: fetch('h5-banner-club');
  464. // background-image: url(~assets/theme-images/ross/h5-banner-club.png);
  465. background-size: 100vw 100vw !important;
  466. .logo {
  467. display: block;
  468. width: 14.8vw;
  469. height: 14.8vw;
  470. border-radius: 50%;
  471. background: #fff;
  472. }
  473. .name {
  474. font-size: 4vw;
  475. color: #fff;
  476. }
  477. }
  478. .page-content {
  479. position: relative;
  480. .title {
  481. font-size: 3.4vw;
  482. color: #404040;
  483. span {
  484. color: fetch('color');
  485. }
  486. }
  487. .filter {
  488. padding: 6.4vw 3.2vw 12.8vw;
  489. }
  490. .navbar-container {
  491. position: fixed;
  492. top: 50% !important;
  493. right: 3.2vw;
  494. left: unset !important;
  495. display: flex;
  496. justify-content: center;
  497. align-items: center;
  498. flex-direction: column;
  499. z-index: 2;
  500. .activity-entry {
  501. width: 23.6vw;
  502. height: 23.6vw;
  503. background: url(~assets/theme-images/ross/pc-icon-entry.png) no-repeat center;
  504. background-size: 23.6vw;
  505. margin-bottom: 1.6vw;
  506. }
  507. .navbar {
  508. width: 14vw;
  509. border-radius: 1.6vw;
  510. background: #fff;
  511. box-shadow: 0px 0.6vw 2vw rgba(40, 40, 40, 0.1);
  512. padding: 2.8vw 0;
  513. box-sizing: border-box;
  514. span {
  515. display: block;
  516. }
  517. .icon {
  518. position: relative;
  519. width: 7.2vw;
  520. height: 7.2vw;
  521. border-radius: 1.2vw;
  522. background: linear-gradient(180deg, #ffba63 0%, #f3920d 100%);
  523. &.icon-device,
  524. &.icon-doctor {
  525. &::after {
  526. content: '';
  527. display: block;
  528. width: 4.8vw;
  529. height: 4.8vw;
  530. position: absolute;
  531. left: 50%;
  532. top: 50%;
  533. transform: translate(-50%, -50%);
  534. background-size: 4.8vw !important;
  535. }
  536. }
  537. &.icon-device {
  538. &::after {
  539. background: url(~assets/theme-images/ross/pc-nav-entry-device-active.png) no-repeat center;
  540. }
  541. }
  542. &.icon-doctor {
  543. &::after {
  544. background: url(~assets/theme-images/ross/pc-nav-entry-doctor-active.png) no-repeat center;
  545. }
  546. }
  547. }
  548. .text {
  549. font-size: 2.4vw;
  550. color: #f3920d;
  551. margin-top: 1.2vw;
  552. }
  553. }
  554. }
  555. }
  556. .list {
  557. display: flex;
  558. align-items: center;
  559. flex-direction: column;
  560. .section {
  561. width: 93.6vw;
  562. height: 26vw;
  563. background-color: #f3f5f6;
  564. border-radius: 4px;
  565. box-sizing: border-box;
  566. padding: 3.2vw;
  567. .cover {
  568. display: block;
  569. width: 19.6vw;
  570. height: 19.6vw;
  571. }
  572. .info {
  573. position: relative;
  574. margin-left: 3.2vw;
  575. @include flex-column-between;
  576. .name {
  577. width: 48vw;
  578. font-size: 4vw;
  579. color: #101010;
  580. font-weight: bold;
  581. margin-top: 5.4vw;
  582. text-overflow: ellipsis;
  583. white-space: nowrap;
  584. overflow: hidden;
  585. }
  586. .mobile,
  587. .address {
  588. width: 66vw;
  589. position: relative;
  590. font-size: 3vw;
  591. color: #404040;
  592. padding-left: 5vw;
  593. line-height: 5vw;
  594. text-overflow: ellipsis;
  595. white-space: nowrap;
  596. overflow: hidden;
  597. &::after {
  598. content: '';
  599. display: block;
  600. width: 4vw;
  601. height: 4vw;
  602. position: absolute;
  603. left: 0;
  604. top: 50%;
  605. transform: translateY(-50%);
  606. background-size: 4vw 4vw;
  607. background-repeat: no-repeat;
  608. }
  609. }
  610. .mobile {
  611. &::after {
  612. background-image: url(~assets/theme-images/common/h5-icon-mobile.png);
  613. }
  614. }
  615. .address {
  616. &::after {
  617. background-image: url(~assets/theme-images/common/h5-icon-address.png);
  618. }
  619. }
  620. .distance {
  621. position: absolute;
  622. font-size: 3vw;
  623. color: #404040;
  624. top: 0.8vw;
  625. right: 0;
  626. }
  627. }
  628. }
  629. }
  630. }
  631. }
  632. }
  633. </style>