|
|
|
|
@ -33,7 +33,8 @@
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
showCourse: false,
|
|
|
|
|
showCourse: false,
|
|
|
|
|
isLocked:false,
|
|
|
|
|
form: {
|
|
|
|
|
username: '',
|
|
|
|
|
course: '',
|
|
|
|
|
@ -94,11 +95,13 @@
|
|
|
|
|
onReady() {
|
|
|
|
|
this.$refs.uForm.setRules(this.rules);
|
|
|
|
|
},
|
|
|
|
|
onLoad() {
|
|
|
|
|
let token = uni.getStorageSync('stbc1_lifeData') ? uni.getStorageSync('stbc1_lifeData').vuex_token : ''
|
|
|
|
|
if (this.base.isNull(token)) {
|
|
|
|
|
this.getToken()
|
|
|
|
|
}
|
|
|
|
|
onLoad() {
|
|
|
|
|
let token = uni.getStorageSync('stbc1_lifeData') ? uni.getStorageSync('stbc1_lifeData').vuex_token : ''
|
|
|
|
|
if (this.base.isNull(token)) {
|
|
|
|
|
this.getToken()
|
|
|
|
|
} else {
|
|
|
|
|
this.getUserInfo()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
selectCourse(e) {
|
|
|
|
|
@ -108,15 +111,21 @@
|
|
|
|
|
saveDonates() {
|
|
|
|
|
let that = this
|
|
|
|
|
this.$refs.uForm.validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
if (valid) {
|
|
|
|
|
if(this.isLocked){
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.isLocked = true
|
|
|
|
|
this.$u.api.updateDonates(this.form).then(res => {
|
|
|
|
|
this.base.toast('提交成功',1500,function(){
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
uni.switchTab({
|
|
|
|
|
url:'/pages/me/index'
|
|
|
|
|
})
|
|
|
|
|
},100)
|
|
|
|
|
this.base.toast('提交成功', 1500, function() {
|
|
|
|
|
setTimeout(function() {
|
|
|
|
|
uni.switchTab({
|
|
|
|
|
url: '/pages/me/index'
|
|
|
|
|
})
|
|
|
|
|
}, 1500)
|
|
|
|
|
})
|
|
|
|
|
}).catch(res => {
|
|
|
|
|
this.isLocked = false
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
console.log('验证失败');
|
|
|
|
|
@ -124,26 +133,45 @@
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
async getToken() {
|
|
|
|
|
let that = this
|
|
|
|
|
await uni.login({
|
|
|
|
|
provider: 'weixin',
|
|
|
|
|
success: (res) => {
|
|
|
|
|
this.$u.api.login({
|
|
|
|
|
code: res.code
|
|
|
|
|
}).then(res1 => {
|
|
|
|
|
uni.setStorageSync("stbc1_lifeData", {
|
|
|
|
|
'vuex_token': res1.token
|
|
|
|
|
})
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
console.log('login-error:', JSON.stringify(err))
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
fail: (res) => {
|
|
|
|
|
console.log("errtoken", JSON.stringify(res))
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
async getToken() {
|
|
|
|
|
let that = this
|
|
|
|
|
await uni.login({
|
|
|
|
|
provider: 'weixin',
|
|
|
|
|
success: (res) => {
|
|
|
|
|
this.$u.api.login({
|
|
|
|
|
code: res.code
|
|
|
|
|
}).then(res1 => {
|
|
|
|
|
uni.setStorageSync("stbc1_lifeData", {
|
|
|
|
|
'vuex_token': res1.token
|
|
|
|
|
})
|
|
|
|
|
this.$u.api.user().then(res2 => {
|
|
|
|
|
that.form.username = res2.user.username
|
|
|
|
|
that.form.mobile = res2.user.mobile
|
|
|
|
|
that.form.company_position = res2.user.company_position
|
|
|
|
|
that.form.company_name = res2.user.company_name
|
|
|
|
|
uni.setStorageSync("stbc1_lifeData", {
|
|
|
|
|
'vuex_token': res1.token,
|
|
|
|
|
'vuex_user': res2.user
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
console.log('login-error:', JSON.stringify(err))
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
fail: (res) => {
|
|
|
|
|
console.log("errtoken", JSON.stringify(res))
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
getUserInfo() {
|
|
|
|
|
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)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|