|
@@ -1,3 +1,6 @@
|
|
|
+ import * as API_Common from '@/apis/common'
|
|
|
+ import * as WxJsApi from '@/utils/wxJsApi.js'
|
|
|
+ import * as API from '@/apis/my.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -10,7 +13,48 @@ export default {
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
-
|
|
|
+ upload(){
|
|
|
+ WxJsApi.chooseImage(1).then(res=>{
|
|
|
+ var formData = {
|
|
|
+ 'photoName': '1.jpg',
|
|
|
+ 'photoFile': res.localData
|
|
|
+ }
|
|
|
+
|
|
|
+ API_Common.upload(formData).then(response => {
|
|
|
+
|
|
|
+ this.pic=response.data
|
|
|
+
|
|
|
+ this.$refs.common.showLoading(false,"上传成功!")
|
|
|
+
|
|
|
+ }).catch(error => {
|
|
|
+ this.$refs.common.showLoading(false,error)
|
|
|
+
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ submit(){
|
|
|
+ if(!this.user.name){
|
|
|
+ this.$refs.common.alert('用户名不能为空')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$refs.common.showLoading();
|
|
|
+ this.user.faceImage=this.pic;
|
|
|
+ this.user.acceptMessage=(this.user.acceptMessage?1:0)
|
|
|
+ API.updateUserInfo(this.user).then((res) => {
|
|
|
+ this.carhelp.setPersonInfo(this.user);
|
|
|
+
|
|
|
+ this.$refs.common.setFnc(function(){
|
|
|
+ uni.switchTab({
|
|
|
+ url: '/pages/my/index'
|
|
|
+ });
|
|
|
+ })
|
|
|
+ this.$refs.common.alert2("操作成功!");
|
|
|
+
|
|
|
+ }).catch(error => {
|
|
|
+ this.$refs.common.showLoading(false,error);
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
gotoUrl(url){
|
|
|
uni.navigateTo({
|
|
|
url:url
|
|
@@ -33,6 +77,8 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
},onReady(){
|
|
|
+
|
|
|
+ WxJsApi.getWxConfig()
|
|
|
this.user=this.carhelp.getPersonInfo();
|
|
|
if(this.user.faceImage){
|
|
|
this.pic=this.user.faceImage;
|