|
@@ -133,92 +133,40 @@ export default {
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- async getImgUrlByOssId(ossId,type){
|
|
|
|
|
- let url = await this.$getImgUrlByOssId(ossId);
|
|
|
|
|
- if(type == 1){
|
|
|
|
|
- this.$api.userRealNameAuth.idCardFrontUrl = url;
|
|
|
|
|
- } else if(type == 2){
|
|
|
|
|
- this.$api.userRealNameAuth.idCardBackUrl = url;
|
|
|
|
|
- }
|
|
|
|
|
- return url;
|
|
|
|
|
- },
|
|
|
|
|
- // 获取文件信息
|
|
|
|
|
- getCommonFile(){
|
|
|
|
|
- this.$api.getCommonFile({data:this.reqParm}).then((res)=>{
|
|
|
|
|
- console.log(res)
|
|
|
|
|
- }).catch(() =>{
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- title: "操作失败"
|
|
|
|
|
- })
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// 保存实名信息
|
|
// 保存实名信息
|
|
|
saveUserRealNameAuth(){
|
|
saveUserRealNameAuth(){
|
|
|
let that = this;
|
|
let that = this;
|
|
|
that.$refs.form1.validate().then(res => {
|
|
that.$refs.form1.validate().then(res => {
|
|
|
// 保存数据
|
|
// 保存数据
|
|
|
- this.$api.userRealNameAuth(null,{data:this.userRealNameAuth}).then((res)=>{
|
|
|
|
|
|
|
+ this.$api.userRealNameAuth(this.userRealNameAuth).then((res)=>{
|
|
|
console.log(res)
|
|
console.log(res)
|
|
|
// 刷新用户信息
|
|
// 刷新用户信息
|
|
|
- this.$refreshUserLoginInfo();
|
|
|
|
|
|
|
+ uni.setStorageSync('userInfo',res.data.data)
|
|
|
|
|
|
|
|
- uni.$u.route({
|
|
|
|
|
- url: '/pages/index/tabbar',
|
|
|
|
|
- params: {
|
|
|
|
|
- PageCur: 'me'
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: "操作成功"
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- }).catch(() =>{
|
|
|
|
|
|
|
+ setTimeout(()=>{
|
|
|
|
|
+ uni.switchTab({
|
|
|
|
|
+ url: '/pages/my/index',
|
|
|
|
|
+ })
|
|
|
|
|
+ },1000)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }).catch((err) =>{
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
- title: "操作失败"
|
|
|
|
|
|
|
+ icon:'error',
|
|
|
|
|
+ title: err
|
|
|
})
|
|
})
|
|
|
});
|
|
});
|
|
|
}).catch(errors => {
|
|
}).catch(errors => {
|
|
|
uni.$u.toast('校验失败,请认真填写')
|
|
uni.$u.toast('校验失败,请认真填写')
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- //头像上传
|
|
|
|
|
- uploadImg1(imgIndex) {
|
|
|
|
|
- let that = this;
|
|
|
|
|
-
|
|
|
|
|
- uni.chooseImage({
|
|
|
|
|
- count: 1,
|
|
|
|
|
- success: (chooseImageRes) => {
|
|
|
|
|
- const tempFilePaths = chooseImageRes.tempFilePaths;
|
|
|
|
|
-
|
|
|
|
|
- uni.uploadFile({
|
|
|
|
|
- url: that.$host + '/resource/oss/upload', //仅为示例,非真实的接口地址
|
|
|
|
|
- filePath: tempFilePaths[0],
|
|
|
|
|
- name: 'file',
|
|
|
|
|
- header: {
|
|
|
|
|
- // "Content-Type": "multipart/form-data",
|
|
|
|
|
- // 'X-Access-Token': uni.getStorageSync('token'),
|
|
|
|
|
- 'Authorization': 'Bearer ' + that.$store.state.loginState.accessToken,
|
|
|
|
|
- },
|
|
|
|
|
- success: (uploadFileRes) => {
|
|
|
|
|
|
|
|
|
|
- let res = JSON.parse(uploadFileRes.data)
|
|
|
|
|
- console.log(res.data)
|
|
|
|
|
- if(imgIndex == 1){ // 身份证正面
|
|
|
|
|
- that.imgUrl1 = res.data.url;
|
|
|
|
|
- that.userRealNameAuth.idCardFront = res.data.ossId
|
|
|
|
|
- that.reqParm.ossId = res.data.ossId
|
|
|
|
|
- console.log(that.reqParm)
|
|
|
|
|
- that.userRealNameAuth.idCardFrontUrl = res.data.url;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if(imgIndex == 2){ // 微信证背面
|
|
|
|
|
- that.imgUrl2 = res.url;
|
|
|
|
|
- that.userRealNameAuth.idCardBack = res.data.ossId
|
|
|
|
|
- that.userRealNameAuth.idCardBackUrl = res.data.url;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|