This commit is contained in:
2024-03-04 17:42:30 +08:00
parent 48b280a450
commit fba7bfa96e
2 changed files with 34 additions and 2 deletions

View File

@ -21,3 +21,13 @@ 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

@ -2,7 +2,7 @@
<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.attachment" mode=""></image> <image :src="item.src" mode=""></image>
<view class="servename"> <view class="servename">
{{item.prizeName?item.prizeName:''}} {{item.prizeName?item.prizeName:''}}
</view> </view>
@ -24,7 +24,8 @@
<script> <script>
import { import {
prizelist, prizelist,
prizeExchangesave prizeExchangesave,
getImgById
} from '@/api/pagesB/PointsMall/index.js' } from '@/api/pagesB/PointsMall/index.js'
export default { export default {
data() { data() {
@ -71,10 +72,29 @@
}, },
info() { info() {
prizelist(this.query).then(res => { prizelist(this.query).then(res => {
res.rows.forEach(e => {
e.src = ''
})
this.list = res.rows this.list = res.rows
this.list.forEach(async (e) => {
e.src = await this.getimg(e.prizeId);
});
this.total = res.total this.total = res.total
}) })
}, },
async getimg(id) {
try {
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() { onLoad() {
this.info(); this.info();
@ -85,6 +105,8 @@
prizelist(this.query).then(res => { prizelist(this.query).then(res => {
if (res.rows) { if (res.rows) {
res.rows.forEach(e => { res.rows.forEach(e => {
e.src = ''
e.src = this.getimg(e.prizeId)
this.list.push(e) this.list.push(e)
}) })
} }