index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view class="container">
  3. <view class="headbox">
  4. <view class="headnav x-bc">
  5. <view :class="activeTab == 0 ? 'headnav-item headnav-active':'headnav-item'" @click="handleNav(0)">
  6. <view>直播计划</view>
  7. <view class="headnav-num">3</view>
  8. <image src="@/static/images/idle.png" mode="aspectFill"></image>
  9. </view>
  10. <view :class="activeTab == 1? 'headnav-item headnav-active':'headnav-item'" @click="handleNav(1)">
  11. <view>今日直播</view>
  12. <view class="headnav-num">3</view>
  13. <image src="@/static/images/streaming.png" mode="aspectFill"></image>
  14. </view>
  15. <view :class="activeTab == 2 ? 'headnav-item headnav-active':'headnav-item'" @click="handleNav(2)">
  16. <view>往日直播</view>
  17. <view class="headnav-num">3</view>
  18. <image src="@/static/images/finished.png" mode="aspectFill"></image>
  19. </view>
  20. </view>
  21. <!-- <view class="x-bc">
  22. <view :class="searchbarNav == index ? 'searchbar x-c searchbar-active':'searchbar x-c'" v-for="(item,index) in searchbar" :key="index" @click="clickSearchbar(index)">
  23. <text>{{item.name}}</text><u-icon class="arrow-down" name="arrow-down" :color="searchbarNav == index ?'#1677ff':'#999'" size="12"></u-icon>
  24. </view>
  25. </view> -->
  26. <view>
  27. <dropdownPanel :filterData='filterData' @onChange="onChange" @confirm="confirm" @reset="reset">
  28. <view v-if="searchbarNav == 0">
  29. <view class="boxnav x-bc">
  30. <view class="boxnav-item" v-for="(item,index) in courseList" :key="index">
  31. <view class="boxnav-item-info one-t" :class="courserIndex == item.courseId ? 'boxnav-active':''" @click="handleCourse(item)">{{item.courseName}}</view>
  32. </view>
  33. </view>
  34. </view>
  35. </dropdownPanel>
  36. </view>
  37. </view>
  38. <view class="coursebox" :style="{height: contentH}">
  39. <mescroll-body bottom="0" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback">
  40. <view class="courselist">
  41. <courseItem :activeTab="activeTab" v-for="(item,index) in dataList" :key="index" :info="item" />
  42. </view>
  43. </mescroll-body>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  49. import { getFsCourseList,getCourseVdieoList } from "@/api/courseManage.js"
  50. import dropdownPanel from "../components/dropdownPanel.vue"
  51. import courseItem from "../components/courseItem.vue"
  52. export default {
  53. mixins: [MescrollMixin],
  54. components: {
  55. courseItem,
  56. dropdownPanel
  57. },
  58. data() {
  59. return {
  60. user: {},
  61. filterData:[{
  62. name: '训练营-营期',
  63. value: 0,
  64. },
  65. {
  66. name: '课程状态',
  67. value: 1,
  68. }],
  69. defaultIndex:[0,0],
  70. contentH: 0,
  71. activeTab: 1,
  72. courseList: [],
  73. courseId: '',
  74. searchbarNav: 0,
  75. courserIndex: 0,
  76. searchbar: [{
  77. name: '训练营-营期'
  78. },
  79. {
  80. name: '课程状态'
  81. }],
  82. mescroll:null,
  83. downOption: {
  84. use:true,
  85. auto: false
  86. },
  87. upOption: {
  88. onScroll:false,
  89. use: true, // 是否启用上拉加载; 默认true
  90. auto: true,
  91. page: {
  92. pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  93. size: 10 // 每页数据的数量,默认10
  94. },
  95. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  96. textNoMore:"已经到底了",
  97. empty: {
  98. icon:'https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png',
  99. tip: '暂无数据'
  100. }
  101. },
  102. dataList: [],
  103. }
  104. },
  105. mounted() {
  106. const windowHeight = uni.getSystemInfoSync().windowHeight
  107. this.contentH = `calc(${windowHeight}px - 132px - 56px)`
  108. this.user = uni.getStorageSync("companyUserInfo") ? JSON.parse(uni.getStorageSync("companyUserInfo")) : {}
  109. this.getFsCourseList()
  110. },
  111. methods: {
  112. onChange(index) {
  113. this.searchbarNav = index
  114. },
  115. confirm() {
  116. this.courseId = this.courserIndex
  117. this.mescroll.resetUpScroll()
  118. },
  119. reset() {
  120. this.courserIndex = ''
  121. },
  122. handleCourse(item) {
  123. this.courserIndex = item.courseId
  124. },
  125. // 训练营
  126. getFsCourseList() {
  127. const day = uni.$u.timeFormat(new Date(), 'yyyy-mm-dd')
  128. const param = {
  129. companyId: this.user.companyId,
  130. companyUserId: this.user.userId,
  131. type: this.user.userType=='00' ? 0 : 1, // 0:经销商/1:群管
  132. }
  133. getFsCourseList(param).then(res=>{
  134. if(res.code==200){
  135. this.courseList = res.data || []
  136. // this.courseId = this.courseList && this.courseList.length > 0 ? this.courseList[0].courseId : ''
  137. // this.searchbar[0].name = this.courseList && this.courseList.length > 0 ? this.courseList[0].courseName : '训练营-营期'
  138. // this.mescroll.resetUpScroll()
  139. }else{
  140. uni.showToast({
  141. icon:'none',
  142. title: res.msg,
  143. });
  144. }
  145. })
  146. },
  147. handleNav(type) {
  148. this.activeTab = type
  149. },
  150. clickSearchbar(type) {
  151. this.searchbarNav = type == this.searchbarNav ? 'colse' : type
  152. },
  153. mescrollInit(mescroll) {
  154. this.mescroll = mescroll;
  155. },
  156. /*下拉刷新的回调 */
  157. downCallback(mescroll) {
  158. mescroll.resetUpScroll()
  159. },
  160. upCallback(page) {
  161. //联网加载数据
  162. var that = this;
  163. var data={
  164. courseId:this.courseId,
  165. status: '',
  166. pageNum: page.num,
  167. pageSize: page.size
  168. };
  169. uni.showLoading({
  170. title:"加载中..."
  171. })
  172. getCourseVdieoList(data).then(res => {
  173. uni.hideLoading()
  174. if(res.code==200){
  175. //设置列表数据
  176. if (page.num == 1) {
  177. that.dataList = res.data.list;
  178. } else {
  179. that.dataList = that.dataList.concat(res.data.list);
  180. }
  181. that.mescroll.endBySize(res.data.list.length, res.data.total);
  182. }else{
  183. uni.showToast({
  184. icon:'none',
  185. title: "请求失败",
  186. });
  187. that.dataList = null;
  188. that.mescroll.endErr();
  189. }
  190. });
  191. },
  192. }
  193. }
  194. </script>
  195. <style lang="scss">
  196. .container {
  197. font-family: PingFang SC, PingFang SC;
  198. font-weight: 400;
  199. font-size: 14px;
  200. color: #222;
  201. }
  202. .boxnav {
  203. flex-wrap: wrap;
  204. padding: 0 0 0 10px;
  205. &-item {
  206. width: 50%;
  207. overflow: hidden;
  208. }
  209. &-item-info {
  210. border: 1px solid #f5f5f5;
  211. text-align: center;
  212. color: #222;
  213. background-color: #f5f5f5;
  214. border-radius: 3px;
  215. padding: 5px;
  216. margin: 0 10px 10px 0;
  217. }
  218. &-active {
  219. border: 1px solid #1677ff !important;
  220. color: #1677ff !important;
  221. background-color: #e7f1fe !important;
  222. }
  223. }
  224. .headbox {
  225. background-color: #fff;
  226. }
  227. .headnav {
  228. padding: 15px 12px;
  229. margin: 0 -10px -10px 0;
  230. box-sizing: border-box;
  231. image {
  232. height: 60px;
  233. width: 50px;
  234. position: absolute;
  235. z-index: 0;
  236. bottom: 0;
  237. right: 0;
  238. display: none;
  239. }
  240. &-item {
  241. flex: 1;
  242. font-size: 16px;
  243. padding: 10px;
  244. border-radius: 10px;
  245. background: #f5f5f5;
  246. margin: 0 10px 10px 0;
  247. position: relative;
  248. z-index: 1;
  249. overflow: hidden;
  250. color: #555;
  251. }
  252. &-active {
  253. background-color: rgb(231, 241, 255) !important;
  254. .headnav-num {
  255. color: #1677ff !important;
  256. }
  257. image {
  258. display: block !important;
  259. }
  260. }
  261. &-num {
  262. font-family: DIN, DIN;
  263. font-weight: bold;
  264. font-size: 25px;
  265. margin: 5px 0;
  266. }
  267. }
  268. .searchbar {
  269. flex: 1;
  270. padding-bottom: 10px;
  271. .arrow-down {
  272. margin-left: 5px;
  273. }
  274. &-active {
  275. color: #1677ff !important;
  276. .arrow-down {
  277. transform: rotate(180deg);
  278. }
  279. }
  280. }
  281. .coursebox {
  282. position: relative;
  283. overflow-y: auto;
  284. box-sizing: border-box;
  285. }
  286. .courselist {
  287. padding: 12px;
  288. box-sizing: border-box;
  289. }
  290. </style>