studyCenter.vue 9.9 KB

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