KunWeb/fapp/ciyon_ap/pages/main/me_info.vue
2025-05-22 12:54:03 +08:00

106 lines
2.8 KiB
Vue

<template>
<ciy-header title="本人信息"></ciy-header>
<form @submit="submit" class="char3">
<view class="ciy-card">
<view class="content char4">
<view class="ciy-form">
<label class="imp">姓名称呼</label>
<view>
<ciy-input name="name" v-model="me.name" type="nickname" bb></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>头像</label>
<view>
<ciy-upload left v-model="me.icon" path="icon" name="icon" imgwidth="400" imgheight="400" camheight="100" sourcetype="rehcam,album,message"></ciy-upload>
</view>
<!-- #ifdef MP-WEIXIN -->
<view>
<button class="btn sm" open-type="chooseAvatar" @chooseavatar="wxavar">从微信获取</button>
</view>
<!-- #endif -->
</view>
<view class="ciy-form">
<label class="imp">手机号</label>
<view>
<ciy-input name="mobile" v-model="me.mobile" type="text" bb></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>微信</label>
<view>
<ciy-input name="wxno" v-model="me.wxno" type="text" bb></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>电子信箱</label>
<view>
<ciy-input name="email" v-model="me.email" type="text" bb></ciy-input>
</view>
</view>
<view class="ciy-form-bottom">
<button class="btn lg cc" form-type="submit">更新个人信息</button>
</view>
</view>
</view>
</form>
</template>
<style>
</style>
<script>
export default {
data() {
return {}
},
onLoad() {
setTimeout(() => {
if (this.me.neednick)
this.me.name = '';
}, 100);
},
methods: {
async wxavar(e) {
var app = getApp();
var opn = {};
opn.post = {
from: 'avar'
};
opn.path = 'icon';
opn.stor = app.globalData.storselect;
opn.maxkb = 0;
opn.imgwidth = 400;
opn.imgheight = 400;
opn.zipjpg = 0.7;
this.me.icon = await this.file_upload1(e.detail.avatarUrl, opn);
},
async submit(e) {
if (!e.detail.value.name)
return this.toast('请输入姓名称呼');
if (!e.detail.value.mobile)
return this.toast('请输入手机号');
if (e.detail.value.name[0] == ':')
return this.toast('姓名称呼不能以:开头');
this._loading = true;
var retjson = await this.callajax({
func: 'me.userinfo_change',
data: e.detail.value
});
this._loading = false;
if (retjson.code != 1)
return this.alert(retjson.errmsg);
this.me.name = e.detail.value.name;
this.me.neednick = false;
this.me.icon = e.detail.value.icon;
this.me.mobile = e.detail.value.mobile;
this.me.wxno = e.detail.value.wxno;
this.me.email = e.detail.value.email;
this.setstorage('me', this.me);
await this.toast('修改成功');
uni.navigateBack();
}
}
}
</script>