activityPageNew.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <template>
  2. <view class="activityPageNew">
  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" @scrolltolower :duration="300">
  32. <!-- 专题教研 -->
  33. <swiper-item>
  34. <scroll-view scroll-y="true" @scrolltolower="aclower" style="height: 100%;">
  35. <view class="">
  36. <listBlock1 ref="listBlock1" :classList="filteredClassList"></listBlock1>
  37. </view>
  38. <view class="loading">
  39. <view v-if="acLoading==1">数据加载中...</view>
  40. <view v-if="acLoading==2">没有更多了~~</view>
  41. </view>
  42. </scroll-view>
  43. </swiper-item>
  44. <!-- 常规教研 -->
  45. <swiper-item>
  46. <scroll-view scroll-y="true" @scrolltolower="pulower" style="height: 100%;">
  47. <view>
  48. <listBlock1 ref="listBlock2" :classList="filteredClassList2"></listBlock1>
  49. </view>
  50. <view class="loading">
  51. <view v-if="puLoading==1">数据加载中...</view>
  52. <view v-if="puLoading==2">没有更多了~~</view>
  53. </view>
  54. </scroll-view>
  55. </swiper-item>
  56. <!-- 付费教研 -->
  57. <swiper-item>
  58. <scroll-view scroll-y="true" style="height: 100%;">
  59. <!-- <view style="padding-bottom: 30rpx;"> -->
  60. <!-- <listBlock1 :classList="monlist" :indexId='indexId'></listBlock1> -->
  61. <!-- </view> -->
  62. <view class=""
  63. style="height: 100%; width: 750rpx;display: flex;justify-content: center;align-items: center;">
  64. <image src="../../static/Frame.png" style="width: 400rpx;height: 400rpx;" mode=""></image>
  65. </view>
  66. </scroll-view>
  67. </swiper-item>
  68. </swiper>
  69. </view>
  70. </template>
  71. <script>
  72. export default {
  73. data() {
  74. return {
  75. navBarData: {
  76. title: "活动",
  77. btn: 0,
  78. },
  79. indexId: 1,
  80. current: 0, //控制展示哪一个
  81. info1: "info1", //类名
  82. info2: "info2",
  83. // swiper: 0,
  84. searchText: "", // 搜索文本
  85. acLoading: 0, //0默认值 1加载中 2没有更多了
  86. accurrentPage: 1, //页数
  87. pucurrentPage: 1,
  88. puLoading: 0, //0默认值 1加载中 2没有更多了
  89. // 教研
  90. teclist: [],
  91. // 常规
  92. pulist: [],
  93. // 付费
  94. monlist: [{
  95. acId: "92e11d93-8778-11ee-b98c-005056b86db5",
  96. acName: "丽湖职教双创教育国际虚拟教研室2023年常规教研活动安排",
  97. acshape: "户外活动",
  98. avatar: "http://139.159.246.165:7006/uploads/20231122/file-1700619408170.jpeg",
  99. bnum: 0,
  100. brief: "丽湖职教双创教育国际虚拟教研室为立足全国,辐射海外的国际化教研室,围绕创新创业教育的人才培养与课程建设开展深度研究。教研室以贯彻落实立德树人根本任务,通过加强跨专业、跨校、跨地域的教研交流,推动高校协同打造国际化的精品教学资源库、优秀教学案例库、优质教师培训资源库等,全面提高教师",
  101. cost: "5000",
  102. create_at: "2023.11.20 03:11",
  103. pers: "15",
  104. pic: "http://139.159.246.165:7006/uploads/20231120/file-1700466209242.png",
  105. type: "1",
  106. username: "袁一鸣",
  107. }]
  108. };
  109. },
  110. // 模糊搜索
  111. computed: {
  112. filteredClassList() {
  113. const filteredList = this.teclist.filter((item) =>
  114. item.acName.includes(this.searchText)
  115. );
  116. return this.searchText ? filteredList : this.teclist;
  117. },
  118. filteredClassList2() {
  119. const filterdList2 = this.pulist.filter((item) =>
  120. item.acName.includes(this.searchText)
  121. );
  122. return this.searchText ? filterdList2 : this.pulist;
  123. },
  124. },
  125. methods: {
  126. aclower() {
  127. console.log('没触底?');
  128. if (this.acLoading == 2) return
  129. this.acLoading = 1
  130. this.accurrentPage++
  131. setTimeout(this.getTecData, 1000)
  132. },
  133. pulower() {
  134. console.log('没触底?');
  135. if (this.puLoading == 2) return
  136. this.puLoading = 1
  137. this.pucurrentPage++
  138. setTimeout(this.getpuData, 1000)
  139. },
  140. // 获取专题
  141. getTecData() {
  142. let data = {
  143. openid: uni.getStorageSync('oId'),
  144. ty: 1,
  145. page: this.accurrentPage, //下拉获取更多的备用字段
  146. lim: 15 //一次获取多少数据
  147. }
  148. this.$request('/selectActivity', "POST", data).then(res => {
  149. // console.log('专题', res[0]);
  150. // this.teclist = res[0]
  151. if (!res[0].length) {
  152. this.acLoading = 2
  153. } else {
  154. this.acLoading = 0
  155. }
  156. this.teclist = [...this.teclist, ...res[0]]
  157. })
  158. },
  159. // 获取常规
  160. getpuData() {
  161. let data = {
  162. openid: uni.getStorageSync('oId'),
  163. ty: 2,
  164. page: this.pucurrentPage, //下拉获取更多的备用字段
  165. lim: 15 //一次获取多少数据
  166. }
  167. this.$request('/selectActivity', "POST", data).then(res => {
  168. // console.log('常规', res[0]);
  169. // this.pulist = res[0]
  170. if (!res[0].length) {
  171. this.puLoading = 2
  172. } else {
  173. this.puLoading = 0
  174. }
  175. this.pulist = [...this.pulist, ...res[0]]
  176. })
  177. },
  178. // 获取付费
  179. getmonData() {
  180. let data = {
  181. openid: uni.getStorageSync('oId'),
  182. ty: 1,
  183. page: this.currentPage, //下拉获取更多的备用字段
  184. lim: 15 //一次获取多少数据
  185. }
  186. this.$request('/selectActivity', "POST", data).then(res => {
  187. // console.log('教研', res[0]);
  188. // this.teclist = res[0]
  189. })
  190. },
  191. // 区域滑动变换头部
  192. swipeIndex(index) {
  193. this.current = index.detail.current;
  194. // this.$refs.listBlock1.getdata()
  195. },
  196. // 触底加载更多
  197. // onReachBottom() {
  198. // console.log('没触底?');
  199. // if (this.newsLoading == 2) return
  200. // this.newsLoading = 1
  201. // this.currentPage++
  202. // setTimeout(this.getData, 1000)
  203. // },
  204. // 区域滑动
  205. phoneLogin() {
  206. this.current = 0;
  207. },
  208. accountLogin() {
  209. this.current = 1;
  210. },
  211. costClass() {
  212. this.current = 2;
  213. }
  214. },
  215. onShow() {
  216. // 获取收藏事件
  217. this.$refs.listBlock1.getdata() //专题
  218. this.$refs.listBlock2.getdata() //常规
  219. // 刷新
  220. // 教研
  221. this.teclist = []
  222. // 常规
  223. this.pulist = []
  224. this.accurrentPage = 1
  225. this.pucurrentPage = 1
  226. this.getpuData() //获取常规列表
  227. this.getTecData() //获取专题列表
  228. this.getAllMessage() // 调用app.js中的方法
  229. // 因为组件没有onshow
  230. // 获取订阅事件
  231. // this.$refs.listBlock1.getSub()
  232. },
  233. };
  234. </script>
  235. <style lang="scss" scoped>
  236. .btntop {
  237. width: 100%;
  238. }
  239. .activityPageNew {
  240. display: flex;
  241. flex-direction: column;
  242. height: 100vh;
  243. .loading {
  244. height: 30rpx;
  245. text-align: center;
  246. padding-top: 20rpx;
  247. padding-bottom: 100rpx;
  248. font-size: 26rpx;
  249. color: #888;
  250. line-height: 2em;
  251. }
  252. .search {
  253. background-color: #ffffff;
  254. position: relative;
  255. display: flex;
  256. width: 750rpx;
  257. height: 88rpx;
  258. justify-content: center;
  259. align-items: center;
  260. .inpSer {
  261. width: 690rpx;
  262. height: 65rpx;
  263. margin: auto;
  264. background-color: rgba(240, 242, 245, 1);
  265. border-radius: 5rpx;
  266. color: rgba(0, 0, 0, 0.26);
  267. position: relative;
  268. .inpTxt {
  269. color: #000;
  270. height: 100%;
  271. width: 100%;
  272. }
  273. input::placeholder {
  274. color: #000;
  275. }
  276. .ico {
  277. position: absolute;
  278. top: 50%;
  279. left: 20rpx;
  280. transform: translate(0, -50%);
  281. display: flex;
  282. align-items: center;
  283. image {
  284. margin-right: 10rpx;
  285. }
  286. }
  287. }
  288. }
  289. .top {
  290. width: 100%;
  291. display: flex;
  292. justify-content: space-between;
  293. margin: auto;
  294. background-color: #ffffff;
  295. padding: 10px 60rpx;
  296. height: 98rpx;
  297. .info1 {
  298. font-weight: bold !important;
  299. position: relative;
  300. color: rgba(0, 0, 0, 0.8);
  301. font-size: 34rpx;
  302. line-height: 48rpx;
  303. width: 136rpx;
  304. height: 48rpx;
  305. text-align: center;
  306. // font-family: PingFang SC;
  307. // font-family: \9ed1\4f53;
  308. .yun {
  309. width: 134rpx;
  310. height: 32rpx;
  311. position: absolute;
  312. left: 0;
  313. bottom: -10rpx;
  314. // transform: translate(-50%,0%);
  315. // box-shadow: 0px 10rpx 30rpx 6rpx #4a97f2;
  316. image {
  317. width: 100%;
  318. height: 100%;
  319. }
  320. }
  321. }
  322. .info2 {
  323. color: rgba(0, 0, 0, 0.6);
  324. font-size: 34rpx;
  325. font-weight: 400;
  326. line-height: 48rpx;
  327. width: 136rpx;
  328. height: 48rpx;
  329. text-align: center;
  330. font-family: 微软雅黑;
  331. }
  332. }
  333. .scroll-view-height {
  334. flex: 1;
  335. width: 100%;
  336. display: flex;
  337. flex-wrap: wrap;
  338. justify-content: space-between;
  339. .cont {
  340. background-color: #ffffff;
  341. width: 332rpx;
  342. padding: 20rpx 15rpx;
  343. border-radius: 10px;
  344. margin-bottom: 20rpx;
  345. image {
  346. width: 300rpx;
  347. height: 170rpx;
  348. border-radius: 10rpx;
  349. }
  350. .tit {
  351. width: 257rpx;
  352. margin: 10rpx 0;
  353. // height: 80rpx;
  354. font-weight: bold;
  355. white-space: normal;
  356. display: -webkit-box;
  357. word-break: break-all;
  358. text-overflow: ellipsis;
  359. overflow: hidden;
  360. -webkit-box-orient: vertical;
  361. -webkit-line-clamp: 2;
  362. /*设置 需要显示的行数*/
  363. }
  364. .teacher {
  365. color: #999999;
  366. }
  367. }
  368. }
  369. }
  370. </style>