wdkc.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view class="">
  3. <view class="zxkjyr" style="padding: 0 42rpx;padding-top: 12rpx;">
  4. <view :class="['zxkjyra',Inv==0?'zxkjyrff':'']" @click="Inv=0">
  5. <text>直播课程</text>
  6. <view class="zxkjxh"></view>
  7. </view>
  8. <view :class="['zxkjyra',Inv==1?'zxkjyrff':'']" @click="Inv=1">
  9. <text>录制课程</text>
  10. <view class="zxkjxh"></view>
  11. </view>
  12. <view :class="['zxkjyra',Inv==2?'zxkjyrff':'']" @click="Inv=2">
  13. <text>下架课程</text>
  14. <view class="zxkjxh"></view>
  15. </view>
  16. </view>
  17. <view class=" ">
  18. <view style="margin-top: 30rpx;">
  19. <view class="fsxto sclixmy" v-for="(item,index) in list" :key="index">
  20. <view class="fzctob">
  21. <view class="sckjert" style="overflow: hidden;">
  22. <image :src="item.img" mode="aspectFill" style="width: 100%; height: 100%;"></image>
  23. </view>
  24. <view class="fsxto" style="width: 100%;margin-left: 24rpx;">
  25. <view class="cphrry"><text>{{item.title}}</text></view>
  26. <!-- -->
  27. <view class="cptxtyra" style="margin-bottom: 10rpx;"><text>{{item.type_title}}</text></view>
  28. <view class="fzctob kcwwerrt">
  29. <text>{{lecturer_name}}</text>
  30. </view>
  31. </view>
  32. </view>
  33. <view style="border-top: 2rpx dashed #e8e8e8;width: 107%;margin-left: -24rpx;margin-top: 22rpx;"></view>
  34. <view class="flztoa" style="margin-top: 26rpx;">
  35. <view class="fzctob">
  36. <text class="wdjga">¥</text>
  37. <text class="wdjgb">{{item.price}}</text>
  38. <!-- <text class="wdjgc">.00</text> -->
  39. <!-- <text class="scjga">原价¥{{item.line_price}}</text> -->
  40. </view>
  41. <!-- <navigator class="kcdrry" url="../lecturer/wdkc-zhixj" hover-class="none">
  42. <image src="/static/lecturer/wdkca1.png" style="width: 136rpx;min-width: 136rpx;height: 50rpx;" mode=""></image>
  43. </navigator> -->
  44. <!-- #ifdef APP-PLUS -->
  45. <view class="toLive" @click="toLive(item)" v-if="Inv==0">
  46. 去直播
  47. </view>
  48. <!-- #endif -->
  49. <view class="kcdrry" @click="unshelfCourse(item.id)">
  50. <image v-if="Inv!=2" src="/static/lecturer/wdkca1.png" style="width: 136rpx;min-width: 136rpx;height: 50rpx;" mode=""></image>
  51. <image v-if="Inv==2" src="/static/lecturer/wdkca2.png" style="width: 136rpx;min-width: 136rpx;height: 50rpx;" mode=""></image>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. <style>
  60. page {
  61. background: #FAFAFA;
  62. }
  63. </style>
  64. <script>
  65. export default {
  66. data() {
  67. return {
  68. Inv: 0,
  69. list:[],
  70. course:[],
  71. fail_live:[],
  72. live:[],
  73. lecturer_name:''
  74. }
  75. },
  76. onLoad() {
  77. this.getList()
  78. },
  79. watch:{
  80. Inv(val){
  81. if(val==0){
  82. this.list = this.live
  83. } else if(val==1){
  84. this.list = this.course
  85. } else if(val==2){
  86. this.list = this.fail_live
  87. }
  88. }
  89. },
  90. methods: {
  91. // 课程列表
  92. getList(){
  93. this.$post({
  94. data:{
  95. do:'MyCourseList',
  96. data:{
  97. user_id:uni.getStorageSync('id')
  98. }
  99. }
  100. }).then(res=>{
  101. console.log(res,'rrrrrrrrrrrrr')
  102. this.course = res.data.course
  103. this.fail_live = res.data.fail_live
  104. this.live = res.data.live
  105. this.lecturer_name = res.data.lecturer_name
  106. if(this.Inv==0){
  107. this.list = this.live
  108. } else if(this.Inv==1){
  109. this.list = this.course
  110. } else if(this.Inv==2){
  111. this.list = this.fail_live
  112. }
  113. })
  114. },
  115. // 去直播
  116. toLive(item){
  117. uni.navigateTo({
  118. url:'/pages/lecturer/Live?chapter_id='+item.chapter_id
  119. })
  120. },
  121. // 上下架课程
  122. unshelfCourse(id){
  123. uni.showModal({
  124. title:'提示',
  125. content:this.Inv==2?'确定要上架该课程吗?':'确定要下架该课程吗?',
  126. success: (res) => {
  127. if(res.confirm){
  128. console.log({
  129. do:'TakeDown',
  130. data:{
  131. user_id:uni.getStorageSync('id'),
  132. id,
  133. state:this.Inv==2?1:0
  134. }
  135. })
  136. this.$post({
  137. data:{
  138. do:'TakeDown',
  139. data:{
  140. user_id:uni.getStorageSync('id'),
  141. id,
  142. state:this.Inv==2?1:0
  143. }
  144. }
  145. }).then(res=>{
  146. uni.showToast({
  147. title:this.Inv==2?'上架成功':'下架成功',
  148. icon:'none',
  149. mask:true
  150. })
  151. setTimeout(()=>{
  152. this.getList()
  153. },1500)
  154. console.log(res)
  155. })
  156. }
  157. }
  158. })
  159. }
  160. }
  161. }
  162. </script>
  163. <style lang="scss" scoped>
  164. .toLive{
  165. height: 45rpx;
  166. display: flex;
  167. justify-content: center;
  168. align-items: center;
  169. color: #405375;
  170. padding: 10rpx 20rpx;
  171. border: 1rpx solid #405375;
  172. border-radius: 25rpx;
  173. }
  174. </style>