校友捐赠

master
lion 1 year ago
parent 14ba761dc2
commit 238d792564

@ -26,6 +26,26 @@
</view> </view>
<u-picker @confirm="selectCourse" v-model="showCourse" :range="courseList" range-key="value" <u-picker @confirm="selectCourse" v-model="showCourse" :range="courseList" range-key="value"
mode="selector"></u-picker> mode="selector"></u-picker>
<!-- 进入后没有手机号的话 绑定 或者 注册 -->
<view class="modal">
<u-popup v-model="showRegister" mode="bottom" :mask-close-able='false'>
<view>
<view class="modal-tip">提示</view>
<view class="modal-content">
<view>如您已是我方校友请先绑定账号</view>
<view @click="goBind" class="modal-bind">
去绑定
</view>
<view>如您还不是我方校友请先注册</view>
<view @click="toRegister" class="modal-register">
去注册
</view>
</view>
</view>
</u-popup>
</view>
</view> </view>
</template> </template>
@ -33,8 +53,10 @@
export default { export default {
data() { data() {
return { return {
showCourse: false, showRegister: false,
isLocked:false, hasMobile: false,
showCourse: false,
isLocked: false,
form: { form: {
username: '', username: '',
course: '', course: '',
@ -111,10 +133,10 @@
saveDonates() { saveDonates() {
let that = this let that = this
this.$refs.uForm.validate(valid => { this.$refs.uForm.validate(valid => {
if (valid) { if (valid) {
if(this.isLocked){ if (this.isLocked) {
return return
} }
this.isLocked = true this.isLocked = true
this.$u.api.updateDonates(this.form).then(res => { this.$u.api.updateDonates(this.form).then(res => {
this.base.toast('提交成功!感谢您的支持!近期我们将会电话与您联系~', 1500, function() { this.base.toast('提交成功!感谢您的支持!近期我们将会电话与您联系~', 1500, function() {
@ -154,6 +176,13 @@
'vuex_token': res1.token, 'vuex_token': res1.token,
'vuex_user': res2.user '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 => { }).catch(err => {
console.log('login-error:', JSON.stringify(err)) console.log('login-error:', JSON.stringify(err))
@ -165,14 +194,36 @@
}); });
}, },
getUserInfo() { getUserInfo() {
let that = this
this.$u.api.user().then(res => { this.$u.api.user().then(res => {
this.form.username = res.user.username this.form.username = res.user.username
this.form.mobile = res.user.mobile this.form.mobile = res.user.mobile
this.form.company_position = res.user.company_position this.form.company_position = res.user.company_position
this.form.company_name = res.user.company_name this.form.company_name = res.user.company_name
this.$u.vuex('vuex_user', res.user) 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'
})
},
} }
} }
</script> </script>
@ -213,6 +264,48 @@
border-radius: 30rpx; border-radius: 30rpx;
padding: 20rpx; 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);
}
} }
} }

@ -69,6 +69,7 @@
data() { data() {
return { return {
showMobile: false, showMobile: false,
isDonate:false,
myMobile:'', myMobile:'',
myCode: '', myCode: '',
hasSend: false, hasSend: false,
@ -148,7 +149,8 @@
this.$refs.uForm.setRules(this.rules); this.$refs.uForm.setRules(this.rules);
}, },
onLoad(options) { 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() { onUnload() {
if (this.sendTimer) { if (this.sendTimer) {
@ -246,6 +248,10 @@
// uni.redirectTo({ // uni.redirectTo({
// url:'/pages/course/index' // url:'/pages/course/index'
// }) // })
}else if(that.isDonate){
uni.redirectTo({
url: '/packages/donate/index'
})
} else { } else {
uni.switchTab({ uni.switchTab({
url: '/pages/me/index' url: '/pages/me/index'

@ -1,6 +1,6 @@
<template> <template>
<view class="container"> <view class="container">
<image class="cbg" :src="base.imgHost('login-top.png')"></image> <image class="cbg" :src="base.imgHost('login-top.png')"></image>
<view class="login"> <view class="login">
<image class="login-logo" :src="base.imgHost('login-logo.png')"></image> <image class="login-logo" :src="base.imgHost('login-logo.png')"></image>
<view class="login-form"> <view class="login-form">
@ -17,7 +17,7 @@
</view> </view>
<view class="login-btn"> <view class="login-btn">
<view @click="handleMsgLogin"></view> <view @click="handleMsgLogin"></view>
</view> </view>
<view class="login-msg" @click="toRegister"></view> <view class="login-msg" @click="toRegister"></view>
</view> </view>
</view> </view>
@ -27,7 +27,8 @@
export default { export default {
data() { data() {
return { return {
hasSend: false, hasSend: false,
isDonate:false,
count: 60, count: 60,
inputStyle: { inputStyle: {
'padding': '0rpx 30rpx', 'padding': '0rpx 30rpx',
@ -45,24 +46,25 @@
mobile: '', mobile: '',
code: '', code: '',
}, },
sendTimer: null, sendTimer: null,
type:'me' type: 'me'
} }
}, },
onLoad(options) { onLoad(options) {
this.type=options.id?'course':'me' this.type = options.id ? 'course' : 'me'
}, this.isDonate = options.isDonate?true:false
onUnload() { },
if(this.sendTimer){ onUnload() {
clearInterval(this.sendTimer); if (this.sendTimer) {
this.sendTimer = null clearInterval(this.sendTimer);
} this.sendTimer = null
}, }
onHide() { },
if(this.sendTimer){ onHide() {
clearInterval(this.sendTimer); if (this.sendTimer) {
this.sendTimer = null clearInterval(this.sendTimer);
} this.sendTimer = null
}
}, },
methods: { methods: {
getSmsCode() { getSmsCode() {
@ -76,7 +78,7 @@
if (!this.base.isMobile(this.form.mobile)) { if (!this.base.isMobile(this.form.mobile)) {
this.base.toast('手机号码错误') this.base.toast('手机号码错误')
return return
} }
let that = this let that = this
this.$u.api.sendSms({ this.$u.api.sendSms({
mobile: this.form.mobile mobile: this.form.mobile
@ -87,8 +89,8 @@
if (that.count > 1) { if (that.count > 1) {
that.count-- that.count--
} else { } else {
clearInterval(that.sendTimer); clearInterval(that.sendTimer);
that.sendTimer = null that.sendTimer = null
that.count = 60 that.count = 60
that.hasSend = false; that.hasSend = false;
} }
@ -103,9 +105,9 @@
if (this.base.isNull(this.form.code)) { if (this.base.isNull(this.form.code)) {
this.base.toast('请输入验证码') this.base.toast('请输入验证码')
return return
} }
let that = this let that = this
console.log("this.type",this.type) console.log("this.type", this.type)
this.$u.api.checkMobile({ this.$u.api.checkMobile({
mobile: this.form.mobile, mobile: this.form.mobile,
code: this.form.code code: this.form.code
@ -114,31 +116,35 @@
if (that.sendTimer) { if (that.sendTimer) {
clearInterval(that.sendTimer); clearInterval(that.sendTimer);
that.hasSend = false; that.hasSend = false;
} }
uni.removeStorageSync("stbc1_lifeData") uni.removeStorageSync("stbc1_lifeData")
uni.setStorageSync("stbc1_lifeData", { uni.setStorageSync("stbc1_lifeData", {
'vuex_token': res.token 'vuex_token': res.token
}) })
if(that.type=='course'){ if (that.type == 'course') {
uni.switchTab({ uni.switchTab({
url: '/pages/course/index' url: '/pages/course/index'
}) })
}else{ } else if (that.isDonate) {
uni.switchTab({ uni.redirectTo({
url: '/pages/me/index' url: '/packages/donate/index'
}) })
} } else {
// this.$u.api.user().then(res => { uni.switchTab({
// this.$u.vuex('vuex_user', res.user) url: '/pages/me/index'
})
}
// this.$u.api.user().then(res => {
// this.$u.vuex('vuex_user', res.user)
// }) // })
}) })
}, },
toRegister(){ toRegister() {
uni.redirectTo({ uni.redirectTo({
url:'/packages/register/index' url: '/packages/register/index'
}) })
} }
} }
@ -229,11 +235,12 @@
border-radius: 30rpx; border-radius: 30rpx;
padding: 20rpx; padding: 20rpx;
} }
} }
&-msg{
text-align: center; &-msg {
padding:20rpx 0; text-align: center;
color:#0d0398; padding: 20rpx 0;
color: #0d0398;
} }
} }
} }

Loading…
Cancel
Save