This commit is contained in:
2024-03-05 09:57:45 +08:00
parent fba7bfa96e
commit b737424eb3
7 changed files with 117 additions and 49 deletions

View File

@ -62,3 +62,14 @@ export function wxsportadd(identity) {
}, },
}) })
} }
// 手动增加积分接口
export function wxsportaddV1(identity, date) {
return request({
url: `/applet/score/record/wxsport/addV1/${identity}/${date}/WX_SPORT_STEP_NUM`,
method: 'get',
header: {
region: uni.getStorageSync('region'),
},
})
}

View File

@ -21,13 +21,3 @@ export function prizeExchangesave(data) {
} }
}) })
} }
//获取图片接口
export function getImgById(prizeId) {
return request({
url: `/applet/score/prize/getImgById/${prizeId}`,
method: 'get',
header: {
region: uni.getStorageSync('region'),
}
})
}

View File

@ -0,0 +1,30 @@
import baseurl from '../../baseurl.js'
var request = function(config) {
return new Promise((resolve, rejected) => {
uni.request({
url: baseurl + config.url,
data: config.data,
method: config.method,
timeout: 60000,
header: config.header,
success(res) {
resolve(res.data)
},
fail(err) {
rejected(err)
}
})
})
}
//获取图片接口
export function getImgById(prizeId) {
return request({
url: `/applet/score/prize/getImgById/${prizeId}`,
method: 'get',
header: {
region: uni.getStorageSync('region'),
}
})
}

View File

@ -2,7 +2,8 @@
<view class="app"> <view class="app">
<view class="contents" v-if="list&&list.length>0"> <view class="contents" v-if="list&&list.length>0">
<view class="content" v-for="item in list"> <view class="content" v-for="item in list">
<image :src="item.src" mode=""></image> <!-- <image :src="item.src" mode=""></image> -->
<u-image width="100%" height="355rpx" :src="item.src"></u-image>
<view class="servename"> <view class="servename">
{{item.prizeName?item.prizeName:''}} {{item.prizeName?item.prizeName:''}}
</view> </view>
@ -25,8 +26,10 @@
import { import {
prizelist, prizelist,
prizeExchangesave, prizeExchangesave,
getImgById
} from '@/api/pagesB/PointsMall/index.js' } from '@/api/pagesB/PointsMall/index.js'
import {
getImgById
} from '@/api/pagesB/getimg/index.js'
export default { export default {
data() { data() {
return { return {
@ -35,7 +38,7 @@
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
}, },
list: null, list: [],
total: 0, total: 0,
}; };
}, },
@ -75,9 +78,14 @@
res.rows.forEach(e => { res.rows.forEach(e => {
e.src = '' e.src = ''
}) })
this.list = res.rows this.list = [
...this.list,
...res.rows
]
this.list.forEach(async (e) => { this.list.forEach(async (e) => {
e.src = await this.getimg(e.prizeId); if (e.src == '') {
e.src = await this.getimg(e.prizeId);
}
}); });
this.total = res.total this.total = res.total
}) })
@ -87,30 +95,17 @@
const res = await getImgById(id); const res = await getImgById(id);
return res.data return res.data
} catch (error) { } catch (error) {
console.log(error);
return null; return null;
} }
// getImgById(id).then(res => {
// console.log(res)
// return res.data
// })
}, },
}, },
onLoad() { onLoad() {
this.info(); this.info();
}, },
onReachBottom() { // onReachBottom() { //
if (this.list.length >= this.total) {} else { if (this.list.length >= this.total) {} else {
this.query.pageNum++ this.query.pageNum++
prizelist(this.query).then(res => { this.info();
if (res.rows) {
res.rows.forEach(e => {
e.src = ''
e.src = this.getimg(e.prizeId)
this.list.push(e)
})
}
})
} }
}, },
onPullDownRefresh() { // onPullDownRefresh() { //
@ -144,6 +139,7 @@
position: relative; position: relative;
border-radius: 5rpx; border-radius: 5rpx;
margin: 0 0 20rpx 0; margin: 0 0 20rpx 0;
border: 1px solid #fff;
.button { .button {
width: 100rpx; width: 100rpx;
@ -178,7 +174,7 @@
padding-left: 3%; padding-left: 3%;
} }
image { ::v-deep .u-image {
width: 100%; width: 100%;
height: 355rpx; height: 355rpx;
border-radius: 5rpx; border-radius: 5rpx;

View File

@ -8,7 +8,7 @@
{{item.score?item.score:0}} 积分 {{item.score?item.score:0}} 积分
</span> </span>
</view> </view>
<image :src="item.prizeBase64" mode=""></image> <u-image width="180rpx" height="180rpx" :src="item.src"></u-image>
<view class="servename"> <view class="servename">
{{item.prizeName?item.prizeName:''}} {{item.prizeName?item.prizeName:''}}
</view> </view>
@ -25,6 +25,9 @@
import { import {
prizeExchangelist prizeExchangelist
} from '@/api/pagesB/exchangerecords/index.js' } from '@/api/pagesB/exchangerecords/index.js'
import {
getImgById
} from '@/api/pagesB/getimg/index.js'
export default { export default {
data() { data() {
return { return {
@ -41,9 +44,28 @@
this.info() this.info()
}, },
methods: { methods: {
async getimg(id) {
try {
const res = await getImgById(id);
return res.data
} catch (error) {
return null;
}
},
info() { info() {
prizeExchangelist(this.query).then(res => { prizeExchangelist(this.query).then(res => {
this.list = res.rows res.rows.forEach(e => {
e.src = ''
})
this.list = [
...this.list,
...res.rows
]
this.list.forEach(async (e) => {
if (e.src == '') {
e.src = await this.getimg(e.prizeId);
}
});
this.total = res.total this.total = res.total
}) })
}, },
@ -51,13 +73,7 @@
onReachBottom() { // onReachBottom() { //
if (this.list.length >= this.total) {} else { if (this.list.length >= this.total) {} else {
this.query.pageNum++ this.query.pageNum++
prizeExchangelist(this.query).then(res => { this.info();
if (res.rows) {
res.rows.forEach(e => {
this.list.push(e)
})
}
})
} }
}, },
onPullDownRefresh() { // onPullDownRefresh() { //
@ -75,9 +91,11 @@
width: 100%; width: 100%;
text-align: justify; text-align: justify;
padding: 25rpx 0 30rpx 0; padding: 25rpx 0 30rpx 0;
::v-deep .u-empty{
::v-deep .u-empty {
margin-top: 25vh !important; margin-top: 25vh !important;
} }
.content { .content {
width: 90%; width: 90%;
height: 321rpx; height: 321rpx;
@ -111,7 +129,7 @@
white-space: nowrap; white-space: nowrap;
} }
image { ::v-deep .u-image {
position: absolute; position: absolute;
left: 3%; left: 3%;
top: 28%; top: 28%;

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -1,28 +1,31 @@
<template> <template>
<view class="app"> <view class="app">
<view class="item" v-for="item in list" :key="item.date"> <view class="item" v-for="item in list" :key="item.date" @tap="tapstep(item)">
<view class="left"> <view class="left">
<image mode="" :src="require('@/pagesC/images/sport.png')" @tap="goconsultationplatform"></image> <image v-if="item.step>=5000" mode="" :src="require('@/pagesC/images/greensport.png')"></image>
<view class="time"> <image mode="" v-else :src="require('@/pagesC/images/sport.png')"></image>
<view class="time" :style="item.step>=5000?'color:#29AF2A':''">
{{item.date}} {{item.date}}
</view> </view>
</view> </view>
<view class="right"> <view class="right">
<view class="number"> <view class="number" :style="item.step>=5000?'color:#29AF2A':''">
{{item.step}} {{item.step}}
</view> </view>
<view class="text"> <view class="text" :style="item.step>=5000?'color:#29AF2A':''">
步数 步数
</view> </view>
</view> </view>
</view> </view>
<u-toast ref="uToast" />
</view> </view>
</template> </template>
<script> <script>
import { import {
wxSportDecrypt, wxSportDecrypt,
wxsportadd wxsportadd,
wxsportaddV1
} from '@/api/pages/homepage/homepage.js' } from '@/api/pages/homepage/homepage.js'
export default { export default {
data() { data() {
@ -37,6 +40,26 @@
this.getStepInfo(); this.getStepInfo();
}, },
methods: { methods: {
tapstep(item) {
if (item.step >= 5000) {
console.log(item)
wxsportaddV1(uni.getStorageSync('userinfo').cardNo, item.date).then(res => {
if (res.code == 200) {
this.$refs.uToast.show({
title: '新增积分成功',
duration: '1500',
type: 'success',
})
} else {
this.$refs.uToast.show({
title: res.msg,
duration: '1500',
type: 'error',
})
}
})
}
},
wxSport(res, resp) { wxSport(res, resp) {
let currentDate = new Date(); let currentDate = new Date();
let year = currentDate.getFullYear(); let year = currentDate.getFullYear();