|
@ -1,4 +1,7 @@ |
|
|
const api = require("../../utils/api") |
|
|
const api = require("../../utils/api") |
|
|
|
|
|
import { $wuxActionSheet } from "../../dist/index" |
|
|
|
|
|
const config = require("../../utils/config") |
|
|
|
|
|
|
|
|
import { |
|
|
import { |
|
|
getTimestamp |
|
|
getTimestamp |
|
|
} from "../../utils/common" |
|
|
} from "../../utils/common" |
|
@ -29,7 +32,8 @@ Page({ |
|
|
changeName:false, |
|
|
changeName:false, |
|
|
visible: false, |
|
|
visible: false, |
|
|
signMsg: '', |
|
|
signMsg: '', |
|
|
signCode: 0 |
|
|
signCode: 0, |
|
|
|
|
|
uploadImageList:[] |
|
|
}, |
|
|
}, |
|
|
onLoad () { |
|
|
onLoad () { |
|
|
if(app.globalData.infoCompleted == 0 || app.globalData.infoCompleted == 4){//当状态为0 或者 4 的时候 显示完善个人信息其余状态为更改个人信息
|
|
|
if(app.globalData.infoCompleted == 0 || app.globalData.infoCompleted == 4){//当状态为0 或者 4 的时候 显示完善个人信息其余状态为更改个人信息
|
|
@ -335,7 +339,105 @@ Page({ |
|
|
duration: 1000 |
|
|
duration: 1000 |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
chooseImage () { |
|
|
|
|
|
const _this = this |
|
|
|
|
|
$wuxActionSheet().showSheet({ |
|
|
|
|
|
buttons: [ |
|
|
|
|
|
{ text: "拍照" }, |
|
|
|
|
|
{ text: "从相册中获取" }, |
|
|
|
|
|
], |
|
|
|
|
|
className: "dialog-class", |
|
|
|
|
|
buttonClicked (index) { |
|
|
|
|
|
if (index === 0) { |
|
|
|
|
|
wx.chooseImage({ |
|
|
|
|
|
count: 1, |
|
|
|
|
|
sizeType: [ "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){ |
|
|
|
|
|
console.log(fileRes); |
|
|
|
|
|
uploadImageList[index].uploaded = true |
|
|
|
|
|
// uploadImageList[index].ossUrl = JSON.parse(fileRes.data).data
|
|
|
|
|
|
_this.imageSave(JSON.parse(fileRes.data).data) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} else if (index === 1) { |
|
|
|
|
|
wx.chooseImage({ |
|
|
|
|
|
count: 1, |
|
|
|
|
|
sizeType: ["compressed"], |
|
|
|
|
|
sourceType: ["album"], |
|
|
|
|
|
success (res) { |
|
|
|
|
|
console.log(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: [...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.imageSave(JSON.parse(fileRes.data).data) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
})(index) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
return true |
|
|
|
|
|
}, |
|
|
|
|
|
cancelText: "取消", |
|
|
|
|
|
cancel () {}, |
|
|
|
|
|
|
|
|
|
|
|
// destructiveButtonClicked () {},
|
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
imageSave(url){ |
|
|
|
|
|
api.updateAvata(url).then(res=>{ |
|
|
|
|
|
console.log(res); |
|
|
|
|
|
this.getUserInfo() |
|
|
|
|
|
}).catch(err=>{ |
|
|
|
|
|
console.log(err); |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
// 签到 2020.07.24
|
|
|
// 签到 2020.07.24
|
|
|
// toSignUp () {
|
|
|
// toSignUp () {
|
|
|
// if (this.data.userInfo.isSignUp == 1) {
|
|
|
// if (this.data.userInfo.isSignUp == 1) {
|
|
|