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