index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  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">
  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(['screenWidth', '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. mounted() {
  115. window.addEventListener('scroll', () => {
  116. this.scrollTop = document.documentElement.scrollTop
  117. })
  118. this.getBanner() // 获取轮播图
  119. // 监听页面尺寸变化
  120. this.screenWidth = document.body.clientWidth
  121. window.onresize = () => {
  122. return (() => {
  123. this.screenWidth = document.body.clientWidth
  124. })()
  125. }
  126. },
  127. beforeDestroy() {
  128. window.removeEventListener('scroll', () => {
  129. this.scrollTop = document.documentElement.scrollTop
  130. })
  131. },
  132. watch: {
  133. screenWidth: {
  134. handler(val) {
  135. const changeBanner = document.getElementsByClassName('page-top')[0]
  136. if (changeBanner) {
  137. if (val > 768) {
  138. if(this.banner.headPcBanner) {
  139. changeBanner.style.backgroundImage = 'url('+ this.banner.headPcBanner+ ')'
  140. }
  141. }else {
  142. if(this.banner.headAppBanner) {
  143. changeBanner.style.backgroundImage = 'url('+ this.banner.headAppBanner+ ')'
  144. }
  145. }
  146. }
  147. },
  148. immediate: true,
  149. deep: true
  150. }
  151. },
  152. methods: {
  153. // 抖音挑战赛
  154. toActivity() {
  155. this.banner.jumpLink && this.$router.push(this.banner.jumpLink)
  156. },
  157. // 从缓存中获取数据
  158. initFromCache(cacheData) {
  159. const data = objectCover(this, cacheData)
  160. console.log(data)
  161. this.$nextTick(() => {
  162. this.$refs.citySelect.initSelectValue({
  163. provinceId: data.provinceId,
  164. cityId: data.cityId,
  165. townId: data.townId,
  166. })
  167. })
  168. },
  169. // banner
  170. async getBanner() {
  171. const { data } = await this.$http.api.bannerImg(this.authUserId)
  172. this.banner = data
  173. const changeBanner = document.getElementsByClassName('page-top')[0]
  174. if (this.screenWidth > 768) {
  175. this.banner.headPcBanner && (changeBanner.style.backgroundImage = 'url('+ this.banner.headPcBanner+ ')')
  176. }else {
  177. this.banner.headAppBanner && (changeBanner.style.backgroundImage = 'url('+ this.banner.headAppBanner+ ')')
  178. }
  179. },
  180. // 城市变化
  181. onCityChange(valueMap) {
  182. const { provinceId, cityId, townId } = valueMap
  183. this.listQuery.provinceId = provinceId
  184. this.listQuery.cityId = cityId
  185. this.listQuery.townId = townId
  186. this.filterClubList()
  187. },
  188. },
  189. }
  190. </script>
  191. <style scoped lang="scss">
  192. .el-input {
  193. ::v-deep {
  194. @include useTheme() {
  195. & > {
  196. .el-input.is-active .el-input__inner,
  197. .el-input__inner:focus {
  198. border-color: fetch('color');
  199. }
  200. }
  201. }
  202. }
  203. }
  204. // pc 端
  205. @media screen and (min-width: 768px) {
  206. .page {
  207. @include useTheme() {
  208. position: relative;
  209. min-height: calc(100vh - 80px - 80px);
  210. background-color: #fff;
  211. .page-top {
  212. height: 530px;
  213. background-image: fetch('pc-banner-club');
  214. // background-image: url(~/assets/theme-images/app/pc-banner-club.png);
  215. background-size: cover;
  216. background-position: center;
  217. cursor: pointer;
  218. }
  219. .page-content {
  220. position: relative;
  221. width: 1000px;
  222. margin: 0 auto;
  223. .title {
  224. font-size: 16px;
  225. color: #404040;
  226. span {
  227. color: fetch('color');
  228. }
  229. }
  230. .filter {
  231. padding: 48px 0 105px;
  232. .search {
  233. width: 640px;
  234. margin: 0 auto;
  235. .el-input {
  236. height: 46px;
  237. font-size: 16px;
  238. .el-input__icon {
  239. font-size: 24px;
  240. line-height: 46px;
  241. margin-left: 12px;
  242. }
  243. ::v-deep {
  244. & > .el-input__inner {
  245. height: 46px;
  246. padding-left: 55px;
  247. }
  248. }
  249. }
  250. }
  251. }
  252. .navbar-container {
  253. position: absolute;
  254. top: 240px;
  255. right: -180px;
  256. display: flex;
  257. justify-content: center;
  258. align-items: center;
  259. flex-direction: column;
  260. .activity-entry {
  261. width: 168px;
  262. height: 168px;
  263. background: url(~assets/theme-images/ross/pc-icon-entry.png) no-repeat center;
  264. background-size: 168px;
  265. margin-bottom: 16px;
  266. }
  267. .navbar {
  268. width: 120px;
  269. border-radius: 16px;
  270. background: #fff;
  271. box-shadow: 0px 6px 20px rgba(40, 40, 40, 0.1);
  272. padding: 24px 0;
  273. box-sizing: border-box;
  274. z-index: 2;
  275. .link {
  276. &:hover {
  277. .icon {
  278. &.icon-device {
  279. background: url(~assets/theme-images/ross/pc-nav-entry-device-active.png) no-repeat center center,
  280. linear-gradient(180deg, #ffba63 0%, #f3920d 100%);
  281. background-size: 48px, 100%;
  282. }
  283. &.icon-doctor {
  284. background: url(~assets/theme-images/ross/pc-nav-entry-doctor-active.png) no-repeat center center,
  285. linear-gradient(180deg, #ffba63 0%, #f3920d 100%);
  286. background-size: 48px, 100%;
  287. }
  288. }
  289. .text {
  290. color: fetch('color');
  291. }
  292. }
  293. span {
  294. display: block;
  295. }
  296. .icon {
  297. width: 72px;
  298. height: 72px;
  299. // background: linear-gradient(180deg, #ffba63 0%, #f3920d 100%);
  300. background-color: #f6f6f7;
  301. border-radius: 12px;
  302. &.icon-device {
  303. background: url(~assets/theme-images/ross/pc-nav-entry-device.png) no-repeat center center #f6f6f7;
  304. background-size: 48px;
  305. }
  306. &.icon-doctor {
  307. background: url(~assets/theme-images/ross/pc-nav-entry-doctor.png) no-repeat center center #f6f6f7;
  308. background-size: 48px;
  309. }
  310. }
  311. .text {
  312. font-size: 16px;
  313. color: #404040;
  314. margin-top: 8px;
  315. }
  316. }
  317. }
  318. }
  319. .list {
  320. display: flex;
  321. align-items: center;
  322. justify-content: space-between;
  323. flex-wrap: wrap;
  324. .empty {
  325. width: 390px;
  326. }
  327. .section {
  328. width: 490px;
  329. height: 136px;
  330. background-color: #f3f5f6;
  331. border-radius: 4px;
  332. box-sizing: border-box;
  333. padding: 16px;
  334. cursor: pointer;
  335. transition: all 0.4s;
  336. &:hover {
  337. box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
  338. }
  339. .cover {
  340. display: block;
  341. width: 104px;
  342. height: 104px;
  343. }
  344. .info {
  345. position: relative;
  346. margin-left: 12px;
  347. width: 330px;
  348. .name {
  349. width: 200px;
  350. font-size: 18px;
  351. color: #101010;
  352. font-weight: bold;
  353. margin-bottom: 24px;
  354. text-overflow: ellipsis;
  355. white-space: nowrap;
  356. overflow: hidden;
  357. }
  358. .mobile,
  359. .address {
  360. width: 268px;
  361. position: relative;
  362. font-size: 14px;
  363. color: #404040;
  364. padding-left: 24px;
  365. line-height: 24px;
  366. text-overflow: ellipsis;
  367. white-space: nowrap;
  368. margin-top: 6px;
  369. overflow: hidden;
  370. &::after {
  371. content: '';
  372. display: block;
  373. width: 16px;
  374. height: 16px;
  375. position: absolute;
  376. left: 0;
  377. top: 50%;
  378. transform: translateY(-50%);
  379. background-size: 16px;
  380. background-repeat: no-repeat;
  381. }
  382. }
  383. .mobile {
  384. &::after {
  385. background-image: url(~assets/theme-images/common/pc-icon-mobile.png);
  386. }
  387. }
  388. .address {
  389. &::after {
  390. background-image: url(~assets/theme-images/common/pc-icon-address.png);
  391. }
  392. }
  393. .distance {
  394. position: absolute;
  395. font-size: 14px;
  396. color: #404040;
  397. top: 2px;
  398. right: 0;
  399. }
  400. }
  401. }
  402. }
  403. }
  404. }
  405. }
  406. }
  407. // 移动 端
  408. @media screen and (max-width: 768px) {
  409. .page {
  410. @include useTheme() {
  411. .page-top {
  412. height: 100vw;
  413. background: fetch('h5-banner-club');
  414. // background-image: url(~assets/theme-images/ross/h5-banner-club.png);
  415. background-size: 100vw 100vw !important;
  416. .logo {
  417. display: block;
  418. width: 14.8vw;
  419. height: 14.8vw;
  420. border-radius: 50%;
  421. background: #fff;
  422. }
  423. .name {
  424. font-size: 4vw;
  425. color: #fff;
  426. }
  427. }
  428. .page-content {
  429. position: relative;
  430. .title {
  431. font-size: 3.4vw;
  432. color: #404040;
  433. span {
  434. color: fetch('color');
  435. }
  436. }
  437. .filter {
  438. padding: 6.4vw 3.2vw 12.8vw;
  439. }
  440. .navbar-container {
  441. position: fixed;
  442. top: 50% !important;
  443. right: 3.2vw;
  444. left: unset !important;
  445. display: flex;
  446. justify-content: center;
  447. align-items: center;
  448. flex-direction: column;
  449. z-index: 2;
  450. .activity-entry {
  451. width: 23.6vw;
  452. height: 23.6vw;
  453. background: url(~assets/theme-images/ross/pc-icon-entry.png) no-repeat center;
  454. background-size: 23.6vw;
  455. margin-bottom: 1.6vw;
  456. }
  457. .navbar {
  458. width: 14vw;
  459. border-radius: 1.6vw;
  460. background: #fff;
  461. box-shadow: 0px 0.6vw 2vw rgba(40, 40, 40, 0.1);
  462. padding: 2.8vw 0;
  463. box-sizing: border-box;
  464. span {
  465. display: block;
  466. }
  467. .icon {
  468. position: relative;
  469. width: 7.2vw;
  470. height: 7.2vw;
  471. border-radius: 1.2vw;
  472. background: linear-gradient(180deg, #ffba63 0%, #f3920d 100%);
  473. &.icon-device,
  474. &.icon-doctor {
  475. &::after {
  476. content: '';
  477. display: block;
  478. width: 4.8vw;
  479. height: 4.8vw;
  480. position: absolute;
  481. left: 50%;
  482. top: 50%;
  483. transform: translate(-50%, -50%);
  484. background-size: 4.8vw !important;
  485. }
  486. }
  487. &.icon-device {
  488. &::after {
  489. background: url(~assets/theme-images/ross/pc-nav-entry-device-active.png) no-repeat center;
  490. }
  491. }
  492. &.icon-doctor {
  493. &::after {
  494. background: url(~assets/theme-images/ross/pc-nav-entry-doctor-active.png) no-repeat center;
  495. }
  496. }
  497. }
  498. .text {
  499. font-size: 2.4vw;
  500. color: #f3920d;
  501. margin-top: 1.2vw;
  502. }
  503. }
  504. }
  505. }
  506. .list {
  507. display: flex;
  508. align-items: center;
  509. flex-direction: column;
  510. .section {
  511. width: 93.6vw;
  512. height: 26vw;
  513. background-color: #f3f5f6;
  514. border-radius: 4px;
  515. box-sizing: border-box;
  516. padding: 3.2vw;
  517. .cover {
  518. display: block;
  519. width: 19.6vw;
  520. height: 19.6vw;
  521. }
  522. .info {
  523. position: relative;
  524. margin-left: 3.2vw;
  525. .name {
  526. width: 48vw;
  527. font-size: 4vw;
  528. color: #101010;
  529. font-weight: bold;
  530. margin-bottom: 4vw;
  531. text-overflow: ellipsis;
  532. white-space: nowrap;
  533. overflow: hidden;
  534. }
  535. .mobile,
  536. .address {
  537. width: 66vw;
  538. position: relative;
  539. font-size: 3vw;
  540. color: #404040;
  541. padding-left: 5vw;
  542. line-height: 5vw;
  543. text-overflow: ellipsis;
  544. white-space: nowrap;
  545. overflow: hidden;
  546. &::after {
  547. content: '';
  548. display: block;
  549. width: 4vw;
  550. height: 4vw;
  551. position: absolute;
  552. left: 0;
  553. top: 50%;
  554. transform: translateY(-50%);
  555. background-size: 4vw 4vw;
  556. background-repeat: no-repeat;
  557. }
  558. }
  559. .mobile {
  560. &::after {
  561. background-image: url(~assets/theme-images/common/h5-icon-mobile.png);
  562. }
  563. }
  564. .address {
  565. &::after {
  566. background-image: url(~assets/theme-images/common/h5-icon-address.png);
  567. }
  568. }
  569. .distance {
  570. position: absolute;
  571. font-size: 3vw;
  572. color: #404040;
  573. top: 0.8vw;
  574. right: 0;
  575. }
  576. }
  577. }
  578. }
  579. }
  580. }
  581. }
  582. </style>