resource.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <view>
  3. <statusBar :item="navBarData"></statusBar>
  4. <uni-search-bar bgColor="#f0f2f5" placeholder="搜索" cancelButton="none" clearButton="none" :focus="true"></uni-search-bar>
  5. <view class="links">
  6. <button class="link-button" :class="{ active: isActive1 }" @click="toggleActive1">资源库</button>
  7. <button class="link-button" :class="{ active: isActive2 }" @click="toggleActive2">精品课程</button>
  8. </view>
  9. <view class="" v-if="tab">
  10. <uni-section type="">
  11. <uni-grid :column="2" :show-border="false" :square="false">
  12. <uni-grid-item v-for="(item, index) in list" :index="index" :key="index">
  13. <view class="grid-item-box">
  14. <view class="v1">
  15. <image class="image" :src="item.url" mode="aspectFill" />
  16. <text class="text">{{ item.text }}</text>
  17. <text class="text1">{{ item.text1 }}</text>
  18. </view>
  19. </view>
  20. </uni-grid-item>
  21. </uni-grid>
  22. </uni-section>
  23. </view>
  24. <view class="" v-else>
  25. <uni-section type="">
  26. <uni-grid :column="2" :show-border="false" :square="false">
  27. <uni-grid-item v-for="(item, index) in list" :index="index" :key="index">
  28. <view class="grid-item-box">
  29. <view class="v1">
  30. <image class="image" :src="item.url" mode="aspectFill" />
  31. <text class="text">{{ item.text }}1</text>
  32. <text class="text1">{{ item.text1 }}</text>
  33. </view>
  34. </view>
  35. </uni-grid-item>
  36. </uni-grid>
  37. </uni-section>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. navBarData: {
  46. title: '资源库',
  47. btn: 1
  48. },
  49. isActive1: true,
  50. isActive2: false,
  51. tab: true,
  52. list: [
  53. {
  54. url: ' ../../static/resource/jqr.png',
  55. text: '这里是课程名称课程名称课程名称...',
  56. badge: '0',
  57. text1: '主讲教师:苏某某'
  58. },
  59. {
  60. url: ' ../../static/resource/jqr.png',
  61. text: '这里是课程名称课程名称课程名称...',
  62. badge: '0',
  63. text1: '主讲教师:苏某某'
  64. },
  65. {
  66. url: ' ../../static/resource/jqr.png',
  67. text: '这里是课程名称课程名称课程名称...',
  68. badge: '0',
  69. text1: '主讲教师:苏某某'
  70. },
  71. {
  72. url: ' ../../static/resource/jqr.png',
  73. text: '这里是课程名称课程名称课程名称...',
  74. badge: '0',
  75. text1: '主讲教师:苏某某'
  76. },
  77. {
  78. url: ' ../../static/resource/jqr.png',
  79. text: '这里是课程名称课程名称课程名称...',
  80. badge: '0',
  81. text1: '主讲教师:苏某某'
  82. },
  83. {
  84. url: ' ../../static/resource/jqr.png',
  85. text: '这里是课程名称课程名称课程名称...',
  86. badge: '0',
  87. text1: '主讲教师:苏某某'
  88. },
  89. {
  90. url: ' ../../static/resource/jqr.png',
  91. text: '这里是课程名称课程名称课程名称...',
  92. badge: '0',
  93. text1: '主讲教师:苏某某'
  94. }
  95. ]
  96. };
  97. },
  98. methods: {
  99. toggleActive1() {
  100. this.isActive1 = true;
  101. this.isActive2 = false;
  102. this.tab = true;
  103. },
  104. toggleActive2() {
  105. this.isActive1 = false;
  106. this.isActive2 = true;
  107. this.tab = false;
  108. }
  109. }
  110. };
  111. </script>
  112. <style lang="scss" scoped>
  113. uni-search-bar {
  114. border-radius: 4px;
  115. }
  116. .uni-section .uni-section-header__decoration {
  117. background-color: transparent;
  118. }
  119. .links {
  120. display: flex;
  121. justify-content: space-evenly;
  122. align-items: center;
  123. margin-top: 16px;
  124. }
  125. .link-button {
  126. border: none;
  127. color: #c2c2c2;
  128. }
  129. .link-button:after {
  130. border: none;
  131. }
  132. .link-button.active {
  133. color: #616366;
  134. // background: url('../../static/resouce/bg.png') no-repeat;
  135. background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0)), url('../../static/resource/bg.png') no-repeat;
  136. background-position: 50% 95%;
  137. background-size: 85%;
  138. // box-shadow: 0px 5px 5px skyblue;
  139. }
  140. .image {
  141. width: 150px;
  142. height: 100px;
  143. border-radius: 4px;
  144. }
  145. .text {
  146. font-weight: 600;
  147. max-width: 120px;
  148. font-size: 14px;
  149. margin-top: 5px;
  150. }
  151. .text1 {
  152. margin-top: 5px;
  153. color: #999999;
  154. max-width: 120px;
  155. font-size: 10px;
  156. }
  157. .grid-dynamic-box {
  158. margin-bottom: 15px;
  159. }
  160. .uni-grid-item {
  161. height: 160px;
  162. }
  163. .grid-item-box {
  164. flex: 1;
  165. // position: relative;
  166. display: flex;
  167. flex-direction: column;
  168. align-items: center;
  169. padding: 10px 0;
  170. height: 160px;
  171. .v1 {
  172. display: flex;
  173. flex-direction: column;
  174. align-items: flex-start;
  175. height: 160px;
  176. }
  177. }
  178. .grid-item-box-row {
  179. flex: 1;
  180. display: flex;
  181. align-items: center;
  182. flex-direction: row;
  183. justify-content: center;
  184. padding: 15px 0;
  185. }
  186. </style>