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: {