|
|
@ -3,6 +3,8 @@ import { |
|
|
|
$wuxDialog |
|
|
|
} from '../../../../dist/index' |
|
|
|
const app = getApp() |
|
|
|
import { $wuxActionSheet } from '../../../../dist/index' |
|
|
|
const config = require('../../../../utils/config') |
|
|
|
Page({ |
|
|
|
|
|
|
|
/** |
|
|
@ -21,6 +23,9 @@ Page({ |
|
|
|
encryptedData: '', //用户unionId为空时 传入
|
|
|
|
iv: '', //用户unionId为空时 传入
|
|
|
|
introduce: '', //自我介绍
|
|
|
|
volunteerNickname:'',//昵称
|
|
|
|
volunteerSignature:'',//签名
|
|
|
|
volunteerFaceImg:'',//头像
|
|
|
|
unionIdStatus: '0', |
|
|
|
wait: 60, |
|
|
|
smsCode: '', |
|
|
@ -30,7 +35,8 @@ Page({ |
|
|
|
dialogConfirmText: '', |
|
|
|
dialogCancelText: '', |
|
|
|
getMobileType: 'wx', |
|
|
|
smsCodeText: '获取验证码' |
|
|
|
smsCodeText: '获取验证码', |
|
|
|
uploadImageList: [], |
|
|
|
}, |
|
|
|
onLoad: function(options) { |
|
|
|
this.getPrepareComplete().then(res => { |
|
|
@ -49,6 +55,11 @@ Page({ |
|
|
|
mobile: e.detail.value |
|
|
|
}) |
|
|
|
}, |
|
|
|
nickname(e){ |
|
|
|
this.setData({ |
|
|
|
volunteerNickname: e.detail.value |
|
|
|
}) |
|
|
|
}, |
|
|
|
bindSmsCodeInput(e) { |
|
|
|
this.setData({ |
|
|
|
smsCode: e.detail.value |
|
|
@ -83,6 +94,11 @@ Page({ |
|
|
|
introduce: e.detail.value |
|
|
|
}) |
|
|
|
}, |
|
|
|
volunteerSignature(e) { |
|
|
|
this.setData({ |
|
|
|
volunteerSignature: e.detail.value |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 查看用户是否完善个人信息
|
|
|
|
checkWxUnionId() { |
|
|
|
api.checkWxUnionId().then(res => { |
|
|
@ -138,7 +154,11 @@ Page({ |
|
|
|
dwellingPlace: res.data.dwellingPlace, |
|
|
|
state: res.data.state, |
|
|
|
gridId: res.data.gridId, |
|
|
|
gridName: res.data.gridName |
|
|
|
gridName: res.data.gridName, |
|
|
|
volunteerNickname:res.data.volunteerNickname, |
|
|
|
volunteerSignature:res.data.volunteerSignature, |
|
|
|
volunteerFaceImg:res.data.volunteerFaceImg, |
|
|
|
introduce:res.data.introduce |
|
|
|
}) |
|
|
|
resolve(true) |
|
|
|
}).catch(err => { |
|
|
@ -199,6 +219,18 @@ Page({ |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
if(!this.data.volunteerFaceImg){ |
|
|
|
this.showToast('请上传头像') |
|
|
|
return false |
|
|
|
} |
|
|
|
if(!this.data.volunteerNickname){ |
|
|
|
this.showToast('请输入昵称') |
|
|
|
return false |
|
|
|
} |
|
|
|
if(!this.data.volunteerSignature){ |
|
|
|
this.showToast('请输入签名') |
|
|
|
return false |
|
|
|
} |
|
|
|
if (!this.data.road) { |
|
|
|
this.showToast('请填写所在小区或所在道路') |
|
|
|
return false |
|
|
@ -226,6 +258,9 @@ Page({ |
|
|
|
dwellingPlace: this.data.dwellingPlace, |
|
|
|
gridId: this.data.gridId, |
|
|
|
introduce: this.data.introduce, |
|
|
|
volunteerFaceImg:this.data.volunteerFaceImg, |
|
|
|
volunteerNickname:this.data.volunteerNickname, |
|
|
|
volunteerSignature:this.data.volunteerSignature, |
|
|
|
wxCode: this.data.unionIdStatus === '1' ? '' : this.data.wxCode, |
|
|
|
encryptedData: this.data.unionIdStatus === '1' ? '' : this.data.encryptedData, |
|
|
|
iv: this.data.unionIdStatus === '1' ? '' : this.data.iv |
|
|
@ -334,4 +369,116 @@ Page({ |
|
|
|
duration: 2000 |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 上传头像
|
|
|
|
// 选择图片 上传弹窗 - 上传图片方式 - 选择图片 - 上传图片 - 回调赋值
|
|
|
|
chooseImage () { |
|
|
|
const _this = this |
|
|
|
|
|
|
|
_this.setData({ |
|
|
|
uploadImageList: [], |
|
|
|
}) |
|
|
|
$wuxActionSheet().showSheet({ |
|
|
|
buttons: [ |
|
|
|
{ text: '拍照' }, |
|
|
|
{ text: '从相册中获取' }, |
|
|
|
], |
|
|
|
className: 'dialog-class', |
|
|
|
buttonClicked(index) { |
|
|
|
console.log(':::::::::::::'+index) |
|
|
|
if (index === 0) { |
|
|
|
wx.chooseImage({ |
|
|
|
count: 1, |
|
|
|
sizeType: ['original', 'compressed'], |
|
|
|
sourceType: ['camera'], |
|
|
|
success (res) { |
|
|
|
const uploadImageList = [..._this.data.uploadImageList] |
|
|
|
uploadImageList.push({ |
|
|
|
uploaded: false, |
|
|
|
ossUrl: '', |
|
|
|
imgUrl: res.tempFilePaths[0], |
|
|
|
imageId: ++_this.data.imageId |
|
|
|
}) |
|
|
|
_this.setData({ |
|
|
|
uploadImageList |
|
|
|
}) |
|
|
|
wx.uploadFile({ |
|
|
|
url: `${config.BASEURL()}group/topic/upload`, |
|
|
|
filePath: res.tempFilePaths[0], |
|
|
|
name: 'file', |
|
|
|
header: { |
|
|
|
'Content-type': 'multipart/form-data' |
|
|
|
}, |
|
|
|
success (fileRes){ |
|
|
|
uploadImageList[uploadImageList.length - 1].uploaded = true |
|
|
|
uploadImageList[uploadImageList.length - 1].ossUrl = JSON.parse(fileRes.data).data |
|
|
|
_this.setData({ |
|
|
|
uploadImageList |
|
|
|
}) |
|
|
|
|
|
|
|
_this.setData({ |
|
|
|
volunteerFaceImg:uploadImageList[0].ossUrl |
|
|
|
}) |
|
|
|
console.log('>>>>>>>>>>>'+_this.data.volunteerFaceImg) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
} else if (index === 1) { |
|
|
|
wx.chooseImage({ |
|
|
|
count: 3 - _this.data.uploadImageList.length, |
|
|
|
sizeType: ['original', 'compressed'], |
|
|
|
sourceType: ['album'], |
|
|
|
success (res) { |
|
|
|
const uploadImageList = [] |
|
|
|
const endIndex = _this.data.uploadImageList.length |
|
|
|
res.tempFilePaths.forEach(item => { |
|
|
|
uploadImageList.push({ |
|
|
|
uploaded: false, |
|
|
|
ossUrl: '', |
|
|
|
imgUrl: item, |
|
|
|
imageId: ++_this.data.imageId |
|
|
|
}) |
|
|
|
}) |
|
|
|
_this.setData({ |
|
|
|
uploadImageList: [..._this.data.uploadImageList,...uploadImageList] |
|
|
|
}) |
|
|
|
uploadImageList.forEach((item, index) => { |
|
|
|
return (function (index) { |
|
|
|
wx.uploadFile({ |
|
|
|
url: `${config.BASEURL()}group/topic/upload`, |
|
|
|
filePath: res.tempFilePaths[index], |
|
|
|
name: 'file', |
|
|
|
header: { |
|
|
|
'Content-type': 'multipart/form-data' |
|
|
|
}, |
|
|
|
success (fileRes){ |
|
|
|
uploadImageList[index].uploaded = true |
|
|
|
uploadImageList[index].ossUrl = JSON.parse(fileRes.data).data |
|
|
|
_this.data.uploadImageList = _this.data.uploadImageList.slice(0, endIndex) |
|
|
|
_this.setData({ |
|
|
|
uploadImageList: [..._this.data.uploadImageList, ...uploadImageList] |
|
|
|
}) |
|
|
|
// _this.data.setData({
|
|
|
|
// volunteerFaceImg:uploadImageList[0].ossUrl
|
|
|
|
// })
|
|
|
|
|
|
|
|
_this.setData({ |
|
|
|
volunteerFaceImg:uploadImageList[0].ossUrl |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
})(index) |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
return true |
|
|
|
}, |
|
|
|
cancelText: '取消', |
|
|
|
cancel() {}, |
|
|
|
destructiveButtonClicked() {}, |
|
|
|
}) |
|
|
|
}, |
|
|
|
}) |