|
|
@@ -40,20 +40,47 @@ Page({
|
|
|
},
|
|
|
submit:function(){
|
|
|
let that=this
|
|
|
+ wx.showLoading({
|
|
|
+ title: '正在上传',
|
|
|
+ })
|
|
|
+ if (!that.data.ditufile&&!that.data.fengmianfile){
|
|
|
+ if (!that.data.dtFilePaths) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '请上传底库照',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ } else if (!that.data.fmFilePaths){
|
|
|
+ wx.showToast({
|
|
|
+ title: '请上传封面照',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ } else if (!that.data.dtFilePaths && !that.data.fmFilePaths){
|
|
|
+ wx.showToast({
|
|
|
+ title: '请先上传新的照片',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ that.data.pathscount=0
|
|
|
+ if (that.data.dtFilePaths){
|
|
|
+ that.data.pathscount++
|
|
|
+ } else if (that.data.fmFilePaths){
|
|
|
+ that.data.pathscount++
|
|
|
+ }
|
|
|
if(that.data.dtFilePaths){
|
|
|
that.upload(that.data.dtFilePaths,'false')
|
|
|
}
|
|
|
if(that.data.fmFilePaths){
|
|
|
- that.upload(that.data.fmFilePaths,true)
|
|
|
+ that.upload(that.data.fmFilePaths,'true')
|
|
|
}
|
|
|
},
|
|
|
upload: function (file, isShowPhoto){
|
|
|
let that=this
|
|
|
- wx.showLoading({
|
|
|
- title: '正在上传',
|
|
|
- })
|
|
|
wx.uploadFile({
|
|
|
- url: api.updateUserHeadImage.if,
|
|
|
+ url: api.updateUserHeadImage,
|
|
|
filePath: file[0],
|
|
|
header: { 'content-type': 'application/x-www-form-urlencoded;charset=utf-8', },
|
|
|
name: 'file',
|
|
|
@@ -65,9 +92,17 @@ Page({
|
|
|
success(res) {
|
|
|
wx.hideLoading()
|
|
|
if (JSON.parse(res.data).youtuMessage.error_code==0){
|
|
|
- wx.redirectTo({
|
|
|
- url: '/pages/success/index',
|
|
|
- })
|
|
|
+ if (that.data.pathscount==1){
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/success/index',
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ if (isShowPhoto=='true'){
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/success/index',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
@@ -76,7 +111,17 @@ Page({
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
-
|
|
|
+ let that=this
|
|
|
+ wx.request({
|
|
|
+ url: api.getYouTuImage,
|
|
|
+ data:{loginId:wx.getStorageSync('loginId')},
|
|
|
+ success(res){
|
|
|
+ that.setData({
|
|
|
+ ditufile: res.data.img?api.total.split('.if')[0] + res.data.img:'',
|
|
|
+ fengmianfile: res.data.showImg? api.total.split('.if')[0] + res.data.showImg:''
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
/**
|