hd.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <view>
  3. <u-navbar :is-back="false" :border-bottom="false" :background="background">
  4. <view style="width: 100%;padding: 0 10rpx;">
  5. <view class="flztoa inlbhhe ">
  6. <navigator class="indihh" url="../index/index" open-type="redirect" hover-class="none">
  7. <text>最新</text>
  8. </navigator>
  9. <!-- <navigator class="indihh" url="../index/hykt" open-type="redirect" hover-class="none">
  10. <text>会员</text>
  11. </navigator> -->
  12. <navigator class="indihh" url="../index/zylx" open-type="redirect" hover-class="none">
  13. <text>治愈练习</text>
  14. </navigator>
  15. <view class="indihh">
  16. <text style="font-size: 44rpx;color: #374B6E;">活动</text>
  17. <view style="width: 26rpx;height: 4rpx;background: #374B6E;border-radius: 4rpx;margin-top: 10rpx;"></view>
  18. </view>
  19. </view>
  20. </view>
  21. </u-navbar>
  22. <view class="hdxmjjr">
  23. <view class="hddderimg" style="overflow: hidden;">
  24. <!-- 图片预留 -->
  25. <image :src="bannerImage" style="width: 100%; height: 100%;" mode="aspectFill"></image>
  26. </view>
  27. <view class="hdwdxinr">
  28. <navigator url="/pages/lecturer/wdhd" hover-class="none">
  29. <text style="font-size: 44rpx;color: #374B6E;">我的活动</text>
  30. </navigator>
  31. <view class="hdmmner"></view>
  32. <navigator url="/pages/lecturer/wdkc" hover-class="none">
  33. <text style="font-size: 44rpx;color: #374B6E;">我的课程</text>
  34. </navigator>
  35. </view>
  36. </view>
  37. <view class="inyyeddf" v-if="kclist.length">
  38. <view class="indhuyr">
  39. <view class="indjbrr"></view>
  40. <text>热门课程</text>
  41. </view>
  42. <scroll-view class="hdceert" style="white-space: nowrap;" @scrolltolower="scrolltolowerkc" scroll-x>
  43. <view class="hdhhyyr" v-for="(item,index) in kclist" :key="index" style="display: inline-block;">
  44. </view>
  45. </scroll-view>
  46. </view>
  47. <view class="inyyeddf" v-if="zblist.length">
  48. <view class="indhuyr">
  49. <view class="indjbrr"></view>
  50. <text>直播课程</text>
  51. </view>
  52. <scroll-view class="hdceert" style="white-space: nowrap;" @scrolltolower="scrolltolowerzb" scroll-x>
  53. <view class="hdhhyyr" v-for="(item,index) in zblist" :key="index" style="display: inline-block;">
  54. </view>
  55. </scroll-view>
  56. </view>
  57. <view class="inyyeddf" v-if="actlist.length">
  58. <view class="indhuyr">
  59. <view class="indjbrr"></view>
  60. <text>线下活动</text>
  61. </view>
  62. <scroll-view class="hdceert" style="white-space: nowrap;" @scrolltolower="scrolltoloweract" scroll-x >
  63. <view class="hdhhyyr" v-for="(item,index) in actlist" :key="index" @click="toDetail(item.id)" style="display: inline-block; overflow: hidden;">
  64. <image :src="item.imglist[0]" mode="aspectFill" style="width: 100%; height: 100%;"></image>
  65. </view>
  66. </scroll-view>
  67. </view>
  68. <view class="youjdje" @click="toAddcourse">
  69. <image src="/static/index/inr2.png" style="width: 96rpx;height: 96rpx;min-width: 96rpx;" mode=""></image>
  70. </view>
  71. <view style="height: 130rpx;"></view>
  72. <view class="dibuboot">
  73. <navigator class="dibubootlb" url="../index/index" open-type="redirect" hover-class="none">
  74. <image src="/static/dibu/bob1.png" style="width: 48rpx;height: 48rpx;"></image>
  75. <text style="color: #374B6E">首页</text>
  76. </navigator>
  77. <!-- <navigator class="dibubootlb" url="../lecturer/wdzx" open-type="redirect" hover-class="none">
  78. <image src="/static/dibu/boa2.png" style="width: 48rpx;height: 48rpx;"></image>
  79. <text>咨询</text>
  80. </navigator>
  81. <navigator class="dibubootlb" url="../index/jiehuo" open-type="redirect" hover-class="none">
  82. <image src="/static/dibu/boa3.png" style="width: 48rpx;height: 48rpx;"></image>
  83. <text>解惑</text>
  84. </navigator> -->
  85. <navigator class="dibubootlb" url="../lecturer/my" open-type="redirect" hover-class="none">
  86. <image src="/static/dibu/boa4.png" style="width: 48rpx;height: 48rpx;"></image>
  87. <text>我的</text>
  88. </navigator>
  89. </view>
  90. </view>
  91. </template>
  92. <style>
  93. page {
  94. background: #FAFAFA;
  95. }
  96. </style>
  97. <script>
  98. export default {
  99. data() {
  100. return {
  101. background: {
  102. backgroundColor: '#ffffff',
  103. },
  104. bannerImage:'', // 顶部图片
  105. kclist:[], // 热门课程
  106. kcpage:1, // 当前第几页课程
  107. kctotal:0, // 课程总条数
  108. kc_id:0, // 热门课程的id
  109. actlist:[], // 活动列表
  110. actpage:1, // 当前第几页活动
  111. acttotal:0, // 活动总条数
  112. zblist:[], // 直播课程列表
  113. zbpage:1, // 当前第几页直播课程
  114. zbtotal:20, // 直播课程总条数
  115. }
  116. },
  117. onLoad() {
  118. this.getCover()
  119. this.getMyCourseOrder()
  120. this.getAcList()
  121. // 我的报名 留着备用
  122. // this.$post({
  123. // data:{
  124. // do:'MyGoodOrder',
  125. // data:{
  126. // page:1,
  127. // num:10,
  128. // type:1,
  129. // user_id:uni.getStorageSync('id'),
  130. // pw:375
  131. // }
  132. // }
  133. // }).then(res=>{
  134. // console.log(res,'+++++')
  135. // console.log(JSON.parse(res.data.list[0].app_content))
  136. // })
  137. },
  138. methods: {
  139. // 热门课程到底
  140. scrolltolowerkc(){
  141. if(this.kclist.length<this.kctotal){
  142. this.zbpage++
  143. this.getClassList(this.kc_id)
  144. }
  145. },
  146. // 直播划到底
  147. scrolltolowerzb(){
  148. if(this.zblist.length<this.zbtotal){
  149. this.zbpage++
  150. // 调直播课程接口
  151. }
  152. },
  153. // 活动划到底
  154. scrolltoloweract(){
  155. if(this.actlist.length < this.acttotal){
  156. this.actpage++
  157. this.getAcList()
  158. }
  159. },
  160. // 获取课程分类
  161. getMyCourseOrder(){
  162. this.$post({
  163. data:{
  164. do:'CourseType',
  165. data:{
  166. user_id:uni.getStorageSync('id'),
  167. type_id:0,
  168. pw:375
  169. }
  170. }
  171. }).then(res=>{
  172. let id = res.data.find(item=>item.title=='热门课程').id
  173. this.kc_id = id
  174. this.getClassList(id)
  175. })
  176. },
  177. // 获取热门课程
  178. getClassList(type_id){
  179. this.$post({
  180. data:{
  181. do:'CourseList',
  182. data:{
  183. page:1,
  184. num:10,
  185. type_id,
  186. user_id:uni.getStorageSync('id')
  187. }
  188. }
  189. }).then(res=>{
  190. this.kctotal = res.data.total
  191. this.kclist = this.actpage==1?res.data.data:[...this.kclist,...res.data.data]
  192. })
  193. },
  194. // 获取活动列表
  195. getAcList(){
  196. this.$post({
  197. data:{
  198. do:'GoodList',
  199. data:{
  200. page:this.actpage,
  201. num:20,
  202. type_id:1,
  203. }
  204. }
  205. }).then(res=>{
  206. console.log(res,'actlist')
  207. this.acttotal = res.data.total
  208. this.actlist = this.actpage==1?res.data.data:[...this.actlist,...res.data.data]
  209. })
  210. },
  211. // 获取活动顶部图片
  212. getCover(){
  213. this.$post({
  214. data:{
  215. do:'HomeView',
  216. }
  217. }).then(res=>{
  218. console.log(res,'cover')
  219. this.bannerImage = res.data.type_4[0].img || ''
  220. })
  221. },
  222. // 活动详情
  223. toDetail(id){
  224. uni.navigateTo({
  225. url:'/pages/user/wdhd-xq?id='+id
  226. })
  227. },
  228. // 去添加课程
  229. toAddcourse(){
  230. if(uni.getStorageSync('is_lecturer')!=1){
  231. uni.showToast({
  232. title:'您还不是讲师,暂不能添加课程',
  233. icon:'none'
  234. })
  235. return
  236. }else{
  237. uni.navigateTo({
  238. url:"../lecturer/sckc"
  239. })
  240. }
  241. }
  242. }
  243. }
  244. </script>
  245. <style lang="scss" scoped>
  246. .hdxmjjr{
  247. margin: 30rpx 20rpx;
  248. }
  249. .hddderimg{
  250. height: 364rpx;
  251. background: #4D6E99;
  252. box-shadow: 0rpx 8rpx 12rpx 2rpx rgba(15, 45, 209, 0.1607843137254902);
  253. border-radius: 16rpx 16rpx 0rpx 0rpx;
  254. }
  255. .hdmmner{
  256. width: 2rpx;
  257. height: 60rpx;
  258. background:#E4E4E4;
  259. }
  260. .hdwdxinr{
  261. background: #FFFFFF;
  262. box-shadow: 0rpx 0rpx 16rpx 2rpx rgba(0, 0, 0, 0.058823529411764705);
  263. border-radius: 0rpx 0rpx 16rpx 16rpx;
  264. display: flex;
  265. justify-content: space-between;
  266. align-items: center;
  267. font-size: 36rpx;
  268. font-weight: 400;
  269. color: #374B6E;
  270. line-height: 50rpx;
  271. padding: 30rpx 96rpx;
  272. font-family: PingFang SC-Bold, PingFang SC;
  273. }
  274. .hdhhyyr{
  275. width: 266rpx;
  276. min-width: 266rpx;
  277. height: 180rpx;
  278. background: #88BBDA;
  279. border-radius: 16rpx 16rpx 16rpx 16rpx;
  280. margin-right: 20rpx;
  281. }
  282. .hdceert{
  283. display: flex;
  284. justify-content: flex-start;
  285. overflow-x: auto;
  286. margin-top: 30rpx;
  287. }
  288. </style>