修改
This commit is contained in:
parent
fba7bfa96e
commit
b737424eb3
@ -61,4 +61,15 @@ export function wxsportadd(identity) {
|
||||
region: uni.getStorageSync('region'),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 手动增加积分接口
|
||||
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'),
|
||||
},
|
||||
})
|
||||
}
|
||||
@ -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'),
|
||||
}
|
||||
})
|
||||
}
|
||||
30
api/pagesB/getimg/index.js
Normal file
30
api/pagesB/getimg/index.js
Normal 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'),
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -2,7 +2,8 @@
|
||||
<view class="app">
|
||||
<view class="contents" v-if="list&&list.length>0">
|
||||
<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">
|
||||
{{item.prizeName?item.prizeName:''}}
|
||||
</view>
|
||||
@ -25,8 +26,10 @@
|
||||
import {
|
||||
prizelist,
|
||||
prizeExchangesave,
|
||||
getImgById
|
||||
} from '@/api/pagesB/PointsMall/index.js'
|
||||
import {
|
||||
getImgById
|
||||
} from '@/api/pagesB/getimg/index.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -35,7 +38,7 @@
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
list: null,
|
||||
list: [],
|
||||
total: 0,
|
||||
};
|
||||
},
|
||||
@ -75,9 +78,14 @@
|
||||
res.rows.forEach(e => {
|
||||
e.src = ''
|
||||
})
|
||||
this.list = res.rows
|
||||
this.list = [
|
||||
...this.list,
|
||||
...res.rows
|
||||
]
|
||||
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
|
||||
})
|
||||
@ -87,30 +95,17 @@
|
||||
const res = await getImgById(id);
|
||||
return res.data
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return null;
|
||||
}
|
||||
// getImgById(id).then(res => {
|
||||
// console.log(res)
|
||||
// return res.data
|
||||
// })
|
||||
},
|
||||
},
|
||||
onLoad() {
|
||||
this.info();
|
||||
},
|
||||
onReachBottom() { //下滑加载
|
||||
onReachBottom() { //上滑加载
|
||||
if (this.list.length >= this.total) {} else {
|
||||
this.query.pageNum++
|
||||
prizelist(this.query).then(res => {
|
||||
if (res.rows) {
|
||||
res.rows.forEach(e => {
|
||||
e.src = ''
|
||||
e.src = this.getimg(e.prizeId)
|
||||
this.list.push(e)
|
||||
})
|
||||
}
|
||||
})
|
||||
this.info();
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() { //下拉刷新
|
||||
@ -144,6 +139,7 @@
|
||||
position: relative;
|
||||
border-radius: 5rpx;
|
||||
margin: 0 0 20rpx 0;
|
||||
border: 1px solid #fff;
|
||||
|
||||
.button {
|
||||
width: 100rpx;
|
||||
@ -178,7 +174,7 @@
|
||||
padding-left: 3%;
|
||||
}
|
||||
|
||||
image {
|
||||
::v-deep .u-image {
|
||||
width: 100%;
|
||||
height: 355rpx;
|
||||
border-radius: 5rpx;
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
{{item.score?item.score:0}} 积分
|
||||
</span>
|
||||
</view>
|
||||
<image :src="item.prizeBase64" mode=""></image>
|
||||
<u-image width="180rpx" height="180rpx" :src="item.src"></u-image>
|
||||
<view class="servename">
|
||||
{{item.prizeName?item.prizeName:''}}
|
||||
</view>
|
||||
@ -25,6 +25,9 @@
|
||||
import {
|
||||
prizeExchangelist
|
||||
} from '@/api/pagesB/exchangerecords/index.js'
|
||||
import {
|
||||
getImgById
|
||||
} from '@/api/pagesB/getimg/index.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -41,9 +44,28 @@
|
||||
this.info()
|
||||
},
|
||||
methods: {
|
||||
async getimg(id) {
|
||||
try {
|
||||
const res = await getImgById(id);
|
||||
return res.data
|
||||
} catch (error) {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
info() {
|
||||
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
|
||||
})
|
||||
},
|
||||
@ -51,13 +73,7 @@
|
||||
onReachBottom() { //下滑加载
|
||||
if (this.list.length >= this.total) {} else {
|
||||
this.query.pageNum++
|
||||
prizeExchangelist(this.query).then(res => {
|
||||
if (res.rows) {
|
||||
res.rows.forEach(e => {
|
||||
this.list.push(e)
|
||||
})
|
||||
}
|
||||
})
|
||||
this.info();
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() { //下拉刷新
|
||||
@ -75,9 +91,11 @@
|
||||
width: 100%;
|
||||
text-align: justify;
|
||||
padding: 25rpx 0 30rpx 0;
|
||||
::v-deep .u-empty{
|
||||
|
||||
::v-deep .u-empty {
|
||||
margin-top: 25vh !important;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 90%;
|
||||
height: 321rpx;
|
||||
@ -111,7 +129,7 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
image {
|
||||
::v-deep .u-image {
|
||||
position: absolute;
|
||||
left: 3%;
|
||||
top: 28%;
|
||||
@ -143,4 +161,4 @@
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
BIN
pagesC/images/greensport.png
Normal file
BIN
pagesC/images/greensport.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
@ -1,28 +1,31 @@
|
||||
<template>
|
||||
<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">
|
||||
<image mode="" :src="require('@/pagesC/images/sport.png')" @tap="goconsultationplatform"></image>
|
||||
<view class="time">
|
||||
<image v-if="item.step>=5000" mode="" :src="require('@/pagesC/images/greensport.png')"></image>
|
||||
<image mode="" v-else :src="require('@/pagesC/images/sport.png')"></image>
|
||||
<view class="time" :style="item.step>=5000?'color:#29AF2A':''">
|
||||
{{item.date}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="number">
|
||||
<view class="number" :style="item.step>=5000?'color:#29AF2A':''">
|
||||
{{item.step}}
|
||||
</view>
|
||||
<view class="text">
|
||||
<view class="text" :style="item.step>=5000?'color:#29AF2A':''">
|
||||
步数
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
wxSportDecrypt,
|
||||
wxsportadd
|
||||
wxsportadd,
|
||||
wxsportaddV1
|
||||
} from '@/api/pages/homepage/homepage.js'
|
||||
export default {
|
||||
data() {
|
||||
@ -37,6 +40,26 @@
|
||||
this.getStepInfo();
|
||||
},
|
||||
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) {
|
||||
let currentDate = new Date();
|
||||
let year = currentDate.getFullYear();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user