123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- <template>
- <view class="resource">
- <statusBar :item="navBarData"></statusBar>
- <view class="search">
- <uni-search-bar v-model="searchText" bgColor="#f0f2f5" class="btntop" placeholder="搜索" cancelButton="none"
- clearButton="none"></uni-search-bar>
- </view>
- <view class="top">
- <view class="left" @click="phoneLogin" :class="current == 0 ? info1 : info2">
- <text class="">资源库</text>
- <view v-if="current == 0" class="yun">
- <image src="https://teacherapi.cocorobo.cn/teaching-file/static//yym/Ellipse 10.png"
- mode="aspectFill"></image>
- </view>
- </view>
- <view class="right" @click="accountLogin" :class="current == 1 ? info1 : info2">
- <text class="">精品慕课</text>
- <view v-if="current == 1" class="yun">
- <image src="https://teacherapi.cocorobo.cn/teaching-file/static//yym/Ellipse 10.png"
- mode="aspectFill"></image>
- </view>
- </view>
- <view class="right" @click="costClass" :class="current == 2 ? info1 : info2">
- <text class="">付费课程</text>
- <view v-if="current == 2" class="yun">
- <image src="https://teacherapi.cocorobo.cn/teaching-file/static//yym/Ellipse 10.png"
- mode="aspectFill"></image>
- </view>
- </view>
- </view>
- <swiper class="scroll-view-height" @change="swipeIndex" :current="current" :duration="300">
- <swiper-item>
- <scroll-view scroll-y="true" style="height: 100%;">
- <view class="">
- <teaching-case ref="reso" :acList='filteredClassList'></teaching-case>
- </view>
- </scroll-view>
- </swiper-item>
- <swiper-item>
- <scroll-view scroll-y="true" style="height: 100%;">
- <view class="">
- <teaching-case ref="tech" :acList='filteredClassList2'></teaching-case>
- </view>
- </scroll-view>
- </swiper-item>
- <swiper-item>
- <scroll-view scroll-y="true" style="height: 100%;">
- <view class=""
- style="height: 100%; width: 750rpx;display: flex;justify-content: center;align-items: center;">
- <image src="../../static/Frame.png" style="width: 400rpx;height: 400rpx;" mode=""></image>
- </view>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- navBarData: {
- title: "课程",
- btn: 0,
- },
- indexId: 1,
- current: 0, //登录方式切换
- info1: "info1", //类名
- info2: "info2",
- // swiper: 0,
- searchText: "", // 搜索文本
- pic_coll: 'https://teacherapi.cocorobo.cn/teaching-file/static/Stara.png',
- pic_coll2: 'https://teacherapi.cocorobo.cn/teaching-file/static/mine/Collect_yellow.png',
- classList: [],
- classList2: [],
- };
- },
- // 模糊搜索
- computed: {
- filteredClassList() {
- const filteredList = this.classList.filter((item) =>
- item.ctit.includes(this.searchText)
- );
- return this.searchText ? filteredList : this.classList;
- },
- filteredClassList2() {
- const filterdList2 = this.classList2.filter((item) =>
- item.ctit.includes(this.searchText)
- );
- return this.searchText ? filterdList2 : this.classList2;
- },
- },
- methods: {
- // 获取资源库
- getclassList() {
- let data = {
- openid: uni.getStorageSync('oId'),
- }
- this.$request('/selectResource', "POST", data).then(res => {
- // console.log('获取资源库', res);
- this.classList = res[0]
- this.classList2 = res[1]
- })
- },
- swipeIndex(index) {
- this.current = index.detail.current;
- },
- // 区域滑动
- phoneLogin() {
- this.current = 0;
- },
- accountLogin() {
- this.current = 1;
- },
- costClass() {
- this.current = 2;
- }
- },
- onShow() {
- this.getAllMessage() // 调用app.js中的方法
- this.getclassList()
- this.$refs.reso.getdata()
- this.$refs.tech.getdata()
- },
- };
- </script>
- <style lang="scss" scoped>
- .btntop {
- width: 100%;
- }
- .resource {
- display: flex;
- flex-direction: column;
- height: 100vh;
- .search {
- background-color: #ffffff;
- position: relative;
- display: flex;
- width: 750rpx;
- height: 88rpx;
- justify-content: center;
- align-items: center;
- }
- .top {
- width: 100%;
- display: flex;
- justify-content: space-between;
- margin: auto;
- background-color: #ffffff;
- padding: 10px 60rpx;
- height: 98rpx;
- .info1 {
- font-weight: bold !important;
- position: relative;
- color: rgba(0, 0, 0, 0.8);
- font-size: 34rpx;
- line-height: 48rpx;
- width: 136rpx;
- height: 48rpx;
- text-align: center;
- .yun {
- width: 134rpx;
- height: 32rpx;
- position: absolute;
- left: 0;
- bottom: -10rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- }
- .info2 {
- color: rgba(0, 0, 0, 0.6);
- font-size: 34rpx;
- font-weight: 400;
- line-height: 48rpx;
- width: 136rpx;
- height: 48rpx;
- text-align: center;
- font-family: 微软雅黑;
- }
- }
- .scroll-view-height {
- flex: 1;
- width: 100%;
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- }
- }
- </style>
|