123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- <template>
- <view>
- <statusBar :item="navBarData"></statusBar>
- <uni-search-bar bgColor="#f0f2f5" placeholder="搜索" cancelButton="none" clearButton="none" :focus="true"></uni-search-bar>
- <view class="links">
- <button class="link-button" :class="{ active: isActive1 }" @click="toggleActive1">资源库</button>
- <button class="link-button" :class="{ active: isActive2 }" @click="toggleActive2">精品课程</button>
- </view>
- <view class="" v-if="tab">
- <uni-section type="">
- <uni-grid :column="2" :show-border="false" :square="false">
- <uni-grid-item v-for="(item, index) in list" :index="index" :key="index">
- <view class="grid-item-box">
- <view class="v1">
- <image class="image" :src="item.url" mode="aspectFill" />
- <text class="text">{{ item.text }}</text>
- <text class="text1">{{ item.text1 }}</text>
- </view>
- </view>
- </uni-grid-item>
- </uni-grid>
- </uni-section>
- </view>
- <view class="" v-else>
- <uni-section type="">
- <uni-grid :column="2" :show-border="false" :square="false">
- <uni-grid-item v-for="(item, index) in list" :index="index" :key="index">
- <view class="grid-item-box">
- <view class="v1">
- <image class="image" :src="item.url" mode="aspectFill" />
- <text class="text">{{ item.text }}1</text>
- <text class="text1">{{ item.text1 }}</text>
- </view>
- </view>
- </uni-grid-item>
- </uni-grid>
- </uni-section>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- navBarData: {
- title: '资源库',
- btn: 1
- },
- isActive1: true,
- isActive2: false,
- tab: true,
- list: [
- {
- url: ' ../../static/resource/jqr.png',
- text: '这里是课程名称课程名称课程名称...',
- badge: '0',
- text1: '主讲教师:苏某某'
- },
- {
- url: ' ../../static/resource/jqr.png',
- text: '这里是课程名称课程名称课程名称...',
- badge: '0',
- text1: '主讲教师:苏某某'
- },
- {
- url: ' ../../static/resource/jqr.png',
- text: '这里是课程名称课程名称课程名称...',
- badge: '0',
- text1: '主讲教师:苏某某'
- },
- {
- url: ' ../../static/resource/jqr.png',
- text: '这里是课程名称课程名称课程名称...',
- badge: '0',
- text1: '主讲教师:苏某某'
- },
- {
- url: ' ../../static/resource/jqr.png',
- text: '这里是课程名称课程名称课程名称...',
- badge: '0',
- text1: '主讲教师:苏某某'
- },
- {
- url: ' ../../static/resource/jqr.png',
- text: '这里是课程名称课程名称课程名称...',
- badge: '0',
- text1: '主讲教师:苏某某'
- },
- {
- url: ' ../../static/resource/jqr.png',
- text: '这里是课程名称课程名称课程名称...',
- badge: '0',
- text1: '主讲教师:苏某某'
- }
- ]
- };
- },
- methods: {
- toggleActive1() {
- this.isActive1 = true;
- this.isActive2 = false;
- this.tab = true;
- },
- toggleActive2() {
- this.isActive1 = false;
- this.isActive2 = true;
- this.tab = false;
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- uni-search-bar {
- border-radius: 4px;
- }
- .uni-section .uni-section-header__decoration {
- background-color: transparent;
- }
- .links {
- display: flex;
- justify-content: space-evenly;
- align-items: center;
- margin-top: 16px;
- }
- .link-button {
- border: none;
- color: #c2c2c2;
- }
- .link-button:after {
- border: none;
- }
- .link-button.active {
- color: #616366;
- // background: url('../../static/resouce/bg.png') no-repeat;
- background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0)), url('../../static/resource/bg.png') no-repeat;
- background-position: 50% 95%;
- background-size: 85%;
- // box-shadow: 0px 5px 5px skyblue;
- }
- .image {
- width: 150px;
- height: 100px;
- border-radius: 4px;
- }
- .text {
- font-weight: 600;
- max-width: 120px;
- font-size: 14px;
- margin-top: 5px;
- }
- .text1 {
- margin-top: 5px;
- color: #999999;
- max-width: 120px;
- font-size: 10px;
- }
- .grid-dynamic-box {
- margin-bottom: 15px;
- }
- .uni-grid-item {
- height: 160px;
- }
- .grid-item-box {
- flex: 1;
- // position: relative;
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 10px 0;
- height: 160px;
- .v1 {
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- height: 160px;
- }
- }
- .grid-item-box-row {
- flex: 1;
- display: flex;
- align-items: center;
- flex-direction: row;
- justify-content: center;
- padding: 15px 0;
- }
- </style>
|