Commit e4cda068 authored by mengcuiguang's avatar mengcuiguang

邀请好友id修改,代码优化

parent b04a2ad6
......@@ -88,7 +88,7 @@
<view style="display: flex;flex-direction: column;align-items: center;">
<view style="font-size: 24rpx;color: gray;margin-top: 16rpx;margin-bottom: 18rpx;">
订单中如有疑问,请在个人中心联系客服</view>
订单中如有疑问,请跳转【我的】页面</view>
</view>
</scroll-view>
</view>
......@@ -199,10 +199,10 @@
this.handlePay();
},
handlePay() {
if (this.os == 'ios') {
message.notify('暂不支持ios支付');
return
}
// if (this.os == 'ios') {
// message.notify('暂不支持ios支付');
// return
// }
let that = this;
let vipBean = this.vipList[this.selectedIndex];
......@@ -273,7 +273,7 @@
}
message.notify(res.errMsg);
// message.notify(res.errMsg);
},
});
} else {
......
......@@ -227,6 +227,10 @@
<view class="box-wrap">
<image class="img1" @click="handleTaskPage" :src="boxImgUrl"></image>
</view>
<view v-if="false" class="box-cebianlan">
<image class="img2" @click="handleCebianlan" :src="ceImgUrl"></image>
</view>
<!-- <uni-popup type="center" ref="select">
......@@ -286,7 +290,8 @@
showMask: false,
maskImage1: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/bg_find1.png',
maskImage2: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/bg_find2.png',
boxImgUrl: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_bag.png',
boxImgUrl: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_bag.png',
ceImgUrl: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_bag.png',
statusBarHeight: app.globalData.statusBarHeight,
};
},
......@@ -422,6 +427,19 @@
},
handleTaskPage() {
navigateTo(`/pagesA/task/task`)
},
handleCebianlan() {
tt.navigateToScene({
scene: 'sidebar',
activity: '7377634523393769484', // 需改成自己小程序生效中的activity id。activity 为可选项,不填或者填写错误 id,会表现为兜底样式
success: (data) => {
console.log(data)
},
fail: (data) => {
console.log(data)
}
})
},
showFirstDialog() {
let that = this;
......@@ -529,5 +547,19 @@
width: 100rpx;
height: 100rpx;
}
}
.box-cebianlan {
height: 100rpx;
width: 120rpx;
right: 0;
bottom: 400rpx;
position: absolute;
z-index: 999;
.img2 {
width: 100rpx;
height: 100rpx;
}
}
</style>
\ No newline at end of file
<template>
<z-paging class="container">
<view class="item-content">
<view class="flex1 task-title-wrap">
<text class="task-title">签到任务</text>
<text class="task-label">领取看点免费看</text>
<text class="sign-rule" @click="showRule">规则</text>
</view>
<view class="task-line"></view>
<view class="task-wrap flex">
<view class="flex1" style="justify-content: space-between">
<block v-for="(item,key) in signList" :key="key">
<view class="flex ml-10">
<view :class="item.compleled?'sign-item':'sign-item2'">
<image :src="item.compleled?signOkImg:signNoneImg"></image>
<text class="text1">{{ '+' + item.reward }}</text>
</view>
<text :style="item.text == '今天'?'color:#f84a57;':''">{{ item.text }}</text>
</view>
</block>
</view>
<button v-if="signData.list[signData.todayMsgIndexInWeek].rewardMoreType==2" open-type="share"
:class="signBtnStyle" @click="sign">{{signData.buttonText}}</button>
<button v-else :class="signBtnStyle" @click="sign">{{signData.buttonText}}</button>
</view>
</view>
<view class="item-content">
<block v-for="(item,key) in taskList" :key="key">
<view class="flex1 task-title-wrap">
<text class="task-title">{{ item.title }}</text>
<text v-if="item.title == '日常任务'" class="task-label">每日0点重置</text>
</view>
<view class="task-line"></view>
<view class="flex task-wrap">
<block v-for="(item2,key2) in item.taskList" :key="key2">
<view class="flex1"
style="width: 96%;justify-content: space-between;margin-top: 10rpx;margin-bottom: 20rpx;">
<view class="flex" style="width: 70%; align-items: flex-start">
<view class="flex1">
<text
style="color: #000000;font-size: 30rpx;font-weight: bold;margin-right: 10rpx;">{{ item2.title }}</text>
<image style="width: 36rpx; height: 36rpx; margin: 0 10rpx" :src="taskCoinImg">
</image>
<text
style="color: #f84a57;font-size: 30rpx;font-weight: bold;">{{ '+' + item2.rewardPoint }}</text>
</view>
<view>
<text style="font-size: 24rpx">{{ item2.content }}</text>
</view>
<view class="flex1" v-if="item2.runingMax>0" style="margin-top: 10rpx">
<view style="width: 120rpx">
<progress style="stroke-width: 8rpx; color: #ffa500" type="horizontal"
:percent=" item2.runing / item2.runingMax * 100 " />
</view>
<text style="margin-left: 20rpx; font-size: 20rpx">{{
item2.runing +
'/' +
item2.runingMax +
' ' +
item2.runingMaxText
}}</text>
</view>
</view>
<text :class="(item2.status==0)?'task-btn':((item2.status==1)?'task-btn2':'task-btn3')"
@click="doTask(item2)">{{ item2.buttonText }}</text>
</view>
</block>
</view>
</block>
</view>
<reward-popup :show="showRewardPopup" :dot="signData.list[signData.todayMsgIndexInWeek].reward"
@rewardClose="rewardClose"></reward-popup>
<signsuc-popup :show="showSignPopup" :moreDot="signData.list[signData.todayMsgIndexInWeek].rewardMore"
:stype="signData.list[signData.todayMsgIndexInWeek].rewardMoreType"
:dot="signData.list[signData.todayMsgIndexInWeek].reward" @submit="sign"
@signClose="signClose"></signsuc-popup>
</z-paging>
</template>
<script>
import rewardPopup from '@/components/reward-popup/reward-popup.vue';
import signsucPopup from '@/components/signsuc-popup/signsuc-popup.vue';
import {
REWARD_ID
} from '../../utils/adConstant.js';
import common from '@/mixins/common';
import {
message,
navigateBack,
navigateTo,
redirectTo
} from '@/utils/fun';
import {
TaskConstant
} from '../../utils/taskConstant.js'
export default {
name: 'task',
mixins: [common],
components: {
rewardPopup,
signsucPopup
},
data() {
return {
signData: '',
signList: [],
taskList: [],
showRewardPopup: false,
showSignPopup: false,
currentDot: '',
signBtnStyle: 'sign-btn',
signOkImg: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_sign_receive.png',
signNoneImg: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_sign_unreceive.png',
taskCoinImg: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_sign_unreceive_little.png',
signRule: '1、每7天为一个签到周期,用户连续签满7天,完成一个签到周期,下次签到开始重新计算新的签到周期。\r\n2、用户每次签到均可获得相应的奖励连续签到7天可获得更高奖励。\r\n3、若途中漏签,则从第一天开始重新计算新的签到周期。\r\n4、签到及任务赠送看点的有效期均为5天,过期自动作废,请及时使用。',
share: {
title: '更多好剧,等你来看',
imageUrl: 'https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/ic_movie.png',
path: '/pages/loading?shareId='
}
}
},
mounted() {
this.getSignList()
this.getTaskList()
this.preloadAd()
},
onUnload() {
this.ad.offClose(this.ad.closeHandler);
},
methods: {
async onShareAppMessage(option) {
const title = this.share.title;
let that = this
return {
title, // 这是要转发的小程序标题
desc: '',
path: this.share.path + getApp().globalData.userId,
imageUrl: this.share.imageUrl,
templateId: "920405b4ghj2fla2gc",
success() {
message.notify('分享成功');
if (that.signData.list[signData.todayMsgIndexInWeek].rewardMoreType) {
that.reportTaskPointMore(that.signData.list[signData.todayMsgIndexInWeek])
}
},
fail() {
message.notify('分享失败');
},
};
},
preloadAd() {
this.ad = tt.createRewardedVideoAd({
adUnitId: REWARD_ID,
});
// 监听错误
this.ad.onError((err) => {
tt.hideLoading();
message.notify('广告拉取失败,请稍候再试');
switch (err.errCode) {
case 1004:
// 无合适的广告
break;
default:
// 更多请参考错误码文档
}
});
// 预加载资源
this.ad.load();
},
showAd(item, isSign) {
let that = this
this.ad.closeHandler = function(res) {
tt.hideLoading();
if (data.isEnded) {
if (isSign) {
that.reportTaskPointMore(item)
} else {
that.reportCompleteTask(item.taskId)
}
} else {
message.notify('未观看完视频');
}
};
this.ad.onClose(this.ad.closeHandler)
this.ad.show();
},
getSignList() {
let that = this
this.post({
url: '/vTask/sign/pageMsg',
showLoading: false,
success: ({
data
}) => {
that.signData = data
that.signList = []
that.signList = data.list
if (that.signData.buttonStatus == 0 || that.signData.buttonStatus == 1) {
that.signBtnStyle = "sign-btn"
} else {
that.signBtnStyle = "sign-btn2"
}
}
});
},
getTaskList() {
// 任务信息
let that = this
this.post({
url: '/vTask/taskList/pageMsg',
showLoading: false,
success: ({
data
}) => {
that.taskList = data.pageMsg
// for (var i = 0; i < that.taskList.length; i++) {
// for (var j = 0; j < that.taskList[i].taskList.length; j++) {
// if (that.taskList[i].taskList[j].listCode == TaskConstant.openForHome &&
// that.taskList[i].taskList[j].status == 0
// ) {
// that.isFromForHome()
// return
// }
// }
// }
// this.$refs.paging.complete(data.pageMsg);
}
});
},
hasShortCut(taskId) {
let that = this
shortcut.hasInstalled({
success: function() {
$utils.showToast('桌面图标已创建!')
that.reportCompleteTask(taskId)
},
fail: function() {
that.createShortCut(taskId)
}
})
},
createShortCut(taskId) {
let that = this
// 创建桌面图标
shortcut.install({
success: function() {
$utils.showToast('创建桌面图标成功!')
that.reportCompleteTask(taskId)
},
fail: function(data, code) {
$utils.showToast('创建桌面图标失败!')
}
})
},
sign() {
let buttonStatus = this.signData.buttonStatus
if (this.signData == '' || this.signData.buttonStatus == 2) {
return
}
if (this.signData.buttonStatus == 0) {
let item = this.signList[this.signData.todayMsgIndexInWeek]
this.reportTaskPoint(item, true)
return
}
let rewardMoreType = this.signList[this.signData.todayMsgIndexInWeek].rewardMoreType
if (rewardMoreType == 1) {
let item = this.signList[this.signData.todayMsgIndexInWeek]
this.showAd(item, true)
} else if (ewardMoreType == 2) {
// 分享
this.myShare(this.signList[this.signData.todayMsgIndexInWeek])
}
},
reportTaskPoint(item, isSign) {
// 领取奖励
let that = this
this.post({
url: '/vTask/common/addTaskPoint',
data: {
taskId: item.taskId
},
showLoading: false,
success: ({
data
}) => {
if (isSign) {
that.currentDot = item.reward
that.getSignList()
that.showSignPopup = true
} else {
that.currentDot = item.rewardPoint
that.getTaskList()
that.showRewardPopup = true
}
},
});
},
reportTaskPointMore(item) {
// 领取奖励
let that = this
this.post({
url: '/vTask/common/addTaskPoint/more',
data: {
taskId: item.taskId
},
showLoading: false,
success: ({
data
}) => {
message.notify('已成功领取' + item.reward + '看点');
that.currentDot = item.reward
that.getSignList()
},
});
},
reportCompleteTask(taskId) {
// 上报完成任务
let that = this
this.post({
url: '/vTask/common/reportCompleteMsg',
data: {
taskId: taskId
},
showLoading: false,
success: ({
data
}) => {
that.getSignList()
that.getTaskList()
}
});
},
showRule() {
uni.showModal({
title: '签到规则',
content: this.signRule,
showCancel: false,
confirmColor: '#33dd44',
confirmText: '确定'
})
},
doTask(item) {
if (item.status == 3) {
// 已领取金币
message.notify('请稍后再试')
return
} else if (item.status == 2) {
// 已领取金币
message.notify('已领取金币')
return
} else if (item.status == 1) {
// 已完成任务,领取看点
this.reportTaskPoint(item, false)
} else {
// 去完成任务
if (
item.listCode == TaskConstant.seeVedioListPage
) {
this.reportCompleteTask(item.taskId)
navigateTo(`/pages/home`)
} else if (
item.listCode == TaskConstant.firstToHomePage ||
item.listCode == TaskConstant.seeVedio ||
item.listCode == TaskConstant.seeOneNewVedio ||
item.listCode == TaskConstant.compeleOneVedio ||
item.listCode == TaskConstant.compeleVedios ||
item.listCode == TaskConstant.completeSeeDays
) {
redirectTo(`/pages/home`)
} else if (
item.listCode == TaskConstant.firstPay ||
item.listCode == TaskConstant.payBack ||
item.listCode == TaskConstant.completePay
) {
navigateTo(`/pagesA/vipPay/vipPay`)
} else if (
item.listCode == TaskConstant.saveToPhonePage
) {
this.hasShortCut(item.taskId)
} else if (
item.listCode == TaskConstant.openForHome
) {
redirectTo(`/pages/home`)
} else if (
item.listCode == TaskConstant.loginByMobie
) {
redirectTo(`/pages/loading`)
} else if (
item.listCode == TaskConstant.seeAd
) {
// TODO 看广告
this.showAd(item, false)
} else {
redirectTo(`/pages/home`)
}
}
},
myShare(item) {
// TODO 分享
},
signMoreReward(item) {
// 签到-广告或者分享后领取更多
let that = this
this.post({
url: '/vTask/common/addTaskPoint/more',
data: {
taskId: item.taskId
},
showLoading: false,
success: ({
data
}) => {
that.currentDot = item.reward
that.getSignList()
that.showSignPopup = true
}
});
},
rewardClose() {
this.showRewardPopup = false
},
signClose() {
this.showSignPopup = false
},
isFromForHome() {
let that = this
if (uni.getEnterOptionsSync().launcher == 'shortcut') {
if (that.taskList.length > 0) {
for (var i = 0; i < that.taskList.length; i++) {
for (var j = 0; j < that.taskList[i].taskList.length; j++) {
if (that.taskList[i].taskList[j].listCode == TaskConstant.openForHome &&
that.taskList[i].taskList[j].status == 0
) {
that.reportCompleteTask(that.taskList[i].taskList[j].taskId)
return
}
}
}
}
}
}
}
}
</script>
<style lang="less">
.container {
background: linear-gradient(#fcddba, #fff5ea);
flex: 1;
}
.item-content {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
margin-top: 20rpx;
}
.flex {
display: flex;
flex-direction: column;
align-items: center;
}
.flex1 {
display: flex;
flex-direction: row;
align-items: center;
}
.task-wrap {
width: 92%;
background-color: #ffffff;
border-radius: 12rpx;
margin-bottom: 30rpx;
image {
width: 40rpx;
height: 40rpx;
}
}
.task-title-wrap {
width: 92%;
background-color: #ffffff;
border-radius: 12rpx;
height: 100rpx;
}
.task-line {
width: 85%;
height: 1rpx;
background: repeating-linear-gradient(to right,
transparent 15%,
#fcddba 20%,
transparent 25%);
/* background: linear-gradient(
to left,
transparent 0%,
transparent 50%,
#ffa500 50%,
#ffa500 100%
);
background-size: 10rpx 1rpx;
background-repeat: repeat-x; */
}
.task-title {
margin-left: 30rpx;
color: #fb4c39;
font-size: 32rpx;
font-weight: bold;
}
.task-label {
border-radius: 6rpx;
font-size: 20rpx;
height: 36rpx;
line-height: 36rpx;
background-color: #fef9ea;
border: 1rpx solid #fb3309;
color: #b67e17;
margin-left: 20rpx;
padding: 0 10rpx;
}
.sign-rule {
margin-left: auto;
background-color: #ffa500;
text-align: center;
font-size: 22rpx;
color: #ffffff;
padding-left: 26rpx;
padding-right: 20rpx;
height: 40rpx;
line-height: 40rpx;
border-top-left-radius: 40rpx;
border-bottom-left-radius: 40rpx;
}
.sign-btn {
color: #ffffff;
text-align: center;
border-radius: 80rpx;
font-size: 34rpx;
width: 90%;
line-height: 80rpx;
height: 80rpx;
margin-top: 30rpx;
margin-bottom: 20rpx;
background: repeating-linear-gradient(to right, #fb6c3a, #fc473a);
button::after {
border: none;
}
}
.sign-btn2 {
color: #ffffff;
text-align: center;
border-radius: 80rpx;
font-size: 30rpx;
width: 90%;
height: 80rpx;
line-height: 80rpx;
margin-top: 30rpx;
margin-bottom: 20rpx;
background-color: #dcdcdc;
button::after {
border: none;
}
}
.task-btn {
font-size: 26rpx;
color: #ffffff;
text-align: center;
border-radius: 70rpx;
background-color: #fb3309;
width: 180rpx;
height: 70rpx;
line-height: 70rpx;
}
.task-btn2 {
color: #ffa500;
text-align: center;
font-size: 28rpx;
border: 1rpx solid #fb3309;
border-radius: 70rpx;
background-color: #ffffff;
width: 180rpx;
height: 70rpx;
line-height: 70rpx;
}
.task-btn3 {
color: #808080;
text-align: center;
font-size: 28rpx;
border: 1rpx solid #808080;
border-radius: 70rpx;
background-color: #ffffff;
width: 180rpx;
height: 70rpx;
line-height: 70rpx;
}
.sign-item {
padding: 10rpx 0;
width: 78rpx;
display: flex;
flex-direction: column;
align-items: center;
border-radius: 8rpx;
border: 1rpx solid #ffa500;
margin: 10rpx 0;
image {
width: 56rpx;
height: 56rpx;
}
.text1 {
margin-top: 4rpx;
color: #ffa500;
}
}
.sign-item2 {
padding: 10rpx 0;
width: 78rpx;
display: flex;
flex-direction: column;
align-items: center;
border-radius: 8rpx;
background-color: #fb3309;
border: 1rpx solid #fb3309;
margin: 10rpx 0;
image {
width: 56rpx;
height: 56rpx;
}
.text1 {
margin-top: 4rpx;
color: #ffa500;
}
}
<template>
<z-paging class="container">
<view class="item-content">
<view class="flex1 task-title-wrap">
<text class="task-title">签到任务</text>
<text class="task-label">领取看点免费看</text>
<text class="sign-rule" @click="showRule">规则</text>
</view>
<view class="task-line"></view>
<view class="task-wrap flex">
<view class="flex1" style="justify-content: space-between">
<block v-for="(item,key) in signList" :key="key">
<view class="flex ml-10">
<view :class="item.compleled?'sign-item':'sign-item2'">
<image :src="item.compleled?signOkImg:signNoneImg"></image>
<text class="text1">{{ '+' + item.reward }}</text>
</view>
<text :style="item.text == '今天'?'color:#f84a57;':''">{{ item.text }}</text>
</view>
</block>
</view>
<button v-if="signData.list[signData.todayMsgIndexInWeek].rewardMoreType==2" open-type="share"
:class="signBtnStyle" @click="sign">{{signData.buttonText}}</button>
<button v-else :class="signBtnStyle" @click="sign">{{signData.buttonText}}</button>
</view>
</view>
<view class="item-content">
<block v-for="(item,key) in taskList" :key="key">
<view class="flex1 task-title-wrap">
<text class="task-title">{{ item.title }}</text>
<text v-if="item.title == '日常任务'" class="task-label">每日0点重置</text>
</view>
<view class="task-line"></view>
<view class="flex task-wrap">
<block v-for="(item2,key2) in item.taskList" :key="key2">
<view class="flex1"
style="width: 96%;justify-content: space-between;margin-top: 10rpx;margin-bottom: 20rpx;">
<view class="flex" style="width: 70%; align-items: flex-start">
<view class="flex1">
<text
style="color: #000000;font-size: 30rpx;font-weight: bold;margin-right: 10rpx;">{{ item2.title }}</text>
<image style="width: 36rpx; height: 36rpx; margin: 0 10rpx" :src="taskCoinImg">
</image>
<text
style="color: #f84a57;font-size: 30rpx;font-weight: bold;">{{ '+' + item2.rewardPoint }}</text>
</view>
<view>
<text style="font-size: 24rpx">{{ item2.content }}</text>
</view>
<view class="flex1" v-if="item2.runingMax>0" style="margin-top: 10rpx">
<view style="width: 120rpx">
<progress style="stroke-width: 8rpx; color: #ffa500" type="horizontal"
:percent=" item2.runing / item2.runingMax * 100 " />
</view>
<text style="margin-left: 20rpx; font-size: 20rpx">{{
item2.runing +
'/' +
item2.runingMax +
' ' +
item2.runingMaxText
}}</text>
</view>
</view>
<text :class="(item2.status==0)?'task-btn':((item2.status==1)?'task-btn2':'task-btn3')"
@click="doTask(item2)">{{ item2.buttonText }}</text>
</view>
</block>
</view>
</block>
</view>
<reward-popup :show="showRewardPopup" :dot="signData.list[signData.todayMsgIndexInWeek].reward"
@rewardClose="rewardClose"></reward-popup>
<signsuc-popup :show="showSignPopup" :moreDot="signData.list[signData.todayMsgIndexInWeek].rewardMore"
:stype="signData.list[signData.todayMsgIndexInWeek].rewardMoreType"
:dot="signData.list[signData.todayMsgIndexInWeek].reward" @submit="sign"
@signClose="signClose"></signsuc-popup>
</z-paging>
</template>
<script>
import rewardPopup from '@/components/reward-popup/reward-popup.vue';
import signsucPopup from '@/components/signsuc-popup/signsuc-popup.vue';
import {
REWARD_ID
} from '../../utils/adConstant.js';
import common from '@/mixins/common';
import {
message,
navigateBack,
navigateTo,
redirectTo
} from '@/utils/fun';
import {
TaskConstant
} from '../../utils/taskConstant.js'
export default {
name: 'task',
mixins: [common],
components: {
rewardPopup,
signsucPopup
},
data() {
return {
signData: '',
signList: [],
taskList: [],
showRewardPopup: false,
showSignPopup: false,
currentDot: '',
signBtnStyle: 'sign-btn',
signOkImg: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_sign_receive.png',
signNoneImg: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_sign_unreceive.png',
taskCoinImg: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_sign_unreceive_little.png',
signRule: '1、每7天为一个签到周期,用户连续签满7天,完成一个签到周期,下次签到开始重新计算新的签到周期。\r\n2、用户每次签到均可获得相应的奖励连续签到7天可获得更高奖励。\r\n3、若途中漏签,则从第一天开始重新计算新的签到周期。\r\n4、签到及任务赠送看点的有效期均为5天,过期自动作废,请及时使用。',
share: {
title: '更多好剧,等你来看',
imageUrl: 'https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/ic_movie.png',
path: '/pages/loading?shareId='
}
}
},
mounted() {
this.getSignList()
this.getTaskList()
this.preloadAd()
},
onUnload() {
this.ad.offClose(this.ad.closeHandler);
},
methods: {
async onShareAppMessage(option) {
const title = this.share.title;
let that = this
return {
title, // 这是要转发的小程序标题
desc: '',
path: this.share.path + getApp().globalData.userId,
imageUrl: this.share.imageUrl,
templateId: "l71480kcg8lhn19i5b",
success() {
message.notify('分享成功');
if (that.signData.list[signData.todayMsgIndexInWeek].rewardMoreType) {
that.reportTaskPointMore(that.signData.list[signData.todayMsgIndexInWeek])
}
},
fail() {
message.notify('分享失败');
},
};
},
preloadAd() {
this.ad = tt.createRewardedVideoAd({
adUnitId: REWARD_ID,
});
// 监听错误
this.ad.onError((err) => {
tt.hideLoading();
message.notify('广告拉取失败,请稍候再试');
switch (err.errCode) {
case 1004:
// 无合适的广告
break;
default:
// 更多请参考错误码文档
}
});
// 预加载资源
this.ad.load();
},
showAd(item, isSign) {
let that = this
this.ad.closeHandler = function(res) {
tt.hideLoading();
if (data.isEnded) {
if (isSign) {
that.reportTaskPointMore(item)
} else {
that.reportCompleteTask(item.taskId)
}
} else {
message.notify('未观看完视频');
}
};
this.ad.onClose(this.ad.closeHandler)
this.ad.show();
},
getSignList() {
let that = this
this.post({
url: '/vTask/sign/pageMsg',
showLoading: false,
success: ({
data
}) => {
that.signData = data
that.signList = []
that.signList = data.list
if (that.signData.buttonStatus == 0 || that.signData.buttonStatus == 1) {
that.signBtnStyle = "sign-btn"
} else {
that.signBtnStyle = "sign-btn2"
}
}
});
},
getTaskList() {
// 任务信息
let that = this
this.post({
url: '/vTask/taskList/pageMsg',
showLoading: false,
success: ({
data
}) => {
that.taskList = data.pageMsg
// for (var i = 0; i < that.taskList.length; i++) {
// for (var j = 0; j < that.taskList[i].taskList.length; j++) {
// if (that.taskList[i].taskList[j].listCode == TaskConstant.openForHome &&
// that.taskList[i].taskList[j].status == 0
// ) {
// that.isFromForHome()
// return
// }
// }
// }
// this.$refs.paging.complete(data.pageMsg);
}
});
},
hasShortCut(taskId) {
let that = this
shortcut.hasInstalled({
success: function() {
$utils.showToast('桌面图标已创建!')
that.reportCompleteTask(taskId)
},
fail: function() {
that.createShortCut(taskId)
}
})
},
createShortCut(taskId) {
let that = this
// 创建桌面图标
shortcut.install({
success: function() {
$utils.showToast('创建桌面图标成功!')
that.reportCompleteTask(taskId)
},
fail: function(data, code) {
$utils.showToast('创建桌面图标失败!')
}
})
},
sign() {
let buttonStatus = this.signData.buttonStatus
if (this.signData == '' || this.signData.buttonStatus == 2) {
return
}
if (this.signData.buttonStatus == 0) {
let item = this.signList[this.signData.todayMsgIndexInWeek]
this.reportTaskPoint(item, true)
return
}
let rewardMoreType = this.signList[this.signData.todayMsgIndexInWeek].rewardMoreType
if (rewardMoreType == 1) {
let item = this.signList[this.signData.todayMsgIndexInWeek]
this.showAd(item, true)
} else if (ewardMoreType == 2) {
// 分享
this.myShare(this.signList[this.signData.todayMsgIndexInWeek])
}
},
reportTaskPoint(item, isSign) {
// 领取奖励
let that = this
this.post({
url: '/vTask/common/addTaskPoint',
data: {
taskId: item.taskId
},
showLoading: false,
success: ({
data
}) => {
if (isSign) {
that.currentDot = item.reward
that.getSignList()
that.showSignPopup = true
} else {
that.currentDot = item.rewardPoint
that.getTaskList()
that.showRewardPopup = true
}
},
});
},
reportTaskPointMore(item) {
// 领取奖励
let that = this
this.post({
url: '/vTask/common/addTaskPoint/more',
data: {
taskId: item.taskId
},
showLoading: false,
success: ({
data
}) => {
message.notify('已成功领取' + item.reward + '看点');
that.currentDot = item.reward
that.getSignList()
},
});
},
reportCompleteTask(taskId) {
// 上报完成任务
let that = this
this.post({
url: '/vTask/common/reportCompleteMsg',
data: {
taskId: taskId
},
showLoading: false,
success: ({
data
}) => {
that.getSignList()
that.getTaskList()
}
});
},
showRule() {
uni.showModal({
title: '签到规则',
content: this.signRule,
showCancel: false,
confirmColor: '#33dd44',
confirmText: '确定'
})
},
doTask(item) {
if (item.status == 3) {
// 已领取金币
message.notify('请稍后再试')
return
} else if (item.status == 2) {
// 已领取金币
message.notify('已领取金币')
return
} else if (item.status == 1) {
// 已完成任务,领取看点
this.reportTaskPoint(item, false)
} else {
// 去完成任务
if (
item.listCode == TaskConstant.seeVedioListPage
) {
this.reportCompleteTask(item.taskId)
navigateTo(`/pages/home`)
} else if (
item.listCode == TaskConstant.firstToHomePage ||
item.listCode == TaskConstant.seeVedio ||
item.listCode == TaskConstant.seeOneNewVedio ||
item.listCode == TaskConstant.compeleOneVedio ||
item.listCode == TaskConstant.compeleVedios ||
item.listCode == TaskConstant.completeSeeDays
) {
redirectTo(`/pages/home`)
} else if (
item.listCode == TaskConstant.firstPay ||
item.listCode == TaskConstant.payBack ||
item.listCode == TaskConstant.completePay
) {
navigateTo(`/pagesA/vipPay/vipPay`)
} else if (
item.listCode == TaskConstant.saveToPhonePage
) {
this.hasShortCut(item.taskId)
} else if (
item.listCode == TaskConstant.openForHome
) {
redirectTo(`/pages/home`)
} else if (
item.listCode == TaskConstant.loginByMobie
) {
redirectTo(`/pages/loading`)
} else if (
item.listCode == TaskConstant.seeAd
) {
// TODO 看广告
this.showAd(item, false)
} else {
redirectTo(`/pages/home`)
}
}
},
myShare(item) {
// TODO 分享
},
signMoreReward(item) {
// 签到-广告或者分享后领取更多
let that = this
this.post({
url: '/vTask/common/addTaskPoint/more',
data: {
taskId: item.taskId
},
showLoading: false,
success: ({
data
}) => {
that.currentDot = item.reward
that.getSignList()
that.showSignPopup = true
}
});
},
rewardClose() {
this.showRewardPopup = false
},
signClose() {
this.showSignPopup = false
},
isFromForHome() {
let that = this
if (uni.getEnterOptionsSync().launcher == 'shortcut') {
if (that.taskList.length > 0) {
for (var i = 0; i < that.taskList.length; i++) {
for (var j = 0; j < that.taskList[i].taskList.length; j++) {
if (that.taskList[i].taskList[j].listCode == TaskConstant.openForHome &&
that.taskList[i].taskList[j].status == 0
) {
that.reportCompleteTask(that.taskList[i].taskList[j].taskId)
return
}
}
}
}
}
}
}
}
</script>
<style lang="less">
.container {
background: linear-gradient(#fcddba, #fff5ea);
flex: 1;
}
.item-content {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
margin-top: 20rpx;
}
.flex {
display: flex;
flex-direction: column;
align-items: center;
}
.flex1 {
display: flex;
flex-direction: row;
align-items: center;
}
.task-wrap {
width: 92%;
background-color: #ffffff;
border-radius: 12rpx;
margin-bottom: 30rpx;
image {
width: 40rpx;
height: 40rpx;
}
}
.task-title-wrap {
width: 92%;
background-color: #ffffff;
border-radius: 12rpx;
height: 100rpx;
}
.task-line {
width: 85%;
height: 1rpx;
background: repeating-linear-gradient(to right,
transparent 15%,
#fcddba 20%,
transparent 25%);
/* background: linear-gradient(
to left,
transparent 0%,
transparent 50%,
#ffa500 50%,
#ffa500 100%
);
background-size: 10rpx 1rpx;
background-repeat: repeat-x; */
}
.task-title {
margin-left: 30rpx;
color: #fb4c39;
font-size: 32rpx;
font-weight: bold;
}
.task-label {
border-radius: 6rpx;
font-size: 20rpx;
height: 36rpx;
line-height: 36rpx;
background-color: #fef9ea;
border: 1rpx solid #fb3309;
color: #b67e17;
margin-left: 20rpx;
padding: 0 10rpx;
}
.sign-rule {
margin-left: auto;
background-color: #ffa500;
text-align: center;
font-size: 22rpx;
color: #ffffff;
padding-left: 26rpx;
padding-right: 20rpx;
height: 40rpx;
line-height: 40rpx;
border-top-left-radius: 40rpx;
border-bottom-left-radius: 40rpx;
}
.sign-btn {
color: #ffffff;
text-align: center;
border-radius: 80rpx;
font-size: 34rpx;
width: 90%;
line-height: 80rpx;
height: 80rpx;
margin-top: 30rpx;
margin-bottom: 20rpx;
background: repeating-linear-gradient(to right, #fb6c3a, #fc473a);
button::after {
border: none;
}
}
.sign-btn2 {
color: #ffffff;
text-align: center;
border-radius: 80rpx;
font-size: 30rpx;
width: 90%;
height: 80rpx;
line-height: 80rpx;
margin-top: 30rpx;
margin-bottom: 20rpx;
background-color: #dcdcdc;
button::after {
border: none;
}
}
.task-btn {
font-size: 26rpx;
color: #ffffff;
text-align: center;
border-radius: 70rpx;
background-color: #fb3309;
width: 180rpx;
height: 70rpx;
line-height: 70rpx;
}
.task-btn2 {
color: #ffa500;
text-align: center;
font-size: 28rpx;
border: 1rpx solid #fb3309;
border-radius: 70rpx;
background-color: #ffffff;
width: 180rpx;
height: 70rpx;
line-height: 70rpx;
}
.task-btn3 {
color: #808080;
text-align: center;
font-size: 28rpx;
border: 1rpx solid #808080;
border-radius: 70rpx;
background-color: #ffffff;
width: 180rpx;
height: 70rpx;
line-height: 70rpx;
}
.sign-item {
padding: 10rpx 0;
width: 78rpx;
display: flex;
flex-direction: column;
align-items: center;
border-radius: 8rpx;
border: 1rpx solid #ffa500;
margin: 10rpx 0;
image {
width: 56rpx;
height: 56rpx;
}
.text1 {
margin-top: 4rpx;
color: #ffa500;
}
}
.sign-item2 {
padding: 10rpx 0;
width: 78rpx;
display: flex;
flex-direction: column;
align-items: center;
border-radius: 8rpx;
background-color: #fb3309;
border: 1rpx solid #fb3309;
margin: 10rpx 0;
image {
width: 56rpx;
height: 56rpx;
}
.text1 {
margin-top: 4rpx;
color: #ffa500;
}
}
</style>
\ No newline at end of file
......@@ -263,10 +263,10 @@
// this.$refs.alertDialog.open();
},
handlePay() {
if (this.os == 'ios') {
message.notify('暂不支持ios支付');
return
}
// if (this.os == 'ios') {
// message.notify('暂不支持ios支付');
// return
// }
let that = this;
let vipBean = this.pointList[this.selectedIndex];
if (this.selectedIndex == -1) {
......@@ -302,7 +302,7 @@
that.ttPay(largeType, res.orderId, ttData);
},
fail(res) {
message.notify(res.errMsg);
// message.notify(res.errMsg);
console.log('requestOrder res.errMsg', res)
},
});
......
......@@ -96,7 +96,7 @@
desc: '',
path: this.share.path + getApp().globalData.userId,
imageUrl: this.share.imageUrl,
templateId: "920405b4ghj2fla2gc",
templateId: "l71480kcg8lhn19i5b",
success() {
message.notify('分享成功');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment