任务中心添加

This commit is contained in:
GaoHao 2024-12-05 14:38:36 +08:00
parent 3bcc491fc2
commit c7df084278
9 changed files with 274 additions and 1 deletions

258
me/task/index.vue Normal file
View File

@ -0,0 +1,258 @@
<!-- 任务中心 -->
<template>
<view class="container">
<view class="task_bg u-absolute">
<u-image class="task_bg" src="../../static/images/me/task_bg.png" ></u-image>
</view>
<view class="icon u-relative padding">
<u-image class="task_icon1 u-relative" src="../../static/images/me/task_icon1.png"></u-image>
<view class="icon_title u-font-32 text-bold u-relative">新人好礼送不停</view>
<u-image class="task_icon2 u-relative" src="../../static/images/me/task_icon2.png"></u-image>
</view>
<view class="content margin-lr padding bg-white u-relative">
<view class="cell flex justify-between" v-for="(item,index) in cellList" :key="index">
<view class="cell_left flex">
<view class="cell_title flex">
<view class="u-font-28 text-bold">{{ item.title}}</view>
<u-image v-if="item.icon" class="cell_icon" :src="item.icon"></u-image>
<view class="u-font-24 tip">{{ item.tip }}</view>
</view>
<view class="subhead u-font-24">{{ item.subhead }}</view>
</view>
<view class="cell_right flex">
<view v-if=" item.type == 2 " class="btn u-font-24 text-bold opt">{{ item.btnText }}</view>
<view v-else-if=" item.type == 3 " class="btn u-font-24 text-bold disabled">{{ item.btnText }}</view>
<view v-else class="btn u-font-24 text-bold">{{ item.btnText }}</view>
<view v-if=" item.type ==4 " class="u-font-20 tip">查看奖品列表</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
components: {
},
data() {
return {
cellList: [
{
title: '分享奖励', type: 1, icon: '../../static/images/me/task_icon3.png', tip: '会员免费领', subhead: '分享好友即可获得', btnText:'立即领取'
},
{
title: '每日签到奖励', type: 2, icon: '../../static/images/me/task_icon3.png', tip: '奖励金币', subhead: '每日付款满3笔即可获得', btnText:'立即看剧'
},
{
title: '每周打卡奖励', type: 3, icon: '', tip: '', subhead: '签到满7天即可获得丰富好礼', btnText:'剩余23次'
},
{
title: '每月打卡奖励1', type: 4, icon: '', tip: '', subhead: '当月签到满21天获得丰富好礼', btnText:'剩余233次'
},
{
title: '每月打卡奖励2', type: 5, icon: '../../static/images/me/task_icon4.png', tip: '奖励金币', subhead: '当月签到满21天即可免费领取', btnText:'立即领取'
},
{
title: '观看视频奖励', type: 6, icon: '../../static/images/me/task_icon3.png', tip: '奖励金币', subhead: '观看完整视频即可获得奖励', btnText:'立即领取'
},
]
}
},
onLoad() {
// #ifdef MP-WEIXIN || MP-TOUTIAO || MP-KUAISHOU
this.osName = uni.getSystemInfoSync().osName;
// #endif
// #ifdef APP
// #endif
// #ifdef MP-WEIXIN
// #endif
// #ifdef H5
// #endif
this.userName = uni.getStorageSync('userName')
},
methods: {
getvipdata() {
let data = {
userId: uni.getStorageSync('userId')
}
this.$u.api.userVip(data).then(res => {
if (res.code == 0 && res.data && res.data.isVip == 2) {
this.isVIP = true;
this.vipData = res.data.endTime
} else {
this.isVIP = false
}
})
},
callPay: function(response) {
if (typeof WeixinJSBridge === "undefined") {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady(response), false);
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady(response));
document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady(response));
}
} else {
this.onBridgeReady(response);
}
},
onBridgeReady: function(response) {
let that = this;
if (!response.package) {
return;
}
console.log("response)))):" + JSON.stringify(response))
WeixinJSBridge.invoke(
'getBrandWCPayRequest', {
"appId": response.appid, //
"timeStamp": response.timestamp, //1970
"nonceStr": response.noncestr, //
"package": response.package,
"signType": response.signType, //
"paySign": response.sign //
},
function(res) {
if (res.err_msg === "get_brand_wcpay_request:ok") {
// 使,
//res.err_msgok
that.showPay = false
uni.showToast({
title: '支付成功',
icon: 'success'
})
let data = {
userId: uni.getStorageSync('userId')
}
that.$u.api.userVip(data).then(res => {
if (res.code == 0 && res.data && res.data
.isVip ==
2) {
uni.setStorageSync('isVIP', true)
} else {
uni.setStorageSync('isVIP', false)
}
})
setTimeout(d => {
let data = {
flag: true
}
uni.$emit('back', data)
uni.navigateBack(1)
}, 1000);
} else {
uni.hideLoading();
}
WeixinJSBridge.log(response.err_msg);
}
);
},
}
}
</script>
<style lang="scss">
.container{
width: 100%;
.task_bg{
width: 100%!important;
height: 494rpx!important;
}
.icon{
.icon_title{
color: #000000;
margin-left: 28rpx;
top: -20rpx;
}
.task_icon1{
width: 74rpx!important;
height: 78rpx!important;
margin-left: 235rpx;
}
.task_icon2{
width: 126rpx!important;
height: 120rpx!important;
top: -40rpx;
}
}
.content{
border-radius: 16rpx;
top: -115rpx;
padding: 28rpx;
.cell{
align-items: center;
padding: 32rpx 0;
border-bottom: 2rpx solid #EBEBEB;
.cell_left{
flex-direction: column;
.cell_title{
align-items: center;
margin-bottom: 12rpx;
color: #333;
.cell_icon{
width: 34rpx!important;
height: 34rpx!important;
margin-left: 16rpx;
}
.tip{
margin-left: 22rpx;
color: #FC5B67;
}
}
.subhead{
color: #999;
}
}
.cell_right{
flex-direction: column;
align-items: center;
.btn{
width: 148rpx;
height: 56rpx;
line-height: 56rpx;
text-align: center;
background-color: #EC6F48;
color: #FFFFFF;
border-radius: 12rpx 12rpx 12rpx 12rpx;
}
.tip{
color: #666;
height: 44rpx;
line-height: 44rpx;
}
.opt{
color: #D39B7E;
background-color: #FBF3EB;
}
.disabled{
color: #999999;
background-color: #E2E2E2;
}
}
}
.cell:last-child{
border-bottom: none;
}
}
}
</style>

View File

@ -255,7 +255,12 @@
"path": "message/index",
"style": {
"navigationBarTitleText": "消息中心"
}
}, {
"path": "task/index",
"style": {
"navigationBarTitleText": "任务中心",
"navigationStyle": "custom"
}
},
{

View File

@ -145,6 +145,16 @@
</view>
<u-badge :offset="[0,20]" type="error" :count="numCount"></u-badge>
</view>
<view class="tool-box-content-item flex align-center justify-center flex-wrap"
@click="goNav('/me/task/index')">
<view class="tool-box-content-item-img">
<image src="../../static/images/me/task.png" mode=""></image>
</view>
<view class="tool-box-content-item-txt">
任务中心
</view>
<u-badge :offset="[0,20]" type="error" :count="numCount"></u-badge>
</view>
<view class="tool-box-content-item flex align-center justify-center flex-wrap"
@click="goNav('/me/jilu/jilu')">
<view class="tool-box-content-item-img">

BIN
static/images/me/task.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB