classold.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <template>
  2. <view class="root">
  3. <view class="topBox dffs">
  4. <u-tabs
  5. :list="dataList.grade"
  6. keyName="name"
  7. :current="current"
  8. :itemStyle="{ fontSize: '28rpx', height: '100rpx' }"
  9. :activeStyle="{ color: '#87C477',borderBottom:'2px solid #87C477' }"
  10. lineHeight="0"
  11. sticky
  12. @click="topHandle"
  13. ></u-tabs>
  14. </view>
  15. <view class="content dfsb">
  16. <view class="secTop">
  17. <scroll-view :scroll-top="0" scroll-y="true" class="scroll-Y">
  18. <view @tap="choose(item.id)" :class="['topLi', leftSel == item.id ? 'topsel' : '']" v-for="(item, index) in dataList.subject" :key="index">
  19. {{ item.name }}
  20. </view>
  21. </scroll-view>
  22. </view>
  23. <view class="topInfo">
  24. <view class="topCInfo">
  25. <scroll-view :scroll-top="0" scroll-y="true" class="scroll-Y" @scrolltolower="lower">
  26. <view class="box">
  27. <view class="swipe">
  28. <u-swiper :autoplay="false" :list="dataList.banner" keyName="img" height="84" border-radius="20" @click="bannerClick"></u-swiper>
  29. </view>
  30. <!-- -->
  31. <view v-if="showVideo==1" class="goodLi dffd">
  32. <view class="fontsm textgrey">{{ '视频类' }}</view>
  33. <view class="son dffs">
  34. <navigator
  35. :url="'/pages/index/video/video?cat=' + item.id"
  36. class="li fontmid"
  37. :class="ind == 0 ? 'sel' : ''"
  38. v-for="(item, ind) in vedio_cats"
  39. :key="ind"
  40. >
  41. {{ item.name }}
  42. </navigator>
  43. </view>
  44. </view>
  45. <view class="goodLi dffd" v-for="(item, index) in classList" :key="index">
  46. <view class="fontsm textgrey">{{ item.name || '商品名称' }}</view>
  47. <view class="son dffs">
  48. <view @click="toNext(2, ite)" class="fontmid" v-for="(ite, ind) in item.children" :key="ind">{{ ite.name || '商品名称' }}</view>
  49. </view>
  50. </view>
  51. </view>
  52. </scroll-view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. export default {
  60. data() {
  61. return {
  62. showVideo: uni.getStorageSync('showVideo') || '0',
  63. current: 0,
  64. vedio_cats: [], // 视频列表
  65. dataList: {}, //一层
  66. classList: [
  67. // { name: '姓名', goods_img: '/static/img/pro/hotbgzj.png' },
  68. ], //商品
  69. leftSel: 0, //一层分类选中
  70. status: 'loadmore',
  71. page: 1,
  72. pagnum: 6
  73. };
  74. },
  75. async onLoad(opt) {
  76. await this.onload();
  77. await this.getVidList();
  78. },
  79. onPullDownRefresh() {
  80. this.page = 1;
  81. this.leftSel = 0;
  82. this.current = 0;
  83. this.dataList = {};
  84. this.classList = [];
  85. this.onload();
  86. setTimeout(function() {
  87. uni.stopPullDownRefresh();
  88. }, 800);
  89. },
  90. // onReachBottom() {
  91. // if (this.status == 'nomore') return;
  92. // this.status = 'loadmore';
  93. // this.page = ++this.page;
  94. // this.onload();
  95. // },
  96. onShow() {},
  97. methods: {
  98. getVidList() {
  99. this.$api
  100. .request('index/index', {
  101. school_type: '',
  102. video_cat: '',
  103. page: 1,
  104. limit:this.pagnum
  105. })
  106. .then(data => {
  107. if (data.code == 200) {
  108. this.showVideo = data.data.vedio_status;
  109. uni.setStorageSync('showVideo', data.data.vedio_status);
  110. this.vedio_cats = data.data.vedio_cats;
  111. } else {
  112. this.$api.toast(data.msg);
  113. }
  114. });
  115. },
  116. // 轮播
  117. bannerClick(e) {
  118. console.log(e);
  119. let item = this.dataList.banner[e];
  120. if (item.goods_id != 0) {
  121. if (item.type == 1) {
  122. uni.navigateTo({
  123. url: '/pages/index/video/videoInfo?id=' + item.goods_id
  124. });
  125. } else {
  126. uni.navigateTo({
  127. url: '/pages/index/navInfo?id=' + item.goods_id
  128. });
  129. }
  130. }
  131. },
  132. // 顶部按钮被点击
  133. topHandle(e) {
  134. console.log('top: ',e);
  135. this.current = e.id;
  136. // this.onload();
  137. },
  138. toNext(val, item) {
  139. console.log(item);
  140. if (val == 1) {
  141. uni.navigateTo({
  142. url: '/pages/index/video/video'
  143. });
  144. return;
  145. }
  146. // console.log('跳转时:',item.id);
  147. uni.navigateTo({
  148. // url: `/pages/index/classList?flag=${val}&subject_id=${val}&grade_id=${this.current}&title=${ item.name }`
  149. url: `/pages/index/classList?flag=${val}&cat_id=${item.id}&subject_id=${this.leftSel}&grade_id=${this.current}&title=${ item.name }`
  150. });
  151. },
  152. choose(index) {
  153. console.log('leftSel: ',index);
  154. this.leftSel = index;
  155. console.log('this.leftSel',this.leftSel);
  156. // this.onload();
  157. },
  158. onload() {
  159. this.status = 'loadmore';
  160. this.$api
  161. .request('index/getCateList', {
  162. grade_id: this.current,
  163. subject_id: this.leftSel
  164. })
  165. .then(data => {
  166. console.log(data);
  167. if (data.code == 200) {
  168. this.current = data.data.grade[0].id;
  169. this.leftSel = data.data.subject[0].id;
  170. this.dataList = data.data;
  171. this.classList = data.data.class_cate;
  172. } else {
  173. this.$api.toast(data.msg);
  174. }
  175. });
  176. }
  177. }
  178. };
  179. </script>
  180. <style lang="scss" scoped>
  181. page {
  182. height: 100vh;
  183. }
  184. .content {
  185. background-color: #fff;
  186. align-items: flex-start;
  187. .topBox {
  188. background-color: #fff;
  189. }
  190. .secTop {
  191. .scroll-Y {
  192. height: calc(100vh - 120rpx);
  193. flex-wrap: wrap;
  194. }
  195. .topLi {
  196. font-size: 26rpx;
  197. width: 168rpx;
  198. padding: 26rpx 0;
  199. line-height: 37rpx;
  200. text-align: center;
  201. background: #f4f4f4;
  202. color: #666;
  203. }
  204. .topsel {
  205. font-size: 28rpx;
  206. box-sizing: border-box;
  207. background-color: #fff;
  208. color: $promain;
  209. font-weight: 600;
  210. }
  211. }
  212. .topInfo {
  213. width: 582rpx;
  214. padding-right: 30rpx;
  215. padding-left: 12rpx;
  216. background-color: #f5f5f5;
  217. // background-color: #fff;
  218. .swipe {
  219. width: 540rpx;
  220. height: 166rpx;
  221. margin: 20rpx 0;
  222. }
  223. .topClass {
  224. position: fixed;
  225. z-index: 1;
  226. background-color: #fff;
  227. padding-left: 12rpx;
  228. width: 556rpx;
  229. .topClaBox {
  230. flex: 1;
  231. height: 98rpx;
  232. line-height: 98rpx;
  233. display: -webkit-box;
  234. overflow-x: auto;
  235. /*适应苹果*/
  236. -webkit-overflow-scrolling: touch;
  237. //父盒子隐藏滚动条
  238. &::-webkit-scrollbar {
  239. display: none;
  240. }
  241. .topClasLi {
  242. font-size: 28rpx;
  243. padding: 0 15rpx;
  244. }
  245. .topClasel {
  246. color: $promain;
  247. }
  248. }
  249. .classDown {
  250. height: 98rpx;
  251. width: 70rpx;
  252. box-shadow: -2rpx -5rpx 2rpx 5rpx rgba($color: #000000, $alpha: 0.05);
  253. background-color: #fff;
  254. .xuanz {
  255. transform: translate(180deg);
  256. }
  257. }
  258. }
  259. .topCInfo {
  260. flex: 1;
  261. height: calc(100vh - 120rpx);
  262. .maskbg {
  263. position: fixed;
  264. top: 170rpx;
  265. left: 200rpx;
  266. width: calc(100% - 200rpx);
  267. height: calc(100% - 100rpx);
  268. background-color: rgba(0, 0, 0, 0.65);
  269. z-index: 2;
  270. }
  271. /* #ifdef MP */
  272. .maskbg {
  273. position: fixed;
  274. top: 70rpx;
  275. }
  276. /* #endif */
  277. .scroll-Y {
  278. height: calc(100vh - 120rpx);
  279. }
  280. .box {
  281. width: 100%;
  282. flex-wrap: wrap;
  283. }
  284. .goodLi {
  285. width: 100%;
  286. margin-top: 20rpx;
  287. padding: 20rpx;
  288. background-color: #fff;
  289. border-radius: 10rpx;
  290. .gdImg {
  291. width: 100%;
  292. height: 120rpx;
  293. background-color: #fbf9fa;
  294. margin-bottom: 36rpx;
  295. }
  296. .oneelli {
  297. text-align: center;
  298. font-size: 24rpx;
  299. }
  300. .son {
  301. margin-top: 10rpx;
  302. margin-left: 30rpx;
  303. flex-wrap: wrap;
  304. .fontmid {
  305. margin-right: 30rpx;
  306. margin-bottom: 20rpx;
  307. font-size: 24rpx !important;
  308. }
  309. }
  310. }
  311. }
  312. }
  313. }
  314. .cartBox {
  315. width: 710rpx;
  316. position: fixed;
  317. bottom: 10rpx;
  318. /* #ifdef H5 */
  319. bottom: 128rpx;
  320. /* #endif */
  321. left: 0;
  322. z-index: 999;
  323. margin: 0 20rpx;
  324. .leftbox {
  325. height: 100rpx;
  326. flex: 1;
  327. background: #000000;
  328. border-radius: 200rpx 0px 0px 200rpx;
  329. padding-left: 30rpx;
  330. .imgBox {
  331. position: relative;
  332. image {
  333. width: 90rpx;
  334. height: 82rpx;
  335. }
  336. }
  337. .priceInfo {
  338. position: relative;
  339. margin-left: 60rpx;
  340. .price {
  341. color: #fff;
  342. }
  343. }
  344. }
  345. .rightbox {
  346. height: 100rpx;
  347. line-height: 100rpx;
  348. text-align: center;
  349. color: #fff;
  350. background: #d8d8d8 linear-gradient(90deg, #6fd237 0%, #57c32a 100%);
  351. border-radius: 0px 200rpx 200rpx 0px;
  352. width: 194rpx;
  353. }
  354. .ordbox {
  355. font-size: 24rpx;
  356. text-align: center;
  357. margin-bottom: 10rpx;
  358. text {
  359. font-size: 30rpx;
  360. }
  361. // height: 100rpx;
  362. // line-height: 100rpx;
  363. // text-align: center;
  364. // color: #fff;
  365. // background: linear-gradient(90deg, #6fd237 0%, #57c32a 100%);
  366. // border-radius: 200rpx ;
  367. // margin-right: 15rpx;
  368. // padding: 0 20rpx;
  369. }
  370. .rightBlack {
  371. background: #000;
  372. color: #999;
  373. }
  374. }
  375. .ordbtn {
  376. position: fixed;
  377. bottom: 130rpx;
  378. right: 0;
  379. z-index: 999;
  380. width: 150rpx;
  381. height: 150rpx;
  382. line-height: 150rpx;
  383. border-radius: 50%;
  384. color: #fff;
  385. text-align: center;
  386. vertical-align: middle;
  387. font-size: 30rpx;
  388. background: radial-gradient(#68e670 0%, #5dce2c 100%);
  389. }
  390. </style>