c5_labsci/fapp/ciyon_ap/pages/me/user_info.vue
2026-01-27 00:52:00 +08:00

102 lines
2.6 KiB
Vue

<template>
<ciy-header title="本人信息"></ciy-header>
<view class="ciy-card char3">
<view class="content char4">
<view class="ciy-form">
<label class="imp">姓名称呼</label>
<view>
<ciy-input bb v-model="editdata.name" type="nickname"></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>头像</label>
<view>
<ciy-upload left v-model="editdata.icon" path="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 bb v-model="editdata.mobile" type="text"></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>微信</label>
<view>
<ciy-input bb v-model="editdata.wxno" type="text"></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>电子信箱</label>
<view>
<ciy-input bb v-model="editdata.email" type="text"></ciy-input>
</view>
</view>
<view class="ciy-form-bottom">
<button class="btn lg cc" @tap="submit">更新个人信息</button>
</view>
</view>
</view>
</template>
<style>
</style>
<script>
export default {
data() {
return {}
},
onLoad() {
this.editdata = {
...this.me
};
},
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 = 70;
this.editdata.icon = await this.file_upload1(e.detail.avatarUrl, opn);
},
async submit() {
if (!this.editdata.name)
return this.toast('请输入姓名称呼');
if (!this.editdata.mobile)
return this.toast('请输入手机号');
if (this.editdata.name[0] == ':')
return this.toast('姓名称呼不能以:开头');
this._loading = true;
var retjson = await this.callfunc({
func: 'me.user_info_change',
data: this.editdata
});
this._loading = false;
if (retjson.code != 1)
return this.alert(retjson.errmsg);
this.me.name = this.editdata.name;
this.me.icon = this.editdata.icon;
this.me.mobile = this.editdata.mobile;
this.me.wxno = this.editdata.wxno;
this.me.email = this.editdata.email;
this.setstorage('me', this.me);
await this.toast('修改成功');
uni.navigateBack();
}
}
}
</script>