index.vue 18 KB

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