index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <view class="recommend-container page-background">
  3. <view class="bg-black">
  4. <cu-custom bgColor="#000000"><view slot="content" style="color: #ffffff">UU睡眠</view></cu-custom>
  5. </view>
  6. <!-- <scroll-view :style="{ height: height }" class="main-container" scroll-y>-->
  7. <!-- <view class="bg-black">-->
  8. <!-- <view class="banner-wrapper">-->
  9. <!-- <swiper class="screen-swiper square-dot" style="min-height: 317upx;" :indicator-dots="true" :circular="true" :autoplay="true" interval="5000" duration="500">-->
  10. <!-- <swiper-item v-for="item in swiperList" :key="item.bannerId">-->
  11. <!-- <image :src="item.pic || item.imageUrl" mode="scaleToFill" class="banner-img"></image>-->
  12. <!-- </swiper-item>-->
  13. <!-- </swiper>-->
  14. <!-- </view>-->
  15. <!-- </view>-->
  16. <!-- <view class="music-wrapper" v-if="recommendList.length > 0">-->
  17. <!-- <box-title title="UU推荐" buttonName="更多" iconName="right" @handlePlay="handleNative('../songList/index')"></box-title>-->
  18. <!-- <song-list :currentList="recommendList"></song-list>-->
  19. <!-- </view>-->
  20. <!-- <view class="music-wrapper" v-if="dayRecommendList.length > 0">-->
  21. <!-- <box-title title="睡眠音乐" buttonName="更多" iconName="kaishi2" @handlePlay="handlePlay('dayRecommendList')"></box-title>-->
  22. <!-- <music-list :currentList="dayRecommendList"></music-list>-->
  23. <!-- </view>-->
  24. <!-- </scroll-view>-->
  25. <!-- <music-control />-->
  26. <view class="main-container">
  27. <view class="music-wrapper" v-if="healthAdvertList.length > 0">
  28. <!-- <box-title title="睡眠小知识" buttonName="更多" iconName="kaishi2" @handlePlay="handlePlay('dayRecommendList')"></box-title>-->
  29. <box-title title="睡眠小知识"></box-title>
  30. <view class="flex-col justify-start knowledge-list">
  31. <view v-for="(item, index) in healthAdvertList" :key="index" class="flex-row items-center space-x-14 knowledge-item" @click="goToDetails(item.id,item.html_url)">
  32. <view class="flex-col flex-auto space-y-8">
  33. <text class="self-start font_4 knowledge-item-title">{{item.title}}</text>
  34. <text v-if="item.summary.length>25" class="knowledge-item-desc">
  35. {{item.summary.substring(0,22)}}...
  36. </text>
  37. <text v-else class="knowledge-item-desc">
  38. {{item.summary.substring(0,22)}}...
  39. </text>
  40. </view>
  41. <image
  42. class="shrink-0 image_12"
  43. src="http://wdklmall.oss-cn-shenzhen.aliyuncs.com/mallgoods/goods/D592E277FFA7474E965A721AF93132D7.png"
  44. />
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <!-- <tab-bar currentPage="index" /> -->
  50. </view>
  51. </template>
  52. <script>
  53. // import songList from './components/songList.vue';
  54. // import musicList from './components/musicList.vue';
  55. // import { getImage, getName } from '@/utils/index.js';
  56. import * as API_doctorAdvert from '@/api/doctor_advert'
  57. import {getDoctorAdvertList} from "../../api/doctor_advert";
  58. export default {
  59. // components: {
  60. // songList,
  61. // musicList
  62. // },
  63. data() {
  64. return {
  65. healthAdvertList: [],
  66. };
  67. },
  68. onLoad() {
  69. this.getCareHealthAdvert()
  70. },
  71. onPullDownRefresh() {
  72. // this.getData();
  73. setTimeout(() => {
  74. uni.stopPullDownRefresh();
  75. }, 1000);
  76. },
  77. methods: {
  78. // 获取健康宣讲
  79. getCareHealthAdvert() {
  80. const data = {
  81. groupId: 12
  82. }
  83. API_doctorAdvert.listByGroupId(data).then(res => {
  84. this.healthAdvertList = res
  85. })
  86. },
  87. // 去往健康宣讲详情页
  88. goToDetails(id, url) {
  89. console.log('url====', url)
  90. if (url === null || url === '') {
  91. uni.navigateTo({
  92. url: '/pages/healthAdvert/careHealthAdvertLook?id=' + id
  93. })
  94. } else {
  95. uni.navigateTo({
  96. url: '/pages/healthAdvert/webview?url=' + url
  97. })
  98. }
  99. },
  100. //播放全部 猜你喜欢
  101. // handlePlay(key) {
  102. // const list = this[key].map(item => {
  103. // return {
  104. // src: '',
  105. // title: item.name,
  106. // singer: getName(item),
  107. // coverImgUrl: getImage(item),
  108. // id: item.id
  109. // };
  110. // });
  111. // this.$store.dispatch('playAllMUsic', list);
  112. // },
  113. //
  114. // handleNative(val) {
  115. // uni.navigateTo({
  116. // url: val
  117. // });
  118. // },
  119. toSearch() {
  120. uni.navigateTo({
  121. url: '../search/index'
  122. });
  123. }
  124. }
  125. };
  126. </script>
  127. <style lang="scss" scoped>
  128. .bg-black {
  129. background-color: #000000;
  130. }
  131. .recommend-container {
  132. position: relative;
  133. background-color: #000000;
  134. height: 100%;
  135. padding-bottom: 100px;
  136. .main-container {
  137. position: relative;
  138. .banner-wrapper {
  139. box-sizing: border-box;
  140. padding: 10px;
  141. .banner-img {
  142. height: 158px;
  143. border-radius: 6px;
  144. }
  145. }
  146. .list-wrapper {
  147. margin-top: 8px;
  148. padding-bottom: 12px;
  149. .list-item {
  150. text-align: center;
  151. font-size: 24rpx;
  152. }
  153. .list-ico {
  154. font-size: 72rpx;
  155. margin-bottom: 6px;
  156. }
  157. .list-title {
  158. font-size: 28rpx;
  159. }
  160. }
  161. .music-wrapper {
  162. margin-top: 5px;
  163. // background: #000000;
  164. box-sizing: border-box;
  165. padding: 15px;
  166. background: linear-gradient(90deg, rgba(86, 17, 247, 0.5) 0%, #4d9efa 100%);
  167. &:last-of-type {
  168. margin-bottom: 0;
  169. }
  170. }
  171. }
  172. .knowledge-list {
  173. margin-top: 1rem;
  174. .space-x-14 {
  175. & > view:not(:first-child),
  176. & > text:not(:first-child),
  177. & > image:not(:first-child) {
  178. margin-left: 0.88rem;
  179. }
  180. .space-y-8 {
  181. & > view:not(:first-child),
  182. & > text:not(:first-child),
  183. & > image:not(:first-child) {
  184. margin-top: 0.5rem;
  185. }
  186. .font_4 {
  187. font-size: 0.88rem;
  188. font-family: PingFangSC;
  189. line-height: 0.81rem;
  190. color: #ffffff;
  191. }
  192. .knowledge-item-title {
  193. opacity: 0.8;
  194. line-height: 1.2rem;
  195. }
  196. .knowledge-item-desc {
  197. // color: #4d4b5e;
  198. color: #ffffff;
  199. font-size: 0.63rem;
  200. font-family: PingFangSC;
  201. line-height: 0.88rem;
  202. }
  203. }
  204. .image_12 {
  205. margin-right: 1.25rem;
  206. width: 3.75rem;
  207. height: 3.75rem;
  208. }
  209. }
  210. .knowledge-item {
  211. margin-left: 3px;
  212. margin-bottom: 20px;
  213. padding-bottom: 20px;
  214. border-bottom: 1px solid #ededed;
  215. }
  216. }
  217. }
  218. </style>