先提交网格员积分签到
This commit is contained in:
@@ -26,7 +26,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapState} from "vuex"
|
||||
import {mapState, mapActions} from "vuex"
|
||||
import qs from "query-string"
|
||||
|
||||
export default {
|
||||
name: "AppMyGrid",
|
||||
@@ -34,11 +35,11 @@ export default {
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
isGridMember: v => v.user.girdCheckType > 0,
|
||||
signIn: v => v.user.gridExtra.isSign == 1,
|
||||
signBtn: v => v.signIn ? '已签到' : '签到'
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
signIn: false,
|
||||
linkList: [
|
||||
{title: '我的积分', img: require('./assets/wdjf.png'), linkUrl: '../AppCreditPoints/AppGridIntegral'},
|
||||
{title: '积分兑换', img: require('./assets/jfdh.png'), linkUrl: '../AppCreditPoints/AppGridIntegral'},
|
||||
@@ -47,13 +48,7 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getMySignStatus() {
|
||||
this.$http.post("/app/appgirdmemberinfo/checkLogOnUser").then(res => {
|
||||
if (res?.data) {
|
||||
this.signIn = res.data.isSign == 1
|
||||
}
|
||||
})
|
||||
},
|
||||
...mapActions(['getGridInfo']),
|
||||
linkTo(url) {
|
||||
uni.navigateTo({url})
|
||||
},
|
||||
@@ -61,19 +56,28 @@ export default {
|
||||
!this.signIn && wx.getLocation({
|
||||
success: res => {
|
||||
const {latitude: lat, longitude: lng} = res
|
||||
this.$http.post('/app/appdvcpconfig/apiForward', `https://apis.map.qq.com/ws/geocoder/v1/?location=${lat},${lng}&key=3RZBZ-LZUCF-CT6J5-NWKZH-FCWOQ-UUFKY&get_poi=1`)
|
||||
if (!!lat && !!lng) {
|
||||
this.$http.post('/app/appdvcpconfig/apiForward', qs.stringifyUrl({
|
||||
url: "https://apis.map.qq.com/ws/geocoder/v1/?get_poi=1",
|
||||
query: {
|
||||
location: [lat, lng].toString(),
|
||||
key: "3RZBZ-LZUCF-CT6J5-NWKZH-FCWOQ-UUFKY",
|
||||
}
|
||||
}))
|
||||
.then(({data: {result: {address}}}) => this.$http.post("/app/appwxsigninfo/sign", {lat, lng, address}))
|
||||
.then(res => {
|
||||
if (res?.code == 0) {
|
||||
this.linkTo("./signResult")
|
||||
}
|
||||
})
|
||||
} else this.$u.toast("无法获取到定位!")
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getMySignStatus()
|
||||
this.getGridInfo()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<section class="signResult">
|
||||
<div class="successImg"/>
|
||||
<b class="mar-t32">今日已完成签到</b>
|
||||
<div v-if="result.score" class="mar-t32 score mar-b112">积分+5</div>
|
||||
<div v-if="result.score>0" class="mar-t32 score mar-b112">积分{{ result.score }}</div>
|
||||
<u-gap v-else class="mar-t32 mar-b112" height="32"/>
|
||||
<AiItem label="时间" :border="false">{{ result.createTime }}</AiItem>
|
||||
<AiItem label="位置" :border="false">{{ result.address }}</AiItem>
|
||||
|
||||
@@ -149,8 +149,9 @@ export const user = {
|
||||
//获取登录着网格员信息
|
||||
return http.post("/app/appgirdmemberinfo/checkLogOnUser", null, config).then(res => {
|
||||
if (res?.data) {
|
||||
let {girdId, girdMemberId, girdName, checkType: girdCheckType, appGirdInfo: gridInfo} = res.data
|
||||
return commit("setUser", {girdId, girdMemberId, girdName, girdCheckType, gridInfo})
|
||||
let {girdId, girdMemberId, girdName, checkType: girdCheckType, appGirdInfo: gridInfo, isSign} = res.data,
|
||||
gridExtra = {isSign}
|
||||
return commit("setUser", {girdId, girdMemberId, girdName, girdCheckType, gridInfo, gridExtra})
|
||||
}
|
||||
}).catch(() => 0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user