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