diff --git a/common/util.js b/common/util.js index 769be8e..c5e121b 100644 --- a/common/util.js +++ b/common/util.js @@ -68,7 +68,7 @@ const base = { return regex.test(phoneNumber); }, // 分享 - shareInfo : ()=> { + shareInfo : () => { return{ title:"苏州科技商学院", imageUrl:"/static/share.jpg" diff --git a/components/topBanner.vue b/components/topBanner.vue index dfb592b..38fe095 100644 --- a/components/topBanner.vue +++ b/components/topBanner.vue @@ -38,7 +38,10 @@ this.show_current_swiper = e.detail.current + 1 }, toCourse(item){ - uni.switchTab({ + // uni.switchTab({ + // url:item.jump_url + // }) + uni.navigateTo({ url:item.jump_url }) } diff --git a/packages/apply/index copy.vue b/packages/apply/index copy.vue new file mode 100644 index 0000000..584d4bc --- /dev/null +++ b/packages/apply/index copy.vue @@ -0,0 +1,323 @@ + + + + + \ No newline at end of file diff --git a/packages/apply/index.vue b/packages/apply/index.vue index 22300e2..0224402 100644 --- a/packages/apply/index.vue +++ b/packages/apply/index.vue @@ -53,8 +53,8 @@ course_id: '', showPosition: false, positionList: [], - dateShow: false, - is_fee:0, //需不需要缴费这个课程 + dateShow: false, + is_fee: 0, //需不需要缴费这个课程 dateParams: { year: true, month: true, @@ -141,21 +141,21 @@ selectSex(e) { console.log("e", e) this.form.sex = this.sexList[e[0]]['value'] - }, - selectPosition(e){ - this.form.company_position = this.positionList[e[0]]['value'] - - }, - // 日期 - dateConfirm(e) { - this.form.birthday = e.year + '-' + e.month + '-' + e.day - }, - getPosition(){ - this.$u.api.getparameter({ - number:'company_position' - }).then(res=>{ - this.positionList = res.detail - }) + }, + selectPosition(e) { + this.form.company_position = this.positionList[e[0]]['value'] + + }, + // 日期 + dateConfirm(e) { + this.form.birthday = e.year + '-' + e.month + '-' + e.day + }, + getPosition() { + this.$u.api.getparameter({ + number: 'company_position' + }).then(res => { + this.positionList = res.detail + }) }, async getCourseDetail(id) { const res = await this.$u.api.courseDetail({ @@ -163,9 +163,9 @@ }) if (res.course_forms && res.course_forms.length > 0) { this.course_forms = res.course_forms - } - this.is_fee = res.is_fee - + } + this.is_fee = res.is_fee + }, backForm(e) { console.log("e", e) @@ -174,93 +174,142 @@ _arr.push({ name: item.name, field: item.field, - value: item.value?item.value:'' - }) - // 更新扩展字段 - if(item.belong_user===1){ - this.form[item.field] = item.value + value: item.value ? item.value : '' + }) + // 更新扩展字段 + if (item.belong_user === 1) { + this.form[item.field] = item.value } }) this.apply_form = _arr - console.log("this.apply_form", this.apply_form,this.form) - // return - this.$refs.uForm.validate(valid => { - if (valid) { - // this.saveUser() - this.applyCourse() - } else { - console.log('验证失败'); - // this.base.toast("验证失败") - } + console.log("this.apply_form", this.apply_form, this.form) + // return + this.$refs.uForm.validate(valid => { + if (valid) { + this.saveUser() + this.applyCourse() + } else { + console.log('验证失败'); + // this.base.toast("验证失败") + } }); }, - saveUser() { + async saveUser() { let that = this - this.$u.api.saveUser(this.form).then(res => { - console.log("user") - this.$u.api.user().then(res => { - this.$u.vuex('vuex_user', res.user) - if(that.is_fee){ - that.newsSubscription() - }else{ - uni.redirectTo({ - url: '/packages/mycourse/index' - }) - } - }) - }).then(res=>{ - if(that.is_fee){ - that.newsSubscription() - }else{ - uni.redirectTo({ - url: '/packages/mycourse/index' - }) - } + await this.$u.api.saveUser(this.form).then(res => { + console.log("user") + // this.$u.api.user().then(res => { + // this.$u.vuex('vuex_user', res.user) + // }) }) - }, - applyCourse() { + async applyCourse() { let that = this - this.$u.api.courseSign({ + // let that = this + await this.$u.api.courseSign({ course_id: this.course_id, data: this.apply_form }).then(res => { - this.base.toast("报名成功",2000,function(){ - setTimeout(function(){ - that.saveUser() - },1500) - - }) - + if (this.is_fee) { + this.newsSubscription() + } else { + this.base.toast("报名成功",1500,function(){ + setTimeout(function(){ + uni.redirectTo({ + url: '/packages/mycourse/index' + }) + },1500) + }) + } + }) - }, + }, // 订阅缴费 + newsSubscription() { + console.log("yesssss") let that = this uni.getSetting({ withSubscriptions: true, //是否获取用户订阅消息的订阅状态,默认false不返回 success(res) { - if (res.authSetting['scope.subscribeMessage']) { - uni.redirectTo({ - url: '/packages/mycourse/index' - }) - } else { - // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息 - uni.requestSubscribeMessage({ - tmplIds: ['6bkRNahvR88pG4Tpk0c2aY81kszvFpdaIV-CdC_ENTM','CCEUrg9t8aW40NEDoqEk7NY7pyllW_0GEHfjwg_DF6A', - '0WMaFZ_0FOS5gtxEAi-fM3pFcYPySRMwYFNASz9oig0','XsR1BJRdE8JtFUC1o3w7DDcscXkCEGu62J8_smMofZI'], - success(res) { - that.base.toast("订阅成功",1500,function(){ + console.log("resdfg", res) + if (res.subscriptionsSetting.mainSwitch) { + if (res.subscriptionsSetting.itemSettings && res.subscriptionsSetting.itemSettings[ + '6bkRNahvR88pG4Tpk0c2aY81kszvFpdaIV-CdC_ENTM'] === 'accept' && + res.subscriptionsSetting.itemSettings[ + 'XsR1BJRdE8JtFUC1o3w7DDcscXkCEGu62J8_smMofZI'] === 'accept' + ) { + console.log("accept") + // 用户已经订阅该消息模板,执行相应操作 + that.base.toast("报名成功", 1500, function() { + setTimeout(function(){ uni.redirectTo({ url: '/packages/mycourse/index' }) + },1500) + + }) + } else { + // 用户没有订阅该消息模板,显示订阅弹窗 + uni.showModal({ + title: '订阅消息', + content: '是否需要订阅预约结果消息', + success(res1) { + if (res1.confirm) { + uni.requestSubscribeMessage({ + tmplIds: [ + '6bkRNahvR88pG4Tpk0c2aY81kszvFpdaIV-CdC_ENTM', + 'XsR1BJRdE8JtFUC1o3w7DDcscXkCEGu62J8_smMofZI', + ], + success(res) { + that.base.toast("报名成功", 1500, function() { + setTimeout(function(){ + uni.redirectTo({ + url: '/packages/mycourse/index' + }) + },1500) + + }) + }, + fail(err) { + that.base.toast("报名成功", 1500, function() { + setTimeout(function(){ + uni.redirectTo({ + url: '/packages/mycourse/index' + }) + },1500) + + }) + } + }) + } else { + that.base.toast("报名成功", 1500, function() { + setTimeout(function(){ + uni.redirectTo({ + url: '/packages/mycourse/index' + }) + },1500) + }) + } + } + }) + + } + } else { + console.log("9999") + that.base.toast("报名成功", 1500, function() { + setTimeout(function(){ + uni.redirectTo({ + url: '/packages/mycourse/index' }) - } + },1500) + }) + // 用户尚未开启订阅消息总开关,建议提醒用户开启 } } - }); + }); }, } } @@ -283,9 +332,9 @@ background-color: #fff; padding: 20rpx 50rpx; border-radius: 20rpx; - position: relative; - height: 100%; - overflow: scroll; + position: relative; + height: 100%; + overflow: scroll; } .form-btn { @@ -296,12 +345,12 @@ padding: 20rpx 0; &>view { - width: 70%; - text-align: center; - margin: 0 auto; - color: #fff; - background: linear-gradient(to right, #5e5fbc, #0d0398); - border-radius: 30rpx; + width: 70%; + text-align: center; + margin: 0 auto; + color: #fff; + background: linear-gradient(to right, #5e5fbc, #0d0398); + border-radius: 30rpx; padding: 20rpx; } } diff --git a/packages/booksubmit/index.vue b/packages/booksubmit/index.vue index c75c84f..a79d8d3 100644 --- a/packages/booksubmit/index.vue +++ b/packages/booksubmit/index.vue @@ -214,6 +214,7 @@ if(val.length>=7){ this.plateList[this.plateIndex]['plate'] = val.join("") } + console.log(this.plateList[this.plateIndex]) }, openPlate(index){ @@ -238,6 +239,7 @@ this.showPlate=false this.plateList[this.plateIndex]['show'] = true this.plateIndex= -1 + this.plateNumber = ['苏', 'E', '', '', '', '', ''] }, // 同行人 addAccompany() { @@ -290,30 +292,26 @@ start_time = this.form.date + ' ' + this.form.start_time + ':00' end_time = this.form.date + ' ' + this.form.end_time + ':00' this.form.accompany_total = this.form.accompany.length - - let _plate = '' + console.log("accompany_total",this.plateList,this.form) + let _plate = [] if(this.plateList.length>0){ - if(this.plateList.length>this.form.accompany_total+1){ + if(this.plateList.length>this.form.accompany_total + 1){ this.base.toast("车辆数量已经大于预约人数了") return } - _plate = this.plateList.join(',') - // this.plateList.map(item=>{ - // _plate+=item.plate+',' - // }) + this.plateList.map(item=>{ + _plate.push(item.plate) + }) } - this.form.plate = _plate - console.log("plate",this.form) + this.form.plate = _plate.join(',') + console.log("plate",this.form) + // return this.$u.api.scheduleSave({ ...this.form, start_time:start_time, end_time:end_time }).then(res => { - this.base.toast("预约成功",2000,function(){ - uni.redirectTo({ - url:'/packages/mybook/index' - }) - }) + this.newsSubscription() }) } else { @@ -321,7 +319,81 @@ // this.base.toast("验证失败") } }); - } + }, + // 订阅消息 + newsSubscription() { + let that = this + uni.getSetting({ + withSubscriptions: true, //是否获取用户订阅消息的订阅状态,默认false不返回 + success(res) { + console.log("resdfg", res) + if (res.subscriptionsSetting.mainSwitch) { + if (res.subscriptionsSetting.itemSettings && res.subscriptionsSetting.itemSettings[ + '0WMaFZ_0FOS5gtxEAi-fM3pFcYPySRMwYFNASz9oig0'] === 'accept') { + // 用户已经订阅该消息模板,执行相应操作 + that.base.toast("预约成功",2000,function(){ + setTimeout(function(){ + uni.redirectTo({ + url:'/packages/mybook/index' + }) + },2000) + }) + } else { + // 用户没有订阅该消息模板,显示订阅弹窗 + uni.showModal({ + title: '订阅消息', + content: '是否需要订阅预约结果消息', + success(res1) { + if (res1.confirm) { + uni.requestSubscribeMessage({ + tmplIds: [ + '0WMaFZ_0FOS5gtxEAi-fM3pFcYPySRMwYFNASz9oig0', + ], + success(res) { + that.base.toast("预约成功",2000,function(){ + setTimeout(function(){ + uni.redirectTo({ + url:'/packages/mybook/index' + }) + },2000) + }) + }, + fail(err) { + that.base.toast("预约成功",2000,function(){ + setTimeout(function(){ + uni.redirectTo({ + url:'/packages/mybook/index' + }) + },2000) + }) + } + }) + } else { + that.base.toast("预约成功",2000,function(){ + setTimeout(function(){ + uni.redirectTo({ + url:'/packages/mybook/index' + }) + },2000) + }) + } + } + }) + + } + } else { + that.base.toast("预约成功",2000,function(){ + setTimeout(function(){ + uni.redirectTo({ + url:'/packages/mybook/index' + }) + },2000) + }) + // 用户尚未开启订阅消息总开关,建议提醒用户开启 + } + } + }); + }, } } diff --git a/packages/course/detail.vue b/packages/course/detail.vue index a5232e9..e684dd7 100644 --- a/packages/course/detail.vue +++ b/packages/course/detail.vue @@ -19,31 +19,13 @@ - + 我要报名 - - - - - - - 提示 - - 如您已是我方校友,请先绑定账号。 - 如您还不是我方校友,请先注册。 - - - - 绑定 - 注册报名 - - - @@ -77,7 +59,6 @@ }, data() { return { - showRegister: false, hasMobile: false, course_id: '', info: {}, @@ -301,27 +282,47 @@ } } - .modal { - &-tip { - text-align: center; - padding: 30rpx; - font-size: 28rpx; - } - - &-content { - height: 300rpx; - padding: 0 30rpx; - } - - &-btn { - display: flex; - justify-content: space-between; - padding: 30rpx; - - u-button { - width: 45%; - } - } + .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); + } } } \ No newline at end of file diff --git a/packages/my/index.vue b/packages/my/index.vue index 6052ae8..7f72140 100644 --- a/packages/my/index.vue +++ b/packages/my/index.vue @@ -2,7 +2,7 @@ - + {{form.username}} @@ -33,6 +33,7 @@ {{item}} + 新增 @@ -54,7 +55,6 @@ - @@ -78,7 +78,9 @@ return { showPosition: false, positionList: [], - form: {}, + form: { + + }, plateList: [], showPark: false, plate1: '', @@ -134,7 +136,8 @@ getUserInfo() { this.$u.api.user().then(res => { console.log("res", res) - this.form = this.base.requestToForm(res.user, this.form) + // this.form = this.base.requestToForm(res.user, this.form) + this.form = this.base.deepCopy(res.user) if (res.user.plate) { this.plateList = res.user.plate.split(',') this.plateList.map((item, index) => { @@ -153,6 +156,10 @@ } // this.plateList.push('') this.showPark = true + }, + delPlate(index){ + this.plateList.splice(index,1) + this.saveUser('del') }, changeMobile() { @@ -162,9 +169,21 @@ }, saveUser(type) { - if (type == 'add') { + if (type == 'add') { + console.log("this.plate1",this.plate1) + if(this.plate1.length<7){ + this.base.toast("车牌号不正确") + return + } + if(this.plateList.indexOf(this.plate1)!==-1){ + this.base.toast("车牌号不能重复") + return + } this.plateList.push(this.plate1) this.form.plate = this.plateList.join(",") + } + if(type=='del'){ + this.form.plate = this.plateList.join(",") } console.log("plateList", this.plateList) let that = this @@ -172,14 +191,25 @@ if (valid) { this.$u.api.saveUser(this.form).then(res => { this.showPark = false - this.plate1 = '' - this.base.toast("更新用户信息成功", 2000, function() { - if (type === 'add') { + this.plate1 = '' + let toastTitle = "更新用户信息成功" + if(type==='add'){ + toastTitle = "新增车牌成功" + }else if(type==='del'){ + toastTitle = "删除车牌成功" + }else{ + toastTitle = "更新用户信息成功" + } + this.base.toast(toastTitle, 2000, function() { + if (type === 'add' || type==='del') { that.getUserInfo() - } else { - uni.switchTab({ - url: '/pages/me/index' - }) + } else { + setTimeout(function(){ + uni.switchTab({ + url: '/pages/me/index' + }) + },2000) + } }) diff --git a/packages/mycourse/coursePay.vue b/packages/mycourse/coursePay.vue index 33e649e..1e3909f 100644 --- a/packages/mycourse/coursePay.vue +++ b/packages/mycourse/coursePay.vue @@ -1,165 +1,237 @@ -