1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- 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 {
- user:{},
- pic:'/static/img/user.png',
- show:true,
- }
- },
- onLoad() {
-
- },
- methods: {
- upload(){
- WxJsApi.chooseImage(1).then(res=>{
- var formData = {
- 'photoName': '1.jpg',
- 'photoFile': res.localData
- }
-
- API_Common.upload(formData).then(response => {
-
- if(response.data){
- this.pic=response.data
-
- this.$refs.common.showLoading(false,"上传成功!")
- }else{
- 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
- })
- },
-
- showphone(phone){
- if(!phone){
- return "";
- }
- if(phone.length!=11){
- return "";
- }
- return phone.substring(0,3)+'****'+phone.substring(8);
- },
- signOut(){
- this.carhelp.signOut()
- uni.redirectTo({
- url: '/pages/car/login'
- })
- }
- },onReady(){
-
- WxJsApi.getWxConfig()
- this.user=this.carhelp.getPersonInfo();
- if(this.user.faceImage){
- this.pic=this.user.faceImage;
- }
- }
- }
|