修改
This commit is contained in:
parent
faf4664e4d
commit
2941522404
@ -43,3 +43,22 @@ export function checkSignApply(identity) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 获取微信运动步数接口
|
||||||
|
export function wxSportDecrypt(data) {
|
||||||
|
return request({
|
||||||
|
url: `/applet/register/wxSportDecrypt`,
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 微信运动自动添加积分接口
|
||||||
|
export function wxsportadd(identity) {
|
||||||
|
return request({
|
||||||
|
url: `/applet/score/record/wxsport/add/${identity}/WX_SPORT_STEP_NUM`,
|
||||||
|
method: 'get',
|
||||||
|
header: {
|
||||||
|
region: uni.getStorageSync('region'),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -681,6 +681,13 @@
|
|||||||
"navigationBarTitleText": "复诊记录",
|
"navigationBarTitleText": "复诊记录",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
"path" : "wxSport/wxSport",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText" : "微信运动",
|
||||||
|
"enablePullDownRefresh" : false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
@ -90,7 +90,9 @@
|
|||||||
import {
|
import {
|
||||||
getOpenId,
|
getOpenId,
|
||||||
detail,
|
detail,
|
||||||
checkSignApply
|
checkSignApply,
|
||||||
|
wxSportDecrypt,
|
||||||
|
wxsportadd
|
||||||
} from '@/api/pages/homepage/homepage.js'
|
} from '@/api/pages/homepage/homepage.js'
|
||||||
import {
|
import {
|
||||||
mapActions
|
mapActions
|
||||||
@ -116,15 +118,69 @@
|
|||||||
this.openid = uni.getStorageSync('openid');
|
this.openid = uni.getStorageSync('openid');
|
||||||
this.region = Number(uni.getStorageSync('region'))
|
this.region = Number(uni.getStorageSync('region'))
|
||||||
if (this.userinfo && this.region != 3) {
|
if (this.userinfo && this.region != 3) {
|
||||||
|
this.checkSignApplyinfo();
|
||||||
|
}
|
||||||
|
if (uni.getStorageSync('userinfo')) {
|
||||||
|
this.wxSportDecryptinfo();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
wxSportDecryptinfo() {
|
||||||
|
let that = this
|
||||||
|
let currentDate = new Date();
|
||||||
|
let year = currentDate.getFullYear();
|
||||||
|
let month = currentDate.getMonth() + 1;
|
||||||
|
let day = currentDate.getDate();
|
||||||
|
month >= 1 && month <= 9 ? (month = "0" + month) : "";
|
||||||
|
day >= 0 && day <= 9 ? (day = "0" + day) : "";
|
||||||
|
let time = `${year}-${month}-${day}`
|
||||||
|
let wxsportaddtime = uni.getStorageSync('wxsportaddtime');
|
||||||
|
if (wxsportaddtime != time) {
|
||||||
|
wx.getSetting({
|
||||||
|
success: function(res) {
|
||||||
|
// 开启微信运动授权
|
||||||
|
if (res.authSetting['scope.werun']) {
|
||||||
|
// 在小程序中获取微信步数
|
||||||
|
wx.login({
|
||||||
|
success: function(res) {
|
||||||
|
if (res.code) {
|
||||||
|
wx.getWeRunData({
|
||||||
|
success: function(resp) {
|
||||||
|
that.wxSport(res, resp)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
wxSport(res, resp) {
|
||||||
|
let obj = {
|
||||||
|
code: res.code,
|
||||||
|
encryptedData: resp.encryptedData,
|
||||||
|
iv: resp.iv
|
||||||
|
}
|
||||||
|
wxSportDecrypt(obj).then(Sportres => {
|
||||||
|
if (Sportres.data && Sportres.data[0].step >= 5000) {
|
||||||
|
wxsportadd(this.userinfo.cardNo).then(sportaddres => {
|
||||||
|
if (sportaddres.code == 200) {
|
||||||
|
uni.setStorageSync('wxsportaddtime', Sportres.data[0].date);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
checkSignApplyinfo() {
|
||||||
checkSignApply(this.userinfo.cardNo).then(res => {
|
checkSignApply(this.userinfo.cardNo).then(res => {
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
this.checkSign = res.data.code
|
this.checkSign = res.data.code
|
||||||
this.infotitle = res.data.info
|
this.infotitle = res.data.info
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {}
|
|
||||||
},
|
},
|
||||||
methods: {
|
|
||||||
...mapActions(["openPopup"]),
|
...mapActions(["openPopup"]),
|
||||||
//跳转选择地址
|
//跳转选择地址
|
||||||
city() {
|
city() {
|
||||||
|
|||||||
@ -45,6 +45,7 @@
|
|||||||
} from '../../api/pages/login/index.js'
|
} from '../../api/pages/login/index.js'
|
||||||
import {
|
import {
|
||||||
getCurrentUser,
|
getCurrentUser,
|
||||||
|
wxSportDecrypt
|
||||||
} from '@/api/pages/homepage/homepage.js'
|
} from '@/api/pages/homepage/homepage.js'
|
||||||
import {
|
import {
|
||||||
createMobileToken
|
createMobileToken
|
||||||
@ -71,9 +72,15 @@
|
|||||||
if (!uni.getStorageSync('location') || !uni.getStorageSync('region')) {
|
if (!uni.getStorageSync('location') || !uni.getStorageSync('region')) {
|
||||||
this.getAddress()
|
this.getAddress()
|
||||||
}
|
}
|
||||||
|
this.sportinfo();
|
||||||
this.phonecode = undefined
|
this.phonecode = undefined
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
sportinfo() {
|
||||||
|
wx.getWeRunData({
|
||||||
|
success: function(res) {}
|
||||||
|
});
|
||||||
|
},
|
||||||
nologin() {
|
nologin() {
|
||||||
this.$refs.uToast.show({
|
this.$refs.uToast.show({
|
||||||
title: '请先阅读并同意《用户协议与隐私政策》',
|
title: '请先阅读并同意《用户协议与隐私政策》',
|
||||||
|
|||||||
@ -503,6 +503,9 @@
|
|||||||
},
|
},
|
||||||
//行为积分
|
//行为积分
|
||||||
goBehaviorpoints() {
|
goBehaviorpoints() {
|
||||||
|
const value = uni.getStorageSync('userinfo');
|
||||||
|
const value2 = uni.getStorageSync('patientId');
|
||||||
|
if (value && value2) {
|
||||||
if (uni.getStorageSync('region') == 3) {
|
if (uni.getStorageSync('region') == 3) {
|
||||||
this.$refs.uToast.show({
|
this.$refs.uToast.show({
|
||||||
title: '当前地区不支持,请选择其它地区',
|
title: '当前地区不支持,请选择其它地区',
|
||||||
@ -513,6 +516,9 @@
|
|||||||
url: '/pagesB/Behaviorpoints/Behaviorpoints'
|
url: '/pagesB/Behaviorpoints/Behaviorpoints'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.gologin();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 切换家庭成员
|
// 切换家庭成员
|
||||||
homeshow() {
|
homeshow() {
|
||||||
|
|||||||
@ -14,29 +14,42 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 500rpx;
|
height: 500rpx;
|
||||||
}
|
}
|
||||||
|
.wxSport{
|
||||||
.Exchangerecords {
|
width: 25%;
|
||||||
width: 180rpx;
|
|
||||||
height: 54rpx;
|
height: 54rpx;
|
||||||
background: #00785C;
|
background: #00785C;
|
||||||
border-radius: 24rpx;
|
border-radius: 24rpx;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0%;
|
bottom: 0%;
|
||||||
right: 15%;
|
right: 6%;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
border: 2rpx solid #00785C;
|
||||||
|
line-height: 54rpx;
|
||||||
|
}
|
||||||
|
.Exchangerecords {
|
||||||
|
width: 25%;
|
||||||
|
height: 54rpx;
|
||||||
|
background: #00785C;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border: 2rpx solid #00785C;
|
border: 2rpx solid #00785C;
|
||||||
line-height: 54rpx;
|
line-height: 54rpx;
|
||||||
}
|
}
|
||||||
.PointsMall {
|
.PointsMall {
|
||||||
width: 180rpx;
|
width: 25%;
|
||||||
height: 54rpx;
|
height: 54rpx;
|
||||||
border: 2rpx solid #00785C;
|
border: 2rpx solid #00785C;
|
||||||
background: #00785C;
|
background: #00785C;
|
||||||
border-radius: 24rpx;
|
border-radius: 24rpx;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0%;
|
bottom: 0%;
|
||||||
left: 15%;
|
left: 6%;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 54rpx;
|
line-height: 54rpx;
|
||||||
|
|||||||
@ -15,6 +15,9 @@
|
|||||||
<view class="Exchangerecords" @tap="goexchange" :style="region!=2?'bottom:15%':''">
|
<view class="Exchangerecords" @tap="goexchange" :style="region!=2?'bottom:15%':''">
|
||||||
兑换记录
|
兑换记录
|
||||||
</view>
|
</view>
|
||||||
|
<view class="wxSport" @tap="gowxSport" :style="region!=2?'bottom:15%':''">
|
||||||
|
微信运动
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bottomitem">
|
<view class="bottomitem">
|
||||||
<view class="PointsRecord">
|
<view class="PointsRecord">
|
||||||
@ -90,6 +93,11 @@
|
|||||||
this.total = res.total
|
this.total = res.total
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
gowxSport() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pagesC/wxSport/wxSport"
|
||||||
|
})
|
||||||
|
},
|
||||||
goexchange() {
|
goexchange() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pagesB/exchangerecords/exchangerecords'
|
url: '/pagesB/exchangerecords/exchangerecords'
|
||||||
|
|||||||
BIN
pagesC/images/sport.png
Normal file
BIN
pagesC/images/sport.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
164
pagesC/wxSport/wxSport.vue
Normal file
164
pagesC/wxSport/wxSport.vue
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
<template>
|
||||||
|
<view class="app">
|
||||||
|
<view class="item" v-for="item in list" :key="item.date">
|
||||||
|
<view class="left">
|
||||||
|
<image mode="" :src="require('@/pagesC/images/sport.png')" @tap="goconsultationplatform"></image>
|
||||||
|
<view class="time">
|
||||||
|
{{item.date}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="right">
|
||||||
|
<view class="number">
|
||||||
|
{{item.step}}
|
||||||
|
</view>
|
||||||
|
<view class="text">
|
||||||
|
步数
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
wxSportDecrypt,
|
||||||
|
wxsportadd
|
||||||
|
} from '@/api/pages/homepage/homepage.js'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: undefined,
|
||||||
|
userinfo: undefined,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.userinfo = uni.getStorageSync('userinfo')
|
||||||
|
this.getStepInfo();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
wxSport(res, resp) {
|
||||||
|
let currentDate = new Date();
|
||||||
|
let year = currentDate.getFullYear();
|
||||||
|
let month = currentDate.getMonth() + 1;
|
||||||
|
let day = currentDate.getDate();
|
||||||
|
month >= 1 && month <= 9 ? (month = "0" + month) : "";
|
||||||
|
day >= 0 && day <= 9 ? (day = "0" + day) : "";
|
||||||
|
let time = `${year}-${month}-${day}`
|
||||||
|
let wxsportaddtime = uni.getStorageSync('wxsportaddtime');
|
||||||
|
let obj = {
|
||||||
|
code: res.code,
|
||||||
|
encryptedData: resp.encryptedData,
|
||||||
|
iv: resp.iv
|
||||||
|
}
|
||||||
|
wxSportDecrypt(obj).then(Sportres => {
|
||||||
|
this.list = Sportres.data
|
||||||
|
if (wxsportaddtime != time) {
|
||||||
|
if (Sportres.data && Sportres.data[0].step >= 5000) {
|
||||||
|
wxsportadd(this.userinfo.cardNo).then(sportaddres => {
|
||||||
|
if (sportaddres.code == 200) {
|
||||||
|
uni.setStorageSync('wxsportaddtime', Sportres.data[0].date);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getStepInfo() {
|
||||||
|
let that = this
|
||||||
|
wx.getSetting({
|
||||||
|
success: function(res) {
|
||||||
|
// 未开启微信运动授权
|
||||||
|
if (!res.authSetting['scope.werun']) {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '获取微信运动步数,需要开启计步权限',
|
||||||
|
success: function(resp) {
|
||||||
|
if (resp.confirm) {
|
||||||
|
//跳转去设置
|
||||||
|
wx.openSetting({
|
||||||
|
success: function(respp) {}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
wx.login({
|
||||||
|
success: function(loginres) {
|
||||||
|
if (loginres.code) {
|
||||||
|
wx.getWeRunData({
|
||||||
|
success: function(WeRunDatares) {
|
||||||
|
that.wxSport(loginres, WeRunDatares)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: function(err) {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '未开通微信运动,请关注“微信运动”公众号后重试',
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: '知道了'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.app {
|
||||||
|
width: 100%;
|
||||||
|
padding-bottom: 50rpx;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
width: 96%;
|
||||||
|
margin: 20rpx auto;
|
||||||
|
height: 200rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
|
||||||
|
.right {
|
||||||
|
width: 44%;
|
||||||
|
height: 160rpx;
|
||||||
|
margin: 20rpx 0;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333333;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.text {
|
||||||
|
line-height: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.number {
|
||||||
|
line-height: 100rpx;
|
||||||
|
font-size: 56rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.left {
|
||||||
|
width: 54%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 160rpx;
|
||||||
|
margin: 20rpx 0;
|
||||||
|
border-right: 2rpx solid #DBDBDB;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 90rpx;
|
||||||
|
height: 90rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.time {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user