|
|
@@ -214,15 +214,22 @@
|
|
|
|
|
|
<!-- 性别选择 -->
|
|
|
<u-picker :show="genderShow" keyName="gender" @confirm="sureChooseGender" :columns="genderList"></u-picker>
|
|
|
+ <cropper selWidth="660rpx" selHeight="660rpx" ref="cropper" quality="0.5" @uploadImg="uploadCropImg" @upload="facePhotoUrl" avatarStyle="width:100vw;height:100vw;"/>
|
|
|
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-
|
|
|
+import cropper from '@/components/lxiaoxiao-cropper/lxiaoxiao-cropper.vue';
|
|
|
export default {
|
|
|
+ components: {
|
|
|
+ cropper
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
+ facePhotoUrl:'',
|
|
|
+ accessToken: null,
|
|
|
+ isAuthUpdate: false,
|
|
|
serviceProjectList: [],
|
|
|
userInfo: {
|
|
|
auth: true,
|
|
|
@@ -260,12 +267,14 @@ export default {
|
|
|
mounted() {
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
+ this.accessToken = uni.getStorageSync("accessToken");
|
|
|
this.getServiceObjectList()
|
|
|
if (option.data) {
|
|
|
const data = JSON.parse(option.data);
|
|
|
console.log('+++++++JSON.parse(option.data)++++++', option.data)
|
|
|
if(data.authServiceIds){
|
|
|
this.userInfo.serviceProjectId = data.authServiceIds.split(',');
|
|
|
+ this.getServiceObjectPhotoRecord(this.userInfo.serviceProjectId)
|
|
|
}
|
|
|
this.userInfo.facePhotoUrl = data.facePhotoUrl;
|
|
|
this.userInfo.minMainCardStatus = data.minMainCardStatus;
|
|
|
@@ -284,10 +293,98 @@ export default {
|
|
|
this.userInfo.nickName = data.nickName;
|
|
|
this.userInfo.remark = data.remark;
|
|
|
this.userInfo.id = data.id;
|
|
|
+ this.getServiceObjectPhotoRecord(this.userInfo.id)
|
|
|
console.log('+++++++JSON.parse(option.data)++++++', this.userInfo)
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
+
|
|
|
+ uploadCropImg(e){
|
|
|
+ uni.compressImage({
|
|
|
+ src: e,
|
|
|
+ success: res => {
|
|
|
+ uni.uploadFile({
|
|
|
+ url: this.$baseUrl + '/resource/oss/upload',
|
|
|
+ filePath:res.tempFilePath,
|
|
|
+ name: 'file',
|
|
|
+ header: {
|
|
|
+ 'Authorization': 'Bearer ' + uni.getStorageInfo('accessToken'),
|
|
|
+ },
|
|
|
+ success: (uploadFileRes) => {
|
|
|
+ let res = JSON.parse(uploadFileRes.data)
|
|
|
+ console.log(res,'成功回调')
|
|
|
+ if(res.code !== 200){
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ duration: 3000,
|
|
|
+ title: res.msg || '系统繁忙,请重试!'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ res.data.url.replace("http", "https");
|
|
|
+ this.verifyFace(res.data)
|
|
|
+ this.facePhotoUrl = res.data.url.replace("http", "https");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ getServiceObjectPhotoRecord(serviceObjectId){
|
|
|
+ this.$api.getServiceObjectPhotoRecord(
|
|
|
+ {
|
|
|
+ serviceObjectId:serviceObjectId
|
|
|
+ }).then(res=>{
|
|
|
+ console.log(res)
|
|
|
+ if (res.data.data){
|
|
|
+ uni.showModal({
|
|
|
+ title:"温馨提示",
|
|
|
+ content:"当前服务对象已授权,照片可修改",
|
|
|
+ showCancel: false,
|
|
|
+ success: function (res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ console.log('用户点击确定');
|
|
|
+ } else if (res.cancel) {
|
|
|
+ console.log('用户点击取消');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ this.isAuthUpdate = res.data.data
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 验证人象
|
|
|
+ verifyFace(data){
|
|
|
+ let that = this;
|
|
|
+ uni.showLoading({
|
|
|
+ title: '人脸识别中'
|
|
|
+ })
|
|
|
+
|
|
|
+ if(this.requestStatus){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.requestStatus=true
|
|
|
+
|
|
|
+ this.$api.verifyFace({
|
|
|
+ auth: true,
|
|
|
+ facePath: data.ossId,
|
|
|
+ businessId: ''
|
|
|
+ }).then((res)=>{
|
|
|
+ this.requestStatus=false
|
|
|
+ uni.hideLoading();
|
|
|
+ this.userInfo.facePhoto= data.ossId
|
|
|
+ this.userInfo.facePhotoUrl=data.url
|
|
|
+ }).catch((err) =>{
|
|
|
+ this.requestStatus=false
|
|
|
+ uni.$u.toast(err.data.msg||'识别失败,请重新上传照片')
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
//修改数组属性名
|
|
|
changeKey(arr, newName, oldName) {
|
|
|
arr.forEach(item => {
|
|
|
@@ -408,31 +505,40 @@ export default {
|
|
|
},
|
|
|
//头像上传
|
|
|
uploadImg1(imgIndex) {
|
|
|
- return //关闭头像上传
|
|
|
- let that = this;
|
|
|
- uni.chooseImage({
|
|
|
- count: 1,
|
|
|
- success: (chooseImageRes) => {
|
|
|
- const tempFilePaths = chooseImageRes.tempFilePaths;
|
|
|
+ console.log(this.isAuthUpdate)
|
|
|
+ if (!this.isAuthUpdate){
|
|
|
+ return //关闭头像上传
|
|
|
+ }
|
|
|
|
|
|
- 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)
|
|
|
- that.imgUrl1 = res.data.url;
|
|
|
- that.userInfo.selfPhoto = res.data.ossId
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ this.$refs.cropper.fSelect();
|
|
|
+
|
|
|
+ // let that = this;
|
|
|
+ // uni.chooseImage({
|
|
|
+ // count: 1,
|
|
|
+ // success: (chooseImageRes) => {
|
|
|
+ // const tempFilePaths = chooseImageRes.tempFilePaths;
|
|
|
+ // console.log(tempFilePaths)
|
|
|
+ // uni.uploadFile({
|
|
|
+ // url: that.$baseUrl + '/resource/oss/upload',
|
|
|
+ // filePath: tempFilePaths[0],
|
|
|
+ // name: 'file',
|
|
|
+ //
|
|
|
+ // header: {
|
|
|
+ // // "Content-Type": "multipart/form-data",
|
|
|
+ // // 'X-Access-Token': uni.getStorageSync('token'),
|
|
|
+ // 'Authorization': 'Bearer ' + this.accessToken,
|
|
|
+ // },
|
|
|
+ // success: (uploadFileRes) => {
|
|
|
+ // let res = JSON.parse(uploadFileRes.data)
|
|
|
+ // console.log(res)
|
|
|
+ // this.verifyFace(res.data)
|
|
|
+ // },
|
|
|
+ // fail: (err)=> {
|
|
|
+ // console.log(err)
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // });
|
|
|
}
|
|
|
}
|
|
|
};
|