From 33dea4d64bcb043afad7fe6f2150f8c17d5a9c6e Mon Sep 17 00:00:00 2001
From: kuaileWu <1432334894@qq.com>
Date: Wed, 17 Apr 2024 17:35:36 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7=E4=BF=A1?=
=?UTF-8?q?=E6=81=AF=E9=A1=B5=E9=9D=A2=E4=BA=A4=E4=BA=92?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/modify_visitor/modify_visitor.vue | 2 +-
pages/user_modify/user_modify.vue | 55 ++++++++++++++++++++++-----------
pages/usercenter/usercenter.vue | 2 +-
3 files changed, 39 insertions(+), 20 deletions(-)
diff --git a/pages/modify_visitor/modify_visitor.vue b/pages/modify_visitor/modify_visitor.vue
index 7032fa7..c4c9165 100644
--- a/pages/modify_visitor/modify_visitor.vue
+++ b/pages/modify_visitor/modify_visitor.vue
@@ -54,7 +54,7 @@
clearTimeout(addtimer)
this.adding = false
if(data == -1) return
- this.$func.toPage('/pages/visitors/visitors?type='+this.type);
+ this.$func.toPage('/pages/visitors/visitors?type='+this.type)
});
},
nameBlurEvent(value, res){
diff --git a/pages/user_modify/user_modify.vue b/pages/user_modify/user_modify.vue
index 256c21c..71a4bdb 100644
--- a/pages/user_modify/user_modify.vue
+++ b/pages/user_modify/user_modify.vue
@@ -5,28 +5,29 @@
头像
-
+
+
点击上传照片
昵称
-
+
用户编号
- 17678689931
-
+ {{uinfo.uid}}
+
- 保存
+ 保存
@@ -36,41 +37,59 @@
data() {
return {
cssUrl:this.cssUrl,
- avator:this.cssUrl+'default_avator.svg'
+ avator:this.cssUrl+'default_avator.svg',
+ uinfo:{}
}
+ },
+ onLoad() {
+ this.getUser()
},
methods: {
+ save(){
+ this.$pop.modelShow('保存成功')
+ },
+ getUser(){
+ this.$http.req('client/user/info', {}, 'POST').then(data=>{
+ if(data == -1) return
+ this.uinfo = data
+ });
+ },
copyUid(uid) {
+ var that = this
uni.setClipboardData({
data: uid,
success: function () {
- uni.showToast({
- title:'用户编号已复制',
- icon:'none'
- })
}
});
},
upload() {
+ var that = this
+ var token = uni.getStorageSync('token')
uni.chooseImage({
count: 1,
success: function(res) {
var tempFilePaths = res.tempFilePaths;
uni.uploadFile({
- url: 'http://example.com/upload',
+ url: '/api/client/common/avatar/',
filePath: tempFilePaths[0],
name: 'file',
header: {
- 'content-type' : 'multipart/form-data'
- },
- formData:{
- 'user': 'test'
+ 'Authorization': token
},
success: function(res){
- console.log(res.data);
+ try{
+ var data = JSON.parse(res.data)
+ if(data.code != 2000){
+ that.$pop.modelShow('上传失败:'+data.msg)
+ return
+ }
+ that.uinfo.avatar = data.data.url
+ }catch(e){
+ that.$pop.modelShow('上传失败~'+e.message)
+ }
},
fail: function(res){
- console.log(res);
+ that.$pop.modelShow('上传失败')
}
});
}
@@ -132,7 +151,7 @@
}
.avator_tips{
position: absolute;
- bottom: 0;
+ bottom: 10rpx;
right: 0;
width: 100%;
z-index: 1;
diff --git a/pages/usercenter/usercenter.vue b/pages/usercenter/usercenter.vue
index 3fa07b9..909ebac 100644
--- a/pages/usercenter/usercenter.vue
+++ b/pages/usercenter/usercenter.vue
@@ -34,7 +34,7 @@
components:{
tabbar:tabbar
},
- onLoad() {
+ onShow() {
this.getUser()
},
methods: {