diff --git a/pages/toRegister/toRegister.js b/pages/toRegister/toRegister.js index 4926a9f..4bdff19 100644 --- a/pages/toRegister/toRegister.js +++ b/pages/toRegister/toRegister.js @@ -21,7 +21,7 @@ Page({ // } // }) let that = this - const versionNum = "1.7.3" + const versionNum = "1.7.4" api.getScanSwitch(versionNum).then(function (res) { console.log(res.data) let state = res.data.scanFlag diff --git a/project.config.json b/project.config.json index b5fc503..6440879 100644 --- a/project.config.json +++ b/project.config.json @@ -6,33 +6,37 @@ "setting": { "urlCheck": false, "es6": true, + "enhance": true, "postcss": true, "preloadBackgroundData": false, "minified": true, "newFeature": true, "coverView": true, + "nodeModules": false, "autoAudits": false, "showShadowRootInWxmlPanel": true, "scopeDataCheck": false, + "uglifyFileName": false, "checkInvalidKey": true, "checkSiteMap": true, "uploadWithSourceMap": true, "compileHotReLoad": false, - "useMultiFrameRuntime": false, + "lazyloadPlaceholderEnable": false, + "useMultiFrameRuntime": true, "useApiHook": true, + "useApiHostProcess": false, "babelSetting": { "ignore": [], "disablePlugins": [], "outputPath": "" }, - "bundle": false, - "useIsolateContext": true, - "useCompilerModule": true, - "userConfirmedUseCompilerModuleSwitch": false, + "enableEngineNative": false, + "useIsolateContext": false, + "userConfirmedBundleSwitch": false, "packNpmManually": false, "packNpmRelationList": [], - "userConfirmedBundleSwitch": false, - "minifyWXSS": true + "minifyWXSS": true, + "showES6CompileOption": false }, "compileType": "miniprogram", "libVersion": "2.9.2", diff --git a/subpages/heart/pages/leaderboardNew/leaderboardNew.js b/subpages/heart/pages/leaderboardNew/leaderboardNew.js old mode 100644 new mode 100755 index af153c2..7ce94d9 --- a/subpages/heart/pages/leaderboardNew/leaderboardNew.js +++ b/subpages/heart/pages/leaderboardNew/leaderboardNew.js @@ -1,292 +1,320 @@ -import { getTimestamp } from "../../../../utils/common" -const api = require("../../../../utils/api") -var api_banner = require("../../../../utils/activity.js") -const app = getApp() -Page({ - - /** - * 页面的初始数据 - */ - data: { - selectTab: "tab1", - selectedTab_B: "tab0", - typeList: [{ //排名方式:0-周,1-月 - type: "tab0", - name: "审核中", - select: true - }, - { - type: "tab1", - name: "已通过", - select: false - }, - { - type: "tab4", - name: "未通过", - select: false - }, { - type: "tab5", - name: "已结束", - select: false - } - ], - // 积分排行榜相关 - datalenght: null, - loveRankingList: [], - preloadVisible: true, - // 列表相关 - loadMoreVisible: false, - loadMoreType: "none", - pageNo: 1, - pageSize: 10, - signedList: [], - timer: "", - timestamp: getTimestamp(), - jilu: true, - banner:[] - }, - // tab 切换 - onTabChange (e) { - this.setData({ - selectTab: e.currentTarget.dataset.tab, - pageNo: 1 - }) - - if (e.currentTarget.dataset.tab == "tab2") { - this.setData({ - jilu: false, - }) - this.getSignedList() - } else { - this.setData({ - jilu: true, - loveRankingList: [], - }) - this.loadLoveRanking() - } - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function () { - this.loadLoveRanking() - this.bannerListV2() - this.setData({ - timestamp: getTimestamp(), - }) - }, - bannerListV2: function () { - let that = this - let params = { - bannerType:"2" - } - api_banner.bannerList(params).then(function (res) { - that.setData({ - banner: res.data - }) - }) - }, - preViewImage (e) { - let list = []; - list.push(this.data.banner[e.currentTarget.dataset.listIndex].bannerImg) - console.log(list) - if (e.currentTarget.dataset.listIndex+1 < this.data.banner.length) { - list.push(this.data.banner[e.currentTarget.dataset.listIndex+1].bannerImg) - } - wx.previewImage({ - urls: list, - current: e.currentTarget.dataset.src - }) - }, - // 加载 爱心互助排行榜 - loadLoveRanking () { - this.setData({ - // loveRankingList: [], - preloadVisible: true - }) - const para = { - pageIndex: this.data.pageNo, - pageSize: this.data.pageSize - } - api.leaderboard(para).then(res => { - this.setData({ - datalenght: res.data.length - }) - // res.data.forEach((item) => { - // this.data.loveRankingList.push(item) - // }) - this.setData({ - loveRankingList: [ ...this.data.loveRankingList, ...res.data ], - loadMoreType: res.data.length === 10 ? "loading" : "none", - preloadVisible: false - }) - }).catch(() => { - this.setData({ - datalenght:0, - loveRankingList: [], - loadMoreType: "none", - preloadVisible: false - }) - }) - }, - - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - if(this.data.selectTab == "tab2"){ - this.pulldownRefresh() - } - if (!app.globalData.previewImage) { - console.log("过滤previewImage引起的onShow") - } - app.globalData.previewImage = false - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - // 参与记录切换 - onButtonChange: function (e) { - const list = this.data.typeList - let that = this; - list.forEach(item => { - if (item.type === e.currentTarget.dataset.type) { - item.select = true - } else { - item.select = false - } - }) - that.setData({ - typeList: list, - selectedTab_B: e.currentTarget.dataset.type - }) - - this.pulldownRefresh() - }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - this.pullDownRefresh = this.selectComponent("#pulldown-refresh") - }, - onPageScroll (e) { - this.pullDownRefresh.onPageScroll(e) - }, - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - this.setData({ - loadMoreVisible: true - }) - if (this.data.loadMoreType === "loading") { - this.setData({ - pageNo: this.data.pageNo + 1 - }) - } - if(this.data.selectTab == "tab2"){ - this.getSignedList() - } else { - this.loadLoveRanking() - } - }, - // 列表 下拉刷新, 初始化加载 - pulldownRefresh () { - this.setData({ - pageNo: 1, - pageSize: 10, - loadMoreVisible: false, - loadMoreType: "none", - preloadVisible: true, - signedList: [], - timestamp: getTimestamp() - }) - const para = { - pageIndex: this.data.pageNo, - pageSize: this.data.pageSize, - timestamp: this.data.timestamp, - actType: this.data.selectedTab_B.substr(3, 1) - } - api.getSignedList(para).then(res => { - this.pullDownRefresh.stopRefresh() - // console.log('已报名活动', res) - this.setData({ - signedList: [...res.data], - loadMoreType: res.data.length === 10 ? "loading" : "none", - preloadVisible: false - }) - }).catch(err => { - this.pullDownRefresh.stopRefresh() - this.setData({ - signedList: [], - loadMoreType: "none", - preloadVisible: false - }) - console.log(err) - }) - }, - // 列表 上拉加载 - getSignedList () { - const para = { - pageIndex: this.data.pageNo, - pageSize: this.data.pageSize, - timestamp: this.data.timestamp, - actType: this.data.selectedTab_B.substr(3, 1) - } - api.getSignedList(para).then(res => { - // console.log('已报名活动', res.data.length) - this.setData({ - signedList: [...this.data.signedList, ...res.data], - loadMoreType: res.data.length === 10 ? "loading" : "none", - preloadVisible: false - }) - }).catch(err => { - this.setData({ - signedList: [], - loadMoreType: "none", - preloadVisible: false - }) - console.log(err) - }).finally(() => { - this.pullDownRefresh.stopRefresh() - }) - }, - - // 查看详情 - toDetail (e) { - if (this.data.selectedTab === "tab4") { - wx.navigateTo({ - url: `/subpages/heart/pages/refusedOrEndedDetail/refusedOrEndedDetail?id=${e.detail.detailId}` - }) - } else if (e.detail.actCurrentState == 5) { - wx.navigateTo({ - url: `/subpages/heart/pages/cancelDetail/cancelDetail?id=${e.detail.detailId}` - }) - } else { - wx.navigateTo({ - url: `/subpages/heart/pages/heartDetail/heartDetail?id=${e.detail.detailId}` - }) - } - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } +import { getTimestamp } from "../../../../utils/common" +const api = require("../../../../utils/api") +var api_banner = require("../../../../utils/activity.js") +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + selectTab: "tab1", + selectedTab_B: "tab0", + typeList: [{ //排名方式:0-周,1-月 + type: "tab0", + name: "审核中", + select: true + }, + { + type: "tab1", + name: "已通过", + select: false + }, + { + type: "tab4", + name: "未通过", + select: false + }, { + type: "tab5", + name: "已结束", + select: false + } + ], + // 积分排行榜相关 + datalenght: null, + loveRankingList: [], + preloadVisible: true, + // 列表相关 + loadMoreVisible: false, + loadMoreType: "none", + pageNo: 1, + pageSize: 10, + signedList: [], + timer: "", + timestamp: getTimestamp(), + jilu: true, + banner:[], + rankId: '0', + rankTabList: [ + { + id: '0', + label: '爱心时长' + }, + { + id: '1', + label: '参与次数' + }, + { + id: '2', + label: '公益积分' + } + ] + }, + // tab 切换 + onTabChange (e) { + this.setData({ + selectTab: e.currentTarget.dataset.tab, + pageNo: 1 + }) + + if (e.currentTarget.dataset.tab == "tab2") { + this.setData({ + jilu: false, + signedList: [] + }) + this.getSignedList() + } else { + this.setData({ + jilu: true, + loveRankingList: [], + }) + this.loadLoveRanking() + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function () { + this.loadLoveRanking() + this.bannerListV2() + this.setData({ + timestamp: getTimestamp(), + }) + }, + bannerListV2: function () { + let that = this + let params = { + bannerType:"2" + } + api_banner.bannerList(params).then(function (res) { + that.setData({ + banner: res.data + }) + }) + }, + preViewImage (e) { + let list = []; + list.push(this.data.banner[e.currentTarget.dataset.listIndex].bannerImg) + console.log(list) + if (e.currentTarget.dataset.listIndex+1 < this.data.banner.length) { + list.push(this.data.banner[e.currentTarget.dataset.listIndex+1].bannerImg) + } + wx.previewImage({ + urls: list, + current: e.currentTarget.dataset.src + }) + }, + // 加载 爱心互助排行榜 + loadLoveRanking () { + this.setData({ + // loveRankingList: [], + preloadVisible: true + }) + const para = { + pageIndex: this.data.pageNo, + pageSize: this.data.pageSize, + type: this.data.rankId + } + api.leaderboard(para).then(res => { + this.setData({ + datalenght: res.data.length + }) + // res.data.forEach((item) => { + // this.data.loveRankingList.push(item) + // }) + this.setData({ + loveRankingList: [ ...this.data.loveRankingList, ...res.data ], + loadMoreType: res.data.length === 10 ? "loading" : "none", + preloadVisible: false + }) + }).catch(() => { + this.setData({ + datalenght:0, + loveRankingList: [], + loadMoreType: "none", + preloadVisible: false + }) + }) + }, + + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + if(this.data.selectTab == "tab2"){ + this.pulldownRefresh() + } + if (!app.globalData.previewImage) { + console.log("过滤previewImage引起的onShow") + } + app.globalData.previewImage = false + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + // 参与记录切换 + onButtonChange: function (e) { + const list = this.data.typeList + let that = this; + list.forEach(item => { + if (item.type === e.currentTarget.dataset.type) { + item.select = true + } else { + item.select = false + } + }) + that.setData({ + typeList: list, + selectedTab_B: e.currentTarget.dataset.type + }) + + this.pulldownRefresh() + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + this.pullDownRefresh = this.selectComponent("#pulldown-refresh") + }, + onPageScroll (e) { + this.pullDownRefresh.onPageScroll(e) + }, + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + this.setData({ + loadMoreVisible: true + }) + if (this.data.loadMoreType === "loading") { + this.setData({ + pageNo: this.data.pageNo + 1 + }) + if(this.data.selectTab == "tab2"){ + this.getSignedList() + } else { + this.loadLoveRanking() + } + } + }, + // 列表 下拉刷新, 初始化加载 + pulldownRefresh () { + this.setData({ + pageNo: 1, + pageSize: 10, + loadMoreVisible: false, + loadMoreType: "none", + preloadVisible: true, + signedList: [], + timestamp: getTimestamp() + }) + const para = { + pageIndex: this.data.pageNo, + pageSize: this.data.pageSize, + timestamp: this.data.timestamp, + actType: this.data.selectedTab_B.substr(3, 1) + } + api.getSignedList(para).then(res => { + this.pullDownRefresh.stopRefresh() + // console.log('已报名活动', res) + this.setData({ + signedList: [...res.data], + loadMoreType: res.data.length === 10 ? "loading" : "none", + preloadVisible: false + }) + }).catch(err => { + this.pullDownRefresh.stopRefresh() + this.setData({ + signedList: [], + loadMoreType: "none", + preloadVisible: false + }) + console.log(err) + }) + }, + // 列表 上拉加载 + getSignedList () { + const para = { + pageIndex: this.data.pageNo, + pageSize: this.data.pageSize, + timestamp: this.data.timestamp, + actType: this.data.selectedTab_B.substr(3, 1) + } + api.getSignedList(para).then(res => { + // console.log('已报名活动', res.data.length) + this.setData({ + signedList: [...this.data.signedList, ...res.data], + loadMoreType: res.data.length === 10 ? "loading" : "none", + preloadVisible: false + }) + }).catch(err => { + this.setData({ + signedList: [], + loadMoreType: "none", + preloadVisible: false + }) + console.log(err) + }).finally(() => { + this.pullDownRefresh.stopRefresh() + }) + }, + + // 查看详情 + toDetail (e) { + if (this.data.selectedTab === "tab4") { + wx.navigateTo({ + url: `/subpages/heart/pages/refusedOrEndedDetail/refusedOrEndedDetail?id=${e.detail.detailId}` + }) + } else if (e.detail.actCurrentState == 5) { + wx.navigateTo({ + url: `/subpages/heart/pages/cancelDetail/cancelDetail?id=${e.detail.detailId}` + }) + } else { + wx.navigateTo({ + url: `/subpages/heart/pages/heartDetail/heartDetail?id=${e.detail.detailId}` + }) + } + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + + //选择排序列 + changeTag (e) { + const id = e.currentTarget.dataset.id + this.setData({ + rankId: id, + loveRankingList: [], + pageNo: 1 + }) + this.loadLoveRanking() + }, }) \ No newline at end of file diff --git a/subpages/heart/pages/leaderboardNew/leaderboardNew.wxml b/subpages/heart/pages/leaderboardNew/leaderboardNew.wxml old mode 100644 new mode 100755 index e0ad357..def85de --- a/subpages/heart/pages/leaderboardNew/leaderboardNew.wxml +++ b/subpages/heart/pages/leaderboardNew/leaderboardNew.wxml @@ -1,76 +1,89 @@ - - - - 志愿者银行 - - 参与记录 - - - - - - - - - - - - - - {{index + 1}} - - - {{item.nickname}} - - - 爱心时长 {{item.kindnessTime}}小时 - - 参加次数 {{item.participationNum}}次 - - - - - - - - - 暂无排名 - 快来参加吧 - - - - - - - + + + + 志愿者银行 + + 参与记录 + + + + + + + + + + + + + + {{item.label}} + + + + + {{index + 1}} + + + {{item.nickname}} + + + + 爱心时长 {{item.kindnessTime}}小时 + + + + 参加次数 {{item.participationNum}}次 + + + + 公益积分 {{item.volunteerPoints}}分 + + + + + + + + + + 暂无排名 + 快来参加吧 + + + + + + + diff --git a/subpages/heart/pages/leaderboardNew/leaderboardNew.wxss b/subpages/heart/pages/leaderboardNew/leaderboardNew.wxss old mode 100644 new mode 100755 index d0db4bd..d19b556 --- a/subpages/heart/pages/leaderboardNew/leaderboardNew.wxss +++ b/subpages/heart/pages/leaderboardNew/leaderboardNew.wxss @@ -1,269 +1,308 @@ -page { - background: #f7f7f7; -} - -.tab-bar { - margin-top: 16rpx; - width: 100%; - height: 90rpx; - background: #fff; - display: flex; - justify-content: space-around; - position: relative; -} - -.tab-bar .tab { - flex: 1; - height: 90rpx; - line-height: 90rpx; - text-align: center; - width: 50%; - font-size: 32rpx; - font-weight: 500; - color: rgba(153, 153, 153, 1); -} - -.tab-bar .select-tab { - color: #E50F00; - font-size: 32rpx; - font-weight: bold; -} - -.tab-bar .select-bar { - width: 40rpx; - height: 8rpx; - border-radius: 5rpx; - background: #E50F00; - position: absolute; - bottom: 0rpx; -} - -.tab-bar .select-bar.tab1 { - left: calc(25% - 15rpx); - transition: left linear 0.4s; -} - -.tab-bar .select-bar.tab2 { - left: calc(75% - 15rpx); - transition: left linear 0.4s; -} - -/* 参与记录 */ -.tab-item { - background: #fff; - height: 80rpx; - width: calc(100% - 60rpx); - padding: 0 30rpx; - display: flex; - align-items: center; -} - -.tab-item button { - position: relative; - display: inline-block; - /* margin: 0 42rpx 0 0; */ - flex-shrink: 0; - /* width: auto !important; */ - width: 164rpx; - height: 52rpx; - min-height: 52rpx !important; - line-height: 52rpx; - border-radius: 30rpx; - padding: 0 20rpx; -} - -button::after { - border: 0rpx; -} - -.tab-item .font-w { - font-size: 30rpx; - font-weight: bold; - color: #fff; - background: linear-gradient(to right, #e95027, #db1a1f); -} - -.tab-item .font-b { - background: #fff; - font-size: 30rpx; - font-weight: 500; - color: #333; - border: 1rpx solid #dbdbdb; -} - -.tab-item .hover-btn { - box-shadow: 0px 0px 10px 0px rgba(188, 0, 5, 0.22); -} - - -/* 爱心排行 */ -.bottom { - width: 100%; - box-sizing: border-box; - background: #fff; - margin-top: 4rpx; - /* padding: 0 30rpx; */ -} -.padding{ - padding: 0 30rpx; -} - - -.bottom .love-ranking-list { - width: 100%; - background: #fff; - border-radius: 16rpx; - box-sizing: border-box; - padding: 0 20rpx; - position: relative; - top: -10rpx; -} - -.bottom .list-item { - width: 100%; - height: 140rpx; - display: flex; - align-items: center; -} - -.bottom .list-item+.list-item { - border-top: 1rpx solid #e5e5e5; -} - -.bottom .list-item .num { - font-size: 36rpx; - color: #333; - font-weight: bolder; - width: 60rpx; - text-indent: 6rpx; -} - -.bottom .list-item .num.color1 { - color: #D42E31; -} - -.bottom .list-item .num.color2 { - color: #DD5800; -} - -.bottom .list-item .num.color3 { - color: #FFA800; -} - -.bottom .list-item .avatar { - width: 90rpx; - height: 90rpx; - object-fit: cover; - border-radius: 50%; - margin-right: 15rpx; -} - -.bottom .list-item .info { - width: calc(100% - 105rpx); -} - -.bottom .list-item .info .name { - font-size: 32rpx; - color: #333; - line-height: 52rpx; - overflow: hidden; - text-overflow: ellipsis; - display: -webkit-box; - -webkit-line-clamp: 1; - -webkit-box-orient: vertical; - display: flex; - align-items: center; -} -.bottom .list-item .info .name image { - width: 30rpx; - height: 30rpx; - margin-left: 10rpx; -} - -.bottom .list-item .info .info-detail { - font-size: 24rpx; - color: #999; - display: flex; - align-items: center; -} - -.bottom .list-item .info .info-detail .heart-time { - width: 24rpx; - height: 24rpx; - object-fit: cover; - margin-right: 6rpx; -} - -.bottom .list-item .info .info-detail .enter-times { - width: 24rpx; - height: 24rpx; - object-fit: cover; - margin-right: 6rpx; - margin-left: 20rpx; -} - -.project-nodata { - width: 100%; - height: calc(100vh - 300rpx); - background: #f7f7f7; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; -} - -.project-nodata .nodata-image { - width: 256rpx; - height: 245rpx; - object-fit: cover; -} - -.project-nodata .nodata-tip { - font-size: 28rpx; - color: #bcbcbc; - height: 50rpx; - line-height: 50rpx; -} - - -/* 参与记录样式 */ - -.activity-list { - width: 100%; - min-height: calc(100vh - 500rpx); - box-sizing: border-box; - padding: 15rpx 20rpx; - } - .activity-list .no-data { - width:100%; - height: calc(100vh - 538rpx); - display: flex; - align-items: center; - justify-content: center; - font-size: 30rpx; - color: #999; - background: #f7f7f7; - } - .banner{ - width: 100%; - height: 500rpx; - background: #fff; - display: flex; - align-items: center; - justify-content: space-around; - } - .banner image{ - width: 310rpx; - height: 440rpx; - } - - .banner .swiper { - width: 100%; - height: 100%; - } - .banner .swiper .swiper-item { - display: flex; - flex-direction: row; - justify-content: center; - align-items: center; - } \ No newline at end of file +page { + background: #f7f7f7; +} + +.tab-bar { + margin-top: 16rpx; + width: 100%; + height: 90rpx; + background: #fff; + display: flex; + justify-content: space-around; + position: relative; +} + +.tab-bar .tab { + flex: 1; + height: 90rpx; + line-height: 90rpx; + text-align: center; + width: 50%; + font-size: 32rpx; + font-weight: 500; + color: rgba(153, 153, 153, 1); +} + +.tab-bar .select-tab { + color: #E50F00; + font-size: 32rpx; + font-weight: bold; +} + +.tab-bar .select-bar { + width: 40rpx; + height: 8rpx; + border-radius: 5rpx; + background: #E50F00; + position: absolute; + bottom: 0rpx; +} + +.tab-bar .select-bar.tab1 { + left: calc(25% - 15rpx); + transition: left linear 0.4s; +} + +.tab-bar .select-bar.tab2 { + left: calc(75% - 15rpx); + transition: left linear 0.4s; +} + +/* 参与记录 */ +.tab-item { + background: #fff; + height: 80rpx; + width: calc(100% - 60rpx); + padding: 0 30rpx; + display: flex; + align-items: center; +} + +.tab-item button { + position: relative; + display: inline-block; + /* margin: 0 42rpx 0 0; */ + flex-shrink: 0; + /* width: auto !important; */ + width: 164rpx; + height: 52rpx; + min-height: 52rpx !important; + line-height: 52rpx; + border-radius: 30rpx; + padding: 0 20rpx; +} + +button::after { + border: 0rpx; +} + +.tab-item .font-w { + font-size: 30rpx; + font-weight: bold; + color: #fff; + background: linear-gradient(to right, #e95027, #db1a1f); +} + +.tab-item .font-b { + background: #fff; + font-size: 30rpx; + font-weight: 500; + color: #333; + border: 1rpx solid #dbdbdb; +} + +.tab-item .hover-btn { + box-shadow: 0px 0px 10px 0px rgba(188, 0, 5, 0.22); +} + + +/* 爱心排行 */ +.bottom { + width: 100%; + box-sizing: border-box; + background: #f7f7f7; + /* margin-top: 4rpx; */ + /* padding: 0 30rpx; */ +} +.padding{ + /* padding: 0 30rpx; */ +} + + +.bottom .love-ranking-list { + width: 100%; + background: #fff; + border-radius: 16rpx; + box-sizing: border-box; + padding: 0 20rpx; + position: relative; + top: -10rpx; +} + +.bottom .list-item { + width: 100%; + height: 140rpx; + display: flex; + align-items: center; + background-color: #fff; + box-sizing: border-box; + padding: 0 30rpx; +} + +.bottom .list-item+.list-item { + border-top: 1rpx solid #e5e5e5; +} + +.bottom .list-item .num { + font-size: 36rpx; + color: #333; + font-weight: bolder; + width: 60rpx; + text-indent: 6rpx; +} + +.bottom .list-item .num.color1 { + color: #D42E31; +} + +.bottom .list-item .num.color2 { + color: #DD5800; +} + +.bottom .list-item .num.color3 { + color: #FFA800; +} + +.bottom .list-item .avatar { + width: 90rpx; + height: 90rpx; + object-fit: cover; + border-radius: 50%; + margin-right: 15rpx; +} + +.bottom .list-item .info { + width: calc(100% - 105rpx); +} + +.bottom .list-item .info .name { + font-size: 32rpx; + color: #333; + line-height: 52rpx; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 1; + -webkit-box-orient: vertical; + display: flex; + align-items: center; +} +.bottom .list-item .info .name image { + width: 30rpx; + height: 30rpx; + margin-left: 10rpx; +} + +.bottom .list-item .info .info-detail { + font-size: 24rpx; + color: #999; + display: flex; + align-items: center; +} + +.bottom .list-item .info .info-detail .heart-time { + width: 24rpx; + height: 24rpx; + object-fit: cover; + margin-right: 6rpx; +} + +.bottom .list-item .info .info-detail .enter-times { + width: 24rpx; + height: 24rpx; + object-fit: cover; + margin-right: 6rpx; + /* margin-left: 20rpx; */ +} + +.project-nodata { + width: 100%; + height: calc(100vh - 300rpx); + background: #f7f7f7; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} + +.project-nodata .nodata-image { + width: 256rpx; + height: 245rpx; + object-fit: cover; +} + +.project-nodata .nodata-tip { + font-size: 28rpx; + color: #bcbcbc; + height: 50rpx; + line-height: 50rpx; +} + + +/* 参与记录样式 */ + +.activity-list { + width: 100%; + min-height: calc(100vh - 500rpx); + box-sizing: border-box; + padding: 15rpx 20rpx; + } + .activity-list .no-data { + width:100%; + height: calc(100vh - 538rpx); + display: flex; + align-items: center; + justify-content: center; + font-size: 30rpx; + color: #999; + background: #f7f7f7; + } + .banner{ + width: 100%; + height: 500rpx; + background: #fff; + display: flex; + align-items: center; + justify-content: space-around; + } + .banner image{ + width: 310rpx; + height: 440rpx; + } + + .banner .swiper { + width: 100%; + height: 100%; + } + .banner .swiper .swiper-item { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + } + +.scroll-tag { + height: 80rpx; + display: flex; + align-items: center; + margin-bottom: 10rpx; +} +.volunteer-tag { + background: rgba(255, 255, 255, 1); + display: flex; + white-space: nowrap; + flex-direction: row; + align-items: center; + justify-content: center; + height: 80rpx; +} +.volunteer-tag .tag { + border: 1px solid #999999; + border-radius: 32rpx; + padding: 0 10rpx; + margin: 0 10rpx; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #333333; + min-width: 140rpx; + text-align: center; + height: 52rpx; + line-height: 52rpx; +} +.volunteer-tag .sel { + border: 1px solid #da433d; + background-color: #da433d; + color: #fff; + font-weight: bold; +} \ No newline at end of file diff --git a/subpages/heart/pages/volunteer/volunteer.js b/subpages/heart/pages/volunteer/volunteer.js old mode 100644 new mode 100755 index 75f629a..0964752 --- a/subpages/heart/pages/volunteer/volunteer.js +++ b/subpages/heart/pages/volunteer/volunteer.js @@ -1,573 +1,611 @@ -const api = require("../../../../utils/api") -const app = getApp() -import { $wuxActionSheet } from "../../../../dist/index" -const config = require("../../../../utils/config") -Page({ - - /** - * 页面的初始数据 全部为必填项 - */ - data: { - statusHeight: 0, // 自定义头部状态栏高度 - navigationHeight: 0, // 自定义头部导航栏高度 - getImgUrl: '', //后台配置背景 - realName: "", //真实姓名 - mobile: "", //手机号 - identityNo: "", //身份证号码 - road: "", //所在道路 - villageName: "", //小区名 - dwellingPlace: "", //住处(楼栋-单元-房间) - gridId: Number, //居住网格id - gridName: "", - wxCode: "", //用户unionId为空时 传入 - encryptedData: "", //用户unionId为空时 传入 - iv: "", //用户unionId为空时 传入 - // introduce: "", //自我介绍 - volunteerNickname:"",//昵称 - volunteerSignature:"",//签名 - volunteerFaceImg:"",//头像 - unionIdStatus: "0", - wait: 60, - smsCode: "", - btntxt: "获取验证码", - dialogTitle: "", - dialogContent: "", - dialogConfirmText: "", - dialogCancelText: "", - getMobileType: "wx", - smsCodeText: "获取验证码", - uploadImageList: [], - disabled:false, - lock: false, //锁定提交状态,防止连击 - volunteerTag: {}, //志愿者标签id - tagList: [{ - tagName: '请选择', - id: '' - }], - tagIndex: 0, - }, - onLoad: function () { - this.setData({ - statusHeight: app.globalData.deviceInfo.statusHeight, - navigationHeight: app.globalData.deviceInfo.navigationHeight - }) - this.getImgUrl() - this.getPrepareComplete().then(() => { - this.getGridList() - this.getVolunteerTags() - }) - this.checkWxUnionId() - this.getWxCode() - }, - //返回上一级 - goback () { - wx.navigateBack({ - delta: 1 - }) - }, - bindRealNameInput (e) { - this.setData({ - realName: e.detail.value - }) - }, - bindMobileInput (e) { - this.setData({ - mobile: e.detail.value - }) - }, - nickname (e){ - this.setData({ - volunteerNickname: e.detail.value - }) - }, - bindSmsCodeInput (e) { - this.setData({ - smsCode: e.detail.value - }) - }, - bindIdentityNoInput (e) { - this.setData({ - identityNo: e.detail.value - }) - }, - - adInputStreet (e) { - this.setData({ - road: e.detail.value - }) - }, - - adInputCommunity (e) { - this.setData({ - villageName: e.detail.value - }) - }, - - adInputBuilding (e) { - this.setData({ - dwellingPlace: e.detail.value - }) - }, - - // adInputIntroduce (e) { - // this.setData({ - // introduce: e.detail.value - // }) - // }, - volunteerSignature (e) { - this.setData({ - volunteerSignature: e.detail.value - }) - }, - // 获取志愿者标签列表 - getVolunteerTags () { - api.getVolunteerTags().then(res => { - if (res.code == 0 && res.msg == 'success') { - this.setData({ - tagList: this.data.tagList.concat(res.data) - }) - res.data.forEach((item, key) => { - if (item.id == this.data.volunteerTag.id) { - this.setData({ - 'volunteerTag.tag': item.tagName, - tagIndex: parseInt(key)+1 - }) - } - }) - } - }).catch(err => { - console.log(err) - }) - }, - // 获取配置图片 - getImgUrl:function (){//0:咨询热线 - let that = this - api.getImgUrl("4").then(function (res) { - that.setData({ - getImgUrl: res.data[0] - }) - }) - }, - // 查看用户是否完善个人信息 - checkWxUnionId () { - api.checkWxUnionId().then(res => { - console.log("查看用户是否已保存unionId", res) - this.setData({ - unionIdStatus: res.data - }) - }).catch(err => { - this.setData({ - unionIdStatus: "0" - }) - console.log(err) - }) - }, - // 获取wxCode - getWxCode () { - const that = this - wx.login({ - success (res) { - that.setData({ - wxCode: res.code - }) - } - }) - }, - // 获取用户信息 - getUserInfo (e) { - this.setData({ - encryptedData: e.detail.encryptedData, - iv: e.detail.iv - }) - if (e.detail.iv) { - this.submission() - } else { - wx.showToast({ - title: "您拒绝了获取信息,无法完成认证", - icon: "none", - duration: 3000 - }) - } - }, - // 拉取 用户信息 - getPrepareComplete () { - return new Promise((resolve, reject) => { - api.prepareComplete().then(res => { - console.log("拉取用户信息", res) - this.setData({ - identityNo: res.data.identityNo, - realName: res.data.realName, - mobile: res.data.mobile, - road: res.data.road, - villageName: res.data.villageName, - dwellingPlace: res.data.dwellingPlace, - state: res.data.state, - gridId: res.data.gridId, - gridName: res.data.gridName, - volunteerNickname:res.data.volunteerNickname, - volunteerSignature:res.data.volunteerSignature, - volunteerFaceImg:res.data.volunteerFaceImg, - 'volunteerTag.id': res.data.volunteerTagId || '0' - // introduce:res.data.introduce - }) - resolve(true) - }).catch(() => { - reject(false) - }) - }) - }, - // 获取所有网格 - getGridList () { - api.getGridList().then(res => { - console.log("获取所有网格", res) - const buttonList = [] - res.data.forEach(item => { - if (item.gridId !== this.data.gridId) { - buttonList.push({ - id: item.gridId, - text: item.grid - }) - } - }) - this.setData({ - gridList: res.data, - changeGridList: buttonList - }) - }).catch(err => { - this.setData({ - gridList: [] - }) - console.log(err) - }) - }, - // 志愿者认证提交 - submission () { - if (!this.data.realName.trim('')) { - this.showToast("请输入姓名") - return false - } - if (this.data.realName.length > 20) { - this.showToast("姓名不能超过20个字") - return false - } - - if (!this.data.identityNo.trim('')) { - this.showToast("请输入身份证号") - return false - } - var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; - if (reg.test(this.data.identityNo) === false) { - this.showToast("请输入正确的身份证号") - return false - } - - if (this.data.getMobileType === "wx") { - if (!this.data.mobile.trim('')) { - this.showToast("请获取手机号") - return false - } - } else if (this.data.getMobileType === "self") { - if (!this.data.mobile.trim('')) { - this.showToast("请输入手机号") - return false - } - if (!this.data.smsCode) { - this.showToast("请输入验证码") - return false - } - } - if(!this.data.volunteerFaceImg){ - this.showToast("请上传头像") - return false - } - if(!this.data.volunteerNickname.trim('')){ - this.showToast("请输入昵称") - return false - } - // if (this.data.volunteerTag.id == '') { - // this.showToast("请选择小组") - // return false - // } - // if(!this.data.volunteerSignature){ - // this.showToast("请输入格言") - // return false - // } - if (!this.data.road.trim('')) { - this.showToast("请填写所在小区或所在道路") - return false - } - if (this.data.road.length > 100) { - this.showToast("小区或所在道路不能超过100个字") - return false - } - // if (!this.data.introduce) { - // this.showToast("请输入自我介绍") - // return false - // } - - // if (!this.data.introduce.length > 200) { - // this.showToast("自我介绍输入内容不超过200字") - // return false - // } - const params = { - smsCode: this.data.smsCode, - realName: this.data.realName.trim(''), - mobile: this.data.mobile.trim(''), - identityNo: this.data.identityNo, - road: this.data.road.trim(''), - villageName: this.data.villageName, - dwellingPlace: this.data.dwellingPlace, - gridId: this.data.gridId, - // introduce: this.data.introduce, - volunteerFaceImg:this.data.volunteerFaceImg, - volunteerNickname:this.data.volunteerNickname.trim(''), - volunteerSignature:this.data.volunteerSignature, - volunteerTagId: this.data.volunteerTag.id, - wxCode: this.data.unionIdStatus === "1" ? "" : this.data.wxCode, - encryptedData: this.data.unionIdStatus === "1" ? "" : this.data.encryptedData, - iv: this.data.unionIdStatus === "1" ? "" : this.data.iv - } - this.setData({ - lock: true - }) - wx.showLoading({ - title: "正在提交", - }) - api.authenticate(params).then(res => { - wx.hideLoading() - - let state = res.data.userState - app.globalData.infoCompleted = state - wx.removeStorageSync("token") - wx.setStorageSync("token", res.data.token) - - this.setData({ - lock: false, - dialogVisible: !this.data.dialogVisible, - dialogTitle: "志愿者认证", - dialogContent: ["您已认证成功,快去报名吧"], - dialogConfirmText: "确定", - // dialogCancelText: '否' - }) - }).catch(err => { - console.log(err) - this.setData({ - lock: false - }) - }) - }, - confirmDialog () { - app.globalData.volunteerChange = true - wx.navigateBack({ - delta: 1 - }) - }, - changeGetMobileType () { - let type = "wx" - if (this.data.getMobileType === "wx") { - type = "self" - } else if (this.data.getMobileType === "self") { - type = "wx" - } - this.setData({ - getMobileType: type - }) - }, - // 获取验证码 - getSmsCode () { - if (!this.data.mobile.trim('')) { - this.showToast("请先输入手机号") - return false - } - this.setData({ - smsCodeText: "获取中..." - }) - const mobile = this.data.mobile - api.sendSms(mobile).then(() => { - this.showToast("验证码发送成功") - let num = 60 - this.setData({ - smsCodeText: "60s后重新获取" - }) - const timer = setInterval(() => { - if (num >= 1) { - this.setData({ - smsCodeText: `${num}s后重新获取` - }) - --num - } else { - clearInterval(timer) - this.setData({ - smsCodeText: "获取验证码" - }) - } - }, 1000) - }).catch(err => { - console.log(err) - this.setData({ - smsCodeText: "获取验证码" - }) - }) - }, - // 获取手机号 - getPhoneNumber (e) { - if (e.detail.errMsg === "getPhoneNumber:ok") { - const para = { - wxCode: "", - encryptedData: e.detail.encryptedData, - iv: e.detail.iv - } - const that = this - wx.login({ - success (res) { - para.wxCode = res.code - api.getWxPhone(para).then(data => { - console.log("获取微信手机号", data) - that.setData({ - mobile: data.data - }) - }).catch(err => { - console.log(err) - }) - } - }) - } - }, - // 代码简化,弹窗统一封装 - showToast (title) { - wx.showToast({ - title: title, - icon: "none", - duration: 2000 - }) - }, - - // 上传头像 - // 选择图片 上传弹窗 - 上传图片方式 - 选择图片 - 上传图片 - 回调赋值 - chooseImage () { - const _this = this - - _this.setData({ - uploadImageList: [], - disabled:true - }) - $wuxActionSheet().showSheet({ - buttons: [ - { text: "拍照" }, - { text: "从相册中获取" }, - ], - className: "dialog-class", - buttonClicked (index) { - console.log(":::::::::::::"+index) - if (index === 0) { - wx.chooseImage({ - count: 1, - sizeType: ["original", "compressed"], - sourceType: ["camera"], - success (res) { - const uploadImageList = [..._this.data.uploadImageList] - uploadImageList.push({ - uploaded: false, - ossUrl: "", - imgUrl: res.tempFilePaths[0], - imageId: ++_this.data.imageId - }) - _this.setData({ - uploadImageList - }) - wx.uploadFile({ - url: `${config.BASEURL()}group/topic/upload`, - filePath: res.tempFilePaths[0], - name: "file", - header: { - "Content-type": "multipart/form-data" - }, - success (fileRes){ - uploadImageList[uploadImageList.length - 1].uploaded = true - uploadImageList[uploadImageList.length - 1].ossUrl = JSON.parse(fileRes.data).data - _this.setData({ - uploadImageList - }) - - _this.setData({ - volunteerFaceImg:uploadImageList[0].ossUrl, - disabled:false - }) - console.log(">>>>>>>>>>>"+_this.data.volunteerFaceImg) - } - }) - - } - }) - } else if (index === 1) { - wx.chooseImage({ - count: 3 - _this.data.uploadImageList.length, - sizeType: ["original", "compressed"], - sourceType: ["album"], - success (res) { - const uploadImageList = [] - const endIndex = _this.data.uploadImageList.length - res.tempFilePaths.forEach(item => { - uploadImageList.push({ - uploaded: false, - ossUrl: "", - imgUrl: item, - imageId: ++_this.data.imageId - }) - }) - _this.setData({ - uploadImageList: [..._this.data.uploadImageList,...uploadImageList] - }) - uploadImageList.forEach((item, index) => { - return (function (index) { - wx.uploadFile({ - url: `${config.BASEURL()}group/topic/upload`, - filePath: res.tempFilePaths[index], - name: "file", - header: { - "Content-type": "multipart/form-data" - }, - success (fileRes){ - uploadImageList[index].uploaded = true - uploadImageList[index].ossUrl = JSON.parse(fileRes.data).data - _this.data.uploadImageList = _this.data.uploadImageList.slice(0, endIndex) - _this.setData({ - uploadImageList: [..._this.data.uploadImageList, ...uploadImageList] - }) - // _this.data.setData({ - // volunteerFaceImg:uploadImageList[0].ossUrl - // }) - - _this.setData({ - volunteerFaceImg:uploadImageList[0].ossUrl, - disabled:false - }) - } - }) - })(index) - }) - } - }) - } - return true - }, - cancelText: "取消", - cancel () { - _this.setData({ - disabled:false - }) - console.log(":::::::::::::::") - }, - destructiveButtonClicked () {}, - }) - }, - // - choosePicker (e) { - let index = e.detail.value - this.setData({ - tagIndex: index, - 'volunteerTag.id': this.data.tagList[index].id, - 'volunteerTag.tag': this.data.tagList[index].tagName - }) - }, +const api = require("../../../../utils/api") +const app = getApp() +import { $wuxActionSheet } from "../../../../dist/index" +const config = require("../../../../utils/config") +Page({ + + /** + * 页面的初始数据 全部为必填项 + */ + data: { + statusHeight: 0, // 自定义头部状态栏高度 + navigationHeight: 0, // 自定义头部导航栏高度 + getImgUrl: '', //后台配置背景 + realName: "", //真实姓名 + mobile: "", //手机号 + identityNo: "", //身份证号码 + road: "", //所在道路 + villageName: "", //小区名 + dwellingPlace: "", //住处(楼栋-单元-房间) + gridId: Number, //居住网格id + gridName: "", + wxCode: "", //用户unionId为空时 传入 + encryptedData: "", //用户unionId为空时 传入 + iv: "", //用户unionId为空时 传入 + // introduce: "", //自我介绍 + volunteerNickname:"",//昵称 + volunteerSignature:"",//签名 + volunteerFaceImg:"",//头像 + unionIdStatus: "0", + wait: 60, + smsCode: "", + btntxt: "获取验证码", + dialogTitle: "", + dialogContent: "", + dialogConfirmText: "", + dialogCancelText: "", + getMobileType: "wx", + smsCodeText: "获取验证码", + uploadImageList: [], + disabled:false, + lock: false, //锁定提交状态,防止连击 + volunteerTag: {}, //志愿者标签id + tagList: [{ + tagName: '请选择', + id: '' + }], + tagIndex: 0, + volunteerDept: {}, //志愿者部门id + deptList: [{ + deptName: '请选择', + id: '' + }], + deptIndex: 0, + }, + onLoad: function () { + this.setData({ + statusHeight: app.globalData.deviceInfo.statusHeight, + navigationHeight: app.globalData.deviceInfo.navigationHeight + }) + this.getImgUrl() + this.getPrepareComplete().then(() => { + this.getGridList() + this.getVolunteerTags() + this.getVolunteerDepts() + }) + this.checkWxUnionId() + this.getWxCode() + }, + //返回上一级 + goback () { + wx.navigateBack({ + delta: 1 + }) + }, + bindRealNameInput (e) { + this.setData({ + realName: e.detail.value + }) + }, + bindMobileInput (e) { + this.setData({ + mobile: e.detail.value + }) + }, + nickname (e){ + this.setData({ + volunteerNickname: e.detail.value + }) + }, + bindSmsCodeInput (e) { + this.setData({ + smsCode: e.detail.value + }) + }, + bindIdentityNoInput (e) { + this.setData({ + identityNo: e.detail.value + }) + }, + + adInputStreet (e) { + this.setData({ + road: e.detail.value + }) + }, + + adInputCommunity (e) { + this.setData({ + villageName: e.detail.value + }) + }, + + adInputBuilding (e) { + this.setData({ + dwellingPlace: e.detail.value + }) + }, + + // adInputIntroduce (e) { + // this.setData({ + // introduce: e.detail.value + // }) + // }, + volunteerSignature (e) { + this.setData({ + volunteerSignature: e.detail.value + }) + }, + // 获取志愿者标签列表 + getVolunteerTags () { + api.getVolunteerTags().then(res => { + if (res.code == 0 && res.msg == 'success') { + this.setData({ + tagList: this.data.tagList.concat(res.data) + }) + res.data.forEach((item, key) => { + if (item.id == this.data.volunteerTag.id) { + this.setData({ + 'volunteerTag.tag': item.tagName, + tagIndex: parseInt(key)+1 + }) + } + }) + } + }).catch(err => { + console.log(err) + }) + }, + // 获取志愿者部门列表 + getVolunteerDepts () { + api.getVolunteerDepts().then(res => { + if (res.code == 0 && res.msg == 'success') { + this.setData({ + deptList: this.data.deptList.concat(res.data) + }) + res.data.forEach((item, key) => { + if (item.id == this.data.volunteerDept.id) { + this.setData({ + 'volunteerDept.dept': item.deptName, + deptIndex: parseInt(key)+1 + }) + } + }) + } + }).catch(err => { + console.log(err) + }) + }, + // 获取配置图片 + getImgUrl:function (){//0:咨询热线 + let that = this + api.getImgUrl("4").then(function (res) { + that.setData({ + getImgUrl: res.data[0] + }) + }) + }, + // 查看用户是否完善个人信息 + checkWxUnionId () { + api.checkWxUnionId().then(res => { + console.log("查看用户是否已保存unionId", res) + this.setData({ + unionIdStatus: res.data + }) + }).catch(err => { + this.setData({ + unionIdStatus: "0" + }) + console.log(err) + }) + }, + // 获取wxCode + getWxCode () { + const that = this + wx.login({ + success (res) { + that.setData({ + wxCode: res.code + }) + } + }) + }, + // 获取用户信息 + getUserInfo (e) { + this.setData({ + encryptedData: e.detail.encryptedData, + iv: e.detail.iv + }) + if (e.detail.iv) { + this.submission() + } else { + wx.showToast({ + title: "您拒绝了获取信息,无法完成认证", + icon: "none", + duration: 3000 + }) + } + }, + // 拉取 用户信息 + getPrepareComplete () { + return new Promise((resolve, reject) => { + api.prepareComplete().then(res => { + console.log("拉取用户信息", res) + this.setData({ + identityNo: res.data.identityNo, + realName: res.data.realName, + mobile: res.data.mobile, + road: res.data.road, + villageName: res.data.villageName, + dwellingPlace: res.data.dwellingPlace, + state: res.data.state, + gridId: res.data.gridId, + gridName: res.data.gridName, + volunteerNickname:res.data.volunteerNickname, + volunteerSignature:res.data.volunteerSignature, + volunteerFaceImg:res.data.volunteerFaceImg, + 'volunteerTag.id': res.data.volunteerTagId || '0', + 'volunteerDept.id': res.data.volunteerDeptId || '0' + // introduce:res.data.introduce + }) + resolve(true) + }).catch(() => { + reject(false) + }) + }) + }, + // 获取所有网格 + getGridList () { + api.getGridList().then(res => { + console.log("获取所有网格", res) + const buttonList = [] + res.data.forEach(item => { + if (item.gridId !== this.data.gridId) { + buttonList.push({ + id: item.gridId, + text: item.grid + }) + } + }) + this.setData({ + gridList: res.data, + changeGridList: buttonList + }) + }).catch(err => { + this.setData({ + gridList: [] + }) + console.log(err) + }) + }, + // 志愿者认证提交 + submission () { + if (!this.data.realName.trim('')) { + this.showToast("请输入姓名") + return false + } + if (this.data.realName.length > 20) { + this.showToast("姓名不能超过20个字") + return false + } + + if (!this.data.identityNo.trim('')) { + this.showToast("请输入身份证号") + return false + } + var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; + if (reg.test(this.data.identityNo) === false) { + this.showToast("请输入正确的身份证号") + return false + } + + if (this.data.getMobileType === "wx") { + if (!this.data.mobile.trim('')) { + this.showToast("请获取手机号") + return false + } + } else if (this.data.getMobileType === "self") { + if (!this.data.mobile.trim('')) { + this.showToast("请输入手机号") + return false + } + if (!this.data.smsCode) { + this.showToast("请输入验证码") + return false + } + } + if(!this.data.volunteerFaceImg){ + this.showToast("请上传头像") + return false + } + if(!this.data.volunteerNickname.trim('')){ + this.showToast("请输入昵称") + return false + } + // if (this.data.volunteerTag.id == '') { + // this.showToast("请选择小组") + // return false + // } + // if(!this.data.volunteerSignature){ + // this.showToast("请输入格言") + // return false + // } + if (!this.data.road.trim('')) { + this.showToast("请填写所在小区或所在道路") + return false + } + if (this.data.road.length > 100) { + this.showToast("小区或所在道路不能超过100个字") + return false + } + // if (!this.data.introduce) { + // this.showToast("请输入自我介绍") + // return false + // } + + // if (!this.data.introduce.length > 200) { + // this.showToast("自我介绍输入内容不超过200字") + // return false + // } + const params = { + smsCode: this.data.smsCode, + realName: this.data.realName.trim(''), + mobile: this.data.mobile.trim(''), + identityNo: this.data.identityNo, + road: this.data.road.trim(''), + villageName: this.data.villageName, + dwellingPlace: this.data.dwellingPlace, + gridId: this.data.gridId, + // introduce: this.data.introduce, + volunteerFaceImg:this.data.volunteerFaceImg, + volunteerNickname:this.data.volunteerNickname.trim(''), + volunteerSignature:this.data.volunteerSignature, + volunteerTagId: this.data.volunteerTag.id, + volunteerDeptId: this.data.volunteerDept.id, + wxCode: this.data.unionIdStatus === "1" ? "" : this.data.wxCode, + encryptedData: this.data.unionIdStatus === "1" ? "" : this.data.encryptedData, + iv: this.data.unionIdStatus === "1" ? "" : this.data.iv + } + this.setData({ + lock: true + }) + wx.showLoading({ + title: "正在提交", + }) + api.authenticate(params).then(res => { + wx.hideLoading() + + let state = res.data.userState + app.globalData.infoCompleted = state + wx.removeStorageSync("token") + wx.setStorageSync("token", res.data.token) + + this.setData({ + lock: false, + dialogVisible: !this.data.dialogVisible, + dialogTitle: "志愿者认证", + dialogContent: ["您已认证成功,快去报名吧"], + dialogConfirmText: "确定", + // dialogCancelText: '否' + }) + }).catch(err => { + console.log(err) + this.setData({ + lock: false + }) + }) + }, + confirmDialog () { + app.globalData.volunteerChange = true + wx.navigateBack({ + delta: 1 + }) + }, + changeGetMobileType () { + let type = "wx" + if (this.data.getMobileType === "wx") { + type = "self" + } else if (this.data.getMobileType === "self") { + type = "wx" + } + this.setData({ + getMobileType: type + }) + }, + // 获取验证码 + getSmsCode () { + if (!this.data.mobile.trim('')) { + this.showToast("请先输入手机号") + return false + } + this.setData({ + smsCodeText: "获取中..." + }) + const mobile = this.data.mobile + api.sendSms(mobile).then(() => { + this.showToast("验证码发送成功") + let num = 60 + this.setData({ + smsCodeText: "60s后重新获取" + }) + const timer = setInterval(() => { + if (num >= 1) { + this.setData({ + smsCodeText: `${num}s后重新获取` + }) + --num + } else { + clearInterval(timer) + this.setData({ + smsCodeText: "获取验证码" + }) + } + }, 1000) + }).catch(err => { + console.log(err) + this.setData({ + smsCodeText: "获取验证码" + }) + }) + }, + // 获取手机号 + getPhoneNumber (e) { + if (e.detail.errMsg === "getPhoneNumber:ok") { + const para = { + wxCode: "", + encryptedData: e.detail.encryptedData, + iv: e.detail.iv + } + const that = this + wx.login({ + success (res) { + para.wxCode = res.code + api.getWxPhone(para).then(data => { + console.log("获取微信手机号", data) + that.setData({ + mobile: data.data + }) + }).catch(err => { + console.log(err) + }) + } + }) + } + }, + // 代码简化,弹窗统一封装 + showToast (title) { + wx.showToast({ + title: title, + icon: "none", + duration: 2000 + }) + }, + + // 上传头像 + // 选择图片 上传弹窗 - 上传图片方式 - 选择图片 - 上传图片 - 回调赋值 + chooseImage () { + const _this = this + + _this.setData({ + uploadImageList: [], + disabled:true + }) + $wuxActionSheet().showSheet({ + buttons: [ + { text: "拍照" }, + { text: "从相册中获取" }, + ], + className: "dialog-class", + buttonClicked (index) { + console.log(":::::::::::::"+index) + if (index === 0) { + wx.chooseImage({ + count: 1, + sizeType: ["original", "compressed"], + sourceType: ["camera"], + success (res) { + const uploadImageList = [..._this.data.uploadImageList] + uploadImageList.push({ + uploaded: false, + ossUrl: "", + imgUrl: res.tempFilePaths[0], + imageId: ++_this.data.imageId + }) + _this.setData({ + uploadImageList + }) + wx.uploadFile({ + url: `${config.BASEURL()}group/topic/upload`, + filePath: res.tempFilePaths[0], + name: "file", + header: { + "Content-type": "multipart/form-data" + }, + success (fileRes){ + uploadImageList[uploadImageList.length - 1].uploaded = true + uploadImageList[uploadImageList.length - 1].ossUrl = JSON.parse(fileRes.data).data + _this.setData({ + uploadImageList + }) + + _this.setData({ + volunteerFaceImg:uploadImageList[0].ossUrl, + disabled:false + }) + console.log(">>>>>>>>>>>"+_this.data.volunteerFaceImg) + } + }) + + } + }) + } else if (index === 1) { + wx.chooseImage({ + count: 3 - _this.data.uploadImageList.length, + sizeType: ["original", "compressed"], + sourceType: ["album"], + success (res) { + const uploadImageList = [] + const endIndex = _this.data.uploadImageList.length + res.tempFilePaths.forEach(item => { + uploadImageList.push({ + uploaded: false, + ossUrl: "", + imgUrl: item, + imageId: ++_this.data.imageId + }) + }) + _this.setData({ + uploadImageList: [..._this.data.uploadImageList,...uploadImageList] + }) + uploadImageList.forEach((item, index) => { + return (function (index) { + wx.uploadFile({ + url: `${config.BASEURL()}group/topic/upload`, + filePath: res.tempFilePaths[index], + name: "file", + header: { + "Content-type": "multipart/form-data" + }, + success (fileRes){ + uploadImageList[index].uploaded = true + uploadImageList[index].ossUrl = JSON.parse(fileRes.data).data + _this.data.uploadImageList = _this.data.uploadImageList.slice(0, endIndex) + _this.setData({ + uploadImageList: [..._this.data.uploadImageList, ...uploadImageList] + }) + // _this.data.setData({ + // volunteerFaceImg:uploadImageList[0].ossUrl + // }) + + _this.setData({ + volunteerFaceImg:uploadImageList[0].ossUrl, + disabled:false + }) + } + }) + })(index) + }) + } + }) + } + return true + }, + cancelText: "取消", + cancel () { + _this.setData({ + disabled:false + }) + console.log(":::::::::::::::") + }, + destructiveButtonClicked () {}, + }) + }, + // + choosePicker (e) { + let index = e.detail.value + this.setData({ + tagIndex: index, + 'volunteerTag.id': this.data.tagList[index].id, + 'volunteerTag.tag': this.data.tagList[index].tagName + }) + }, + // + choosePicker2 (e) { + let index = e.detail.value + this.setData({ + deptIndex: index, + 'volunteerDept.id': this.data.deptList[index].id, + 'volunteerDept.dept': this.data.deptList[index].deptName + }) + }, }) \ No newline at end of file diff --git a/subpages/heart/pages/volunteer/volunteer.wxml b/subpages/heart/pages/volunteer/volunteer.wxml old mode 100644 new mode 100755 index b1026fd..9d1efbd --- a/subpages/heart/pages/volunteer/volunteer.wxml +++ b/subpages/heart/pages/volunteer/volunteer.wxml @@ -1,185 +1,194 @@ - - - - - - - - - 志愿者去哪儿 - - - - - - - - - - - - - - 基本信息 - - - - - - * - 姓名 - - - - - - - - * - 身份证号 - - - - - - - - * - 手机号 - - - - - - - - - * - 手机号 - - - - - - - - * - 验证码 - - - - - - - - - {{getMobileType === 'wx' ? '*如若获取手机号异常,请点击切换至手机号/验证码注册方式' : '*点击可切回至从微信获取手机号注册方式'}} - - - - *头像 - - - - - - - *昵称 - - - - - - 选择小组 - - - - {{tagList[tagIndex].tagName}} - - - - - 格言 - - - - - - - - - - - - - - - 居住地址 - - - - - - - {{gridName}} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + 志愿者去哪儿 + + + + + + + + + + + + + + 基本信息 + + + + + + * + 姓名 + + + + + + + + * + 身份证号 + + + + + + + + * + 手机号 + + + + + + + + + * + 手机号 + + + + + + + + * + 验证码 + + + + + + + + + {{getMobileType === 'wx' ? '*如若获取手机号异常,请点击切换至手机号/验证码注册方式' : '*点击可切回至从微信获取手机号注册方式'}} + + + + *头像 + + + + + + + *昵称 + + + + + + 选择小组 + + + + {{tagList[tagIndex].tagName}} + + + + + 选择部门 + + + + {{deptList[deptIndex].deptName}} + + + + + 格言 + + + + + + + + + + + + + + + 居住地址 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/utils/api.js b/utils/api.js old mode 100644 new mode 100755 index 59ae85b..02b9dd2 --- a/utils/api.js +++ b/utils/api.js @@ -1,628 +1,635 @@ -var fly = require("./request.js") -module.exports = { - getToken: getToken, - getCompleteName: getCompleteName, - saveWxFormid: saveWxFormid, - getScanSwitch: getScanSwitch, - getTokenV2: getTokenV2, - updateWxInfo: updateWxInfo, - sendSms: sendSms, - gridLeaderRegister: gridLeaderRegister, - getGridList: getGridList, - changeGrid: changeGrid, - completeInfo: completeInfo, - completeResidentInfo: completeResidentInfo, - completePartyInfo: completePartyInfo, - prepareComplete: prepareComplete, - getUserInfo: getUserInfo, - getMyAssociation: getMyAssociation, - getCommandAssociation: getCommandAssociation, - getMyTopicList: getMyTopicList, - getMyTopicListV2:getMyTopicListV2, - getMyIssueList: getMyIssueList, - getMyProjectList: getMyProjectList, - checkWxUnionId: checkWxUnionId, - bannerList: bannerList, - getFirstInfo: getFirstInfo, - noticelist: noticelist, - newsList: newsList, - getIssueList: getIssueList, - getProjectList: getProjectList, - pointsRankinglist: pointsRankinglist, - pointsRecordlist: pointsRecordlist, - // 爱心互助 - leaderboard: leaderboard, - detail: detail, - rejectDetail: rejectDetail, - cancelDetail: cancelDetail, - clockAddressDetail: clockAddressDetail, - clockList: clockList, - clockListV2: clockListV2, - getPhraseList: getPhraseList, - sagenumAddOne: sagenumAddOne, - clock: clock, - authenticate: authenticate, - signup: signup, - cancelsignup:cancelsignup, - getSignedList: getSignedList, - unpassActivityDetail: unpassActivityDetail, - completeInfoV2: completeInfoV2, - getTokenV3: getTokenV3, - getWxPhone: getWxPhone, - applyAct: applyAct, - applyRecord: applyRecord, - applyActDetail: applyActDetail, - getImgUrl: getImgUrl, - completeResidentInfoV2: completeResidentInfoV2, - completePartyInfoV2: completePartyInfoV2, - userPointsRankinglist:userPointsRankinglist, - getDefaultGridInfo:getDefaultGridInfo, - getResidentConfig:getResidentConfig, - getScrip:getScrip, - getHomePhone:getHomePhone, - gradeRankinglist:gradeRankinglist, - userInfoSignUp:userInfoSignUp, - moduleCategory: moduleCategory, - reportIssue: reportIssue, - reportIssueList: reportIssueList, - reportIssueDetail: reportIssueDetail, - getVolunteerTags: getVolunteerTags, - getActInfo: getActInfo, - signIn: signIn, - suggestDict: suggestDict, - suggestDictList: suggestDictList, - suggestDetail: suggestDetail -} - -function getToken (wxCode) { - return fly.get("app-user/user/ma/getToken", { - wxCode: wxCode - }) -} - -function bannerList (position) { - return fly.get("news/banner/list", { - position - }) -} - -function getIssueList (param) { - return fly.get("events/issue/list", param) -} - -function getProjectList (param) { - return fly.get("events/item/list", param) -} - -function getFirstInfo () { - // return fly.post("news/information/first") - return fly.post("news/v2/information/first") -} - -function noticelist (param) { - return fly.get("news/notice/list", param) -} - -function newsList (param) { - return fly.get("news/news/list", param) -} - -function getScanSwitch (versionNum) { - return fly.get("ma/scanSwitch", { - versionNum - }) -} - -function getCompleteName (gridId) { - return fly.get("admin/dept/completeName", { - gridId: gridId - }) -} - -function saveWxFormid (wxCode, wxFormId) { - return fly.post("app-user/wxformid/save", { - wxCode: wxCode, - wxFormId: wxFormId - }) -} - -function getTokenV2 ({ - wxCode, - gridId, - inviteUserId -}) { - return fly.get("app-user/user/ma/v2/getToken", { - wxCode, - gridId, - inviteUserId - }) -} - -function updateWxInfo (wxCode, encryptedData, iv) { - return fly.post("app-user/user/ma/updateWxInfo", { - wxCode: wxCode, - encryptedData: encryptedData, - iv: iv - }) -} - -function gridLeaderRegister (mobile, smsCode, wxCode) { - return fly.post("app-user/user/ma/gridLeaderRegister", { - mobile: mobile, - smsCode: smsCode, - wxCode: wxCode - }) -} - - - -function prepareComplete () { - return fly.get("app-user/user/prepareComplete", {}) -} - -function sendSms (mobile) { - return fly.get("message/sms/sendCode", { - mobile: mobile - }) -} - -/** - * 获取网格长管理的所有网格 - */ -function getGridList () { - return fly.get("app-user/user/listGrid") -} - -/** - * 网格长切换网格 - * @params { - * gridId 将要切换的网格id - * } - */ -function changeGrid (gridId) { - return fly.get(`app-user/user/switchGrid/${gridId}`) -} -// ---------------------------------友邻社群接口start------------------ - -/** - * 获取用户信息 - * @param {*} param0 - */ -// function getUserInfo() { -// return fly.get('/app-user/user/getInfoById') -// } -function getUserInfo () { - return fly.get("app-user/user/getInfoById") -} -/** - * 我的群列表 - */ -function getMyAssociation () { - return fly.get("group/group/listOfMine") -} - -/** - * 推荐群列表 - */ -function getCommandAssociation () { - return fly.get("group/group/listOfRecommend") -} - -// ---------------------------------友邻社群接口end-------------------- - -// ---------------------------------个人中心接口start------------------ - -/** - * 我的话题列表 - */ -function getMyTopicList ({ - pageIndex, - pageSize -}) { - return fly.get("group/topic/listOfMine", { - pageIndex, - pageSize - }) -} -/** - * 我的话题列表V2 - */ -function getMyTopicListV2 ({ - pageIndex, - pageSize, - timestamp -}) { - return fly.get("partyGroup/myTopicList/list", { - pageIndex, - pageSize, - timestamp - }) -} -/** - * 我的议题列表 - */ -function getMyIssueList () { - return fly.get("events/issue/listByUserId") -} - -/** - * 我的项目列表 - */ -function getMyProjectList ({ - pageIndex, - pageSize, - timestamp -}) { - return fly.get("events/item/listByUserId", { - pageIndex, - pageSize, - timestamp - }) -} - -/** - * 查看用户是否已保存unionId - */ -function checkWxUnionId () { - return fly.get("app-user/user/checkWxUnionId") -} -// ---------------------------------个人中心接口 end------------------- - -/** - * 积分记录-积分记录接口 - * timestamp String 第一页查询发起时的时间 - * pageIndex Number 页码 - * pageSize Number 页容量 - */ -function pointsRecordlist ({ - timestamp, - pageIndex, - pageSize -}) { - return fly.get("points/pointsRecord/list", { - timestamp, - pageIndex, - pageSize - }) -} - -/** - * 积分记录-积分排行接口 - * timestamp String 第一页查询发起时的时间 - * pageIndex Number 页码 - * pageSize Number 页容量 - * rankingType Number 排名方式:0-周,1-月 - */ - -function pointsRankinglist ({ - timestamp, - pageIndex, - pageSize, - rankingType -}) { - return fly.get("points/pointsRanking/list", { - timestamp, - pageIndex, - pageSize, - rankingType - }) -} -/** - * 积分记录-锦水-积分排行接口 v2 排名方式发生改变 - * timestamp String 第一页查询发起时的时间 - * pageIndex Number 页码 - * pageSize Number 页容量 - * rankingType Number 排名方式:0-网格,1-街道 - */ -function userPointsRankinglist ({ - timestamp, - pageIndex, - pageSize, - rankingType -}) { - return fly.get("app-user/userPointsRanking/list", { - timestamp, - pageIndex, - pageSize, - rankingType - }) -} - -// *****************************爱心互助接口*************************** - -/** - * 排行榜 - */ -function leaderboard ({pageIndex, pageSize}) { - return fly.get("heart/volunteer/leaderboard", { - pageIndex, - pageSize - }) -} -/** - * 活动详情 - */ -function detail ({id,actType}) { - return fly.get(`heart/act/detail`,{ - id: id, - actType: actType - }) -} - -/** - * 未通过活动详情 - */ -function rejectDetail (id) { - return fly.get(`heart/act/rejectDetail/${id}`) -} - -/** - * 取消活动详情 - */ -function cancelDetail (id) { - return fly.get(`heart/act/cancelDetail/${id}`) -} - - -/** - * 活动打卡地点详情 - */ -function clockAddressDetail (id) { - return fly.get("heart/act/clockAddressDetail", { - actId: id - }) -} - -/** - * 打卡列表 - */ -function clockList (actId) { - return fly.get("heart/act/clockList", { - actId: actId - }) -} -/** - * 打卡列表 - */ -function clockListV2 ({ actId, pageIndex, pageSize}) { - return fly.get("heart/act/V2/clockList", { - actId, - pageIndex, - pageSize - }) -} -/** - * 常用语列表 - */ -function getPhraseList () { - return fly.get("heart/phrase/getPhraseList") -} - -/** - * 使用常用语 - */ -function sagenumAddOne (id) { - return fly.post("heart/phrase/sagenumAddOne", { - id: id - }) -} - - -/** - * 活动打卡 - */ -function clock (data) { - return fly.post("heart/act/clock", data) -} - -// /** -// * 志愿者认证 -// */ -// function authenticate(data) { -// return fly.post('app-user/volunteer/authenticate', data) -// } - -/** - * 志愿者认证 v2 - */ -function authenticate (data) { - return fly.post("app-user/volunteer/v2/authenticate", data) -} -/** - * 活动报名 - */ - -function signup (actId) { - return fly.post(`heart/act/signup?actId=${actId}`) -} - -/** - * 取消报名 - */ -function cancelsignup (id, response) { - return fly.post("heart/act/cancelsignup", { - actId: id, - failureReason: response - }) -} - - - -/** - * 已报名活动 - */ -function getSignedList ({ pageIndex, pageSize, timestamp, actType }) { - return fly.get("heart/act/signupList", { - pageIndex, - pageSize, - timestamp, - actType - }) -} - -/** - * 未通过活动详情 - */ -function unpassActivityDetail (id) { - return fly.get(`heart/act/rejectDetail/${id}`) -} - - - -/** - * 用户完善个人信息v2(不穿验证码) - */ -function completeInfoV2 (para) { - return fly.post("app-user/user/v2/completeInfo", para) -} -function completeInfo (data) { - return fly.post("app-user/user/completeInfo", data) -} -//居民 完善个人信息 -function completeResidentInfo (data) { - return fly.post("app-user/user/completeResidentInfo", data) -} -//党员 完善个人信息 -function completePartyInfo (data) { - return fly.post("app-user/user/completePartyInfo", data) -} -// 居民 完善个人信息v2 不需要穿验证码 -function completeResidentInfoV2 (para) { - return fly.post("app-user/user/v2/completeResidentInfo", para) -} -// 党员 完善个人信息 v2 不需要穿验证码 -function completePartyInfoV2 (para) { - return fly.post("app-user/user/v2/completePartyInfo", para) -} - - -/** - * 获取Token v3 网格码和邀请码合二为一 - */ - -function getTokenV3 (para) { - return fly.get("app-user/user/ma/v3/getToken", para) -} - -/********微信获取手机号 ********/ -function getWxPhone ({ wxCode, encryptedData, iv }) { - return fly.get("app-user/user/ma/getWxPhone", { - wxCode, - encryptedData, - iv - }) -} - -// 志愿者去哪儿-我要申请 -function applyAct (para) { - return fly.post("heart/actApply/applyAct", para) -} -// 志愿者去哪儿-申请记录 -function applyRecord ({ - pageIndex, - pageSize -}) { - return fly.get("heart/actApply/applyRecord", { - pageIndex, - pageSize - }) -} -// 志愿者去哪儿-活动详情 -function applyActDetail (id) { - return fly.get(`heart/actApply/applyActDetail/${id}`) -} - -// 获取配置图片 -function getImgUrl (imgType) { - return fly.get(`imgConfig/getImgUrl/${imgType}`) -} - -// *****************************爱心互助接口***************************end -// 获取默认网格信息 -function getDefaultGridInfo () { - return fly.get("dic/getDefaultGridInfo") -} -// 获取居民端配置 -function getResidentConfig () { - return fly.get("residentConfig/getResidentConfig") -} - -// *****************************获取临时凭证接口****6.22***************end -// 获取临时凭证用于跳转到数据端 -function getScrip () { - return fly.post("admin/getScrip") -} -// 获取首页电话 -function getHomePhone () { - return fly.get("imgConfig/getImgUrl/3") -} - -/** - * 积分记录-等级排行接口 6.28 - * timestamp String 第一页查询发起时的时间 - * pageIndex Number 页码 - * pageSize Number 页容量 - */ - -function gradeRankinglist ({ - timestamp, - pageIndex, - pageSize -}) { - return fly.get("app-user/user/gradeRanking/list", { - timestamp, - pageIndex, - pageSize - }) -} - -/** - * 用户签到 2020.07.24 - */ - -function userInfoSignUp () { - return fly.get("app-user/user/sign") -} - -// 一键服务/解码锦水 改版模块类别接口 -function moduleCategory(params) { - return fly.get('news/module/moduleCategory', params) -} - -// 锦水清风-我要举报 -function reportIssue (para) { - return fly.post("custom/reportissue/submit", para) -} -// 一键服务-锦水清风-举报问题列表接口 -function reportIssueList(para) { - return fly.get('custom/reportissue/list', para) -} -//一键服务-锦水清风-举报问题详情接口 -function reportIssueDetail (id) { - return fly.get(`custom/reportissue/detail/${id}`) -} -//志愿者标签列表 -function getVolunteerTags () { - return fly.get(`app-user/volunteer/tags`) -} -//居民扫签到码获取活动信息接口 -function getActInfo (para) { - return fly.get(`act/actsignin/actInfo`, para) -} -// 居民签到打卡 -function signIn (para) { - return fly.post("act/actsignin/signin", para) -} - -// 建议直通-我的建议 -function suggestDict (para) { - return fly.post("custom/advice/submit", para) -} -// 一键服务-建议直通-建议列表接口 -function suggestDictList(para) { - return fly.get('custom/advice/list', para) -} -//一键服务-建议直通-建议详情接口 -function suggestDetail (id) { - return fly.get(`custom/advice/detail/${id}`) +var fly = require("./request.js") +module.exports = { + getToken: getToken, + getCompleteName: getCompleteName, + saveWxFormid: saveWxFormid, + getScanSwitch: getScanSwitch, + getTokenV2: getTokenV2, + updateWxInfo: updateWxInfo, + sendSms: sendSms, + gridLeaderRegister: gridLeaderRegister, + getGridList: getGridList, + changeGrid: changeGrid, + completeInfo: completeInfo, + completeResidentInfo: completeResidentInfo, + completePartyInfo: completePartyInfo, + prepareComplete: prepareComplete, + getUserInfo: getUserInfo, + getMyAssociation: getMyAssociation, + getCommandAssociation: getCommandAssociation, + getMyTopicList: getMyTopicList, + getMyTopicListV2:getMyTopicListV2, + getMyIssueList: getMyIssueList, + getMyProjectList: getMyProjectList, + checkWxUnionId: checkWxUnionId, + bannerList: bannerList, + getFirstInfo: getFirstInfo, + noticelist: noticelist, + newsList: newsList, + getIssueList: getIssueList, + getProjectList: getProjectList, + pointsRankinglist: pointsRankinglist, + pointsRecordlist: pointsRecordlist, + // 爱心互助 + leaderboard: leaderboard, + detail: detail, + rejectDetail: rejectDetail, + cancelDetail: cancelDetail, + clockAddressDetail: clockAddressDetail, + clockList: clockList, + clockListV2: clockListV2, + getPhraseList: getPhraseList, + sagenumAddOne: sagenumAddOne, + clock: clock, + authenticate: authenticate, + signup: signup, + cancelsignup:cancelsignup, + getSignedList: getSignedList, + unpassActivityDetail: unpassActivityDetail, + completeInfoV2: completeInfoV2, + getTokenV3: getTokenV3, + getWxPhone: getWxPhone, + applyAct: applyAct, + applyRecord: applyRecord, + applyActDetail: applyActDetail, + getImgUrl: getImgUrl, + completeResidentInfoV2: completeResidentInfoV2, + completePartyInfoV2: completePartyInfoV2, + userPointsRankinglist:userPointsRankinglist, + getDefaultGridInfo:getDefaultGridInfo, + getResidentConfig:getResidentConfig, + getScrip:getScrip, + getHomePhone:getHomePhone, + gradeRankinglist:gradeRankinglist, + userInfoSignUp:userInfoSignUp, + moduleCategory: moduleCategory, + reportIssue: reportIssue, + reportIssueList: reportIssueList, + reportIssueDetail: reportIssueDetail, + getVolunteerTags: getVolunteerTags, + getActInfo: getActInfo, + signIn: signIn, + suggestDict: suggestDict, + suggestDictList: suggestDictList, + suggestDetail: suggestDetail, + getVolunteerDepts: getVolunteerDepts +} + +function getToken (wxCode) { + return fly.get("app-user/user/ma/getToken", { + wxCode: wxCode + }) +} + +function bannerList (position) { + return fly.get("news/banner/list", { + position + }) +} + +function getIssueList (param) { + return fly.get("events/issue/list", param) +} + +function getProjectList (param) { + return fly.get("events/item/list", param) +} + +function getFirstInfo () { + // return fly.post("news/information/first") + return fly.post("news/v2/information/first") +} + +function noticelist (param) { + return fly.get("news/notice/list", param) +} + +function newsList (param) { + return fly.get("news/news/list", param) +} + +function getScanSwitch (versionNum) { + return fly.get("ma/scanSwitch", { + versionNum + }) +} + +function getCompleteName (gridId) { + return fly.get("admin/dept/completeName", { + gridId: gridId + }) +} + +function saveWxFormid (wxCode, wxFormId) { + return fly.post("app-user/wxformid/save", { + wxCode: wxCode, + wxFormId: wxFormId + }) +} + +function getTokenV2 ({ + wxCode, + gridId, + inviteUserId +}) { + return fly.get("app-user/user/ma/v2/getToken", { + wxCode, + gridId, + inviteUserId + }) +} + +function updateWxInfo (wxCode, encryptedData, iv) { + return fly.post("app-user/user/ma/updateWxInfo", { + wxCode: wxCode, + encryptedData: encryptedData, + iv: iv + }) +} + +function gridLeaderRegister (mobile, smsCode, wxCode) { + return fly.post("app-user/user/ma/gridLeaderRegister", { + mobile: mobile, + smsCode: smsCode, + wxCode: wxCode + }) +} + + + +function prepareComplete () { + return fly.get("app-user/user/prepareComplete", {}) +} + +function sendSms (mobile) { + return fly.get("message/sms/sendCode", { + mobile: mobile + }) +} + +/** + * 获取网格长管理的所有网格 + */ +function getGridList () { + return fly.get("app-user/user/listGrid") +} + +/** + * 网格长切换网格 + * @params { + * gridId 将要切换的网格id + * } + */ +function changeGrid (gridId) { + return fly.get(`app-user/user/switchGrid/${gridId}`) +} +// ---------------------------------友邻社群接口start------------------ + +/** + * 获取用户信息 + * @param {*} param0 + */ +// function getUserInfo() { +// return fly.get('/app-user/user/getInfoById') +// } +function getUserInfo () { + return fly.get("app-user/user/getInfoById") +} +/** + * 我的群列表 + */ +function getMyAssociation () { + return fly.get("group/group/listOfMine") +} + +/** + * 推荐群列表 + */ +function getCommandAssociation () { + return fly.get("group/group/listOfRecommend") +} + +// ---------------------------------友邻社群接口end-------------------- + +// ---------------------------------个人中心接口start------------------ + +/** + * 我的话题列表 + */ +function getMyTopicList ({ + pageIndex, + pageSize +}) { + return fly.get("group/topic/listOfMine", { + pageIndex, + pageSize + }) +} +/** + * 我的话题列表V2 + */ +function getMyTopicListV2 ({ + pageIndex, + pageSize, + timestamp +}) { + return fly.get("partyGroup/myTopicList/list", { + pageIndex, + pageSize, + timestamp + }) +} +/** + * 我的议题列表 + */ +function getMyIssueList () { + return fly.get("events/issue/listByUserId") +} + +/** + * 我的项目列表 + */ +function getMyProjectList ({ + pageIndex, + pageSize, + timestamp +}) { + return fly.get("events/item/listByUserId", { + pageIndex, + pageSize, + timestamp + }) +} + +/** + * 查看用户是否已保存unionId + */ +function checkWxUnionId () { + return fly.get("app-user/user/checkWxUnionId") +} +// ---------------------------------个人中心接口 end------------------- + +/** + * 积分记录-积分记录接口 + * timestamp String 第一页查询发起时的时间 + * pageIndex Number 页码 + * pageSize Number 页容量 + */ +function pointsRecordlist ({ + timestamp, + pageIndex, + pageSize +}) { + return fly.get("points/pointsRecord/list", { + timestamp, + pageIndex, + pageSize + }) +} + +/** + * 积分记录-积分排行接口 + * timestamp String 第一页查询发起时的时间 + * pageIndex Number 页码 + * pageSize Number 页容量 + * rankingType Number 排名方式:0-周,1-月 + */ + +function pointsRankinglist ({ + timestamp, + pageIndex, + pageSize, + rankingType +}) { + return fly.get("points/pointsRanking/list", { + timestamp, + pageIndex, + pageSize, + rankingType + }) +} +/** + * 积分记录-锦水-积分排行接口 v2 排名方式发生改变 + * timestamp String 第一页查询发起时的时间 + * pageIndex Number 页码 + * pageSize Number 页容量 + * rankingType Number 排名方式:0-网格,1-街道 + */ +function userPointsRankinglist ({ + timestamp, + pageIndex, + pageSize, + rankingType +}) { + return fly.get("app-user/userPointsRanking/list", { + timestamp, + pageIndex, + pageSize, + rankingType + }) +} + +// *****************************爱心互助接口*************************** + +/** + * 排行榜 + */ +function leaderboard ({pageIndex, pageSize, type}) { + return fly.get("heart/volunteer/leaderboard", { + pageIndex, + pageSize, + type + }) +} +/** + * 活动详情 + */ +function detail ({id,actType}) { + return fly.get(`heart/act/detail`,{ + id: id, + actType: actType + }) +} + +/** + * 未通过活动详情 + */ +function rejectDetail (id) { + return fly.get(`heart/act/rejectDetail/${id}`) +} + +/** + * 取消活动详情 + */ +function cancelDetail (id) { + return fly.get(`heart/act/cancelDetail/${id}`) +} + + +/** + * 活动打卡地点详情 + */ +function clockAddressDetail (id) { + return fly.get("heart/act/clockAddressDetail", { + actId: id + }) +} + +/** + * 打卡列表 + */ +function clockList (actId) { + return fly.get("heart/act/clockList", { + actId: actId + }) +} +/** + * 打卡列表 + */ +function clockListV2 ({ actId, pageIndex, pageSize}) { + return fly.get("heart/act/V2/clockList", { + actId, + pageIndex, + pageSize + }) +} +/** + * 常用语列表 + */ +function getPhraseList () { + return fly.get("heart/phrase/getPhraseList") +} + +/** + * 使用常用语 + */ +function sagenumAddOne (id) { + return fly.post("heart/phrase/sagenumAddOne", { + id: id + }) +} + + +/** + * 活动打卡 + */ +function clock (data) { + return fly.post("heart/act/clock", data) +} + +// /** +// * 志愿者认证 +// */ +// function authenticate(data) { +// return fly.post('app-user/volunteer/authenticate', data) +// } + +/** + * 志愿者认证 v2 + */ +function authenticate (data) { + return fly.post("app-user/volunteer/v2/authenticate", data) +} +/** + * 活动报名 + */ + +function signup (actId) { + return fly.post(`heart/act/signup?actId=${actId}`) +} + +/** + * 取消报名 + */ +function cancelsignup (id, response) { + return fly.post("heart/act/cancelsignup", { + actId: id, + failureReason: response + }) +} + + + +/** + * 已报名活动 + */ +function getSignedList ({ pageIndex, pageSize, timestamp, actType }) { + return fly.get("heart/act/signupList", { + pageIndex, + pageSize, + timestamp, + actType + }) +} + +/** + * 未通过活动详情 + */ +function unpassActivityDetail (id) { + return fly.get(`heart/act/rejectDetail/${id}`) +} + + + +/** + * 用户完善个人信息v2(不穿验证码) + */ +function completeInfoV2 (para) { + return fly.post("app-user/user/v2/completeInfo", para) +} +function completeInfo (data) { + return fly.post("app-user/user/completeInfo", data) +} +//居民 完善个人信息 +function completeResidentInfo (data) { + return fly.post("app-user/user/completeResidentInfo", data) +} +//党员 完善个人信息 +function completePartyInfo (data) { + return fly.post("app-user/user/completePartyInfo", data) +} +// 居民 完善个人信息v2 不需要穿验证码 +function completeResidentInfoV2 (para) { + return fly.post("app-user/user/v2/completeResidentInfo", para) +} +// 党员 完善个人信息 v2 不需要穿验证码 +function completePartyInfoV2 (para) { + return fly.post("app-user/user/v2/completePartyInfo", para) +} + + +/** + * 获取Token v3 网格码和邀请码合二为一 + */ + +function getTokenV3 (para) { + return fly.get("app-user/user/ma/v3/getToken", para) +} + +/********微信获取手机号 ********/ +function getWxPhone ({ wxCode, encryptedData, iv }) { + return fly.get("app-user/user/ma/getWxPhone", { + wxCode, + encryptedData, + iv + }) +} + +// 志愿者去哪儿-我要申请 +function applyAct (para) { + return fly.post("heart/actApply/applyAct", para) +} +// 志愿者去哪儿-申请记录 +function applyRecord ({ + pageIndex, + pageSize +}) { + return fly.get("heart/actApply/applyRecord", { + pageIndex, + pageSize + }) +} +// 志愿者去哪儿-活动详情 +function applyActDetail (id) { + return fly.get(`heart/actApply/applyActDetail/${id}`) +} + +// 获取配置图片 +function getImgUrl (imgType) { + return fly.get(`imgConfig/getImgUrl/${imgType}`) +} + +// *****************************爱心互助接口***************************end +// 获取默认网格信息 +function getDefaultGridInfo () { + return fly.get("dic/getDefaultGridInfo") +} +// 获取居民端配置 +function getResidentConfig () { + return fly.get("residentConfig/getResidentConfig") +} + +// *****************************获取临时凭证接口****6.22***************end +// 获取临时凭证用于跳转到数据端 +function getScrip () { + return fly.post("admin/getScrip") +} +// 获取首页电话 +function getHomePhone () { + return fly.get("imgConfig/getImgUrl/3") +} + +/** + * 积分记录-等级排行接口 6.28 + * timestamp String 第一页查询发起时的时间 + * pageIndex Number 页码 + * pageSize Number 页容量 + */ + +function gradeRankinglist ({ + timestamp, + pageIndex, + pageSize +}) { + return fly.get("app-user/user/gradeRanking/list", { + timestamp, + pageIndex, + pageSize + }) +} + +/** + * 用户签到 2020.07.24 + */ + +function userInfoSignUp () { + return fly.get("app-user/user/sign") +} + +// 一键服务/解码锦水 改版模块类别接口 +function moduleCategory(params) { + return fly.get('news/module/moduleCategory', params) +} + +// 锦水清风-我要举报 +function reportIssue (para) { + return fly.post("custom/reportissue/submit", para) +} +// 一键服务-锦水清风-举报问题列表接口 +function reportIssueList(para) { + return fly.get('custom/reportissue/list', para) +} +//一键服务-锦水清风-举报问题详情接口 +function reportIssueDetail (id) { + return fly.get(`custom/reportissue/detail/${id}`) +} +//志愿者标签列表 +function getVolunteerTags () { + return fly.get(`app-user/volunteer/tags`) +} +//居民扫签到码获取活动信息接口 +function getActInfo (para) { + return fly.get(`act/actsignin/actInfo`, para) +} +// 居民签到打卡 +function signIn (para) { + return fly.post("act/actsignin/signin", para) +} + +// 建议直通-我的建议 +function suggestDict (para) { + return fly.post("custom/advice/submit", para) +} +// 一键服务-建议直通-建议列表接口 +function suggestDictList(para) { + return fly.get('custom/advice/list', para) +} +//一键服务-建议直通-建议详情接口 +function suggestDetail (id) { + return fly.get(`custom/advice/detail/${id}`) +} + +//志愿者注册-志愿者部门列表 +function getVolunteerDepts () { + return fly.get(`app-user/volunteer/depts`) } \ No newline at end of file diff --git a/utils/config.js b/utils/config.js index 37bf49a..2579475 100644 --- a/utils/config.js +++ b/utils/config.js @@ -8,7 +8,7 @@ module.exports = { function BASEURL() { // return 'https://epdc-jinan-test.elinkservice.cn/js/epdc-api/api/' // 锦水测试环境 return 'https://epdc-jinshui.elinkservice.cn/epdc-api/api/' // 锦水正式环境接口地址 - // return 'http://192.168.43.49:9094/epdc-api/api/' + // return 'http://10.10.10.192:9094/epdc-api/api/' // return 'https://nei.netease.com/api/apimock-v2/068b11343b2a993a9292d11f4b3fa8a8/api/' }