diff --git a/packages/donate/index.vue b/packages/donate/index.vue index 3e84e88..8d5dc3d 100644 --- a/packages/donate/index.vue +++ b/packages/donate/index.vue @@ -26,6 +26,26 @@ + + + + + + 提示 + + 如您已是我方校友,请先绑定账号 + + 去绑定 + + 如您还不是我方校友,请先注册 + + 去注册 + + + + + + @@ -33,8 +53,10 @@ export default { data() { return { - showCourse: false, - isLocked:false, + showRegister: false, + hasMobile: false, + showCourse: false, + isLocked: false, form: { username: '', course: '', @@ -111,10 +133,10 @@ saveDonates() { let that = this this.$refs.uForm.validate(valid => { - if (valid) { - if(this.isLocked){ - return - } + if (valid) { + if (this.isLocked) { + return + } this.isLocked = true this.$u.api.updateDonates(this.form).then(res => { this.base.toast('提交成功!感谢您的支持!近期我们将会电话与您联系~', 1500, function() { @@ -154,6 +176,13 @@ 'vuex_token': res1.token, 'vuex_user': res2.user }) + if (that.base.isNull(res.user.mobile)) { + that.showRegister = true + that.hasMobile = false + } else { + that.showRegister = false + that.hasMobile = true + } }) }).catch(err => { console.log('login-error:', JSON.stringify(err)) @@ -165,14 +194,36 @@ }); }, getUserInfo() { + let that = this this.$u.api.user().then(res => { this.form.username = res.user.username this.form.mobile = res.user.mobile this.form.company_position = res.user.company_position this.form.company_name = res.user.company_name this.$u.vuex('vuex_user', res.user) + if (that.base.isNull(res.user.mobile)) { + that.showRegister = true + that.hasMobile = false + } else { + that.showRegister = false + that.hasMobile = true + } }) - }, + }, + + // 去绑定登录 + goBind() { + uni.redirectTo({ + url: '/packages/register/login?isDonate=isDonate' + }) + }, + // 去注册 + toRegister() { + uni.redirectTo({ + url: '/packages/register/index?isDonate=isDonate' + }) + }, + } } @@ -213,6 +264,48 @@ border-radius: 30rpx; padding: 20rpx; } + } + .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); + } } } diff --git a/packages/register/index.vue b/packages/register/index.vue index 1016eee..49777c4 100644 --- a/packages/register/index.vue +++ b/packages/register/index.vue @@ -69,6 +69,7 @@ data() { return { showMobile: false, + isDonate:false, myMobile:'', myCode: '', hasSend: false, @@ -148,7 +149,8 @@ this.$refs.uForm.setRules(this.rules); }, onLoad(options) { - this.course_id = options.id ? options.id : null + this.course_id = options.id ? options.id : null + this.isDonate = options.isDonate?options.isDonate:false }, onUnload() { if (this.sendTimer) { @@ -246,6 +248,10 @@ // uni.redirectTo({ // url:'/pages/course/index' // }) + }else if(that.isDonate){ + uni.redirectTo({ + url: '/packages/donate/index' + }) } else { uni.switchTab({ url: '/pages/me/index' diff --git a/packages/register/login.vue b/packages/register/login.vue index ebfc4c5..a433118 100644 --- a/packages/register/login.vue +++ b/packages/register/login.vue @@ -1,6 +1,6 @@