studyCenter.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. <template>
  2. <view class="content">
  3. <!-- <view class="navbox" id="guide4">
  4. <view class="navbox-item">
  5. <view class="navbox-iteminfo" @click="loginNavTo('/pages_course/learning')">
  6. <image src="@/static/images/course/course_icon.png" mode="aspectFill"></image>
  7. <text>在学课程</text>
  8. </view>
  9. </view>
  10. <view class="navbox-item" @click="loginNavTo('/pages_course/noteList')">
  11. <view class="navbox-iteminfo">
  12. <image src="@/static/images/course/note_icon.png" mode="aspectFill"></image>
  13. <text>学习笔记</text>
  14. </view>
  15. </view>
  16. <view class="navbox-item">
  17. <view class="navbox-iteminfo" @click="handleCollect()">
  18. <image src="@/static/images/course/collect_icon.png" mode="aspectFill"></image>
  19. <text>我的收藏</text>
  20. </view>
  21. </view>
  22. <view class="navbox-item" >
  23. <view class="navbox-iteminfo">
  24. <image src="@/static/images/course/evaluate_icon.png" mode="aspectFill"></image>
  25. <text>我的评价</text>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="navbox navbox-other">
  30. <view class="navbox-item" @click="handleOrder(0)">
  31. <image src="@/static/images/course/order_icon.png" mode="aspectFill"></image>
  32. <text>全部订单</text>
  33. </view>
  34. <view class="navbox-item" @click="handleOrder(1)">
  35. <image src="@/static/images/course/obligation_icon.png" mode="aspectFill"></image>
  36. <text>待付款</text>
  37. </view>
  38. <view class="navbox-item" @click="handleOrder(2)">
  39. <image src="@/static/images/course/paid_icon.png" mode="aspectFill"></image>
  40. <text>已支付</text>
  41. </view>
  42. <view class="navbox-item" @click="handleOrder(4)">
  43. <image src="@/static/images/course/evaluate_icon24.png" mode="aspectFill"></image>
  44. <text>已退款</text>
  45. </view>
  46. </view> -->
  47. <!-- 开通会员入口 -->
  48. <!-- <view class="vipbox" v-if="!user.isVip" @tap="loginNavTo('/pages_course/vipBuy')">
  49. <view class="vipbox-l">
  50. <image class="vip-icon" src="@/static/images/course/v_icon.png" mode="aspectFill"></image>
  51. <text>新用户开通会员,仅需9.9/月看全场</text>
  52. </view>
  53. <image class="vip-arrow" src="@/static/images/course/vip_arrow_right_icon.png" mode="aspectFill"></image>
  54. </view> -->
  55. <!-- 签到 -->
  56. <!-- <view class="sign">
  57. <view class="sign-info">
  58. <view class="sign-day">已连续签到<text>{{signNum}}</text>天</view>
  59. <view class="sign-num">我的积分:{{integral}}</view>
  60. </view>
  61. <view class="sign-box">
  62. <view class="sign-boxbar">
  63. <view class="sign-line">
  64. <view class="sign-line-item" v-for="i in 6" :key="i"></view>
  65. </view>
  66. <view class="sign-item" v-for="(item,index) in sign" :key="index">
  67. <image src="@/static/images/course/sign_in_on_icon.png" v-if="index + 1 <= signNum"></image>
  68. <view class="sign-item-circle" v-else></view>
  69. <view :class="index + 1 <= signNum ? 'active-text sign-item-txt':'sign-item-txt'">第{{index + 1}}天</view>
  70. </view>
  71. </view>
  72. <button class="sign-btn" @click="loginNavTo('/pages_user/user/integral')">立即签到</button>
  73. </view>
  74. </view>
  75. -->
  76. <!-- 讲堂 -->
  77. <view class="hallbox">
  78. <hallItem class="gapitem" v-for="(item, index) in recommendList " :key="index" :item="item" @click.native="navTo('/pages_course/info?courseId='+item.courseId)" />
  79. </view>
  80. </view>
  81. </template>
  82. <script>
  83. import hallItem from "./hallItem.vue";
  84. import { getCourseList } from '@/api/course'
  85. import {getUserInfo} from '@/api/user'
  86. import {getUserSign} from '@/api/integral';
  87. export default{
  88. components: {
  89. hallItem
  90. },
  91. data() {
  92. return {
  93. recommendList:[],
  94. user:{isVip:false},
  95. isDaySign:false,
  96. signNum:0,
  97. integral:0,
  98. defaultSign: [
  99. {signNum:10,sort:1,day:"第1天"},
  100. {signNum:20,sort:2,day:"第2天"},
  101. {signNum:30,sort:3,day:"第3天"},
  102. {signNum:40,sort:4,day:"第4天"},
  103. {signNum:50,sort:5,day:"第5天"},
  104. {signNum:50,sort:6,day:"第6天"},
  105. {signNum:50,sort:7,day:"第7天"},
  106. ],
  107. sign:[],
  108. data:null,
  109. }
  110. },
  111. mounted() {
  112. this.getRecommendList();
  113. this.utils.isLogin().then(res => {
  114. if(res){
  115. this.getUserInfo();
  116. this.getUserSign();
  117. } else {
  118. this.sign = this.defaultSign
  119. }
  120. })
  121. let that=this;
  122. uni.$on('refreshUserSign', function() {
  123. that.utils.isLogin().then(res => {
  124. if(res){
  125. that.getUserSign();
  126. }
  127. })
  128. });
  129. },
  130. methods: {
  131. onShowFun() {
  132. this.getRecommendList();
  133. this.utils.isLogin().then(res => {
  134. if(res){
  135. this.getUserInfo();
  136. this.getUserSign();
  137. } else {
  138. this.signNum=0;
  139. this.isDaySign=false;
  140. this.integral=0;
  141. this.sign = this.defaultSign
  142. }
  143. })
  144. },
  145. getRecommendList(){
  146. let that=this;
  147. const params={"isTui":1};
  148. getCourseList(params,1,10).then(res => {
  149. if(res.code==200){
  150. this.recommendList=res.data.list;
  151. }
  152. },
  153. rej => {}
  154. );
  155. },
  156. getUserSign(){
  157. getUserSign().then(res => {
  158. if(res.code==200){
  159. this.data=res.member;
  160. this.signNum=res.signNum;
  161. this.isDaySign=res.isDaySign;
  162. this.integral=res.integral;
  163. this.sign=JSON.parse(res.sign);
  164. }else{
  165. uni.showToast({
  166. icon:'none',
  167. title: "请求失败",
  168. });
  169. }
  170. },
  171. rej => {}
  172. );
  173. },
  174. handleOrder(status) {
  175. this.loginNavTo('/pages_course/studyCenter/orderList?status='+status);
  176. },
  177. handleCollect() {
  178. this.loginNavTo('/pages_course/studyCenter/courseCollect');
  179. },
  180. getUserInfo(){
  181. let that=this;
  182. getUserInfo().then(res => {
  183. if(res.code==200){
  184. if(res.user!=null){
  185. uni.setStorageSync('userInfo',JSON.stringify(res.user));
  186. this.user=res.user;
  187. }
  188. else{
  189. uni.showToast({
  190. icon:'none',
  191. title: res.msg,
  192. });
  193. }
  194. }
  195. },
  196. rej => {}
  197. );
  198. },
  199. loginNavTo(url){
  200. this.utils.isLogin().then(res=>{
  201. if(res) {
  202. this.$navTo(url);
  203. }
  204. })
  205. },
  206. navTo(url) {
  207. uni.navigateTo({
  208. url: url
  209. })
  210. },
  211. }
  212. }
  213. </script>
  214. <style lang="scss" scoped>
  215. @mixin u-flex($flexD, $alignI, $justifyC) {
  216. display: flex;
  217. flex-direction: $flexD;
  218. align-items: $alignI;
  219. justify-content: $justifyC;
  220. }
  221. .content {
  222. padding: 0 24rpx;
  223. font-family: PingFang SC, PingFang SC;
  224. font-weight: 400;
  225. }
  226. .navbox {
  227. @include u-flex(row,center,space-between);
  228. margin-top: 12rpx;
  229. &:last-child {
  230. margin-right: 0;
  231. }
  232. &-item {
  233. flex:1;
  234. margin-right: 18rpx;
  235. @include u-flex(column,center,center);
  236. }
  237. &-iteminfo {
  238. width: 162rpx;
  239. height: 162rpx;
  240. background: rgba(255,255,255,0.7);
  241. border-radius: 24rpx 24rpx 24rpx 24rpx;
  242. @include u-flex(column,center,center);
  243. font-size: 26rpx;
  244. color: #222222;
  245. }
  246. image {
  247. width: 64rpx;
  248. height: 64rpx;
  249. margin-bottom: 14rpx;
  250. }
  251. }
  252. .navbox-other {
  253. height: 160rpx;
  254. background: #FFFFFF;
  255. border-radius: 16rpx 16rpx 16rpx 16rpx;
  256. font-size: 24rpx;
  257. image {
  258. width: 48rpx;
  259. height: 48rpx;
  260. margin-bottom: 10rpx;
  261. }
  262. }
  263. .vipbox {
  264. height: 120rpx;
  265. margin-top: 20rpx;
  266. padding: 0 20rpx 0 32rpx;
  267. border-radius: 16rpx;
  268. overflow: hidden;
  269. @include u-flex(row,center,space-between);
  270. font-weight: 500;
  271. font-size: 28rpx;
  272. color: #7F5532;
  273. background: url("@/static/images/course/vip_bg.png") no-repeat right / 152rpx 120rpx,linear-gradient( 90deg, #FFE6C5 0%, #FBD095 100%);
  274. &-l {
  275. @include u-flex(row,center,flex-start);
  276. }
  277. .vip-icon {
  278. width: 32rpx;
  279. height: 32rpx;
  280. margin-right: 24rpx;
  281. }
  282. .vip-arrow {
  283. width: 48rpx;
  284. height: 48rpx;
  285. }
  286. }
  287. .sign {
  288. margin-top: 20rpx;
  289. padding: 26rpx 20rpx;
  290. background: url("@/static/images/course/sign_in_bg.png") no-repeat right top / cover,linear-gradient( 180deg, #EB473A 0%, #FBE8DE 100%);
  291. border-radius: 20rpx;
  292. overflow: hidden;
  293. &-info {
  294. @include u-flex(row,center,space-between);
  295. }
  296. &-day {
  297. margin-top: -10rpx;
  298. font-weight: 600;
  299. font-size: 32rpx;
  300. color: #FFFFFF;
  301. @include u-flex(row,baseline,flex-start);
  302. text {
  303. font-family: Roboto, Roboto;
  304. font-weight: bold;
  305. font-size: 56rpx;
  306. color: #FEEBC9;
  307. }
  308. }
  309. &-num {
  310. height: 42rpx;
  311. padding: 0 16rpx;
  312. background: #FFE3DE;
  313. border-radius: 20rpx 20rpx 20rpx 20rpx;
  314. border: 2rpx solid rgba(255,255,255,0.3);
  315. font-size: 24rpx;
  316. color: #F6443C;
  317. line-height: 42rpx;
  318. }
  319. &-box {
  320. background: #FEFAF7;
  321. border-radius: 12rpx;
  322. padding: 34rpx 32rpx 32rpx 32rpx;
  323. margin-top: 20rpx;
  324. }
  325. &-btn {
  326. font-weight: 500;
  327. font-size: 28rpx;
  328. color: #FFFFFF;
  329. height: 72rpx;
  330. line-height: 72rpx;
  331. margin-top: 40rpx;
  332. background: linear-gradient( 90deg, #EB4A42 0%, #EE7E50 100%);
  333. box-shadow: 0rpx 8rpx 8rpx 0rpx rgba(238,124,80,0.2);
  334. border-radius: 36rpx 36rpx 36rpx 36rpx;
  335. &::after {
  336. border: none;
  337. }
  338. }
  339. &-boxbar {
  340. @include u-flex(row,center,space-between);
  341. overflow: hidden;
  342. position: relative;
  343. }
  344. &-line {
  345. width: 100%;
  346. padding: 0 20rpx;
  347. box-sizing: border-box;
  348. @include u-flex(row,center,space-between);
  349. position: absolute;
  350. top: 24rpx;
  351. left: 0;
  352. &-item {
  353. flex: 1;
  354. height: 4rpx;
  355. background: #F8D7D3;
  356. }
  357. }
  358. &-item {
  359. @include u-flex(column,center,center);
  360. font-size: 22rpx;
  361. color: #757575;
  362. position: relative;
  363. z-index: 1;
  364. &-circle {
  365. width: 48rpx;
  366. height: 48rpx;
  367. background: #FEFAF7;
  368. border-radius: 50%;
  369. border: 5rpx solid #F8D7D3;
  370. box-sizing: border-box;
  371. }
  372. &-txt {
  373. margin-top: 16rpx;
  374. }
  375. image {
  376. width: 48rpx;
  377. height: 48rpx;
  378. }
  379. }
  380. .active-text {
  381. color: #EC5D46;
  382. }
  383. }
  384. .hallbox {
  385. @include u-flex(row, center, flex-start);
  386. flex-wrap: wrap;
  387. margin: 0 -18rpx -18rpx 0;
  388. padding: 20rpx 0;
  389. .gapitem {
  390. margin: 0 18rpx 18rpx 0;
  391. }
  392. }
  393. </style>