我的、活动日志、团队详情

This commit is contained in:
dong_bo0602 2020-06-26 18:43:33 +08:00
parent e49c9055e9
commit 7269c49254
14 changed files with 630 additions and 9 deletions

View File

@ -1,7 +1,9 @@
{
"pages": [
"pages/center/center",
"pages/index/index",
"pages/activityDialog/activityDialog",
"pages/teamDetail/teamDetail",
"pages/center/center",
"pages/volunteerRegister/volunteerRegister",
"pages/volunteer/volunteer",
"pages/heritage/heritage",

BIN
images/delete.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

View File

@ -0,0 +1,66 @@
// pages/activityDialog/activityDialog.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,32 @@
<view class="dialog">
<view class="dialog-box">
<view class="avatar">
<image src="../../images/avatar.png"></image>
</view>
<view class="user-info">
<view class="name">姓名</view>
<view class="content">哈哈哈哈哈</view>
<view class="public-time">
<view class="time">2020-02-02 00:00:00</view>
<view class="delete">
<image src="../../images/delete.png"></image>
</view>
</view>
</view>
</view>
<view class="dialog-box">
<view class="avatar">
<image src="../../images/avatar.png"></image>
</view>
<view class="user-info">
<view class="name">姓名</view>
<view class="content">哈哈哈哈哈</view>
<view class="public-time">
<view class="time">2020-02-02 00:00:00</view>
<view class="delete">
<image src="../../images/delete.png"></image>
</view>
</view>
</view>
</view>
</view>

View File

@ -0,0 +1,42 @@
.dialog{
padding: 30rpx;
}
.dialog-box{
margin-bottom: 15rpx;
display: flex;
justify-content: space-between;
}
.avatar{
width: 15%;
}
.avatar image{
width: 100%;
height: 90rpx;
}
.user-info{
width: 83%;
border-bottom: 1px solid #DEDEDE;
padding-bottom: 10rpx;
}
.name{
font-size: 34rpx;
color: #949494;
margin: 15rpx 0;
}
.content{
font-size: 30rpx;
color: #000;
margin-bottom: 15rpx;
}
.public-time{
display: flex;
justify-content: space-between;
}
.time{
font-size: 28rpx;
color: #949494;
}
.delete, .delete image{
width: 40rpx;
height: 40rpx;
}

View File

@ -7,8 +7,19 @@ Page({
*/
data: {
userAvatar: '',
token: ''
token: '',
userInfo: {},
usercenterUrl: app.usercenterUrl,
sourcePath: '/route/file/downloadfile/true/',
randomName: '',
showPhone: true,
phone: '',
code: '',
gotCode: false,
restTime: 120,
timer: ''
},
// 选择头像来源
changeAvatar: function () {
var self = this
wx.showActionSheet({
@ -24,6 +35,7 @@ Page({
}
})
},
// 选择图片
chooseAvatar: function (type) {
var self = this
wx.chooseImage({
@ -32,14 +44,13 @@ Page({
sourceType: [type],
success: function (res) {
var avatar = res.tempFilePaths[0];
console.log(avatar)
app.restAjax.file(app.restAjax.path('{usercenterUrl}/app/file/uploadimage', [app.usercenterUrl]), avatar, 'image', {
headers: {
token: self.data.token
}
}, function (code, data) {
console.log(data);
var id = JSON.parse(data).data
self.uploadAvatar(id)
}, function (code, data) {
console.log(data)
})
@ -49,6 +60,38 @@ Page({
}
})
},
// 上传
uploadAvatar: function (avatarId) {
var self = this
app.restAjax.put(app.restAjax.path('{usercenterUrl}/app/user/updateuseravatar', [app.usercenterUrl]), {
avatar: avatarId
}, {
headers: {
token: self.data.token
}
}, function (code, data) {
wx.setStorageSync('token', data.data);
self.getUserInfo()
}, function (code, data) {
console.log(data)
})
},
// 获取用户信息
getUserInfo: function () {
var self = this
app.restAjax.get(app.restAjax.path('{usercenterUrl}/app/user/getappuser', [app.usercenterUrl]), {}, {
headers: {
token: self.data.token
}
}, function (code, data) {
self.setData({
userInfo: data
})
}, function (code, data) {
console.log(data)
})
},
// 获取token
getToken: function () {
var self = this
wx.getStorage({
@ -57,6 +100,7 @@ Page({
self.setData({
token: res.data
})
self.getUserInfo()
},
})
},
@ -76,11 +120,126 @@ Page({
url: '../myVolunteerActivity/myVolunteerActivity',
})
},
// 判断用户是否为随机名称
isRandomName: function () {
var self = this
wx.getStorage({
key: 'isRandomUsername',
success: function (res) {
if (res.data == 1) {
wx.hideTabBar()
self.setData({
randomName: true
})
}
}
})
},
// 取消绑定手机
cancelPhone: function () {
this.setData({
showPhone: false
})
wx.showTabBar()
},
// 获取输入的手机号
phoneNum: function (res) {
this.setData({
phone: res.detail.value
})
console.log(this.data.phone)
},
// 校验手机号
testPhone: function () {
var self = this
if (self.data.phone) {
if (!/^1(3|4|5|6|7|8|9)\d{9}$/.test(self.data.phone)) {
wx.showToast({
title: '请输入正确的手机号',
icon: 'none',
duration: 1500
})
} else {
self.getCode()
}
} else {
wx.showToast({
title: '手机号不能为空',
icon: 'none',
duration: 1500
})
}
},
// 获取验证码
getCode: function () {
var self = this
app.restAjax.get(app.restAjax.path('{usercenterUrl}/api/sms/getverificationcode/' + self.data.phone, [app.usercenterUrl]), {}, null,
function (code, data) {
if (code == 200) {
console.log(data)
self.setData({
gotCode: true
})
self.data.timer = setInterval(function () {
var cur = self.data.restTime - 1
console.log(cur)
if (cur == 0) {
clearInterval(self.data.timer)
self.setData({
restTime: 120,
gotCode: false
})
}
self.setData({
restTime: cur
})
}, 1000)
}
},
function (code, data) {
console.log(data)
wx.showToast({
title: data.msg,
icon: 'none',
duration: 1500
})
} )
},
// 提交绑定手机
submitPhone: function () {
var self = this
app.restAjax.put(app.restAjax.path('{usercenterUrl}/app/user/updateminiappdefaultusername', [app.usercenterUrl]), {
phone: self.data.phone,
verificationCode: self.data.code
}, {
headers: {
token: self.data.token
}
}, function (code, data) {
console.log(data)
wx.setStorageSync('token', data.data);
wx.setStorageSync('isRandomUsername', 0)
clearInterval(self.data.timer)
self.setData({
showPhone: false,
restTime: 120
})
self.getUserInfo()
}, function (code, data) {
console.log(data)
})
},
// 验证码
inputCode: function (e) {
this.setData({
code: e.detail.value
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.isRandomName()
this.getToken()
},

View File

@ -3,10 +3,10 @@
</view>
<view class="page-container">
<view class="person">
<view class="user-avatar" bindtap="changeAvatar">
<image src="{{userAvatar}}"></image>
<view class="user-avatar" bindtap="changeAvatar" wx:if="{{userInfo.avatar}}">
<image src="{{usercenterUrl}}{{sourcePath}}{{userInfo.avatar}}"></image>
</view>
<view class="user-name">杜若无心</view>
<view class="user-name">{{userInfo.name}}</view>
</view>
<view class="main">
<view class="main-title">常用功能</view>
@ -41,4 +41,21 @@
</view>
</view>
</view>
</view>
<view class="set-phone" wx:if="{{randomName && showPhone}}">
<view class="set-phone-box">
<view class="tips">您还没有绑定手机号,请先绑定手机号</view>
<view class="phone-input">
<input placeholder="请输入手机号" bindinput="phoneNum" class="phone-input"></input>
</view>
<view class="code-input">
<input placeholder="请输入验证码" bindinput="inputCode"></input>
<view class="get-code" bindtap="testPhone" wx:if="{{!gotCode}}">获取验证码</view>
<view class="got-code" wx:else>{{restTime}}</view>
</view>
<view class="set-phone-btn-box">
<view class="set-phone-btn" bindtap="submitPhone">确认</view>
<view class="set-phone-btn" bindtap="cancelPhone">取消</view>
</view>
</view>
</view>

View File

@ -63,4 +63,83 @@
.title{
font-size: 28rpx;
color: #242424;
}
.set-phone{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, .6);
z-index: 100;
}
.set-phone-box{
width: 96%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: #fff;
border-radius: 10rpx;
padding: 30rpx;
box-sizing: border-box;
}
.tips{
font-size: 28rpx;
color: #000;
}
.phone-input{
margin: 25rpx 0;
}
.code-input{
display: flex;
justify-content: space-between;
margin-bottom: 25rpx;
}
.code-input input{
width: 70%;
height: 55rpx;
border: 1px solid #dedede;
border-radius: 10rpx;
padding: 0 10rpx;
box-sizing: border-box;
font-size: 28rpx;
}
.phone-input input{
width: 100%;
height: 55rpx;
border: 1px solid #dedede;
border-radius: 10rpx;
padding: 0 10rpx;
box-sizing: border-box;
font-size: 28rpx;
}
.get-code, .got-code{
font-size: 28rpx;
background: rgba(159,21,18,.1);
color: #9F1512;
width: 28%;
line-height: 55rpx;
text-align: center;
border-radius: 10rpx;
}
.got-code{
background: #fff;
color: #4a4d52;
border: 1px solid #eaeaea;
}
.set-phone-btn-box{
display: flex;
justify-content: space-between;
}
.set-phone-btn{
width: 49%;
height: 65rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
color: #fff;
background: #9F1512;
border-radius: 10rpx;
}

View File

@ -0,0 +1,66 @@
// pages/teamDetail/teamDetail.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,68 @@
<view class="team">
<view class="team-info">
<view class="row">
<view class="title">团队名称:</view>
<view class="content">团队名称</view>
</view>
<view class="row">
<view class="title">团队人数:</view>
<view class="content">1</view>
</view>
<view class="row">
<view class="title">所属区域:</view>
<view class="content">所属区域</view>
</view>
<view class="row">
<view class="title">团队介绍:</view>
<view class="content intro">团队介绍</view>
</view>
</view>
<view class="team-member">
<view class="member-title">团队成员</view>
<view class="member-box">
<view class="member-avatar">
<image src="../../images/avatar.png"></image>
</view>
<view class="member-info">
<view class="name">名字<text class="post">队长</text></view>
<view class="join-time">加入时间2020-02-02</view>
</view>
</view>
<view class="member-box">
<view class="member-avatar">
<image src="../../images/avatar.png"></image>
</view>
<view class="member-info">
<view class="name">名字<text class="post">队长</text></view>
<view class="join-time">加入时间2020-02-02</view>
</view>
</view>
<view class="member-box">
<view class="member-avatar">
<image src="../../images/avatar.png"></image>
</view>
<view class="member-info">
<view class="name">名字<text class="post">队长</text></view>
<view class="join-time">加入时间2020-02-02</view>
</view>
</view>
</view>
<view class="team-member">
<view class="member-title">申请人员</view>
<view class="member-box">
<view class="member-avatar">
<image src="../../images/avatar.png"></image>
</view>
<view class="member-info">
<view class="name apply-member">
<view class="name-box">名字</view>
<view class="btn">
<view class="agree">通过</view>
<view class="refuse">拒绝</view>
</view>
</view>
<view class="join-time">加入时间2020-02-02</view>
</view>
</view>
</view>
</view>

View File

@ -0,0 +1,83 @@
.team{
padding: 30rpx;
}
.team-info{
margin-bottom: 20rpx;
}
.row{
display: flex;
justify-content: space-between;
}
.title{
width: 23%;
font-size: 28rpx;
line-height: 65rpx;
}
.content{
width: 75%;
line-height: 65rpx;
font-size: 28rpx;
border-bottom: 1px solid #DEDEDE;
}
.intro{
min-height: 200rpx;
}
.team-member{
margin-top: 20rpx;
}
.member-title{
font-size: 30rpx;
color: #000;
padding-left: 25rpx;
border-left: 10rpx solid #9F1512;
margin-bottom: 20rpx;
}
.member-box{
display: flex;
justify-content: space-between;
padding: 10rpx 0;
border-bottom: 1px solid #DEDEDE;
}
.member-avatar{
width: 15%;
}
.member-avatar image{
width: 100%;
height: 90rpx;
}
.member-info{
width: 83%;
}
.name{
font-size: 30rpx;
margin: 20rpx 0;
}
.post{
display: inline-block;
background: rgba(159,21,18,.1);
color: #9F1512;
padding: 0 10rpx;
margin-left: 15rpx;
}
.join-time{
font-size: 28rpx;
color: #949494;
}
.apply-member, .btn{
display: flex;
justify-content: space-between;
}
.agree, .refuse{
padding: 0 10rpx;
background: rgba(159,21,18,.1);
color: #9F1512;
}
.refuse{
margin-left: 15rpx;
}
.name-box{
width: 60%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

View File

@ -4,6 +4,7 @@
left: 0;
right: 0;
padding: 0 30rpx;
background: #fff;
}
.fixed-tab{
padding: 30rpx 0;