提交 4baf8177 编写于 作者: M m0_74163447

后端交互

上级 7f31d405
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</view> </view>
<view class="info"> <view class="info">
<view class="info1"> <view class="info1">
<view class="head-portrait"></view> <view class="head-portrait" :style="'background: url('+headPortraitIcon+') no-repeat center/cover #eeeeee;'"></view>
<view class="nickname">{{nickname}}</view> <view class="nickname">{{nickname}}</view>
</view> </view>
<view class="info2"> <view class="info2">
...@@ -20,10 +20,7 @@ ...@@ -20,10 +20,7 @@
<view class="team-icon"></view> <view class="team-icon"></view>
<view class="team-name">运动小队:{{teamName}}</view> <view class="team-name">运动小队:{{teamName}}</view>
</view> </view>
<view class="point">
<view class="point-icon"></view>
<view class="point-num">运动积分:{{point}}</view>
</view>
</view> </view>
</view> </view>
<view> <view>
...@@ -33,7 +30,7 @@ ...@@ -33,7 +30,7 @@
<view>我的帖子</view> <view>我的帖子</view>
</view> </view>
<view class="running-record"> <view class="running-record">
<view class="running-record-icon"></view> <view class="running-record-icon" @click="goToRunningRecord()"></view>
<view>运动记录</view> <view>运动记录</view>
</view> </view>
<view class="setting"> <view class="setting">
...@@ -55,11 +52,11 @@ ...@@ -55,11 +52,11 @@
export default { export default {
data () { data () {
return { return {
iStatusBarHeight:0, headPortraitIcon:'',
nickname:'王二蛋', nickname:'',
schoolName:'福州大学', schoolName:'',
teamName:'must go', teamName:'',
point:'1250' point:''
} }
}, },
methods:{ methods:{
...@@ -77,10 +74,31 @@ ...@@ -77,10 +74,31 @@
uni.navigateTo({ uni.navigateTo({
url: '/pages/my/my-resetpassword' url: '/pages/my/my-resetpassword'
}) })
} },
goToRunningRecord() {
uni.navigateTo({
url: '/pages/my/my-running-record'
})
},
getData() {
uniCloud.callFunction({
name: 'fe-my-information',
data: {userId:'6450da43e1a35c371b3699cc'}
})
.then(res => {
this.headPortraitIcon=res.result.data.icon,
this.nickname=res.result.data.username,
this.schoolName=res.result.data.school,
this.teamName=res.result.data.team,
//this.activityList=res.result.data.activityList,
console.log(res);
});
},
}, },
onLoad() { onLoad() {
plus.navigator.setStatusBarBackground('#EDEEF0'); plus.navigator.setStatusBarBackground('#EDEEF0');
this.getData()
} }
} }
</script> </script>
...@@ -120,8 +138,8 @@ ...@@ -120,8 +138,8 @@
height: 200rpx; height: 200rpx;
border-radius: 50%; border-radius: 50%;
background-size:100% 100%; background-size:100% 100%;
background-image:url("/static/my/main/head-portrait.png") ; /* background-image:url("/static/my/main/head-portrait.png") ;
background-repeat:no-repeat; background-repeat:no-repeat; */
float: left; float: left;
} }
.nickname{ .nickname{
...@@ -139,21 +157,21 @@ ...@@ -139,21 +157,21 @@
border-radius: 20rpx; border-radius: 20rpx;
background-color: #FFFFFF; background-color: #FFFFFF;
width:75%; width:75%;
height: 60%; height: 40%;
margin-top: 50px; margin-top: 50px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }
.school{ .school{
height: 30%; height: 50%;
margin-top: 20rpx;
} }
.school-icon{ .school-icon{
width: 70rpx; width: 100rpx;
height: 70rpx; height: 100rpx;
margin-top: 50rpx; margin-top: 30rpx;
margin-left: 50rpx; margin-left: 50rpx;
background-size:100% 100%; background-size:100% 100%;
background-image:url("/static/my/main/school-icon.png"); background-image:url("/static/my/main/school-icon.png");
...@@ -162,23 +180,23 @@ ...@@ -162,23 +180,23 @@
} }
.school-name{ .school-name{
width: 320rpx; width: 340rpx;
height: 30rpx; height: 30rpx;
margin-top: 60rpx; margin-top: 60rpx;
margin-right: 55rpx; margin-right: 45rpx;
font-size: 35rpx; font-size: 35rpx;
text-align: left; text-align: left;
float: right; float: right;
} }
.team{ .team{
height: 30%; height: 50%;
} }
.team-icon{ .team-icon{
width: 70rpx; width: 100rpx;
height: 70rpx; height: 100rpx;
margin-top: 50rpx; margin-top: 40rpx;
margin-left: 50rpx; margin-left: 50rpx;
background-size:100% 100%; background-size:100% 100%;
background-image:url("/static/my/main/team-icon.png"); background-image:url("/static/my/main/team-icon.png");
...@@ -187,43 +205,19 @@ ...@@ -187,43 +205,19 @@
} }
.team-name{ .team-name{
width: 320rpx; width: 340rpx;
height: 30rpx;
margin-top: 60rpx;
margin-right: 55rpx;
font-size: 35rpx;
text-align: left;
float: right;
}
.point{
height: 30%;
}
.point-icon{
width: 70rpx;
height: 70rpx;
margin-top: 50rpx;
margin-left: 50rpx;
background-size:100% 100%;
background-image:url("/static/my/main/point-icon.png");
background-repeat:no-repeat;
float: left;
}
.point-num{
width: 320rpx;
height: 30rpx; height: 30rpx;
margin-top: 60rpx; margin-top: 60rpx;
margin-right: 55rpx; margin-right: 45rpx;
font-size: 35rpx; font-size: 35rpx;
text-align: left; text-align: left;
float: right; float: right;
} }
.func{ .func{
width:75%; width:75%;
margin-top: 30rpx; /* margin-top: 10rpx; */
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
display: flex; display: flex;
......
...@@ -6,15 +6,14 @@ ...@@ -6,15 +6,14 @@
<span class="empty"></span> <span class="empty"></span>
</view> </view>
<view class="container"> <view class="container">
<view class="ui-all"> <view class="ui-all">
<view class="avatar" @tap="avatarChoose">
<view class="avatar" @tap="avatarChoose">
<view class="imgAvatar"> <view class="imgAvatar">
<view class="iavatar" :style="'background: url('+avatar+') no-repeat center/cover #eeeeee;'"> <view class="iavatar" :style="'background: url('+avatar+') no-repeat center/cover #eeeeee;'"></view>
</view>
</view> </view>
<text v-if="avatar">修改头像</text> <text>修改头像</text>
<text v-if="!avatar">设置头像</text>
<button v-if="!avatar" open-type="getUserInfo" @tap="getUserInfo" class="getInfo"></button> <button v-if="!avatar" open-type="getUserInfo" @tap="getUserInfo" class="getInfo"></button>
</view> </view>
<view class="ui-list"> <view class="ui-list">
...@@ -30,9 +29,9 @@ ...@@ -30,9 +29,9 @@
</view> </view>
<view class="ui-list right"> <view class="ui-list right">
<text>性别</text> <text>性别</text>
<picker @change="bindPickerChange" mode='selector' range-key="name" :value="index1" :range="sex"> <picker @change="bindPickerChange" mode='selector' range-key="name" :value="index1" :range="selectSex">
<view class="picker"> <view class="picker">
{{sex[index1].name}} {{selectSex[index1].name}}
</view> </view>
</picker> </picker>
</view> </view>
...@@ -46,27 +45,25 @@ ...@@ -46,27 +45,25 @@
</view> </view>
<button class="save" @tap="savaInfo">保 存 修 改</button> <button class="save" @tap="savaInfo">保 存 修 改</button>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import {
pathToBase64,
base64ToPath
} from 'js_sdk/mmmm-image-tools/index.js';
export default { export default {
data() { data() {
return { return {
sex: [{ selectSex: [{
id: 1, id: 1,
name: '' name: ''
}, { }, {
id: 2, id: 2,
name: '' name: ''
}], }],
index1: 0, index1: '0',
school: [{ school: [{
id: 1, id: 1,
name: '福州大学' name: '福州大学'
...@@ -74,13 +71,13 @@ ...@@ -74,13 +71,13 @@
id: 2, id: 2,
name: 'xx大学' name: 'xx大学'
}], }],
index2: 0, index2: '0',
avatar: '', avatar: '',
// url: '', schoolName:'',
nickName: '王二蛋', nickName: '',
mobile: '15305986885', mobile: '',
headimg: ''
sex:'',
} }
}, },
...@@ -101,26 +98,41 @@ ...@@ -101,26 +98,41 @@
this.mobile = e.detail.value; this.mobile = e.detail.value;
}, },
avatarChoose() { avatarChoose() {
let that = this; let that = this;
uni.chooseImage({ uniCloud.chooseAndUploadFile({
count: 1, type: 'image',
sizeType: ['original', 'compressed'], success(res) {
sourceType: ['album', 'camera'], that.avatar = res["tempFiles"][0]["url"];
success: function(res) { //console.log(res);
var tempFilePaths = res.tempFilePaths; //console.log(this.avatar);
pathToBase64(tempFilePaths[0]) //图像转base64工具 },
.then(base64 => { fail() {},
that.avatar = base64; complete() {}
//将文件转化为base64并显示
// that.avatarUpload(base64); //同时将头像上传至数据库进行存储
}).catch(error => {
console.error(error)
})
}
}); });
}, },
// avatarChoose() {
// let that = this;
// uni.chooseImage({
// count: 1,
// sizeType: ['original', 'compressed'],
// sourceType: ['album', 'camera'],
// success: function(res) {
// var tempFilePaths = res.tempFilePaths;
// pathToBase64(tempFilePaths[0]) //图像转base64工具
// .then(base64 => {
// that.avatar = base64;
// //将文件转化为base64并显示
// // that.avatarUpload(base64); //同时将头像上传至数据库进行存储
// }).catch(error => {
// console.error(error)
// })
// }
// });
// },
getUserInfo() { getUserInfo() {
uni.getUserProfile({ uni.getUserProfile({
...@@ -145,18 +157,20 @@ ...@@ -145,18 +157,20 @@
// }) // })
// } // }
// }, // },
savaInfo () { savaInfo() {
uni.showModal({ uni.showModal({
title: '温馨提示', //提示标题 title: '温馨提示', //提示标题
content: '确认修改你的个人信息吗', //提示内容 content: '确认修改你的个人信息吗', //提示内容
showCancel: true, //是否显示取消按钮 showCancel: true, //是否显示取消按钮
success:res => { success: res => {
if (res.confirm) { //confirm为ture,代表用户点击确定 if (res.confirm) { //confirm为ture,代表用户点击确定
let that = this; let that = this;
let gender = that.selectSex[that.index1].name;
let school = that.school[that.index2].name;
let nickname = that.nickName; let nickname = that.nickName;
let mobile = that.mobile; let mobile = that.mobile;
let headimg = that.avatar;
// let updata = {}; let updata = {};
if (!nickname) { if (!nickname) {
uni.showToast({ uni.showToast({
title: '请填写昵称', title: '请填写昵称',
...@@ -165,14 +179,15 @@ ...@@ -165,14 +179,15 @@
}); });
return; return;
} }
// updata.nickname = nickname; updata.nickname = nickname;
// if (!headimg) { if (!headimg) {
// headimg = that.avater; headimg = that.avater;
// } }
// updata.headimg = headimg; updata.headimg = headimg;
// updata.gender = gender; updata.gender = gender;
updata.school = school;
if (that.isPoneAvailable(mobile)) { if (that.isPoneAvailable(mobile)) {
// updata.mobile = mobile; updata.mobile = mobile;
} else { } else {
uni.showToast({ uni.showToast({
title: '手机号码有误,请重填', title: '手机号码有误,请重填',
...@@ -181,7 +196,7 @@ ...@@ -181,7 +196,7 @@
}); });
return; return;
} }
this.Upload(updata);
// that.updata(updata); // that.updata(updata);
} else if (res.cancel) { //cancel为ture,代表用户点击取消 } else if (res.cancel) { //cancel为ture,代表用户点击取消
console.log('点击了取消按钮'); console.log('点击了取消按钮');
...@@ -190,7 +205,7 @@ ...@@ -190,7 +205,7 @@
}) })
}, },
isPoneAvailable(poneInput) { isPoneAvailable(poneInput) {
var myreg = /^[1][3,4,5,7,8][0-9]{9}$/; var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
if (!myreg.test(poneInput)) { if (!myreg.test(poneInput)) {
...@@ -232,10 +247,22 @@ ...@@ -232,10 +247,22 @@
uni.navigateBack({ uni.navigateBack({
delta: 1, //返回层数,2则上上页 delta: 1, //返回层数,2则上上页
}) })
} },
Upload(updata) {
uniCloud.callFunction({
name: 'fe-my-modifyinformation',
data: {userId:'6450da43e1a35c371b3699cc',icon:updata.headimg,username:updata.nickname,school:updata.school,phone:updata.mobile,gender:updata.gender}
})
.then(res => {
console.log(res);
});
},
}, },
onLoad() { onLoad() {
plus.navigator.setStatusBarBackground('#EDEEF0'); plus.navigator.setStatusBarBackground('#EDEEF0');
//this.getData();
} }
} }
......
...@@ -10,22 +10,22 @@ ...@@ -10,22 +10,22 @@
<span class="empty"></span> <span class="empty"></span>
</view> </view>
<view class="content"> <view class="content">
<veiw class="password"> <view class="password">
<span>&ensp;&ensp;码:</span> <span>&ensp;&ensp;码:</span>
<input placeholder="请输入原密码" type="text" :password="showPassword" name="input"></input> <input placeholder="请输入原密码" type="text" :password="showPassword" name="input"></input>
<!-- <text :class="[!showPassword ?'cuIcon-attentionfill' : 'cuIcon-attentionforbidfill']" class="text-gray" @click="showPwd" ></text> --> <!-- <text :class="[!showPassword ?'cuIcon-attentionfill' : 'cuIcon-attentionforbidfill']" class="text-gray" @click="showPwd" ></text> -->
<!-- <input type="safe-password" :value="originalPassword" :valplaceholder='请输入原密码'></input> --> <!-- <input type="safe-password" :value="originalPassword" :valplaceholder='请输入原密码'></input> -->
</veiw> </view>
<veiw class="password"> <view class="password">
<span>&ensp;&ensp;码:</span> <span>&ensp;&ensp;码:</span>
<input placeholder="请输入新密码" type="text" @input="bindNewPassword" :password="showPassword" <input placeholder="请输入新密码" type="text" @input="bindNewPassword" :password="showPassword"
name="input"></input> name="input"></input>
</veiw> </view>
<veiw class="password"> <view class="password">
<span>确认密码:</span> <span>确认密码:</span>
<input placeholder="请确认密码" type="text" @input="bindConfirmPassword" :password="showPassword" <input placeholder="请确认密码" type="text" @input="bindConfirmPassword" :password="showPassword"
name="input"></input> name="input"></input>
</veiw> </view>
</view> </view>
<view class="confirm"> <view class="confirm">
<button class="confirm-btn" @click="confirmModification()">确认修改</button> <button class="confirm-btn" @click="confirmModification()">确认修改</button>
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
data() { data() {
return { return {
showPassword: true, showPassword: true,
password:'1223',
newPassword: '', newPassword: '',
confirmPassword: '', confirmPassword: '',
} }
...@@ -61,8 +62,10 @@ ...@@ -61,8 +62,10 @@
success: res => { success: res => {
if (res.confirm) { //confirm为ture,代表用户点击确定 if (res.confirm) { //confirm为ture,代表用户点击确定
let that = this; let that = this;
let password = that.password;
let newPassword = that.newPassword; let newPassword = that.newPassword;
let confirmPassword = that.confirmPassword; let confirmPassword = that.confirmPassword;
let updata = {};
if (!that.isPasswordAvailable(newPassword)) { if (!that.isPasswordAvailable(newPassword)) {
uni.showToast({ uni.showToast({
title: '密码长度在8-20位!', title: '密码长度在8-20位!',
...@@ -78,9 +81,10 @@ ...@@ -78,9 +81,10 @@
}); });
return; return;
} else { } else {
// updata.mobile = mobile; updata.password = password;
//return; updata.newPassword = newPassword;
} }
this.Upload(updata);
} else if (res.cancel) { //cancel为ture,代表用户点击取消 } else if (res.cancel) { //cancel为ture,代表用户点击取消
console.log('点击了取消按钮'); console.log('点击了取消按钮');
} }
...@@ -109,6 +113,17 @@ ...@@ -109,6 +113,17 @@
delta: 1, //返回层数,2则上上页 delta: 1, //返回层数,2则上上页
}) })
}, },
Upload(updata) {
uniCloud.callFunction({
name: 'fe-my-resetpassword',
data: {userId:'6450da43e1a35c371b3699cc',password:updata.password,newPassword:updata.newPassword}
})
.then(res => {
console.log(res);
});
},
onload() { onload() {
plus.navigator.setStatusBarBackground('#EDEEF0'); plus.navigator.setStatusBarBackground('#EDEEF0');
} }
......
...@@ -44,9 +44,11 @@ ...@@ -44,9 +44,11 @@
showCancel: true, //是否显示取消按钮 showCancel: true, //是否显示取消按钮
success: function (res) { success: function (res) {
if (res.confirm) { //confirm为ture,代表用户点击确定 if (res.confirm) { //confirm为ture,代表用户点击确定
console.log('点击了确定按钮'); uni.navigateTo({
url: '/pages/login/login'
})
} else if (res.cancel) { //cancel为ture,代表用户点击取消 } else if (res.cancel) { //cancel为ture,代表用户点击取消
console.log('点击了取消按钮');
} }
} }
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册