更新代码

This commit is contained in:
duan
2025-01-07 17:10:57 +08:00
parent e41396774b
commit 62c768be02
37 changed files with 5377 additions and 91 deletions

View File

@@ -1,79 +1,193 @@
<template>
<view class="task_bg u-absolute">
<image class="task_bg" src="@/static/task/task_bg.png"></image>
</view>
<view class="icon">
<image class="task_icon1" src="@/static/task/task_icon1.png"></image>
<view class="icon_title">新人好礼送不停</view>
<image class="task_icon2" src="@/static/task/task_icon2.png"></image>
</view>
<view style="background-color: #F3F4F8;">
<view class="contentTop ">
<view>
<image src="@/static/task/renwubg.png" mode=""></image>
<view>已连续签到 <text class="num">{{ datas.signDays }}</text> </view>
<view class="task_bg u-absolute">
<image class="task_bg" src="@/static/task/task_bg.png"></image>
</view>
<view>
<view v-for="item in datas.signInList" :key="item.id"
:style="item.status == 1 ? 'color:#EFA765' : 'color:#999'">
{{ item.status == 1 ? '已签到' : '待签到' }}
<view :style="item.status == 1 ? 'color:#999' : 'color:#EFA765'">
{{ item.signDay.substr(5, 8) }}
<view class="icon">
<image class="task_icon1" src="@/static/task/task_icon1.png"></image>
<view class="icon_title">新人好礼送不停</view>
<image class="task_icon2" src="@/static/task/task_icon2.png"></image>
</view>
<view class="contentTop ">
<view>
<image src="@/static/task/renwubg.png" mode=""></image>
<view>已连续签到 <text class="num">{{ datas.signDays }}</text> </view>
</view>
<view>
<view v-for="item in datas.signInList" :key="item.id"
:style="item.status == 1 ? 'color:#EFA765' : 'color:#999'">
{{ item.status == 1 ? '已签到' : '待签到' }}
<view :style="item.status == 1 ? 'color:#999' : 'color:#EFA765'">
{{ item.signDay.substr(5, 8) }}
</view>
<image v-if="item.status == 0" src="@/static/task/xing (1).png" mode=""></image>
<image v-else src="@/static/task/xing (2).png" mode=""> </image>
</view>
<image v-if="item.status == 0" src="@/static/task/xing (1).png" mode=""></image>
<image v-else src="@/static/task/xing (2).png" mode="">
</image>
</view>
</view>
</view>
<!-- <view class="content margin-lr padding bg-white u-relative" v-if="list.length">
<view class="cell flex justify-between" v-for="(item, index) in list" :key="index" v-if="item.shows">
<view class="cell_left flex">
<view class="cell_title flex">
<view class="u-font-28 text-bold title"
:style="{ alignSelf: item.rewardImg ? 'center' : 'flex-start' }">{{ item.title }}</view>
<u-image v-if="item.rewardImg" class="cell_icon" :src="item.rewardImg"></u-image>
<view class="u-font-24 tip">{{ item.rewardDetail }}</view>
<view class="content " v-if="datas.list.length">
<view class="cell " v-for="(item, index) in datas.list" :key="index">
<view class="cell_left ">
<view class="cell_title ">
<view class=" title" :style="{ alignSelf: item.rewardImg ? 'center' : 'flex-start' }">{{
item.title
}}</view>
<image v-if="item.rewardImg" class="cell_icon" :src="item.rewardImg" mode=""></image>
<view class="tip">{{ item.rewardDetail }}</view>
</view>
<view class="subhead ">{{ item.detail }}</view>
</view>
<view class="subhead u-font-24">{{ item.detail }}</view>
</view>
<view class="cell_right flex">
<view v-if="item.disabled" class="btn u-font-24 text-bold"
:style="{ backgroundColor: item.buttonBgColor, color: item.buttonFontColor }" @click="goNav(item)">
{{ item.type == 1 ? item.buttonTitle : item.number ? `${item.discNumber}/${item.number}` : (
item.discNumber <= 0 ? item.buttonTitle : `剩余${item.discNumber}`) }} </view>
<view v-else class="btn u-font-24 text-bold disabled">
{{ item.type == 1 ? item.buttonTitle : item.number ? `${item.discNumber}/${item.number}`
: (item.discNumber <= 0 ? item.buttonTitle : `剩余${item.discNumber}`) }} </view>
<view v-if="item.buttonUnderContent && item.buttonUnderUrl" class="u-font-22 tip"
@click="goNav({ id: item.id, buttonUrl: item.buttonUnderUrl, jumpType: 1, title: item.title, disabled: item.disabled, discNumber: item.discNumber })">
<view class="cell_right ">
<view v-if="item.disabled" class="btn "
:style="{ backgroundColor: item.buttonBgColor, color: item.buttonFontColor }"
@tap="goNav(item)">
{{ item.type == 1 ? item.buttonTitle : item.number ? `${item.discNumber}/${item.number}` : (
item.discNumber <= 0 ? item.buttonTitle : `剩余${item.discNumber}`) }} </view>
<view v-else class="btn disabled">
{{ item.type == 1 ? item.buttonTitle : item.number ? `${item.discNumber}/${item.number}`
: (item.discNumber <= 0 ? item.buttonTitle : `剩余${item.discNumber}`) }} <view
v-if="item.buttonUnderContent && item.buttonUnderUrl" class=" tip"
@tap="goNav(item, item.buttonUnderUrl)">
{{ item.buttonUnderContent }}
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view> -->
<!-- 激励视频广告 -->
<!-- <ad-rewarded-video v-if="adRewardedVideo" ref="adRewardedVideo" adpid="1531580352" :loadnext="true"
v-slot:default="{ loading, error }" :url-callback="datas.urlCallback" @load="onadload" @close="onadclose"
@error="onaderror">
<view class="ad-error" v-if="error">{{ error }}</view>
</ad-rewarded-video> -->
</view>
</template>
<script setup>
import {
reactive,
watch
getCurrentInstance, nextTick
} from "vue";
import {
onShow, onReachBottom
} from '@dcloudio/uni-app'
import { getUserSignData } from '@/api/task/index.js'
import { getUserSignData, selectTaskCenter, taskReceive } from '@/api/task/index.js'
const currentInstance = getCurrentInstance()
let datas = reactive({
signDays: 0,
signInList: [],
list: [],
// ios审核
isExamine: uni.getStorageSync('isExamine'),
urlCallback: {},
adRewardedVideo: true,
})
onShow(() => {
// this.getTaskdata()
getTaskdata()
getsignIn()
// nextTick(() => {
// currentInstance.ctx.$refs.adRewardedVideo.load();
// })
})
//广告播放成功回调
async function onadclose(e) {
const detail = e.detail
if (detail && detail.isEnded) {
// 正常播放结束
// /sqx_fast/app/ad/state
let res = await this.$Request.getT('app/ad/state', {
extraKey: this.urlCallback.extra
})
this.$Request.getT('/app/common/type/921').then(res => {
if (res.code == 0) {
console.log(res)
uni.showToast({
title: '获得' + res.data.value + '分钟免费时长',
icon: 'none'
})
}
})
} else {
// 播放中途退出
}
}
async function goNav(item, url) {
// jumpType (integer, optional): 跳转类型 1 内部路径 2 外部路径 ,
// type (integer, optional): 任务类型 1 普通任务 2 打卡任务 9 其它 ,
if (url) {
console.log(url, 'debug12')
let urls = ''
if (url == '/pages/task/prizeList') {
urls = url + '?source=2'
}
if (url == '/pages/task/receiveMember') {
urls = url + `?standard=${item.discNumber == null ? true : false}&taskId=${item.id}`
}
uni.navigateTo({
url: urls
})
} else {
if (item.jumpType == 0) {
if (item.title.indexOf("新人福利") != -1) {
let res = await taskReceive({ id: item.id })
if (res.code == 0) {
uni.showToast({
title: res.id == 15 ? '签到成功' : '领取成功',
icon: 'none'
})
setTimeout(() => {
getTaskdata()
getsignIn()
}, 1000)
} else {
uni.switchTab({
url: '/pages/index/index'
})
}
} else if (item.buttonTitle.indexOf("观看视频") != -1) {
// 首次加载广告
datas.urlCallback = {
userId: uni.getStorageSync('userId'),
extra: uni.getStorageSync('userId') + "" + new Date().getTime(),
}
currentInstance.ctx.$refs.adRewardedVideo.show();
} else {
uni.switchTab({
url: "/pages/index/index"
})
}
} else if (item.jumpType == 1) {
let buttonUrl = item.buttonUrl
console.log(buttonUrl, 'debug')
if (item.title && item.title.indexOf('每周打卡奖励') != -1) {
buttonUrl = item.buttonUrl + '?source=2'
}
if (item.title && item.title.indexOf('每月打卡奖励1') != -1) {
buttonUrl = item.buttonUrl + '?source=3'
}
if (item.title && item.title.indexOf('每月打卡奖励2') != -1) {
buttonUrl = `${item.buttonUrl}?standard=${item.discNumber == null ? true : false}&taskId=${item.id}`
}
uni.navigateTo({
url: buttonUrl
})
} else if (item.jumpType == 3) {
uni.switchTab({
url: item.buttonUrl
})
}
}
}
function onadload(e) {
datas.adRewardedVideo = true;
}
// 获得签到
async function getsignIn() {
let res = await getUserSignData()
@@ -81,24 +195,20 @@ async function getsignIn() {
datas.signDays = res.signDays
}
// 获取任务列表
function getTaskdata() {
this.$Request.getT('/app/taskCenter/selectTaskCenter', {}).then(res => {
if (res.code == 0) {
if (!this.isShowMoneyPay) {
let arrData = []
res.data.forEach(ele => {
if (ele.title.indexOf('分享奖励') == -1 && ele.title.indexOf('新人福利') == -1 &&
ele.title.indexOf('观看视频奖励') == -1) {
arrData.push(ele)
}
})
this.list = arrData
} else {
this.list = res.data
async function getTaskdata() {
let res = await selectTaskCenter()
if (!datas.isExamine) {
let arrData = []
res.forEach(ele => {
if (ele.title.indexOf('分享奖励') == -1 && ele.title.indexOf('新人福利') == -1 &&
ele.title.indexOf('观看视频奖励') == -1) {
arrData.push(ele)
}
}
uni.stopPullDownRefresh();
})
})
datas.list = arrData
} else {
datas.list = res
}
}
</script>
@@ -142,10 +252,12 @@ function getTaskdata() {
}
.contentTop {
margin-bottom: 32rpx;
border-radius: 16rpx;
top: -126rpx;
padding: 30rpx;
top: -115rpx;
padding: 28rpx;
margin-bottom: 32rpx;
position: relative;
background-color: #ffffff;
color: #666666;
@@ -186,21 +298,118 @@ function getTaskdata() {
>view {
margin-top: 20rpx;
width: 80rpx;
width: 86rpx;
height: 94rpx;
background: linear-gradient(180deg, #FFF7E3 0%, #FFFFFF 100%);
border-radius: 14rpx 14rpx 0rpx 0rpx;
}
>image {
width: 52rpx;
height: 48rpx;
position: absolute;
top: 100rpx;
top: 110rpx;
left: 14rpx;
}
}
}
}
.content {
border-radius: 16rpx;
top: -115rpx;
padding: 28rpx;
background-color: #ffffff;
color: #666666;
margin-left: 32rpx;
margin-right: 32rpx;
position: relative;
border-radius: 16rpx;
top: -115rpx;
padding: 28rpx;
.cell {
padding: 32rpx 0;
border-bottom: 2rpx solid #EBEBEB;
display: flex;
justify-content: space-between;
.cell_left {
flex-direction: column;
margin-top: 10rpx;
.cell_title {
margin-bottom: 12rpx;
color: #333;
display: flex;
.title {
display: flex;
flex-shrink: 0;
font-size: 28rpx;
font-weight: bold;
}
.cell_icon {
width: 48rpx !important;
height: 34rpx !important;
margin-left: 16rpx;
}
.tip {
margin-left: 22rpx;
color: #FC5B67;
font-size: 24rpx;
}
}
.subhead {
color: #999;
font-size: 24rpx;
}
}
.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-color: #EC6F48;
color: #FFFFFF;
border-radius: 12rpx 12rpx 12rpx 12rpx;
font-size: 24rpx;
font-weight: bold;
}
.tip {
color: #EC6F48;
height: 44rpx;
line-height: 44rpx;
margin-top: 5rpx;
font-size: 22rpx;
}
.opt {
color: #D39B7E;
background-color: #FBF3EB;
}
.disabled {
color: #999999;
background-color: #E2E2E2;
}
}
}
.cell:last-child {
border-bottom: none;
}
}
</style>

89
pages/task/prizeList.vue Normal file
View File

@@ -0,0 +1,89 @@
<!-- 任务中心 -->
<template>
<view class="container">
<view class="task_bg "></view>
<view class="content " v-if="datas.list.length">
<view class="cell " v-for="(item, index) in datas.list" :key="index">
<image class="cell_icon" :src="item.url"></image>
<view class="name ">{{ item.name }}</view>
</view>
</view>
</view>
</template>
<script setup>
import { reactive, ref, onMounted, onUnmounted, getCurrentInstance } from 'vue'
import {
onLoad
} from '@dcloudio/uni-app'
import { selectDiscSpinning } from '@/api/task/index.js'
let datas = reactive({
list: [],
source: null
})
onLoad(options => {
datas.source = options.source
getList()
})
async function getList() {
let res = await selectDiscSpinning({ source: datas.source })
datas.list = res.records
}
</script>
<style lang="scss">
.container {
width: 100%;
height: 100vh;
.task_bg {
width: 100%;
height: 100%;
position: absolute;
top: 0;
background: url('../../static/task/prize_bg.png') no-repeat top center / cover;
}
.content {
z-index: 9;
padding: 370rpx 28rpx 0 28rpx;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
position: relative;
.cell {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
background: linear-gradient(315deg, #FFFFFF 0%, #F9E3D9 100%);
border-radius: 32rpx 32rpx 32rpx 32rpx;
border: 4rpx solid #FFFFFF;
margin-bottom: 48rpx;
padding: 36rpx 28rpx;
.cell_icon {
width: 244rpx !important;
height: 198rpx !important;
border-radius: 16rpx !important;
margin-bottom: 32rpx;
}
.name {
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
}
}
}
</style>

View File

@@ -0,0 +1,193 @@
<!-- 任务中心 -->
<template>
<view class="container">
<view class="task_bg ">
<image class="task_bg" src="@/static/task/member_bg.png" mode=""></image>
<view class="title ">每月打卡免费领</view>
</view>
<view class="content" v-if="datas.list.length">
<view class="title">
<view>打卡奖励</view>
<view class="tip">每月免费领</view>
</view>
<view class="cell " v-for="(item, index) in datas.list" :key="index">
<view class="cell_left ">
<image class="cell_icon" :src="item.url"></image>
<view class="cell_title ">
<view class=" title">{{ item.name }}</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import { reactive, ref, onMounted, onUnmounted, getCurrentInstance } from 'vue'
import {
onLoad
} from '@dcloudio/uni-app'
import { selectDiscSpinning } from '@/api/task/index.js'
let datas = reactive({
list: [],
source: null
})
onLoad(options => {
datas.source = options.source
getList()
})
async function getList() {
let res = await selectDiscSpinning({ source: datas.source })
datas.list = res.records
}
</script>
<style lang="scss">
.container {
width: 100%;
height: 100vh;
// display: flex;
// flex-direction: column;
.task_bg {
width: 100% !important;
height: 470rpx !important;
position: relative;
.title {
width: 314rpx;
height: 72rpx;
line-height: 72rpx;
text-align: center;
border-radius: 108rpx 108rpx 108rpx 108rpx;
border: 6rpx solid #3D6DC6;
font-weight: bold;
font-size: 34rpx;
color: #3D6DC6;
position: absolute;
top: 210rpx;
left: 26rpx;
}
}
.content {
color: #666666;
height: calc(100% - 410rpx);
border-radius: 16rpx;
top: -60rpx;
z-index: 9;
padding: 64rpx 28rpx;
background: linear-gradient(-45deg, #DDEAFC 0%, #FFFFFF 100%);
border-radius: 32rpx 32rpx 0rpx 0rpx;
overflow-y: auto;
position: relative;
>.title {
display: flex;
align-items: center;
font-weight: bold;
font-size: 32rpx;
color: #333333;
margin-bottom: 22rpx;
.tip {
font-weight: 400;
font-size: 24rpx;
color: #666666;
margin-left: 10rpx;
}
}
.cell {
display: flex;
align-items: center;
justify-content: space-between;
background: linear-gradient(90deg, #FFF4E0 0%, #FFFBF5 100%);
border-radius: 8rpx 8rpx 8rpx 8rpx;
margin-bottom: 32rpx;
padding: 32rpx 28rpx;
.cell_left {
display: flex;
flex-direction: row;
align-items: center;
.cell_icon {
width: 84rpx !important;
height: 84rpx !important;
margin-right: 30rpx;
border-radius: 4rpx !important;
}
.cell_title {
display: flex;
align-items: center;
color: #333;
.title {
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
.tip {
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
}
}
.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;
}
.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;
}
}
}
.cell:last-child {
border-bottom: none;
}
}
}
</style>