From e6fef74ea3867d282dff1bc26dccf46a0518b837 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 16 Jun 2021 19:54:53 +0800
Subject: [PATCH] 1.新增点击头像上传 2.新增用户昵称,手机号,邮箱,生日可修改
---
pages/myself/childen/aboutUs.vue | 12 +
manifest.json | 2
pages/myself/childen/xinxi.vue | 104 +++++++++++++++-----
pages.json | 32 ++++++
pages/article/article.vue | 8 -
xcxjingqingmap_patrol/js/vueMain.js | 4
pages/myself/myself.vue | 69 +++++++++++++
store/mutations.js | 1
store/state.js | 7
store/actions.js | 2
10 files changed, 193 insertions(+), 48 deletions(-)
diff --git a/manifest.json b/manifest.json
index 8898573..7138e21 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,6 +1,6 @@
{
"name" : "jfpt",
- "appid" : "__UNI__647B57F",
+ "appid" : "__UNI__88EDF2B",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
diff --git a/pages.json b/pages.json
index 3df62e5..ccdf632 100644
--- a/pages.json
+++ b/pages.json
@@ -60,6 +60,38 @@
}
},
{
+ "path": "pages/myself/childen/info/nickName",
+ "name": "nickName",
+ "style": {
+ "navigationBarTitleText": "修改昵称",
+ "navigationBarBackgroundColor": "#F56968"
+ }
+ },
+ {
+ "path": "pages/myself/childen/info/phone",
+ "name": "phone",
+ "style": {
+ "navigationBarTitleText": "修改电话",
+ "navigationBarBackgroundColor": "#F56968"
+ }
+ },
+ {
+ "path": "pages/myself/childen/info/email",
+ "name": "email",
+ "style": {
+ "navigationBarTitleText": "修改邮箱",
+ "navigationBarBackgroundColor": "#F56968"
+ }
+ },
+ {
+ "path": "pages/myself/childen/info/birthday",
+ "name": "birthday",
+ "style": {
+ "navigationBarTitleText": "修改生日",
+ "navigationBarBackgroundColor": "#F56968"
+ }
+ },
+ {
"path": "pages/business/business",
"name": "business",
"style": {
diff --git a/pages/article/article.vue b/pages/article/article.vue
index 9bdfa4e..2e346c6 100644
--- a/pages/article/article.vue
+++ b/pages/article/article.vue
@@ -120,7 +120,6 @@
this.loadStatus='nomore';
}
}
-
}
});
}
@@ -217,14 +216,7 @@
border-radius: 5px;
}
}
-
-
}
-
-
-
-
-
}
diff --git a/pages/myself/childen/aboutUs.vue b/pages/myself/childen/aboutUs.vue
index 54e24a9..6e051b6 100644
--- a/pages/myself/childen/aboutUs.vue
+++ b/pages/myself/childen/aboutUs.vue
@@ -69,13 +69,17 @@
}
}
</script>
-
+<style lang="scss">
+ page{
+ background-color: rgba($color: #F5F0F6, $alpha: 0.5);
+ }
+</style>
<style lang="scss" scoped>
.aboutUs {
width: 100%;
height: 100%;
// background-color: rgba(128,128,128,0.1);
- background-color: #F5F0F6;
+ // background-color: #F5F0F6;
.up{
width: 100%;
@@ -161,8 +165,8 @@
bottom: 1.5%;
// left: calc((100% - 640rpx)/2);
// text-align: center;
- font-size: 22rpx;
- color: #808080;
+ font-size: 20rpx;
+ // color: #808080;
}
}
}
diff --git a/pages/myself/childen/xinxi.vue b/pages/myself/childen/xinxi.vue
index 61e5127..9362a6b 100644
--- a/pages/myself/childen/xinxi.vue
+++ b/pages/myself/childen/xinxi.vue
@@ -14,21 +14,25 @@
<view class="title">编号</view>
<view class="msg">{{user.id}}</view>
</view>
- <view class="row row-base-info">
+ <view class="row row-base-info" @click="updateNickName()">
<view class="title">昵称</view>
- <view class="msg">{{user.name}}</view>
+ <image src="../../../static/workbench/bracket.png">
+ <view class="msg-update">{{user.name}}</view>
</view>
- <view class="row row-base-info">
+ <view class="row row-base-info" @click="updatePhone()">
<view class="title">电话</view>
- <view class="msg">{{user.phone}}</view>
+ <image src="../../../static/workbench/bracket.png">
+ <view class="msg-update">{{user.phone}}</view>
</view>
- <view class="row row-base-info">
+ <view class="row row-base-info" @click="updateEmail()">
<view class="title">邮箱</view>
- <view class="msg">{{user.email}}</view>
+ <image src="../../../static/workbench/bracket.png">
+ <view class="msg-update">{{user.email}}</view>
</view>
- <view class="row row-base-info-birthday">
+ <view class="row row-base-info-birthday" @click="updateBirthday()">
<view class="title">生日</view>
- <view class="msg">{{user.birthday}}</view>
+ <image src="../../../static/workbench/bracket.png">
+ <view class="msg-update">{{user.birthday}}</view>
</view>
</view>
@@ -72,6 +76,27 @@
this.getUserInfo();
},
methods:{
+ //跳转至修改昵称页面
+ updateNickName(){
+ uni.navigateTo({
+ url: 'info/nickName?name='+this.user.name
+ });
+ },
+ updatePhone(){
+ uni.navigateTo({
+ url: 'info/phone?phone='+this.user.phone
+ });
+ },
+ updateEmail(){
+ uni.navigateTo({
+ url: 'info/email?email='+this.user.email
+ });
+ },
+ updateBirthday(){
+ uni.navigateTo({
+ url: 'info/birthday?birthday='+this.user.birthday
+ });
+ },
//获取客户信息
getUserInfo(){
var that = this;
@@ -90,12 +115,16 @@
}
}
</script>
-
+<style lang="scss">
+ page{
+ background-color: rgba($color: #F5F0F6, $alpha: 0.5);
+ }
+</style>
<style lang="scss" scoped>
.user-info{
width: 100%;
height: 100%;
- background-color: #F5F0F6;
+ // background-color: #F5F0F6;
letter-spacing: 1rpx;
.base-info-title{
@@ -109,47 +138,68 @@
.base-info{
width: 100%;
- height: 565rpx;
+ height: 635rpx;
background-color: #FFFFFF;
.row-base-info{
width: 94%;
margin: 0 auto;
- height: 80rpx;
+ height: 90rpx;
border-bottom: 1px solid rgba(128,128,128,0.1);
+ line-height: 90rpx;
.title{
- line-height: 80rpx;
float: left;
font-size: 28rpx;
}
.msg{
- line-height: 80rpx;
position: absolute;
right: 30rpx;
color: #808080;
font-size: 24rpx;
+ }
+
+ .msg-update{
+ position: absolute;
+ right: 90rpx;
+ color: #808080;
+ font-size: 24rpx;
+ }
+
+ image{
+ position: absolute;
+ margin-top: 20rpx;
+ right: 30rpx;
+ width: 40rpx;
+ height: 40rpx;
}
}
.row-base-info-birthday{
width: 94%;
margin: 0 auto;
- height: 80rpx;
+ height: 90rpx;
+ line-height: 90rpx;
.title{
- line-height: 80rpx;
float: left;
font-size: 28rpx;
}
- .msg{
- line-height: 80rpx;
+ .msg-update{
position: absolute;
- right: 30rpx;
+ right: 90rpx;
color: #808080;
font-size: 24rpx;
+ }
+
+ image{
+ position: absolute;
+ margin-top: 20rpx;
+ right: 30rpx;
+ width: 40rpx;
+ height: 40rpx;
}
}
}
@@ -158,30 +208,30 @@
height: 60rpx;
line-height: 60rpx;
position: relative;
- left: -60rpx;
+ left: 20rpx;
font-size: 24rpx;
color: #808080;
}
.dept-info{
width: 100%;
- height: 160rpx;
+ height: 180rpx;
background-color: #FFFFFF;
.row-dept-info{
width: 94%;
margin: 0 auto;
- height: 80rpx;
+ height: 90rpx;
border-bottom: 1px solid rgba(128,128,128,0.1);
.title{
- line-height: 80rpx;
+ line-height: 90rpx;
float: left;
font-size: 28rpx;
}
.msg{
- line-height: 80rpx;
+ line-height: 90rpx;
position: absolute;
right: 30rpx;
color: #808080;
@@ -192,16 +242,16 @@
.row-dept-info-post{
width: 94%;
margin: 0 auto;
- height: 80rpx;
+ height: 90rpx;
.title{
- line-height: 80rpx;
+ line-height: 90rpx;
float: left;
font-size: 28rpx;
}
.msg{
- line-height: 80rpx;
+ line-height: 90rpx;
position: absolute;
right: 30rpx;
color: #808080;
diff --git a/pages/myself/myself.vue b/pages/myself/myself.vue
index 40bd3ba..4dc7b3c 100644
--- a/pages/myself/myself.vue
+++ b/pages/myself/myself.vue
@@ -4,7 +4,7 @@
<view class="m-top">
<view class="m-t-left">
<view class="userImg">
- <img class="img" :src="useimg" alt="">
+ <img class="img" :src="useimg" @click="ChooseImage">
</view>
<view class="usermsg">
<view>{{userName}}</view>
@@ -102,10 +102,11 @@
butTitle() {
return this.$store.state.loging == true ? '登出' : '登入'
}
-
},
onLoad() {
-
+ if(this.$store.state.avatar!=null && this.$store.state.avatar!=''){
+ this.useimg = this.$store.state.avatar;
+ }
},
methods: {
openThere(fn) {
@@ -165,6 +166,68 @@
that.showTextmsg = false;
}
},
+ //图片上传
+ ChooseImage() {
+ var that = this;
+ uni.chooseImage({
+ count: 1, //可选择数量,默认9
+ sizeType: ['compressed','original'], //上传压缩图,原图
+ sourceType: ['album','camera'], //从相册选择或从使用相机
+ success: async (res) => {
+ for (var i = 0; i < res.tempFiles.length; i++) {
+ if(res.tempFiles[i].size > 10 * 1024 * 1000){ //上传图片大小限制
+ uni.showToast({
+ title: "照片大小不能10MB",
+ icon: "none"
+ })
+ return
+ }
+ }
+ var tempFilePath = res.tempFilePaths;
+ try{
+ uni.showLoading({
+ title:"上传中...",
+ mask:true
+ })
+ var that = this;
+ // 文件上传
+ uni.uploadFile({
+ // url: 'https://web.byisf.com/api/blade-jfpts/depl/put-depl', //仅为示例,非真实的接口地址
+ url: 'http://web.byisf.com:82/blade-jfpts/depl/put-depl',
+ filePath: tempFilePath[0],
+ name: 'file',
+ formData: {
+ 'user': 'test' // 上传附带参数
+ },
+ success: (data) => {
+ that.useimg = JSON.parse(data.data).data;
+ //修改用户头像信息
+ uni.request({
+ url:"http://s16s652780.51mypc.cn/api/blade-user/updateUserInfo",
+ method:"POST",
+ data:{
+ id: this.$store.state.puserID,
+ avatar:that.useimg
+ },
+ success:(res)=> {
+ if(res.data.code==200){
+ uni.showToast({
+ title: '上传成功!',
+ duration: 2000
+ });
+ }
+ }
+ })
+ }
+ });
+ }catch(e){
+ console.log(e);
+ }finally{
+ uni.hideLoading();
+ }
+ }
+ });
+ }
// geton() {
// wx.navigateTo({
// url: '../poput/workbench/policeDetails/policeDetails?id=111'
diff --git a/store/actions.js b/store/actions.js
index eed99ca..a7cdd8b 100644
--- a/store/actions.js
+++ b/store/actions.js
@@ -45,9 +45,11 @@
success: (res) => {
if (res.statusCode == 200) {
store.commit('getUserData',res.data)
+ console.log(res.data,123542);
data.isit = true;
data.userName = res.data.real_name; //警袁姓名
data.userID = res.data.user_id; //警袁id
+ data.avatar = res.data.avatar; //头像
// data.userPhon = res.user_id;
store.commit('login', data);
}
diff --git a/store/mutations.js b/store/mutations.js
index adb6feb..283f761 100644
--- a/store/mutations.js
+++ b/store/mutations.js
@@ -8,6 +8,7 @@
state.message.useName = data.userName;
state.puserName = data.userName;
state.puserID = data.userID;
+ state.avatar = data.avatar;
}
//储存用户
WxStorage.set("init", "true");
diff --git a/store/state.js b/store/state.js
index 9457e25..067fd27 100644
--- a/store/state.js
+++ b/store/state.js
@@ -5,9 +5,10 @@
},
logPath: '',
piAPI: 'http://s16s652780.51mypc.cn/api/',
- puserName: '陈慧英',
- puserID: '1370564873280430082',
- puserIphone:'15649685246',
+ puserName: '',
+ puserID: '',
+ puserIphone:'',
+ avatar:"",
UserData: {},
}
diff --git a/xcxjingqingmap_patrol/js/vueMain.js b/xcxjingqingmap_patrol/js/vueMain.js
index 3220159..06ca1f2 100644
--- a/xcxjingqingmap_patrol/js/vueMain.js
+++ b/xcxjingqingmap_patrol/js/vueMain.js
@@ -9,8 +9,8 @@
nowIndex: 1,
//基础路径
- pathUrl: "http://localhost:89",
- // pathUrl: "https://web.byisf.com/api/blade-jfpts",
+ // pathUrl: "http://localhost:89",
+ pathUrl: "http://s16s652780.51mypc.cn/api/blade-jfpts",
layer: null,
--
Gitblit v1.9.3