From 83e06be21559f08ac7d7195e19bd2bcaeda96689 Mon Sep 17 00:00:00 2001 From: yanran200730 Date: Wed, 2 Nov 2022 16:05:35 +0800 Subject: [PATCH] bug --- src/project/tianfuxing/AppHome/Activity.vue | 185 ++++++++-- src/project/tianfuxing/AppHome/AppHome.vue | 10 +- src/project/tianfuxing/AppHome/Culture.vue | 315 ++++++++++-------- .../tianfuxing/AppHome/PhotoReport.vue | 10 +- src/utils/axios.js | 1 - 5 files changed, 347 insertions(+), 174 deletions(-) diff --git a/src/project/tianfuxing/AppHome/Activity.vue b/src/project/tianfuxing/AppHome/Activity.vue index a6e84bd..911fee2 100644 --- a/src/project/tianfuxing/AppHome/Activity.vue +++ b/src/project/tianfuxing/AppHome/Activity.vue @@ -1,39 +1,37 @@ @@ -46,18 +44,145 @@ data () { return { - qqmapsdk: null + id: '', + info: {}, + qqmapsdk: null, + pageShow: false, + latitude: '', + longitude: '', + address: '', + distance: 100000 } }, - onLoad () { - // this.getLocation() + computed: { + isClock () { + if (!this.info.id) { + return false + } + + const times = new Date().getTime() + const inSTimes = new Date(this.info.intoBegintime.replaceAll('-', '/')).getTime() + const inETimes = new Date(this.info.intoEndtime.replaceAll('-', '/')).getTime() + const outSTimes = new Date(this.info.exitBegintime.replaceAll('-', '/')).getTime() + const outETimes = new Date(this.info.exitEndtime.replaceAll('-', '/')).getTime() + + if (this.info.clockRange > this.distance && (!this.info.intoClock && (times > inSTimes && times < inETimes)) || this.info.exitClock && (times > outSTimes && times < outETimes)) { + return true + } + + return false + }, + + intoIntegral () { + if (!this.info.id) { + return 0 + } + + const times = new Date().getTime() + const inSTimes = new Date(this.info.intoBegintime.replaceAll('-', '/')).getTime() + const inETimes = new Date(this.info.intoEndtime.replaceAll('-', '/')).getTime() + const outSTimes = new Date(this.info.exitBegintime.replaceAll('-', '/')).getTime() + const outETimes = new Date(this.info.exitEndtime.replaceAll('-', '/')).getTime() + + if (!this.info.intoClock && (times > inSTimes && times < inETimes)) { + return this.info.intoIntegral + } + + if (!this.info.exitClock && (times > outSTimes && times < outETimes)) { + return this.info.exitIntegral + } + + return 0 + } + }, + + onShow () { + this.getInfo() + }, + + onLoad (query) { + this.id = query.id this.qqmapsdk = new QQMapWX({ key: '3RZBZ-LZUCF-CT6J5-NWKZH-FCWOQ-UUFKY' }) + + this.$loading() }, methods: { + getInfo () { + this.$instance.post(`/appactivityinfo/queryDetailById?id=${this.id}`).then(res => { + if (res.code === 0) { + this.info = res.data + + this.$nextTick(() => { + this.getLocation() + this.pageShow = true + }) + } + }) + }, + + toSign () { + if (!this.latitude) { + this.$dialog.alert({ + title: '温馨提示', + content: '您未授权定位,请先授权!' + }).then(() => { + this.getLocation() + }).catch(() => { + }) + + return false + } + + if (!this.isClock) { + this.$dialog.alert({ + title: '温馨提示', + content: '不满足打卡条件!' + }).then(() => { + this.getLocation() + }).catch(() => { + }) + + return false + } + + this.$loading() + let type = 0 + const times = new Date().getTime() + const inSTimes = new Date(this.info.intoBegintime.replaceAll('-', '/')).getTime() + const inETimes = new Date(this.info.intoEndtime.replaceAll('-', '/')).getTime() + const outSTimes = new Date(this.info.exitBegintime.replaceAll('-', '/')).getTime() + const outETimes = new Date(this.info.exitEndtime.replaceAll('-', '/')).getTime() + if (!this.info.intoClock && (times > inSTimes && times < inETimes)) { + type = 0 + } + + if (!this.info.exitClock && (times > outSTimes && times < outETimes)) { + type = 1 + } + this.$instance.post(`/appactivityinfo/clock`, { + address: this.address, + activityId: this.id, + clockTime: this.$dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss'), + lat: this.latitude, + lng: this.longitude, + type + }).then(res => { + if (res.code === 0) { + this.$toast('打卡成功') + + this.getInfo() + } + + this.$hideLoading() + }).catch(() => { + this.$hideLoading() + }) + }, + getLocation () { wx.authorize({ scope: 'scope.userLocation', @@ -65,14 +190,13 @@ uni.getLocation({ type: 'wgs84', success: res => { - console.log('当前位置的经度:' + res.longitude) - console.log('当前位置的纬度:' + res.latitude) this.latitude = res.latitude this.longitude = res.longitude this.qqmapsdk.reverseGeocoder({ location: `${res.latitude},${res.longitude}`, success: data => { console.log(data) + this.address = data.result.formatted_addresses.recommend }, fail: function(info){ console.log(info) @@ -85,11 +209,11 @@ latitude: res.latitude }, to: [{ - longitude: 114.342093, - latitude: 30.499959 + longitude: this.info.lng, + latitude: this.info.lat }], success: res => { - console.log(res.result.elements[0].distance) + this.distance = res.result.elements[0].distance }, fail: function(error) { console.error(error) @@ -121,6 +245,14 @@ } }) }, + + toAddress () { + wx.openLocation({ + latitude: this.info.lat, + longitude: this.info.lng, + scale: 18 + }) + } } } @@ -232,13 +364,22 @@ box-shadow: 0 8px 12px -4px rgba(133,196,255,0.65); border-radius: 50%; + &.disable { + border-color: #D5DCEA; + background-image: none; + + h2 { + color: #ADB9D1; + } + } + h2 { - margin-bottom: 20px; color: #fff; font-size: 40px; } span { + margin-top: 20px; color: rgba(255, 255, 255, 0.8); font-size: 28px; } diff --git a/src/project/tianfuxing/AppHome/AppHome.vue b/src/project/tianfuxing/AppHome/AppHome.vue index ddf14a0..7bab497 100644 --- a/src/project/tianfuxing/AppHome/AppHome.vue +++ b/src/project/tianfuxing/AppHome/AppHome.vue @@ -13,19 +13,19 @@

线下活动

-
+
-

10月31日线下公益宣传

-

百年征程波澜壮阔,百年初心历久弥坚。7月1日上午,庆祝中国共产党成立100周年大会在北百年征程波澜壮阔,百年初心历久弥坚。7月1日上午,庆祝中国共产党成立100周年大会在北…

+

{{ item.title }}

+

{{ item.detail }}

进场时间:

- 2022-10-14 09:25:25 至 2022-10-28 12:00:00 + {{ item.intoBegintime }} 至 {{ item.intoEndtime }}

进场时间:

- 2022-10-14 09:25:25 至 2022-10-28 12:00:00 + {{ item.exitBegintime }} 至 {{ item.exitEndtime }}
diff --git a/src/project/tianfuxing/AppHome/Culture.vue b/src/project/tianfuxing/AppHome/Culture.vue index 573ffd3..2d4de7a 100644 --- a/src/project/tianfuxing/AppHome/Culture.vue +++ b/src/project/tianfuxing/AppHome/Culture.vue @@ -18,161 +18,188 @@

我上传的

-
- - 待审核 +
+ + {{ mapStatus(item.status) }}
- 10-15 19:25 - 积分+5 + {{ $dayjs(item.createTime).format('MM-DD HH:mm') }} + 积分+{{ item.integral }}
+
-
上传朋友圈截图
-
上传群聊截图
+
上传朋友圈截图
+
上传群聊截图