index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/649415135a7e3f0310661c1e/649415b654fe0000116ae544/16874496879438729687.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. export default {
  58. // components: {
  59. // songList,
  60. // musicList
  61. // },
  62. data() {
  63. return {
  64. healthAdvertList: [],
  65. };
  66. },
  67. onLoad() {
  68. this.getCareHealthAdvert()
  69. },
  70. onPullDownRefresh() {
  71. // this.getData();
  72. setTimeout(() => {
  73. uni.stopPullDownRefresh();
  74. }, 1000);
  75. },
  76. methods: {
  77. // 获取健康宣讲
  78. getCareHealthAdvert() {
  79. const data = {
  80. pageNo: 1,
  81. pageSize: 10,
  82. shopId: 486, // 先写死
  83. title: ''
  84. }
  85. API_doctorAdvert.getDoctorAdvertList(data).then(res => {
  86. this.healthAdvertList = res.data
  87. })
  88. },
  89. // 去往健康宣讲详情页
  90. goToDetails(id, url) {
  91. console.log('url====', url)
  92. if (url === null || url === '') {
  93. uni.navigateTo({
  94. url: '/pages/healthAdvert/careHealthAdvertLook?id=' + id
  95. })
  96. } else {
  97. uni.navigateTo({
  98. url: '/pages/care/part/webview?url=' + url
  99. })
  100. }
  101. },
  102. //播放全部 猜你喜欢
  103. // handlePlay(key) {
  104. // const list = this[key].map(item => {
  105. // return {
  106. // src: '',
  107. // title: item.name,
  108. // singer: getName(item),
  109. // coverImgUrl: getImage(item),
  110. // id: item.id
  111. // };
  112. // });
  113. // this.$store.dispatch('playAllMUsic', list);
  114. // },
  115. //
  116. // handleNative(val) {
  117. // uni.navigateTo({
  118. // url: val
  119. // });
  120. // },
  121. toSearch() {
  122. uni.navigateTo({
  123. url: '../search/index'
  124. });
  125. }
  126. }
  127. };
  128. </script>
  129. <style lang="scss" scoped>
  130. .bg-black {
  131. background-color: #000000;
  132. }
  133. .recommend-container {
  134. position: relative;
  135. background-color: #000000;
  136. height: 100%;
  137. padding-bottom: 100px;
  138. .main-container {
  139. position: relative;
  140. .banner-wrapper {
  141. box-sizing: border-box;
  142. padding: 10px;
  143. .banner-img {
  144. height: 158px;
  145. border-radius: 6px;
  146. }
  147. }
  148. .list-wrapper {
  149. margin-top: 8px;
  150. padding-bottom: 12px;
  151. .list-item {
  152. text-align: center;
  153. font-size: 24rpx;
  154. }
  155. .list-ico {
  156. font-size: 72rpx;
  157. margin-bottom: 6px;
  158. }
  159. .list-title {
  160. font-size: 28rpx;
  161. }
  162. }
  163. .music-wrapper {
  164. margin-top: 5px;
  165. background: #000000;
  166. box-sizing: border-box;
  167. padding: 15px;
  168. &:last-of-type {
  169. margin-bottom: 0;
  170. }
  171. }
  172. }
  173. .knowledge-list {
  174. margin-top: 1rem;
  175. .space-x-14 {
  176. & > view:not(:first-child),
  177. & > text:not(:first-child),
  178. & > image:not(:first-child) {
  179. margin-left: 0.88rem;
  180. }
  181. .space-y-8 {
  182. & > view:not(:first-child),
  183. & > text:not(:first-child),
  184. & > image:not(:first-child) {
  185. margin-top: 0.5rem;
  186. }
  187. .font_4 {
  188. font-size: 0.88rem;
  189. font-family: PingFangSC;
  190. line-height: 0.81rem;
  191. color: #ffffff;
  192. }
  193. .knowledge-item-title {
  194. opacity: 0.8;
  195. }
  196. .knowledge-item-desc {
  197. color: #4d4b5e;
  198. font-size: 0.63rem;
  199. font-family: PingFangSC;
  200. line-height: 0.88rem;
  201. }
  202. }
  203. .image_12 {
  204. margin-right: 1.25rem;
  205. width: 3.75rem;
  206. height: 3.75rem;
  207. }
  208. }
  209. .knowledge-item {
  210. margin-left: 3px;
  211. margin-bottom: 20px;
  212. }
  213. }
  214. }
  215. </style>