diff --git a/App.vue b/App.vue index ec8901a..ced4bee 100644 --- a/App.vue +++ b/App.vue @@ -1,21 +1,27 @@ - \ No newline at end of file diff --git a/packages/schoolmate/index.vue b/packages/schoolmate/index.vue index e935371..0566fba 100644 --- a/packages/schoolmate/index.vue +++ b/packages/schoolmate/index.vue @@ -210,6 +210,7 @@ company_type: '', company_industry: '', } + this.current = 0 this.getMyCourseTxl() }, confirmSearch() { diff --git a/pages/book/index.vue b/pages/book/index.vue index 97bf44c..930bbac 100644 --- a/pages/book/index.vue +++ b/pages/book/index.vue @@ -1,34 +1,37 @@ @@ -82,42 +85,37 @@ topBanner }, data() { - return { - showRegister:false, + return { + showRegister: false, banner_list: [], - hasMobile: false, - go_course_id:'', + hasMobile: false, + go_course_id: '', hasData: true, current_page: 1, total_page: 0, load_status: '', course_list: [], - course_status: [{ - type: 'primary', - value: '未开始' - }, { - type: 'warning', - value: '进行中' - }, { - type: 'info', - value: '已结束' - }], } }, + onShareAppMessage() { + return this.base.shareInfo + }, + onShareTimeline() { + return this.base.shareInfo + }, onLoad() { - - this.getBannerList() - - }, - onShow() { - this.getCourseList() - this.showRegister = false - let user = uni.getStorageSync("stbc_lifeData") ? uni.getStorageSync("stbc_lifeData").vuex_user : {} - if(!this.base.isNull(user.mobile)){ - this.hasMobile = true - }else{ - this.hasMobile = false - } + this.getBannerList() + + this.getCourseList() + }, + onShow() { + this.showRegister = false + let user = uni.getStorageSync("stbc_lifeData") ? uni.getStorageSync("stbc_lifeData").vuex_user : {} + if (!this.base.isNull(user.mobile)) { + this.hasMobile = true + } else { + this.hasMobile = false + } }, onReachBottom() { // console.log("this.onReachBottom", this.current_page, this.total_page) @@ -129,18 +127,20 @@ if (!this.hasData) { return } - this.current_page = this.current_page + 1 + if (this.current_page > this.total_page) { this.base.toast('没有更多了') return } + this.current_page = this.current_page + 1 this.getCourseList() }, async getCourseList() { this.load_status = 'loading' const res = await this.$u.api.courseIndex({ page: this.current_page, - page_size: 10 + page_size: 10, + // status:1 }) this.total_page = res.last_page if (res.data.length === 0 && this.current_page === 1) { @@ -149,72 +149,78 @@ this.course_list.push(...res.data) }, - convertToChineseMonth(dateString,dateStatus) { - if (this.base.isNull(dateString) || dateStatus==='待定') { - return { - month:'', - year:"定" + convertToChineseMonth(dateString, dateStatus) { + if (this.base.isNull(dateString) || dateStatus === '待定') { + return { + month: '', + year: "定" + } + } else { + // 解析日期字符串 + const dateParts = dateString.split('-'); + const year = parseInt(dateParts[0], 10); + const monthNumber = parseInt(dateParts[1], 10); + const day = parseInt(dateParts[2], 10); + + // 定义中文月份 + const chineseMonths = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']; + + // 获取中文月份 + const chineseMonth = chineseMonths[monthNumber - 1]; + + return { + year: year, + month: chineseMonth, + day: day } - }else{ - // 解析日期字符串 - const dateParts = dateString.split('-'); - const year = parseInt(dateParts[0], 10); - const monthNumber = parseInt(dateParts[1], 10); - const day = parseInt(dateParts[2], 10); - - // 定义中文月份 - const chineseMonths = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']; - - // 获取中文月份 - const chineseMonth = chineseMonths[monthNumber - 1]; - - return { - year: year, - month: chineseMonth, - day: day - } } - - }, + + }, // 报名 - toDetail(item) { - this.go_course_id = item.id - - // 收费的不限制报名人数 total没值也不限制 - - // 免费的限制报名人数 - if(!item.is_fee && (item.total && item.total>0)){ - // 报名人数已满 - if(item.sign_total>=item.total){ - this.base.toast("当前报名人数已满") - return - } - } - if(!this.hasMobile){ - this.showRegister = true - return - }else{ - uni.navigateTo({ - url:'/packages/apply/index?id='+this.go_course_id - }) + toDetail(item) { + uni.navigateTo({ + url: '/packages/course/detail?id=' + item.id + }) + return + + + this.go_course_id = item.id + + // 收费的不限制报名人数 total没值也不限制 + + // 免费的限制报名人数 + if (!item.is_fee && (item.total && item.total > 0)) { + // 报名人数已满 + if (item.course_signs_count >= item.total) { + this.base.toast("当前报名人数已满") + return + } } - }, - // 去绑定登录 - goBind(){ - console.log("qwe") - uni.navigateTo({ - url:'/packages/register/login?id='+this.go_course_id - }) - }, - // 去注册 - toRegister(){ - uni.navigateTo({ - url:'/packages/register/index?id='+this.go_course_id - }) + if (!this.hasMobile) { + this.showRegister = true + return + } else { + uni.navigateTo({ + url: '/packages/apply/index?id=' + this.go_course_id + }) + } + }, + // 去绑定登录 + goBind() { + console.log("qwe") + uni.navigateTo({ + url: '/packages/register/login?id=' + this.go_course_id + }) + }, + // 去注册 + toRegister() { + uni.navigateTo({ + url: '/packages/register/index?id=' + this.go_course_id + }) }, async getBannerList() { const res = await this.$u.api.otherBanner({ - position:1, + position: 1, }) this.banner_list = res }, @@ -344,6 +350,7 @@ } } } + &-btn { width: 150rpx; font-size: 24rpx; @@ -351,123 +358,144 @@ color: #fff; padding: 10rpx 20rpx; border-radius: 30rpx; - margin: 20rpx; + margin: 20rpx; text-align: center; } - } - // 未开始 - &-start{ - .list-item-wrap{ - width:100%; - &-time{ - background: linear-gradient(to bottom,#cf847d,#b00d10); - } - &-status{ - border-right:none; - &-type { - &>text { - background: linear-gradient(to right,#cf847d,#b00d10); - } - } - &-label { - &:before { - content: " "; - background: #cfcfcf; - } - } - } - - } - .list-item-btn{ - display: none; - } - - } - // 已结束 - &-end{ - .list-item-wrap{ - width:100%; - &-time{ - background: linear-gradient(to bottom,#e4cdb4,#c69c6d); - } - &-status{ - border-right:none; - &-type { - &>text { - background: linear-gradient(to right,#e4cdb4,#c69c6d); - } - } - &-label { - &:before { - content: " "; - background: #cfcfcf; - } - } - } - - } - .list-item-btn{ - display: none; - } - } - - } - .modal{ - ::v-deep .u-drawer-bottom{ - border-radius: 40rpx; - } - &-tip{ - text-align: center; - padding:30rpx; - font-size: 32rpx; - } - &-content{ - height:450rpx; - padding:0 30rpx; - font-size: 32rpx; - text-align: center; - &>view{ - margin:30rpx auto; - } - } - &-bind { - width: 45%; - text-align: center; - margin: 0 auto; - color: #fff; - border-radius: 30rpx; - padding: 20rpx; - background: linear-gradient(to right, #e4cdb4, #c69c6d); - } - - &-register { - width: 45%; - text-align: center; - margin: 0 auto; - color: #fff; - border-radius: 30rpx; - padding: 20rpx; - background: linear-gradient(to right, #5e5fbc, #0d0398); - } - &-btn{ - display: flex; - justify-content: space-between; - padding:30rpx; - &>view{ - width:45%; - text-align: center; - margin: 0 auto; - color: #fff; - border-radius: 30rpx; - padding: 20rpx; - } - &-bind{ - background: linear-gradient(to right, #e4cdb4, #c69c6d); - } - &-register{ - background: linear-gradient(to right, #5e5fbc, #0d0398); - } - } + } + + // 未开始 + &-start { + .list-item-wrap { + width: 100%; + + &-time { + background: linear-gradient(to bottom, #cf847d, #b00d10); + } + + &-status { + border-right: none; + + &-type { + &>text { + background: linear-gradient(to right, #cf847d, #b00d10); + } + } + + &-label { + &:before { + content: " "; + background: #cfcfcf; + } + } + } + + } + + .list-item-btn { + display: none; + } + + } + + // 已结束 + &-end { + .list-item-wrap { + width: 100%; + + &-time { + background: linear-gradient(to bottom, #e4cdb4, #c69c6d); + } + + &-status { + border-right: none; + + &-type { + &>text { + background: linear-gradient(to right, #e4cdb4, #c69c6d); + } + } + + &-label { + &:before { + content: " "; + background: #cfcfcf; + } + } + } + + } + + .list-item-btn { + display: none; + } + } + + } + + .modal { + ::v-deep .u-drawer-bottom { + border-radius: 40rpx; + } + + &-tip { + text-align: center; + padding: 30rpx; + font-size: 32rpx; + } + + &-content { + height: 450rpx; + padding: 0 30rpx; + font-size: 32rpx; + text-align: center; + + &>view { + margin: 30rpx auto; + } + } + + &-bind { + width: 45%; + text-align: center; + margin: 0 auto; + color: #fff; + border-radius: 30rpx; + padding: 20rpx; + background: linear-gradient(to right, #e4cdb4, #c69c6d); + } + + &-register { + width: 45%; + text-align: center; + margin: 0 auto; + color: #fff; + border-radius: 30rpx; + padding: 20rpx; + background: linear-gradient(to right, #5e5fbc, #0d0398); + } + + &-btn { + display: flex; + justify-content: space-between; + padding: 30rpx; + + &>view { + width: 45%; + text-align: center; + margin: 0 auto; + color: #fff; + border-radius: 30rpx; + padding: 20rpx; + } + + &-bind { + background: linear-gradient(to right, #e4cdb4, #c69c6d); + } + + &-register { + background: linear-gradient(to right, #5e5fbc, #0d0398); + } + } } } \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index a0b2eee..7c76d6d 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,5 +1,9 @@