| | |
| | | barHeight: '', |
| | | navBarHeight: '', |
| | | searchVal: '', |
| | | scoll: false, |
| | | isWhite: false, |
| | | userInfo: {}, |
| | | tabList: [], //目录 |
| | |
| | | activeItem: 0, //精选课程默认选中 |
| | | courseTypeList: [], //精选课程分类 |
| | | courseList: [], |
| | | courseTypeActive: [], |
| | | bookTypeList: [], //图书类型 |
| | | activeItem1: 0, |
| | | bookTypeData: {}, |
| | |
| | | shoppingCartGetId: [], |
| | | baseRefresh: { |
| | | value: false |
| | | } |
| | | }, |
| | | loading: true |
| | | }, |
| | | onShow() { |
| | | this.setData({ |
| | | searchVal: "", |
| | | }); |
| | | console.log(this.data.searchVal) |
| | | this.loadHomePage(); |
| | | this.getBannerList() |
| | | |
| | | }, |
| | | |
| | | onLoad() { |
| | | this.getBannerList() |
| | | const systInfo = wx.getSystemInfoSync(); |
| | | const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息 |
| | | const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 导航栏高度 |
| | |
| | | } else { |
| | | // 如果是第一次登录,会跳转至绑定用户信息页面,填写完用户信息后进行登录并储存token和用户信息,结束后跳转回当前页面(携带页面参数) |
| | | } |
| | | |
| | | this.registe() |
| | | this.init(); |
| | | }, |
| | | onReachBottom() {}, |
| | | onPullDownRefresh() { |
| | | this.setData({ |
| | | 'baseRefresh.value': true, |
| | | isWhite: false |
| | | }) |
| | | this.getBannerList(); |
| | | this.init(); |
| | | }, |
| | | init() { |
| | |
| | | 'baseRefresh.value': false, |
| | | }) |
| | | }, 500); |
| | | }, |
| | | |
| | | registe() { |
| | | app.MG.app.creatUserBehavior({ |
| | | refCode: "sign" |
| | | }).then(res => {}); |
| | | }, |
| | | |
| | | getBannerList() { |
| | |
| | | const item = res.datas[i] |
| | | list.push({ |
| | | value: item.icon, |
| | | link: item.jsek_link |
| | | link: item.jsek_link, |
| | | |
| | | }) |
| | | } |
| | | this.setData({ |
| | | bannerList: list |
| | | bannerList: list, |
| | | loading: false |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | navToActivityDetail(e) { |
| | | let { |
| | | info |
| | | } = e.currentTarget.dataset |
| | | console.log(info) |
| | | if (info.link) { |
| | | wx.navigateTo({ |
| | | url: info.link, |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | loadHomePage() { |
| | | fetchHome().then(({ |
| | |
| | | //点击目录 |
| | | toPages(item) { |
| | | let info = item.target.dataset.info |
| | | console.log(info); |
| | | if (info.url) { |
| | | if (info.text == "图书服务") { |
| | | wx.switchTab({ |
| | |
| | | start: 0, |
| | | size: 4 |
| | | }, |
| | | filterList: [{ |
| | | value: 'Normal', |
| | | field: 'state' |
| | | }], |
| | | fields: { |
| | | liveTime: [], |
| | | lecturer: [], |
| | |
| | | getCourseTypeListList() { |
| | | const data = { |
| | | path: 'jsek_homepageDigitalCourses', |
| | | filterList: [], |
| | | queryType: '\\', |
| | | searchList: [], |
| | | size: '20', |
| | |
| | | sort: { |
| | | type: 'Asc', |
| | | field: 'LinkOrder' |
| | | } |
| | | }, |
| | | filterList: [{ |
| | | value: 'Normal', |
| | | field: 'state' |
| | | }] |
| | | } |
| | | app.MG.store.getStoreChannelList(data).then((res) => { |
| | | if (res.datas && res.datas.length > 0) { |
| | |
| | | const obj = { |
| | | storeInfo: "app.config.goodsStore", |
| | | path: item.pathList + '\\' + item.id, |
| | | coverSize: { |
| | | width: 260 |
| | | }, |
| | | // coverSize: { |
| | | // height: 205 |
| | | // }, |
| | | paging: { |
| | | start: 0, |
| | | size: 4 |
| | | }, |
| | | filterList: [{ |
| | | value: 'Normal', |
| | | field: 'state' |
| | | }], |
| | | fields: { |
| | | courseLeader: [], |
| | | affiliatedUnit: [], |
| | |
| | | }, |
| | | tabChangeHandle(item) { |
| | | let info = this.data.courseTypeList[item.detail.value] |
| | | this.setData({ |
| | | courseList: [], |
| | | courseTypeActive: item.detail.value |
| | | }) |
| | | this.getCourseList(info) |
| | | }, |
| | | //图书服务分类 |
| | | getBookTypeList() { |
| | | const data = { |
| | | path: 'jsek_homepageBookService', |
| | | filterList: [], |
| | | filterList: [{ |
| | | value: 'Normal', |
| | | field: 'state' |
| | | }], |
| | | queryType: '\\', |
| | | searchList: [], |
| | | size: '20', |
| | |
| | | start: 0, |
| | | size: 6 |
| | | }, |
| | | filterList: [{ |
| | | value: 'Normal', |
| | | field: 'state' |
| | | }], |
| | | fields: { |
| | | author: [] |
| | | } |
| | |
| | | start: 0, |
| | | size: 3 |
| | | }, |
| | | filterList: [{ |
| | | value: 'Normal', |
| | | field: 'state' |
| | | }], |
| | | fields: { |
| | | author: [] |
| | | } |
| | |
| | | start: 0, |
| | | size: 6 |
| | | }, |
| | | filterList: [{ |
| | | value: 'Normal', |
| | | field: 'state' |
| | | }], |
| | | fields: { |
| | | author: [], |
| | | } |
| | |
| | | }); |
| | | }, |
| | | goSubjectDetail(e) { |
| | | const { |
| | | book |
| | | } = e.currentTarget.dataset; |
| | | wx.showToast({ |
| | | title: "建设中", |
| | | icon: 'none', |
| | | duration: 1000 |
| | | }) |
| | | // return wx.showToast({ |
| | | // title: "建设中", |
| | | // icon: 'none', |
| | | // duration: 1000 |
| | | // }) |
| | | const item = e.currentTarget.dataset.book |
| | | console.log(item); |
| | | wx.navigateTo({ |
| | | url: '/pages/specialDiscussion/webView/index?link=' + item.jsek_link |
| | | }); |
| | | }, |
| | | goCourseDetail(e) { |
| | | // return wx.showToast({ |
| | | // title: "建设中", |
| | | // icon: 'none', |
| | | // duration: 1000 |
| | | // }) |
| | | |
| | | const { |
| | | book |
| | | } = e.currentTarget.dataset; |
| | | wx.showToast({ |
| | | title: "建设中", |
| | | icon: 'none', |
| | | duration: 1000 |
| | | }) |
| | | console.log(book); |
| | | wx.navigateTo({ |
| | | url: '/pages/digitalCourses/digitalCoursesDetails/index?id=' + book.id + '&path=' + book.idPath, |
| | | }); |
| | | }, |
| | | goReadBookDetail(e) { |
| | | const { |
| | |
| | | const { |
| | | book |
| | | } = e.currentTarget.dataset; |
| | | wx.showToast({ |
| | | title: "建设中", |
| | | icon: 'none', |
| | | duration: 1000 |
| | | }) |
| | | wx.navigateTo({ |
| | | url: '/pages/digitalTextbooks/digitalTextbooksDetails/index?id=' + book.id, |
| | | }); |
| | | }, |
| | | |
| | | |
| | |
| | | const { |
| | | info |
| | | } = e.currentTarget.dataset; |
| | | wx.showToast({ |
| | | title: "建设中", |
| | | icon: 'none', |
| | | duration: 1000 |
| | | }) |
| | | return; |
| | | if (wx.getStorageSync(app.config.tokenKey)) { |
| | | let query = { |
| | | start: 0, |
| | |
| | | onMoreGuide(e) { |
| | | let type = e.currentTarget.dataset.info |
| | | if (type == "tushufuwu") { |
| | | let assortCode = ""; |
| | | if (this.data.bookTypeData.name == '高等教育') { |
| | | assortCode = "jsek_higherEducation" |
| | | } |
| | | if (this.data.bookTypeData.name == '职业教育') { |
| | | assortCode = "jsek_vocationalEducation" |
| | | } |
| | | if (this.data.bookTypeData.name == '教师教育') { |
| | | assortCode = "jsek_teacherEducation" |
| | | } |
| | | if (this.data.bookTypeData.name == '少儿教育') { |
| | | assortCode = "jsek_childrenEducation" |
| | | } |
| | | if (this.data.bookTypeData.name == '考试培训') { |
| | | assortCode = "jsek_examTraining" |
| | | } |
| | | if (this.data.bookTypeData.name == '主题出版') { |
| | | assortCode = "jsek_themePublishing" |
| | | } |
| | | if (this.data.bookTypeData.name == '学术著作') { |
| | | assortCode = "jsek_academicWorks" |
| | | } |
| | | if (this.data.bookTypeData.name == '大众读物') { |
| | | assortCode = "jsek_popularReadingMaterials" |
| | | } |
| | | wx.navigateTo({ |
| | | url: '/packageBookService/pages/bookServices/list/index?assorName=' + this.data.bookTypeData.name |
| | | url: '/packageBookService/pages/bookServices/list/index?assorName=' + this.data.bookTypeData.name + '&assortCode=' + assortCode |
| | | }) |
| | | } else if (type == "shuziyuedu") { |
| | | wx.navigateTo({ |
| | | url: '/pages/home/digitalRead/index' |
| | | }) |
| | | } else if (type == "zhuantitaolun") { |
| | | // return wx.showToast({ |
| | | // title: "建设中", |
| | | // icon: 'none', |
| | | // duration: 1000 |
| | | // }) |
| | | wx.navigateTo({ |
| | | url: '/pages/specialDiscussion/index' |
| | | }) |
| | | |
| | | } else if (type == "jingxuankecheng") { |
| | | // return wx.showToast({ |
| | | // title: "建设中", |
| | | // icon: 'none', |
| | | // duration: 1000 |
| | | // }) |
| | | wx.navigateTo({ |
| | | url: '/pages/digitalCourses/index?courseTypeActive=' + this.data.courseTypeActive |
| | | }) |
| | | } else if (type == "shuzijiaocai") { |
| | | wx.navigateTo({ |
| | | url: '/pages/digitalTextbooks/index' |
| | | }) |
| | | } else { |
| | | wx.showToast({ |
| | |
| | | |
| | | }, |
| | | |
| | | // 扫一扫 |
| | | onIconScanTap() { |
| | | wx.scanCode({ |
| | | success(res) { |
| | | console.log(res); |
| | | if (res.errMsg == "scanCode:ok" && res.path || res.result) { |
| | | let path = res.path || res.result |
| | | wx.redirectTo({ |
| | | url: '/' + path, |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | |
| | | |
| | | // 监听滚动条 |
| | | onScroll(e) { |
| | | console.log(e) |
| | | this.setData({ |
| | | isWhite: true |
| | | }) |
| | | if (e.detail.scrollTop == 0) { |
| | | this.setData({ |
| | | isWhite: false |
| | | }) |
| | | if (this.data.scoll) { |
| | | if (e.detail.scrollTop < 20) { |
| | | this.data.scoll = false |
| | | this.isChange(false); |
| | | } |
| | | } else { |
| | | if (e.detail.scrollTop > 20) { |
| | | this.data.scoll = true |
| | | this.isChange(true); |
| | | } |
| | | } |
| | | // this.setData({ |
| | | // isWhite: e.detail.scrollTop > 20 ? true : false |
| | | // }) |
| | | }, |
| | | |
| | | onScrollToTop(e) { |
| | | |
| | | isChange(data) { |
| | | this.setData({ |
| | | isWhite: e.detail.scrollTop > 50 ? true : false |
| | | isWhite: data |
| | | }) |
| | | }, |
| | | |
| | | onRetrievalPage() { |
| | | |
| | | // 首页测试登录功能,后续注释 |