index.vue 18 KB

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