index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  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">{{ 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">{{ item.mobile || '暂无' }}</div>-->
  75. <div class="address" style="display: none;">
  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. },
  219. }
  220. </script>
  221. <style scoped lang="scss">
  222. .el-input {
  223. ::v-deep {
  224. @include useTheme() {
  225. & > {
  226. .el-input.is-active .el-input__inner,
  227. .el-input__inner:focus {
  228. border-color: fetch('color');
  229. }
  230. }
  231. }
  232. }
  233. }
  234. // pc 端
  235. @media screen and (min-width: 768px) {
  236. .page {
  237. @include useTheme() {
  238. position: relative;
  239. min-height: calc(100vh - 80px - 80px);
  240. background-color: #fff;
  241. .page-top {
  242. height: 530px;
  243. background-image: fetch('pc-banner-club');
  244. // background-image: url(~/assets/theme-images/app/pc-banner-club.png);
  245. background-size: cover;
  246. background-position: center;
  247. cursor: pointer;
  248. }
  249. .page-content {
  250. position: relative;
  251. width: 1000px;
  252. margin: 0 auto;
  253. .title {
  254. font-size: 16px;
  255. color: #404040;
  256. span {
  257. color: fetch('color');
  258. }
  259. }
  260. .filter {
  261. padding: 48px 0 105px;
  262. .search {
  263. width: 640px;
  264. margin: 0 auto;
  265. .el-input {
  266. height: 46px;
  267. font-size: 16px;
  268. .el-input__icon {
  269. font-size: 24px;
  270. line-height: 46px;
  271. margin-left: 12px;
  272. }
  273. ::v-deep {
  274. & > .el-input__inner {
  275. height: 46px;
  276. padding-left: 55px;
  277. }
  278. }
  279. }
  280. }
  281. }
  282. .navbar-container {
  283. position: absolute;
  284. top: 240px;
  285. right: -180px;
  286. display: flex;
  287. justify-content: center;
  288. align-items: center;
  289. flex-direction: column;
  290. .activity-entry {
  291. width: 168px;
  292. height: 168px;
  293. background: url(~assets/theme-images/ross/pc-icon-entry.png) no-repeat center;
  294. background-size: 168px;
  295. margin-bottom: 16px;
  296. }
  297. .navbar {
  298. width: 120px;
  299. border-radius: 16px;
  300. background: #fff;
  301. box-shadow: 0px 6px 20px rgba(40, 40, 40, 0.1);
  302. padding: 24px 0;
  303. box-sizing: border-box;
  304. z-index: 2;
  305. .link {
  306. &:hover {
  307. .icon {
  308. &.icon-device {
  309. background: url(~assets/theme-images/ross/pc-nav-entry-device-active.png) no-repeat center center,
  310. linear-gradient(180deg, #ffba63 0%, #f3920d 100%);
  311. background-size: 48px, 100%;
  312. }
  313. &.icon-doctor {
  314. background: url(~assets/theme-images/ross/pc-nav-entry-doctor-active.png) no-repeat center center,
  315. linear-gradient(180deg, #ffba63 0%, #f3920d 100%);
  316. background-size: 48px, 100%;
  317. }
  318. }
  319. .text {
  320. color: fetch('color');
  321. }
  322. }
  323. span {
  324. display: block;
  325. }
  326. .icon {
  327. width: 72px;
  328. height: 72px;
  329. // background: linear-gradient(180deg, #ffba63 0%, #f3920d 100%);
  330. background-color: #f6f6f7;
  331. border-radius: 12px;
  332. &.icon-device {
  333. background: url(~assets/theme-images/ross/pc-nav-entry-device.png) no-repeat center center #f6f6f7;
  334. background-size: 48px;
  335. }
  336. &.icon-doctor {
  337. background: url(~assets/theme-images/ross/pc-nav-entry-doctor.png) no-repeat center center #f6f6f7;
  338. background-size: 48px;
  339. }
  340. }
  341. .text {
  342. font-size: 16px;
  343. color: #404040;
  344. margin-top: 8px;
  345. }
  346. }
  347. }
  348. }
  349. .list {
  350. display: flex;
  351. align-items: center;
  352. justify-content: space-between;
  353. flex-wrap: wrap;
  354. .empty {
  355. width: 390px;
  356. }
  357. .section {
  358. width: 490px;
  359. height: 136px;
  360. background-color: #f3f5f6;
  361. border-radius: 4px;
  362. box-sizing: border-box;
  363. padding: 16px;
  364. cursor: pointer;
  365. transition: all 0.4s;
  366. &:hover {
  367. box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
  368. }
  369. .cover {
  370. display: block;
  371. width: 104px;
  372. height: 104px;
  373. }
  374. .info {
  375. position: relative;
  376. margin-left: 12px;
  377. width: 330px;
  378. @include flex-column-between;
  379. .name {
  380. width: 200px;
  381. font-size: 20px;
  382. color: #101010;
  383. font-weight: bold;
  384. margin-top: 40px;
  385. text-overflow: ellipsis;
  386. white-space: nowrap;
  387. overflow: hidden;
  388. }
  389. .mobile,
  390. .address {
  391. width: 268px;
  392. position: relative;
  393. font-size: 14px;
  394. color: #404040;
  395. padding-left: 24px;
  396. line-height: 24px;
  397. text-overflow: ellipsis;
  398. white-space: nowrap;
  399. margin-top: 6px;
  400. overflow: hidden;
  401. &::after {
  402. content: '';
  403. display: block;
  404. width: 16px;
  405. height: 16px;
  406. position: absolute;
  407. left: 0;
  408. top: 50%;
  409. transform: translateY(-50%);
  410. background-size: 16px;
  411. background-repeat: no-repeat;
  412. }
  413. }
  414. .mobile {
  415. &::after {
  416. background-image: url(~assets/theme-images/common/pc-icon-mobile.png);
  417. }
  418. }
  419. .address {
  420. &::after {
  421. background-image: url(~assets/theme-images/common/pc-icon-address.png);
  422. }
  423. }
  424. .distance {
  425. position: absolute;
  426. font-size: 14px;
  427. color: #404040;
  428. top: 2px;
  429. right: 0;
  430. }
  431. }
  432. }
  433. }
  434. }
  435. }
  436. }
  437. }
  438. // 移动 端
  439. @media screen and (max-width: 768px) {
  440. .page {
  441. @include useTheme() {
  442. .page-top {
  443. height: 100vw;
  444. background: fetch('h5-banner-club');
  445. // background-image: url(~assets/theme-images/ross/h5-banner-club.png);
  446. background-size: 100vw 100vw !important;
  447. .logo {
  448. display: block;
  449. width: 14.8vw;
  450. height: 14.8vw;
  451. border-radius: 50%;
  452. background: #fff;
  453. }
  454. .name {
  455. font-size: 4vw;
  456. color: #fff;
  457. }
  458. }
  459. .page-content {
  460. position: relative;
  461. .title {
  462. font-size: 3.4vw;
  463. color: #404040;
  464. span {
  465. color: fetch('color');
  466. }
  467. }
  468. .filter {
  469. padding: 6.4vw 3.2vw 12.8vw;
  470. }
  471. .navbar-container {
  472. position: fixed;
  473. top: 50% !important;
  474. right: 3.2vw;
  475. left: unset !important;
  476. display: flex;
  477. justify-content: center;
  478. align-items: center;
  479. flex-direction: column;
  480. z-index: 2;
  481. .activity-entry {
  482. width: 23.6vw;
  483. height: 23.6vw;
  484. background: url(~assets/theme-images/ross/pc-icon-entry.png) no-repeat center;
  485. background-size: 23.6vw;
  486. margin-bottom: 1.6vw;
  487. }
  488. .navbar {
  489. width: 14vw;
  490. border-radius: 1.6vw;
  491. background: #fff;
  492. box-shadow: 0px 0.6vw 2vw rgba(40, 40, 40, 0.1);
  493. padding: 2.8vw 0;
  494. box-sizing: border-box;
  495. span {
  496. display: block;
  497. }
  498. .icon {
  499. position: relative;
  500. width: 7.2vw;
  501. height: 7.2vw;
  502. border-radius: 1.2vw;
  503. background: linear-gradient(180deg, #ffba63 0%, #f3920d 100%);
  504. &.icon-device,
  505. &.icon-doctor {
  506. &::after {
  507. content: '';
  508. display: block;
  509. width: 4.8vw;
  510. height: 4.8vw;
  511. position: absolute;
  512. left: 50%;
  513. top: 50%;
  514. transform: translate(-50%, -50%);
  515. background-size: 4.8vw !important;
  516. }
  517. }
  518. &.icon-device {
  519. &::after {
  520. background: url(~assets/theme-images/ross/pc-nav-entry-device-active.png) no-repeat center;
  521. }
  522. }
  523. &.icon-doctor {
  524. &::after {
  525. background: url(~assets/theme-images/ross/pc-nav-entry-doctor-active.png) no-repeat center;
  526. }
  527. }
  528. }
  529. .text {
  530. font-size: 2.4vw;
  531. color: #f3920d;
  532. margin-top: 1.2vw;
  533. }
  534. }
  535. }
  536. }
  537. .list {
  538. display: flex;
  539. align-items: center;
  540. flex-direction: column;
  541. .section {
  542. width: 93.6vw;
  543. height: 26vw;
  544. background-color: #f3f5f6;
  545. border-radius: 4px;
  546. box-sizing: border-box;
  547. padding: 3.2vw;
  548. .cover {
  549. display: block;
  550. width: 19.6vw;
  551. height: 19.6vw;
  552. }
  553. .info {
  554. position: relative;
  555. margin-left: 3.2vw;
  556. @include flex-column-between;
  557. .name {
  558. width: 48vw;
  559. font-size: 4vw;
  560. color: #101010;
  561. font-weight: bold;
  562. margin-bottom: 4vw;
  563. text-overflow: ellipsis;
  564. white-space: nowrap;
  565. overflow: hidden;
  566. }
  567. .mobile,
  568. .address {
  569. width: 66vw;
  570. position: relative;
  571. font-size: 3vw;
  572. color: #404040;
  573. padding-left: 5vw;
  574. line-height: 5vw;
  575. text-overflow: ellipsis;
  576. white-space: nowrap;
  577. overflow: hidden;
  578. &::after {
  579. content: '';
  580. display: block;
  581. width: 4vw;
  582. height: 4vw;
  583. position: absolute;
  584. left: 0;
  585. top: 50%;
  586. transform: translateY(-50%);
  587. background-size: 4vw 4vw;
  588. background-repeat: no-repeat;
  589. }
  590. }
  591. .mobile {
  592. &::after {
  593. background-image: url(~assets/theme-images/common/h5-icon-mobile.png);
  594. }
  595. }
  596. .address {
  597. &::after {
  598. background-image: url(~assets/theme-images/common/h5-icon-address.png);
  599. }
  600. }
  601. .distance {
  602. position: absolute;
  603. font-size: 3vw;
  604. color: #404040;
  605. top: 0.8vw;
  606. right: 0;
  607. }
  608. }
  609. }
  610. }
  611. }
  612. }
  613. }
  614. </style>