This commit is contained in:
parent
f92a3bbdf6
commit
ae33f415b0
|
|
@ -56,6 +56,7 @@ export const discSpinningdraw = (data) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export const selectUserMoney = (data) => {
|
export const selectUserMoney = (data) => {
|
||||||
return http.request({
|
return http.request({
|
||||||
url: '/moneyDetails/selectUserMoney',
|
url: '/moneyDetails/selectUserMoney',
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,14 @@ export const selectTaskCenter = (data) => {
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 兑换列表
|
||||||
|
export const selectTaskCenterUserReward = (data) => {
|
||||||
|
return http.request({
|
||||||
|
url: '/taskCenterReward/selectTaskCenterUserReward',
|
||||||
|
data,
|
||||||
|
isreturm:true
|
||||||
|
})
|
||||||
|
}
|
||||||
// 获取签到
|
// 获取签到
|
||||||
export const getUserSignData = (data) => {
|
export const getUserSignData = (data) => {
|
||||||
return http.request({
|
return http.request({
|
||||||
|
|
@ -14,6 +22,12 @@ export const getUserSignData = (data) => {
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export const receiveGoods = (data) => {
|
||||||
|
return http.request({
|
||||||
|
url: 'taskCenter/receiveGoods',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
// 任务-签到
|
// 任务-签到
|
||||||
export const taskReceive = (data) => {
|
export const taskReceive = (data) => {
|
||||||
return http.request({
|
return http.request({
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ function commonsProcess(showLoading, httpReqCallback, isreturm) {
|
||||||
// 避免混淆重新命名
|
// 避免混淆重新命名
|
||||||
let bodyData = data;
|
let bodyData = data;
|
||||||
if (isreturm) {
|
if (isreturm) {
|
||||||
return Promise.resolve(bodyData.data || bodyData.page || bodyData);
|
return Promise.resolve(bodyData);
|
||||||
}
|
}
|
||||||
if (statusCode == 500) {
|
if (statusCode == 500) {
|
||||||
isShowErrorToast = true;
|
isShowErrorToast = true;
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,35 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="cell " v-for="(item, index) in datas.list" :key="index">
|
<view class="cell " v-for="(item, index) in datas.list" :key="index">
|
||||||
<view class="cell_left ">
|
<view class="cell_left ">
|
||||||
<image class="cell_icon" :src="item.url"></image>
|
<image class="cell_icon" :src="item.img"></image>
|
||||||
<view class="cell_title ">
|
<view class="cell_title ">
|
||||||
<view class=" title">{{ item.name }}</view>
|
<view class=" title">{{ item.name }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view class="cell_right" v-if="datas.standard=='true'">
|
||||||
|
<viwe v-if="!datas.receive">
|
||||||
|
<view class="btn" @click="taskReceive(item)">领取</view>
|
||||||
|
</viwe>
|
||||||
|
<view v-else>
|
||||||
|
<view v-if="item.disabled">
|
||||||
|
<view class="btn disabled">领取</view>
|
||||||
|
</view>
|
||||||
|
<view v-else>
|
||||||
|
<view v-if="!item.targetId" class="btn" @click="toDuiHuan(item)">去兑换</view>
|
||||||
|
<view v-else class="btn receive">已兑换</view>
|
||||||
|
<u-image v-if="!item.targetId" class="icon"
|
||||||
|
style=" width: 32rpx!important;height: 36rpx!important;position: absolute; right: 0;bottom: 0;"
|
||||||
|
src="@/static/task/receive2.png"></u-image>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<image v-else src="@/static/task/receive1.png"
|
||||||
|
style="width: 130rpx!important;height: 130rpx!important;position: absolute; right: 0;bottom: 0;"
|
||||||
|
mode=""></image>
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -25,32 +49,89 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref, onMounted, onUnmounted, getCurrentInstance } from 'vue'
|
import {
|
||||||
|
reactive,
|
||||||
|
ref,
|
||||||
|
onMounted,
|
||||||
|
onUnmounted,
|
||||||
|
getCurrentInstance
|
||||||
|
} from 'vue'
|
||||||
import {
|
import {
|
||||||
onLoad
|
onLoad
|
||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
import { selectDiscSpinning } from '@/api/task/index.js'
|
import {
|
||||||
|
selectTaskCenterUserReward
|
||||||
|
} from '@/api/task/index.js'
|
||||||
let datas = reactive({
|
let datas = reactive({
|
||||||
list: [],
|
list: [],
|
||||||
source: null
|
source: null,
|
||||||
|
standard: true,
|
||||||
|
receive: null,
|
||||||
|
record: null,
|
||||||
|
taskId: "",
|
||||||
|
|
||||||
})
|
})
|
||||||
onLoad(options => {
|
onLoad(options => {
|
||||||
|
console.log(options, '调试1')
|
||||||
|
if (options.source) {
|
||||||
datas.source = options.source
|
datas.source = options.source
|
||||||
|
}
|
||||||
|
if (options.standard) {
|
||||||
|
datas.standard = options.standard
|
||||||
|
}
|
||||||
|
if (options.taskId) {
|
||||||
|
datas.taskId = options.taskId
|
||||||
|
}
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
|
// 去兑换
|
||||||
|
function toDuiHuan(item) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/index/prizeDraw/duihuan?id=${datas.record}&foreignType=task`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 领取
|
||||||
|
*/
|
||||||
|
async function taskReceive(item) {
|
||||||
|
let res = await receiveGoods({
|
||||||
|
taskId: datas.taskId,
|
||||||
|
sourceId: item.id
|
||||||
|
})
|
||||||
|
uni.showToast({
|
||||||
|
title: '领取成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
getList()
|
||||||
|
}
|
||||||
async function getList() {
|
async function getList() {
|
||||||
let res = await selectDiscSpinning({ source: datas.source })
|
let res = await selectTaskCenterUserReward({
|
||||||
datas.list = res.records
|
taskId: datas.taskId
|
||||||
|
})
|
||||||
|
if (res.code == 0) {
|
||||||
|
datas.list = res.data
|
||||||
|
datas.list.map(item => {
|
||||||
|
item.disabled = true
|
||||||
|
})
|
||||||
|
datas.receive = res.receive
|
||||||
|
datas.record = res.record
|
||||||
|
if (datas.receive) {
|
||||||
|
datas.list.map(item => {
|
||||||
|
if (item.id == datas.receive) {
|
||||||
|
item.disabled = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.container {
|
.container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
// display: flex;
|
// display: flex;
|
||||||
// flex-direction: column;
|
// flex-direction: column;
|
||||||
|
|
@ -111,6 +192,7 @@ async function getList() {
|
||||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||||
margin-bottom: 32rpx;
|
margin-bottom: 32rpx;
|
||||||
padding: 32rpx 28rpx;
|
padding: 32rpx 28rpx;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.cell_left {
|
.cell_left {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -189,5 +271,45 @@ async function getList() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.cell_right {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
width: 148rpx;
|
||||||
|
height: 56rpx;
|
||||||
|
line-height: 56rpx;
|
||||||
|
text-align: center;
|
||||||
|
background: #6DA9F7;
|
||||||
|
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
border: 2rpx solid transparent;
|
||||||
|
position: relative;
|
||||||
|
z-index: 99;
|
||||||
|
}
|
||||||
|
|
||||||
|
.opt {
|
||||||
|
color: #D39B7E;
|
||||||
|
background-color: #FBF3EB;
|
||||||
|
}
|
||||||
|
|
||||||
|
.disabled {
|
||||||
|
color: #999999;
|
||||||
|
background-color: #E2E2E2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.receive {
|
||||||
|
background: rgba(178, 223, 255, 0.62);
|
||||||
|
border: 2rpx solid #6DA9F7;
|
||||||
|
color: #6DA9F7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
Loading…
Reference in New Issue