resource.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <view class="resource">
  3. <statusBar :item="navBarData"></statusBar>
  4. <view class="search">
  5. <uni-search-bar v-model="searchText" bgColor="#f0f2f5" class="btntop" placeholder="搜索" cancelButton="none"
  6. clearButton="none"></uni-search-bar>
  7. </view>
  8. <view class="top">
  9. <view class="left" @click="phoneLogin" :class="current == 0 ? info1 : info2">
  10. <text class="">资源库</text>
  11. <view v-if="current == 0" class="yun">
  12. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//yym/Ellipse 10.png"
  13. mode="aspectFill"></image>
  14. </view>
  15. </view>
  16. <view class="right" @click="accountLogin" :class="current == 1 ? info1 : info2">
  17. <text class="">精品慕课</text>
  18. <view v-if="current == 1" class="yun">
  19. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//yym/Ellipse 10.png"
  20. mode="aspectFill"></image>
  21. </view>
  22. </view>
  23. <view class="right" @click="costClass" :class="current == 2 ? info1 : info2">
  24. <text class="">付费课程</text>
  25. <view v-if="current == 2" class="yun">
  26. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//yym/Ellipse 10.png"
  27. mode="aspectFill"></image>
  28. </view>
  29. </view>
  30. </view>
  31. <swiper class="scroll-view-height" @change="swipeIndex" :current="current" :duration="300">
  32. <swiper-item>
  33. <scroll-view scroll-y="true" style="height: 100%;">
  34. <view class="">
  35. <teaching-case ref="reso" :acList='filteredClassList'></teaching-case>
  36. </view>
  37. </scroll-view>
  38. </swiper-item>
  39. <swiper-item>
  40. <scroll-view scroll-y="true" style="height: 100%;">
  41. <view class="">
  42. <teaching-case ref="tech" :acList='filteredClassList2'></teaching-case>
  43. </view>
  44. </scroll-view>
  45. </swiper-item>
  46. <swiper-item>
  47. <scroll-view scroll-y="true" style="height: 100%;">
  48. <view class=""
  49. style="height: 100%; width: 750rpx;display: flex;justify-content: center;align-items: center;">
  50. <image src="../../static/Frame.png" style="width: 400rpx;height: 400rpx;" mode=""></image>
  51. </view>
  52. </scroll-view>
  53. </swiper-item>
  54. </swiper>
  55. </view>
  56. </template>
  57. <script>
  58. export default {
  59. data() {
  60. return {
  61. navBarData: {
  62. title: "课程",
  63. btn: 0,
  64. },
  65. indexId: 1,
  66. current: 0, //登录方式切换
  67. info1: "info1", //类名
  68. info2: "info2",
  69. // swiper: 0,
  70. searchText: "", // 搜索文本
  71. pic_coll: 'https://teacherapi.cocorobo.cn/teaching-file/static/Stara.png',
  72. pic_coll2: 'https://teacherapi.cocorobo.cn/teaching-file/static/mine/Collect_yellow.png',
  73. classList: [],
  74. classList2: [],
  75. };
  76. },
  77. // 模糊搜索
  78. computed: {
  79. filteredClassList() {
  80. const filteredList = this.classList.filter((item) =>
  81. item.ctit.includes(this.searchText)
  82. );
  83. return this.searchText ? filteredList : this.classList;
  84. },
  85. filteredClassList2() {
  86. const filterdList2 = this.classList2.filter((item) =>
  87. item.ctit.includes(this.searchText)
  88. );
  89. return this.searchText ? filterdList2 : this.classList2;
  90. },
  91. },
  92. methods: {
  93. // 获取资源库
  94. getclassList() {
  95. let data = {
  96. openid: uni.getStorageSync('oId'),
  97. }
  98. this.$request('/selectResource', "POST", data).then(res => {
  99. // console.log('获取资源库', res);
  100. this.classList = res[0]
  101. this.classList2 = res[1]
  102. })
  103. },
  104. swipeIndex(index) {
  105. this.current = index.detail.current;
  106. },
  107. // 区域滑动
  108. phoneLogin() {
  109. this.current = 0;
  110. },
  111. accountLogin() {
  112. this.current = 1;
  113. },
  114. costClass() {
  115. this.current = 2;
  116. }
  117. },
  118. onShow() {
  119. this.getAllMessage() // 调用app.js中的方法
  120. this.getclassList()
  121. this.$refs.reso.getdata()
  122. this.$refs.tech.getdata()
  123. },
  124. };
  125. </script>
  126. <style lang="scss" scoped>
  127. .btntop {
  128. width: 100%;
  129. }
  130. .resource {
  131. display: flex;
  132. flex-direction: column;
  133. height: 100vh;
  134. .search {
  135. background-color: #ffffff;
  136. position: relative;
  137. display: flex;
  138. width: 750rpx;
  139. height: 88rpx;
  140. justify-content: center;
  141. align-items: center;
  142. }
  143. .top {
  144. width: 100%;
  145. display: flex;
  146. justify-content: space-between;
  147. margin: auto;
  148. background-color: #ffffff;
  149. padding: 10px 60rpx;
  150. height: 98rpx;
  151. .info1 {
  152. font-weight: bold !important;
  153. position: relative;
  154. color: rgba(0, 0, 0, 0.8);
  155. font-size: 34rpx;
  156. line-height: 48rpx;
  157. width: 136rpx;
  158. height: 48rpx;
  159. text-align: center;
  160. .yun {
  161. width: 134rpx;
  162. height: 32rpx;
  163. position: absolute;
  164. left: 0;
  165. bottom: -10rpx;
  166. image {
  167. width: 100%;
  168. height: 100%;
  169. }
  170. }
  171. }
  172. .info2 {
  173. color: rgba(0, 0, 0, 0.6);
  174. font-size: 34rpx;
  175. font-weight: 400;
  176. line-height: 48rpx;
  177. width: 136rpx;
  178. height: 48rpx;
  179. text-align: center;
  180. font-family: 微软雅黑;
  181. }
  182. }
  183. .scroll-view-height {
  184. flex: 1;
  185. width: 100%;
  186. display: flex;
  187. flex-wrap: wrap;
  188. justify-content: space-between;
  189. }
  190. }
  191. </style>