resource.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. <template>
  2. <view class="resource">
  3. <statusBar :item="navBarData"></statusBar>
  4. <view class="search">
  5. <uni-search-bar
  6. v-model="searchText"
  7. bgColor="#f0f2f5"
  8. class="btntop"
  9. placeholder="搜索"
  10. cancelButton="none"
  11. clearButton="none"
  12. ></uni-search-bar>
  13. </view>
  14. <view class="top">
  15. <view
  16. class="left"
  17. @click="phoneLogin"
  18. :class="current == 0 ? info1 : info2"
  19. >
  20. <text class="">资源库</text>
  21. <view v-if="current == 0" class="yun">
  22. <image
  23. src="http://43.139.158.220:5007/img/static/yym/Ellipse 10.png"
  24. mode="aspectFill"
  25. ></image>
  26. </view>
  27. </view>
  28. <view
  29. class="right"
  30. @click="accountLogin"
  31. :class="current == 1 ? info1 : info2"
  32. >
  33. <text class="">精品慕课</text>
  34. <view v-if="current == 1" class="yun">
  35. <image
  36. src="http://43.139.158.220:5007/img/static/yym/Ellipse 10.png"
  37. mode="aspectFill"
  38. ></image>
  39. </view>
  40. </view>
  41. </view>
  42. <swiper
  43. class="scroll-view-height"
  44. :style="{ height: swiper + 'px' }"
  45. @change="swipeIndex"
  46. :current="current"
  47. :duration="300"
  48. >
  49. <swiper-item>
  50. <scroll-view scroll-y="true" :style="{ height: swiper + 'px' }">
  51. <view class="contBox">
  52. <view
  53. class="cont"
  54. @click="gotoLogin"
  55. v-for="(item, index) in filteredClassList"
  56. :index="index"
  57. :key="index"
  58. >
  59. <image class="image" :src="item.url" mode="aspectFill" />
  60. <view class="tit btn-font">{{ item.className }}</view>
  61. <view class="teacher fz-font">{{ item.th_name }}</view>
  62. </view>
  63. </view>
  64. </scroll-view>
  65. </swiper-item>
  66. <swiper-item>
  67. <scroll-view scroll-y="true" :style="{ height: swiper + 'px' }">
  68. <view class="contBox">
  69. <view
  70. class="cont"
  71. @click="gotoWeb(index)"
  72. v-for="(item, index) in filteredClassList2"
  73. :index="index"
  74. :key="index"
  75. >
  76. <image class="image" :src="item.url" mode="aspectFill" />
  77. <view class="tit btn-font">{{ item.className }}</view>
  78. <view class="teacher fz-font">{{ item.th_name }}</view>
  79. </view>
  80. </view>
  81. </scroll-view>
  82. </swiper-item>
  83. </swiper>
  84. </view>
  85. </template>
  86. <script>
  87. export default {
  88. data() {
  89. return {
  90. navBarData: {
  91. title: "资源库",
  92. btn: 0,
  93. },
  94. current: 0, //登录方式切换
  95. info1: "info1", //类名
  96. info2: "info2",
  97. swiper: 0,
  98. searchText: "", // 搜索文本
  99. classList: [
  100. {
  101. url: "http://43.139.158.220:5007/img/static/pubic/img5.jpg",
  102. className: "创新思维",
  103. th_name: "主讲教师: 吴伟",
  104. },
  105. {
  106. url: "http://43.139.158.220:5007/img/static/img/sc.jpg",
  107. className: "商机识别与创业营销 ",
  108. th_name: "主讲教师:明照凤 ",
  109. },
  110. {
  111. url: "http://43.139.158.220:5007/img/static/img/sg.jpg",
  112. className: "双创生态圈构建 ",
  113. th_name: "主讲教师: 徐文泽",
  114. },
  115. {
  116. url: "http://43.139.158.220:5007/img/static/img/cy.jpg",
  117. className: "创业基础 ",
  118. th_name: "主讲教师: 杨哲旗",
  119. },
  120. {
  121. url: "http://43.139.158.220:5007/img/static/img/ks.png",
  122. className: "跨界产品研发实战 ",
  123. th_name: "主讲教师: 王程程",
  124. },
  125. {
  126. url: "http://43.139.158.220:5007/img/static/img/cs.jpg",
  127. className: "创造性思维与创新方法训练 ",
  128. th_name: "主讲教师: 申珊珊",
  129. },
  130. {
  131. url: "http://43.139.158.220:5007/img/static/img/hs.jpg",
  132. className: "行业创业实践 ",
  133. th_name: "主讲教师: 陆亚文",
  134. },
  135. {
  136. url: "http://43.139.158.220:5007/img/static/img/cx.png",
  137. className: "创新方法与训练 ",
  138. th_name: "主讲教师: 张梦龙",
  139. },
  140. ],
  141. classList2: [
  142. {
  143. url: "http://43.139.158.220:5007/img/static/img/ydjk.png",
  144. className: "运动与健康",
  145. th_name: "主讲教师: 代方梅 史文文",
  146. },
  147. {
  148. url: "http://43.139.158.220:5007/img/static/img/shyy.png",
  149. className: "生活英语听说",
  150. th_name: "主讲教师: 杨芳 张文霞",
  151. },
  152. {
  153. url: "http://43.139.158.220:5007/img/static/img/yyll.jpg",
  154. className: "科研伦理与学术规范",
  155. th_name: "主讲教师: 印波",
  156. },
  157. {
  158. url: "http://43.139.158.220:5007/img/static/img/kylw.png",
  159. className: "如何写好科研论文",
  160. th_name: "主讲教师: 高飞飞 张靖",
  161. },
  162. ],
  163. };
  164. },
  165. // 模糊搜索
  166. computed: {
  167. filteredClassList() {
  168. const filteredList = this.classList.filter((item) =>
  169. item.className.includes(this.searchText)
  170. );
  171. return this.searchText ? filteredList : this.classList;
  172. },
  173. filteredClassList2() {
  174. const filterdList2 = this.classList2.filter((item) =>
  175. item.className.includes(this.searchText)
  176. );
  177. return this.searchText ? filterdList2 : this.classList2;
  178. },
  179. },
  180. methods: {
  181. gotoLogin() {
  182. // uni.navigateTo({
  183. // url: "/pages/login/login"
  184. // })
  185. const value = uni.getStorageSync("login");
  186. if (value == 0) {
  187. uni.navigateTo({
  188. url: "/pages/login/login",
  189. });
  190. } else if (this.current === 0) {
  191. const selectedItem = this.classList[this.current];
  192. const url =
  193. "https://zyk.icve.com.cn/chuangxin/18a329e8-3cd6-4983-a1aa-945a28198bc3";
  194. uni.navigateTo({
  195. url: "/pages/skipone/skipone?url=" + encodeURIComponent(url),
  196. });
  197. }
  198. },
  199. gotoWeb(index) {
  200. if (this.current === 1) {
  201. const urls = [
  202. "https://www.xuetangx.com/course/HUBU10011000132/16906642?channel=i.area.course_list_all",
  203. "https://www.xuetangx.com/course/THU05021000376?channel=i.area.course_list_all",
  204. "https://www.xuetangx.com/course/BNU03031000037/16905009?channel=i.area.course_list_all",
  205. "https://www.xuetangx.com/course/THU04011000365/16906220?channel=i.area.course_list_all",
  206. ];
  207. if (index >= 0 && index < urls.length) {
  208. const url = urls[index];
  209. uni.navigateTo({
  210. url: "/pages/skipone/skipone?url=" + encodeURIComponent(url),
  211. });
  212. }
  213. }
  214. },
  215. toggleActive1() {
  216. this.isActive1 = true;
  217. this.isActive2 = false;
  218. this.tab = true;
  219. },
  220. toggleActive2() {
  221. this.isActive1 = false;
  222. this.isActive2 = true;
  223. this.tab = false;
  224. },
  225. swipeIndex(index) {
  226. this.current = index.detail.current;
  227. },
  228. phoneLogin() {
  229. this.current = 0;
  230. },
  231. accountLogin() {
  232. this.current = 1;
  233. },
  234. },
  235. onReady() {},
  236. onLoad() {
  237. if (this.navheight) {
  238. this.swiper = this.screenHeight - this.navheight - 140;
  239. } else {
  240. this.swiper = this.screenHeight - this.customBar - 150;
  241. }
  242. },
  243. };
  244. </script>
  245. <style lang="scss" scoped>
  246. .btntop {
  247. width: 100%;
  248. }
  249. .resource {
  250. .search {
  251. background-color: #ffffff;
  252. position: relative;
  253. display: flex;
  254. width: 750rpx;
  255. height: 88rpx;
  256. justify-content: center;
  257. align-items: center;
  258. // background-color: rebeccapurple;
  259. .inpSer {
  260. width: 690rpx;
  261. height: 65rpx;
  262. margin: auto;
  263. background-color: rgba(240, 242, 245, 1);
  264. border-radius: 5rpx;
  265. color: rgba(0, 0, 0, 0.26);
  266. position: relative;
  267. .inpTxt {
  268. // padding: 0px, 12rpx, 0px, 12rpx;
  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: 500rpx;
  291. display: flex;
  292. justify-content: space-between;
  293. margin: auto;
  294. background-color: #ffffff;
  295. padding: 10px 150rpx;
  296. // margin-bottom: 40px;
  297. // font-size: 18px;
  298. // padding-top: 0;
  299. .info1 {
  300. font-weight: bold !important;
  301. position: relative;
  302. color: rgba(0, 0, 0, 0.8);
  303. font-size: 34rpx;
  304. line-height: 48rpx;
  305. width: 136rpx;
  306. height: 48rpx;
  307. text-align: center;
  308. // font-family: PingFang SC;
  309. // font-family: \9ed1\4f53;
  310. .yun {
  311. width: 134rpx;
  312. height: 32rpx;
  313. position: absolute;
  314. left: 0;
  315. bottom: -10rpx;
  316. // transform: translate(-50%,0%);
  317. // box-shadow: 0px 10rpx 30rpx 6rpx #4a97f2;
  318. image {
  319. width: 100%;
  320. height: 100%;
  321. }
  322. }
  323. }
  324. .info2 {
  325. color: rgba(0, 0, 0, 0.6);
  326. font-size: 34rpx;
  327. font-weight: 400;
  328. line-height: 48rpx;
  329. width: 136rpx;
  330. height: 48rpx;
  331. text-align: center;
  332. font-family: 微软雅黑;
  333. }
  334. }
  335. .scroll-view-height {
  336. // background-color: ;
  337. // height: 68vh;
  338. // background-color: red;
  339. // padding-bottom: 50px;
  340. .contBox {
  341. width: 100%;
  342. padding: 10px 30rpx;
  343. // height: 100%;
  344. display: flex;
  345. flex-wrap: wrap;
  346. justify-content: space-between;
  347. // background-color: greenyellow;
  348. margin-bottom: 50px;
  349. .cont {
  350. background-color: #ffffff;
  351. width: 332rpx;
  352. padding: 20rpx 15rpx;
  353. border-radius: 10px;
  354. margin-bottom: 20rpx;
  355. image {
  356. width: 300rpx;
  357. height: 170rpx;
  358. border-radius: 10rpx;
  359. }
  360. .tit {
  361. width: 257rpx;
  362. margin: 10rpx 0;
  363. // height: 80rpx;
  364. font-weight: bold;
  365. white-space: normal;
  366. display: -webkit-box;
  367. word-break: break-all;
  368. text-overflow: ellipsis;
  369. overflow: hidden;
  370. -webkit-box-orient: vertical;
  371. -webkit-line-clamp: 2;
  372. /*设置 需要显示的行数*/
  373. }
  374. .teacher {
  375. color: #999999;
  376. }
  377. }
  378. }
  379. }
  380. }
  381. </style>