|
@@ -1,3 +1,4 @@
|
|
|
+const api = require('../../utils/api.js');
|
|
|
const app = getApp(),
|
|
|
{
|
|
|
globalData: {
|
|
@@ -104,6 +105,38 @@ Page({
|
|
|
url: e.currentTarget.dataset.url,
|
|
|
})
|
|
|
},
|
|
|
+ updateimage:function(){
|
|
|
+ let that=this
|
|
|
+ wx.chooseImage({
|
|
|
+ count:1,
|
|
|
+ success: function(res) {
|
|
|
+ wx.showLoading({
|
|
|
+ title: '正在上传',
|
|
|
+ })
|
|
|
+ wx.uploadFile({
|
|
|
+ url: api.updateimage,
|
|
|
+ filePath: res.tempFilePaths[0],
|
|
|
+ header: { 'content-type': 'application/x-www-form-urlencoded;charset=utf-8', },
|
|
|
+ name: 'file',
|
|
|
+ formData: {
|
|
|
+ 'fileType': 'image',
|
|
|
+ 'loginId': wx.getStorageSync('loginId')
|
|
|
+ },
|
|
|
+ success(res) {
|
|
|
+ wx.hideLoading()
|
|
|
+ console.log(res)
|
|
|
+ if (JSON.parse(res.data.data).status == true) {
|
|
|
+ wx.getStorageSync('userInfo').avatarUrl = api.total + JSON.parse(res.data.data).headImage
|
|
|
+ wx.showToast({
|
|
|
+ title: '修改成功',
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
goLogin,
|
|
|
// navigate_auth_native
|
|
|
})
|