|
@@ -2,11 +2,11 @@
|
|
|
<view class="container">
|
|
|
<view class="row b-b flex">
|
|
|
<text class="tit">头像</text>
|
|
|
- <image :src="userInfo.avatar"></image>
|
|
|
+ <image :src="userInfo.avatar" @click.stop="imgsub"></image>
|
|
|
</view>
|
|
|
<view class="row b-b flex">
|
|
|
<text class="tit">昵称</text>
|
|
|
- <input class="input" v-model="userInfo.nickname" type="text" disabled="true" placeholder-class="placeholder" />
|
|
|
+ <input class="input" v-model="userInfo.nickname" type="text" placeholder-class="placeholder" />
|
|
|
</view>
|
|
|
<view class="row b-b flex">
|
|
|
<text class="tit">ID</text>
|
|
@@ -16,9 +16,11 @@
|
|
|
<text class="tit">用户账号</text>
|
|
|
<input class="input" v-model="userInfo.account" type="number" disabled="true" placeholder-class="placeholder" />
|
|
|
</view>
|
|
|
- <view class="submit-box">
|
|
|
+ <view class="submit-box flex" >
|
|
|
+ <view class="submit" @click="edit">确认修改</view>
|
|
|
<view class="submit" @click="toLogout">退出登录</view>
|
|
|
</view>
|
|
|
+
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
@@ -26,6 +28,9 @@ import uniList from '@/components/uni-list/uni-list.vue';
|
|
|
import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
|
|
|
import { mapState, mapMutations } from 'vuex';
|
|
|
import { logout } from '@/api/set.js';
|
|
|
+import {
|
|
|
+ uploads,edit
|
|
|
+ } from '@/api/user.js';
|
|
|
export default {
|
|
|
components: {
|
|
|
uniList,
|
|
@@ -64,6 +69,27 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ imgsub() {
|
|
|
+ console.log('上传头像')
|
|
|
+ uploads({
|
|
|
+ filename: ''
|
|
|
+ }).then(data => {
|
|
|
+ console.log("data",data);
|
|
|
+ this.userInfo.avatar = data[0].url;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ edit() {
|
|
|
+ const that = this;
|
|
|
+ edit({
|
|
|
+ avatar: this.userInfo.avatar,
|
|
|
+ nickname: this.userInfo.nickname
|
|
|
+ }).then( e =>{
|
|
|
+ that.$api.msg('修改成功');
|
|
|
+ }).catch(e =>{
|
|
|
+ console.log(e);
|
|
|
+ that.$api.msg('修改失败');
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
@@ -91,8 +117,10 @@ page {
|
|
|
}
|
|
|
}
|
|
|
.submit-box{
|
|
|
- padding: 157rpx 95rpx;
|
|
|
+ padding-top: 157rpx;
|
|
|
.submit{
|
|
|
+ margin: 40rpx;
|
|
|
+ width: 50%;
|
|
|
background-color: #5771DF;
|
|
|
color: #FFFFFF;
|
|
|
text-align: center;
|