index.vue 20 KB

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