diff --git a/app.js b/app.js index 78f7845..458b692 100644 --- a/app.js +++ b/app.js @@ -3,12 +3,13 @@ var restAjax = require('utils/restAjax.js'); var dialog = require('utils/dialog.js'); App({ loginUrl: 'http://192.168.0.113:7001/usercenter', - usercenterUrl: 'http://192.168.0.113:7001/usesrcenter', + usercenterUrl: 'http://192.168.0.113:7001/usercenter', newsUrl: 'http://192.168.0.113:8082/news', libraryUrl: 'http://192.168.0.113:8081/library', + venueUrl: 'http://192.168.0.109:8082/venuebooking', activityUrl: 'http://192.168.0.111:8080/culturalactivity/', volunteerUrl: 'http://192.168.0.111:8888/volunteer/', - venueUrl: '', + restAjax: restAjax, dialog: dialog, onLaunch: function () { diff --git a/app.json b/app.json index 0b259bb..a3f277c 100644 --- a/app.json +++ b/app.json @@ -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", @@ -64,6 +66,11 @@ } ] }, + "permission": { + "scope.userLocation": { + "desc": "你的位置信息将用于您当前所在位置" + } + }, "style": "v2", "sitemapLocation": "sitemap.json" } \ No newline at end of file diff --git a/images/delete.png b/images/delete.png new file mode 100644 index 0000000..63f7d52 Binary files /dev/null and b/images/delete.png differ diff --git a/pages/activityDialog/activityDialog.js b/pages/activityDialog/activityDialog.js new file mode 100644 index 0000000..3c20d34 --- /dev/null +++ b/pages/activityDialog/activityDialog.js @@ -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 () { + + } +}) \ No newline at end of file diff --git a/pages/activityDialog/activityDialog.json b/pages/activityDialog/activityDialog.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/activityDialog/activityDialog.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/activityDialog/activityDialog.wxml b/pages/activityDialog/activityDialog.wxml new file mode 100644 index 0000000..57a02dd --- /dev/null +++ b/pages/activityDialog/activityDialog.wxml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/activityDialog/activityDialog.wxss b/pages/activityDialog/activityDialog.wxss new file mode 100644 index 0000000..b01a43d --- /dev/null +++ b/pages/activityDialog/activityDialog.wxss @@ -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; +} \ No newline at end of file diff --git a/pages/center/center.js b/pages/center/center.js index d49a43a..de7bca9 100644 --- a/pages/center/center.js +++ b/pages/center/center.js @@ -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,16 +44,13 @@ Page({ sourceType: [type], success: function (res) { var avatar = res.tempFilePaths[0]; - console.log(avatar) - app.restAjax.post(app.restAjax.path('{usercenterUrl}/app/file/uploadimage', [app.usercenterUrl]), { - image: 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) }) @@ -51,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({ @@ -59,6 +100,7 @@ Page({ self.setData({ token: res.data }) + self.getUserInfo() }, }) }, @@ -78,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() }, diff --git a/pages/center/center.wxml b/pages/center/center.wxml index e434ec7..6f06c29 100644 --- a/pages/center/center.wxml +++ b/pages/center/center.wxml @@ -3,10 +3,10 @@ - - + + - 杜若无心 + {{userInfo.name}} 常用功能 @@ -41,4 +41,21 @@ + + + + 您还没有绑定手机号,请先绑定手机号 + + + + + + 获取验证码 + {{restTime}} + + + 确认 + 取消 + + \ No newline at end of file diff --git a/pages/center/center.wxss b/pages/center/center.wxss index 6307e32..c4d5a4a 100644 --- a/pages/center/center.wxss +++ b/pages/center/center.wxss @@ -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; } \ No newline at end of file diff --git a/pages/teamDetail/teamDetail.js b/pages/teamDetail/teamDetail.js new file mode 100644 index 0000000..aaf2ecc --- /dev/null +++ b/pages/teamDetail/teamDetail.js @@ -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 () { + + } +}) \ No newline at end of file diff --git a/pages/teamDetail/teamDetail.json b/pages/teamDetail/teamDetail.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/teamDetail/teamDetail.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/teamDetail/teamDetail.wxml b/pages/teamDetail/teamDetail.wxml new file mode 100644 index 0000000..7f28701 --- /dev/null +++ b/pages/teamDetail/teamDetail.wxml @@ -0,0 +1,68 @@ + + + + 团队名称: + 团队名称 + + + 团队人数: + 1 + + + 所属区域: + 所属区域 + + + 团队介绍: + 团队介绍 + + + + 团队成员 + + + + + + 名字队长 + 加入时间:2020-02-02 + + + + + + + + 名字队长 + 加入时间:2020-02-02 + + + + + + + + 名字队长 + 加入时间:2020-02-02 + + + + + 申请人员 + + + + + + + 名字 + + 通过 + 拒绝 + + + 加入时间:2020-02-02 + + + + \ No newline at end of file diff --git a/pages/teamDetail/teamDetail.wxss b/pages/teamDetail/teamDetail.wxss new file mode 100644 index 0000000..0443cd1 --- /dev/null +++ b/pages/teamDetail/teamDetail.wxss @@ -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; +} \ No newline at end of file diff --git a/pages/venue/venue.js b/pages/venue/venue.js index 20fdd62..edfb9a3 100644 --- a/pages/venue/venue.js +++ b/pages/venue/venue.js @@ -1,3 +1,4 @@ +var app = getApp(); // pages/venue/venue.js Page({ @@ -5,8 +6,8 @@ Page({ * 页面的初始数据 */ data: { - baseUrl : 'http://192.168.0.109:8082/venuebooking/', - imgRoute : 'route/file/downloadfile/true/', + venueUrl : app.venueUrl, + imgRoute : '/route/file/downloadfile/true/', venueTypeParentId : 'df8b758c-f6d8-465a-9aa8-c451fde47076', page : '1', rows : '10', @@ -38,23 +39,23 @@ Page({ //获取场馆分类 listVenueType : function(){ var self = this; - wx.request({ - url: self.data.baseUrl + 'app/venuedictionary/listvenuedictionarybyparentidrelease/' + self.data.venueTypeParentId, - success : function(res){ - var data = res.data; + app.restAjax.get(app.restAjax.path('{venueUrl}/app/venuedictionary/listvenuedictionarybyparentidrelease/{venueTypeParentId}', + [app.venueUrl, self.data.venueTypeParentId]), {}, null, + function(code,data){ self.setData({ - venueTypeList : data.data - }) + venueTypeList: data.data + }); + },function(code, data){ + app.dialog.msg(data.msg); } - }) + ); }, //获取场馆列表 listPageVenuesInfo : function(){ var self = this; - wx.request({ - url: self.data.baseUrl + 'app/venuesinfo/listpagevenuesinforelease', - data : { + app.restAjax.get(app.restAjax.path('{venueUrl}/app/venuesinfo/listpagevenuesinforelease', [app.venueUrl]), + { page : self.data.page, rows : self.data.rows, orderKey : self.data.orderKey, @@ -62,9 +63,8 @@ Page({ latitude: self.data.latitude, longitude: self.data.longitude, selfLocation: 'TX', - }, - success : function(res){ - var data = res.data; + }, null, + function(code, data){ data.rows.forEach(element => { element.venuePanorama = element.venuePanorama.split(',')[0]; if(element.apart >= 1000){ @@ -76,10 +76,14 @@ Page({ self.setData({ venuesList : data.rows, page : data.page - }) - + }); + }, function(code,data){ + app.dialog.msg(data.msg); + },function(){ + wx.hideNavigationBarLoading(); + wx.stopPullDownRefresh(); } - }) + ); }, //切换场馆类型 @@ -97,7 +101,6 @@ Page({ //切换场馆排序 changeVenuesOrderBy: function(options){ var beCheck = options.currentTarget.dataset.becheck; - console.log(options); this.setData({ orderKey : beCheck }) @@ -158,10 +161,6 @@ Page({ orderKey: '', }) this.onLoad(); - setTimeout(() => { - wx.hideNavigationBarLoading() - wx.stopPullDownRefresh() - }, 500); }, /** diff --git a/pages/venue/venue.wxml b/pages/venue/venue.wxml index 2a510c2..25a3eeb 100644 --- a/pages/venue/venue.wxml +++ b/pages/venue/venue.wxml @@ -1,7 +1,7 @@ - - + + {{item.dictionaryName}} @@ -18,9 +18,9 @@ - + - + diff --git a/pages/venue/venue.wxss b/pages/venue/venue.wxss index d692850..aa6ecd2 100644 --- a/pages/venue/venue.wxss +++ b/pages/venue/venue.wxss @@ -4,6 +4,7 @@ left: 0; right: 0; padding: 0 30rpx; + background: #fff; } .fixed-tab{ padding: 30rpx 0; diff --git a/pages/venueDetail/venueDetail.js b/pages/venueDetail/venueDetail.js index 5db2e05..a0d2ebb 100644 --- a/pages/venueDetail/venueDetail.js +++ b/pages/venueDetail/venueDetail.js @@ -1,15 +1,14 @@ +var app = getApp(); // pages/venueDetail/venueDetail.js Page({ - /** * 页面的初始数据 */ data: { - baseUrl: 'http://192.168.0.109:8082/venuebooking/', - imgRoute : 'route/file/downloadfile/true/', + venueUrl: app.venueUrl, + imgRoute : '/route/file/downloadfile/true/', indicatorDots: true, autoplay: true, - venuesInfoId: '', venuesDetail:{}, venuesProjectList: [], @@ -22,37 +21,35 @@ Page({ //场馆详情接口 getVenuesDetail: function(){ var self = this; - wx.request({ - url: self.data.baseUrl + 'app/venuesinfo/getvenuesinfobyidrelease/' + self.data.venuesInfoId, - data: { + app.restAjax.get(app.restAjax.path('{venueUrl}/app/venuesinfo/getvenuesinfobyidrelease/{venuesInfoId}',[app.venueUrl, self.data.venuesInfoId]), + { resultLocation: 'TX' - }, - success:(res) => { - var swiperImg = res.data.venuePanorama.split(','); + }, null, function(code, data){ + var swiperImg = data.venuePanorama.split(','); if(swiperImg.length <= 1){ self.setData({ indicatorDots: false, autoplay: false }) - } + }; self.setData({ - venuesDetail: res.data, + venuesDetail: data, swiperImg: swiperImg, - venueCharge: res.data.venueCharge + venueCharge: data.venueCharge }); - console.log(self.data.venuesDetail); + }, function(code,data){ + app.dialog.msg(data.msg); } - }) + ); }, //获取项目列表 listVenuesProject: function(){ var self = this; - wx.request({ - url: self.data.baseUrl + 'app/venuesproject/listprojectinforelease/' + self.data.venuesInfoId, - success: (res) => { + app.restAjax.get(app.restAjax.path('{venueUrl}/app/venuesproject/listprojectinforelease/{venuesInfoId}', [app.venueUrl, self.data.venuesInfoId]), {}, null , + function(code,data){ self.setData({ - venuesProjectList: res.data + venuesProjectList: data }); if(self.data.venuesProjectList.length > 0){ self.setData({ @@ -60,8 +57,10 @@ Page({ }); self.getVenuesProjectDetail(); }; + }, function(code, data){ + app.dialog.msg(data.msg); } - }) + ); }, //切换当前选择项目 @@ -79,21 +78,22 @@ Page({ //获取项目详情信息 getVenuesProjectDetail: function(){ var self = this; - wx.request({ - url: self.data.baseUrl + 'app/venuesproject/getvenuesprojectdetailrelease/' + self.data.selectVenuesProject, - success: function(res){ + app.restAjax.get(app.restAjax.path('{venueUrl}/app/venuesproject/getvenuesprojectdetailrelease/{selectVenuesProject}', + [app.venueUrl, self.data.selectVenuesProject]), {}, null, + function(code,data){ + console.log(data); self.setData({ - selectVenuesProjectDetail: res.data.data + selectVenuesProjectDetail: data.data }); + }, function(code,data){ + app.dialog.msg(data.msg); } - }); + ); }, //场馆地图导航 showMap: function(options){ - console.log(options); var dataObj = options.currentTarget.dataset - console.log(dataObj.latitude + 0) wx.openLocation({//​使用微信内置地图查看位置。 latitude: Number(dataObj.latitude),//要去的纬度-地址 longitude: Number(dataObj.longitude),//要去的经度-地址 diff --git a/pages/venueDetail/venueDetail.wxml b/pages/venueDetail/venueDetail.wxml index b9a2b07..9972306 100644 --- a/pages/venueDetail/venueDetail.wxml +++ b/pages/venueDetail/venueDetail.wxml @@ -1,7 +1,7 @@ - - + + @@ -28,7 +28,7 @@ {{item.projectName}} + wx:for="{{venuesProjectList}}" wx:key="index" bindtap="changeVenuesProject" data-id="{{item.venuesProjectId}}">{{item.projectName}}