From 9203a43facf5fd967aaafcfc41541a9f4565869a Mon Sep 17 00:00:00 2001
From: li-guang <153605324@qq.com>
Date: Thu, 07 Jan 2021 11:29:28 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/jyyforjava/hive-app
---
hive-app/pages/mine/myInfo.vue | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 102 insertions(+), 12 deletions(-)
diff --git a/hive-app/pages/mine/myInfo.vue b/hive-app/pages/mine/myInfo.vue
index e5af2e8..fc70b7c 100644
--- a/hive-app/pages/mine/myInfo.vue
+++ b/hive-app/pages/mine/myInfo.vue
@@ -1,29 +1,28 @@
<template>
<!-- 我的信息 -->
<view class="font-14">
- <view class="right mr-10">
- <text class="gray">NO.354</text>
- </view>
<view class="center">
- <image class="header-img" src="../../static/images/default-avatar.png"></image>
+ <image class="header-img"
+ :src="formData.photo?formData.photo:'../../static/images/default-avatar.png'"
+ @click="showUploadImage"></image>
</view>
<view class="mt-20 content">
<view class="input-group-row">
<text class="label">姓名<text class="require">*</text></text>
- <input type="text" maxlength="20" placeholder="阿狸" placeholder-class='placeholder'/>
+ <input type="text" v-model="formData.name" maxlength="20" placeholder="姓名" placeholder-class='placeholder'/>
</view>
<view class="input-group-row">
<text class="label">英文名</text>
- <input type="text" maxlength="20" placeholder="Lisa" placeholder-class='placeholder'/>
+ <input type="text" v-model="formData.engName" maxlength="100" placeholder="英文名" placeholder-class='placeholder'/>
</view>
<view class="input-group-row">
<text class="label">手机号码<text class="require">*</text></text>
- <input type="text" maxlength="20" placeholder="13170303460" placeholder-class='placeholder'/>
+ <input type="text" v-model="formData.telphone" maxlength="20" placeholder="手机号码" placeholder-class='placeholder'/>
</view>
<view class="input-group-row">
<text class="label">性别<text class="require">*</text></text>
<view class="right-text">
- <radio-group name="sex">
+ <radio-group name="sex" @change="sexChange">
<label><radio value="男" color="#518EFF" class="radio" :checked="formData.sex==='男'"/>男</label>
<label><radio value="女" color="#518EFF" class="radio" :checked="formData.sex==='女'"/>女</label>
</radio-group>
@@ -39,29 +38,119 @@
</view>
<view class="input-group-row">
<text class="label">Eamil</text>
- <input type="text" maxlength="20" placeholder="请输入Eamil" placeholder-class='placeholder'/>
+ <input type="text" v-model="formData.email" maxlength="20" placeholder="请输入Eamil" placeholder-class='placeholder'/>
</view>
<view class="input-group-row">
<text class="label">服务签名</text>
- <input type="text" maxlength="20" placeholder="请输入服务签名" placeholder-class='placeholder'/>
+ <input type="text" v-model="formData.serviceSign" maxlength="100" placeholder="请输入服务签名" placeholder-class='placeholder'/>
</view>
<view class="input-group-row">
<text class="label">住址</text>
- <input type="text" maxlength="20" placeholder="请输入住址" placeholder-class='placeholder'/>
+ <input type="text" v-model="formData.address" maxlength="100" placeholder="请输入住址" placeholder-class='placeholder'/>
</view>
</view>
- <button class="blue-btn sticky-footer">保存</button>
+ <button class="blue-btn sticky-footer" :disabled="isDisabled" @click="submit">保存</button>
</view>
</template>
<script>
+ import imageUploadUtils from '../../common/jssdk/uploadImg.js'
export default{
data(){
return{
+ isDisabled: false,
formData: {
sex: '女',
+ photo: ''
}
}
+ },
+ onLoad() {
+ this.loadUserInfo()
+ },
+ computed: {
+ endDate() {
+ return this.getDate('end');
+ }
+ },
+ methods:{
+ loadUserInfo(){
+ this.$httpUtils.request('/api/user/findUserInfo').then((res) => {
+ if(res.status == 200){
+ this.formData = res.mapInfo.detail
+ }
+ })
+ },
+ valid(){
+ const {name, telphone, sex} = this.formData;
+ if(!name){
+ this.$toast.info('请输入姓名');
+ return false;
+ }
+ if(!this.$utils.checkPhone(telphone)){
+ this.$toast.info('请填写正确的手机号码');
+ return false;
+ }
+ if(!sex){
+ this.$toast.info('请选择性别');
+ return false;
+ }
+ },
+ submit(){
+ if(this.valid() === false){
+ return;
+ }
+ let roleInfo = this.$httpUtils.getRoleInfo();
+ let token = this.$httpUtils.getToken();
+ this.isDisabled = true;
+ this.$httpUtils.request('/api/user/modifyUserInfo', this.formData, 'POST').then((res) => {
+ if(res.status == 200){
+ if(roleInfo){
+ roleInfo.name = this.formData.name;
+ roleInfo.photo = this.formData.photo;
+ uni.setStorage({
+ key: 'userInfo',
+ data: JSON.stringify({
+ token: token,
+ roleInfo: roleInfo
+ }),
+ success: () => {
+ uni.navigateBack()
+ }
+ });
+ }
+
+ }
+ this.isDisabled = false;
+ this.$toast.info(res.info)
+ }).catch((err) => {
+ this.isDisabled = false;
+ })
+ },
+ sexChange(e){
+ this.formData.sex = e.detail.value;
+ },
+ dateChange(e){
+ this.formData.birthday = e.detail.value;
+ },
+ showUploadImage(){
+ imageUploadUtils.show((res) => {
+ this.formData.photo = res;
+ })
+ },
+ getDate(type) {
+ const date = new Date();
+ let year = date.getFullYear();
+ let month = date.getMonth() + 1;
+ let day = date.getDate();
+
+ if (type === 'start') {
+ year = year - 70;
+ }
+ month = month > 9 ? month : '0' + month;;
+ day = day > 9 ? day : '0' + day;
+ return `${year}-${month}-${day}`;
+ },
}
}
</script>
@@ -70,6 +159,7 @@
.header-img{
width: 60px;
height: 60px;
+ padding-top: 10px;
border-radius: 50%;
}
.content{
--
Gitblit v1.9.1