123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329 |
- const app = require('../../utils/util.js');
- const tools = require('../../utils/tools.js');
- Page({
- data: {
-
- wqdataArr: 0,
- jjdataArr: 0,
- isNeedlogin: false,
- // 课程轮播
- bnrUrl: [{
- clasImg: app.globalData.imgUrl+"/images/zbfm.png"
- }],
- gridArr: [{
- url: "/images/icon1.png",
- name: "在线直播",
- isread: true
- }, {
- url: "/images/icon2.png",
- name: "在线录播",
- isread: true
- }, {
- url: "/images/icon3.png",
- name: "互动答疑",
- isread: true
- }, {
- url: "/images/icon4.png",
- name: "测试答卷",
- isread: true
- }],
- xczsArr: [],
- goGridArr: [
- '/pages/onlineClass/onlineClass',
- '/pages/demandCourses/demandCourses',
- '/pages/myInteractions/myInteractions',
- '/pages/testAnswer/testAnswer'
- ],
- active: 0,
- xcpArr: [],
- wdArr:[],
- notice:"",
- noticeVis:false,
- vType:["理论阵地","我的学院","特色课程","特色管理"]
- },
- // 轮播点击去上课跳转到我的班级
- gomyClass(e) {
- if (e.currentTarget.dataset.item.isActive == 5) {
- wx.switchTab({
- url: '/pages/myClass/myClass',
- })
- }
- },
- // 即将开班
- gostartClass(e) {
- if (e.currentTarget.dataset.item !== 0) {
- wx.navigateTo({
- url: '/pages/startClass/startClass',
- })
- } else {
- wx.showModal({
- showCancel: false,
- content: "您还没有即将开班哦",
- success(res) {
- if (res.confirm) {
- wx.switchTab({
- url: '../index/index'
- })
- }
- }
- })
- }
- },
- // 往期开班
- goagoClass(e) {
- if (e.currentTarget.dataset.item !== 0) {
- wx.navigateTo({
- url: '/pages/agoClass/agoClass',
- })
- } else {
- wx.showModal({
- showCancel: false,
- content: "您还没有往期开班哦",
- success(res) {
- if (res.confirm) {
- wx.switchTab({
- url: '../index/index'
- })
- }
- }
- })
- }
- },
- // 宣传展示查看更多
- xczsMore() {
- wx.navigateTo({
- url: '/pages/exhibitionList/exhibitionList?id=0',
- })
- },
- // 每个宣传展示跳转详情页
- turnDetails(e) {
- let num = e.currentTarget.id;
- wx.navigateTo({
- url: '/pages/exhibitionList/exhibitionList?id=' + num,
- })
- },
- // 首页的四个点击
- goGrid(e) {
- wx.navigateTo({
- url: this.data.goGridArr[e.currentTarget.dataset.id]
- })
- },
- // banner图
- getBanner(sessionKey) {
- wx.request({
- url: app.globalData.publicUrl + '/wx/student/selAllClas',
- method: "post",
- data: {
- sessionKey
- },
- success: (res) => {
- if (res.data.data && res.data.data.claList.length != 0) {
- this.setData({
- bnrUrl: res.data.data.claList
- })
- }
- }
- })
- },
- // 即将开班有几个
- getjjLength(sessionKey) {
- wx.request({
- url: app.globalData.publicUrl + '/wx/student/selClasToo',
- method: "post",
- data: {
- sessionKey,
- isActive: "0"
- },
- success: (res) => {
- if (res.data.data)
- this.setData({
- jjdataArr: res.data.data.length
- })
- }
- })
- },
- // 往期开班有几个
- getwqLength(sessionKey) {
- wx.request({
- url: app.globalData.publicUrl + '/wx/student/selClasToo',
- method: "post",
- data: {
- sessionKey,
- isActive: "2"
- },
- success: (res) => {
- if (res.data.data)
- this.setData({
- wqdataArr: res.data.data.length
- })
- }
- })
- },
- // 四个宣传图
- getfour() {
- wx.request({
- url: app.globalData.publicUrl + '/wx/course/listCategory',
- method: "post",
- success: (res) => {
- this.setData({
- xczsArr: res.data.list
- })
- }
- })
- },
- // 四个宣传图onshow
- getfour1() {
- wx.request({
- url: app.globalData.publicUrl + '/wx/course/listCategory',
- method: "post",
- success: (res) => {
- if (this.data.xczsArr && this.data.xczsArr.length != 0) {
- if (this.data.xczsArr.sort().toString() != res.data.list.sort().toString()) {
- this.setData({
- xczsArr: res.data.list
- })
- }
- }
- }
- })
- },
- // 第一个小红点
- getRedPoint1(sessionKey) {
- let completeStatus1 = `gridArr[${0}].isread`;
- let completeStatus2 = `gridArr[${1}].isread`;
- wx.request({
- url: app.globalData.publicUrl + '/wx/course/undoneLogo',
- method: "post",
- data: {
- sessionKey
- },
- success: (res) => {
- if (res.data.code == 0 && res.data.isLive == true) {
- this.setData({
- [completeStatus1]: false
- })
- }
- if (res.data.code == 0 && res.data.isRecord == true) {
- this.setData({
- [completeStatus2]: false
- })
- }
- }
- })
- },
- // 第四个小红点
- getRedPoint4(sessionKey) {
- let completeStatus = `gridArr[${3}].isread`;
- wx.request({
- url: app.globalData.publicUrl + '/wx/exam/list',
- method: "post",
- data: {
- sessionKey,
- status: 0
- },
- success: (res) => {
- if (res.data.code == 0 && res.data.list.length > 0) {
- this.setData({
- [completeStatus]: false
- })
- } else {
- this.setData({
- [completeStatus]: true
- })
- }
- }
- })
- },
- goSeevideo(e) {
- let id = e.currentTarget.dataset.item.id
- wx.navigateTo({
- url: '/pages/dbVideo/dbVideo?id=' + id,
- })
- },
- onChange(event) {
- let tag = event.detail.name + 1;
- this.getVedioList(tag)
-
- },
- getVedioList(tag){
- var that=this;
- wx.request({
- method: "POST",
- url: app.globalData.publicUrl + '/wx/course/listByCourseTag?tag=' + tag,
- success: (e) => {
- that.setData({
- xcpArr: e.data.list,
- })
- }
- })
- },
- toNotice(){
- var that=this;
- wx.setStorage({
- data: that.data.noticeArr,
- key: 'noticeArr',
- success:()=>{
- wx.navigateTo({
- url: '../myNoticen/myNotice'
- })
- }
- })
- },
- getNotice(sessionKey){
- wx.request({
-
- url: app.globalData.publicUrl + '/wx/eduNoticeSee/afficheLists',
- method: "post",
- data: {
- sessionKey: sessionKey,
- //isSee: 1
- // isNotice: 0
- },
- success: (res) => {
- console.log(res);
-
- if (res.data.code == 0) {
- if (res.data.data.notReadAfficheList.length !== 0) {
- this.setData({
- noticeVis: true,
- noticeArr: res.data,
- notice: res.data.data.notReadAfficheList[0].noticeContent
-
- })
- } else {
- this.setData({
- noticeArr: res.data.data,
- noticeVis: false,
-
- })
- }
- } else {
- this.setData({
- noticeVis: false
- })
- }
- },
- fail: () => {
- this.setData({
- noticeVis: false
- })
- }
- })
- },
- async onShow() {
- const sessionKey = await tools.checkSessionAndLogin();
- // this.getBanner(sessionKey);
- this.getjjLength(sessionKey);
- this.getwqLength(sessionKey);
- this.getRedPoint1(sessionKey);
- this.getRedPoint4(sessionKey);
- this.getNotice(sessionKey);
-
- // this.getfour1();
- },
- async onLoad() {
- //this.getfour();
-
- this.getVedioList(this.data.active+1);
- },
- })
|