|
@@ -84,6 +84,7 @@
|
|
|
import {
|
|
|
checkPhone
|
|
|
} from '@/apis/utils'
|
|
|
+ import * as mineApi from '@/apis/youth/mine.js'
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
@@ -107,6 +108,34 @@
|
|
|
this.findByOpenId();
|
|
|
},
|
|
|
methods: {
|
|
|
+ getLoadMyCourses(studentId) {
|
|
|
+ uni.showLoading({
|
|
|
+ title: "加载中",
|
|
|
+ mask: true,
|
|
|
+ })
|
|
|
+ mineApi.loadMyCourses({
|
|
|
+ studentId: studentId,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 100
|
|
|
+ }).then((res) => {
|
|
|
+ uni.hideLoading();
|
|
|
+ var list = res.data.data;
|
|
|
+ if(list.length == 0) {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/youth/course/course'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/youth/homePage/homePage'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ uni.hideLoading();
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/youth/course/course'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
findByOpenId() {
|
|
|
|
|
|
var openId = this.carhelp.getOpenId()
|
|
@@ -139,9 +168,11 @@
|
|
|
this.carhelp.setPersonInfoPlus(res.data.data);
|
|
|
this.carhelp.setNsStudentId({studentId: res.data.data.nsStudentInfo.id});
|
|
|
|
|
|
- uni.redirectTo({
|
|
|
- url: '/pages/youth/homePage/homePage'
|
|
|
- })
|
|
|
+ // uni.redirectTo({
|
|
|
+ // url: '/pages/youth/homePage/homePage'
|
|
|
+ // })
|
|
|
+ var studentId = res.data.data.nsStudentInfo.id;
|
|
|
+ this.getLoadMyCourses(studentId);
|
|
|
} else {
|
|
|
this.carhelp.logoff()
|
|
|
}
|
|
@@ -253,9 +284,15 @@
|
|
|
var token = response ? response.data.token : '';
|
|
|
this.carhelp.setToken(token);
|
|
|
this.carhelp.setPersonInfo(response.data.regUser);
|
|
|
- uni.redirectTo({
|
|
|
- url: '/pages/youth/homePage/homePage'
|
|
|
- })
|
|
|
+
|
|
|
+ var nsStudentInfo = response.data.nsStudentInfo;
|
|
|
+ if(nsStudentInfo != null) {
|
|
|
+ this.getLoadMyCourses(nsStudentInfo.id);
|
|
|
+ } else {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/youth/homePage/homePage'
|
|
|
+ })
|
|
|
+ }
|
|
|
}).catch(error => {
|
|
|
uni.showToast({
|
|
|
title: error,
|