123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600 |
- <template>
- <view class="wrapper">
- <!-- 领取奖励提示,解锁成就 -->
- <view v-if="currentType == 'levelReward'" class="reward-container">
- <image style="width: 548rpx; height: 240rpx;" mode="aspectFit"
- src="../../../static/common/subNVue/reward-title.png">
- </image>
- <view class="position-relative">
- <image style="width: 472rpx; height: 482rpx;" mode="aspectFit"
- src="../../../static/common/subNVue/bg-light.png">
- </image>
- <view class="position-absolute-center">
- <image class="reward-image"
- :style="{width:lists[levelRewardIndex].width+'px',height:lists[levelRewardIndex].height+'px'}"
- mode="aspectFit" :src="lists[levelRewardIndex].url">
- </image>
- </view>
- </view>
- <view class="position-relative">
- <image style="width: 502rpx;height: 94rpx;" mode="aspectFit"
- src="../../../static/common/subNVue/line-border@2x.png">
- </image>
- <view class="position-absolute-center">
- <text class="text-white text-15px text-center"
- style="line-height: 30rpx;height: 30rpx;">{{lists[levelRewardIndex].explain}}</text>
- </view>
- </view>
- <button class="make-bg-bPurple reward-button" @click="buttonMessage('confirm')"><text
- class="text-white text-18px">确定</text> </button>
- </view>
- <!-- 显示奖励信息 -->
- <view v-if="currentType == 'prompt'" class="reward-container" style="height: 1000rpx;">
- <view class="position-absolute-center-top" style="top: 20rpx;">
- <image style="width: 656rpx; height: 224rpx;" mode="aspectFit"
- src="../../../static/common/subNVue/prompt-bg-title@2x.png">
- </image>
- </view>
- <view class="prompt-mid" style="height: 622rpx; ">
- <block v-for="(item, index) in lists" :key="index">
- <view class="justify-center align-center" style="height: 230rpx; width: 160rpx; margin:5rpx;">
- <view class="prompt-cell-bg"></view>
- <image class="position-absolute-center-top" style="height:200rpx;"
- src="../../../static/common/subNVue/prompt-bg@2x.png"></image>
- <view class="position-absolute-center-top" style="height:140rpx;top: 40rpx;">
- <image :style="{width:item.width+'px',height:item.height+'px'}" mode="aspectFit"
- :src="item.url">
- </image>
- <view class="position-absolute-center-bottom">
- <text class="text-14px text-center"
- style="height: 14px;line-height: 14px;">{{item.explain}}</text>
- </view>
- </view>
- </view>
- </block>
- </view>
- <view class="position-absolute-center-top" style="top: 160rpx">
- <image class="prompt-title" mode="aspectFit"
- src="../../../static/common/subNVue/prompt-reward-title@2x.png">
- </image>
- <!-- 内容部分 -->
- <text class="text-18px text-black" style="margin-top: 44rpx;">本关卡可获得以下奖励</text>
- </view>
- <view class="position-absolute-center-bottom" style="bottom: 260rpx;">
- <button class="make-bg-bPurple prompt-button" @click="buttonMessage('confirm')"><text
- class="text-white text-18px">确定</text> </button>
- </view>
- </view>
- <!-- 解锁关卡 -->
- <view v-if="currentType == 'unlock'" class="reward-container" style="height: 1000rpx;">
- <view class="position-absolute-center-top" style="top: 20rpx;">
- <image style="width: 656rpx; height: 224rpx;" mode="aspectFit"
- src="../../../static/common/subNVue/prompt-bg-title@2x.png">
- </image>
- </view>
- <view class="prompt-mid flex-direction-column" style="height: 622rpx">
- <view class="" style="height: 230rpx; width: 500rpx; margin:5rpx;">
- <view class="position-absolute-center">
- <image class="" style="height:296rpx;width: 296rpx"
- src="../../../static/common/subNVue/unlock/unlock-mid-bg.png"></image>
- </view>
- <view class="position-absolute-center">
- <image style="width: 196rpx;height:196rpx;" mode="aspectFit"
- src="../../../static/common/subNVue/unlock/unlock-mid.png">
- </image>
- </view>
- </view>
- <view>
- <!-- 内容部分 -->
- <text class="text-18px text-black">解锁关卡消耗:</text>
- </view>
- <view class="justify-center align-center flex-direction-row unlock-cell">
- <view class="align-center flex-direction-row"
- style="margin-right: 40rpx; padding: 0 18px; height: 56rpx;">
- <image class="png-more" style="margin-right: 16rpx;"
- src="../../../static/common/sideBar/sGold.png">
- </image>
- <view class="text-14px" style="line-height: 28rpx;">{{unlockItem.consumeGold}}</view>
- </view>
- <view class=" align-center flex-direction-row" style="padding: 0 18px; height: 56rpx;">
- <image class="png-more" style="margin-right: 16rpx; "
- src="../../../static/common/sideBar/sDiamond.png">
- </image>
- <view class="text-14px" style="line-height: 28rpx;">{{unlockItem.consumeDiamond}}</view>
- </view>
- </view>
- </view>
- <view class="position-absolute-center-top" style="top: 160rpx">
- <image class="prompt-title" mode="aspectFit"
- src="../../../static/common/subNVue/unlock/unlock-title.png">
- </image>
- </view>
- <view class="position-absolute-center-bottom justify-center align-center flex-direction-row"
- style="bottom: 240rpx;">
- <button class="make-bg-bPurple unlock-button" @click="buttonMessage('confirm')"><text
- class="text-white text-18px">解锁</text> </button>
- <button class="bg-grey-mid unlock-button" style="margin-left: 44rpx; border-color: #CDCDCD;"
- @click="buttonMessage('cancle')"><text class="text-white text-18px">取消</text> </button>
- </view>
- </view>
- <!-- 显示签到信息 -->
- <view v-if="currentType == 'signIn'" class="reward-container" style="height: 1000rpx;">
- <view class="position-absolute-center-top" style="top: 20rpx;">
- <image style="width: 656rpx; height: 224rpx;" mode="aspectFit"
- src="../../../static/common/subNVue/prompt-bg-title@2x.png">
- </image>
- </view>
- <view class="prompt-mid justify-start flex-direction-column" style="height: 724rpx; ">
- <view style="height: 81rpx;"></view>
- <view class="flex-wrap flex-direction-row flex-sub justify-center">
- <block v-for="(item, index) in lists" :key="index">
- <view class="justify-center align-center" style="height: 148rpx; width: 116rpx; margin:5rpx;">
- <view class="prompt-cell-bg" style="height: 148rpx;" :style="{opacity:item.isSelect?0.5:1}">
- </view>
- <view class="position-absolute-center" style="height:148rpx;">
- <image style="" :style="{width:item.width+'px',height:item.height+'px'}"
- mode="aspectFit" :src="item.isSelect?item.selectedUrl:item.url">
- </image>
- <text class="text-14px text-center " :class="item.isSelect?'text-gray':''"
- style="height: 14px;line-height: 14px; margin-top:12rpx;">{{item.value}}</text>
- </view>
- </view>
- <view class="justify-center align-center" style=" margin:22rpx 5rpx;">
- <image v-if="item.isSelect" class="" style="height:34rpx;width:34rpx;"
- src="../../../static/common/subNVue/sign/sign-tick@2x.png"></image>
- <text v-else class="text-13px text-gray">第{{index+1}}天</text>
- </view>
- </block>
- </view>
- </view>
- <view class="position-absolute-center-top" style="top: 108rpx">
- <image class="prompt-title" mode="aspectFit"
- src="../../../static/common/subNVue/sign/sign-title@2x.png">
- </image>
- </view>
- <view class="position-absolute-center-bottom" style="bottom: 200rpx;">
- <block v-if="isSignIn">
- <button class="prompt-button" style="border: none;" type="default" disabled="true"><text class="text-18px text-gray">已签到领取</text> </button>
- </block>
- <block v-else>
- <button class="make-bg-bPurple prompt-button" @click="buttonMessage('confirm')"><text
- class="text-white text-18px">签到领取</text> </button>
- </block>
- </view>
- </view>
- <!-- pk过关面板 -->
- <view v-if="currentType == 'pkFinish'" class="reward-container" style="height: 1000rpx;">
- <view class="position-absolute-center-top" style="top: 20rpx;">
- <image style="width: 570rpx; height: 908rpx;" mode="aspectFit"
- src="../../../static/common/subNVue/pkFinish@2x.png">
- </image>
- </view>
- <view class="flex flex-direction justify-around align-center" style="position: relative;">
- <text class="make-text-bPurple " style="font-size: 23px;">胜利</text>
- <image class="margin-12px" style="width: 150rpx;height: 150rpx;" :src="pkFinishItem.url"></image>
- <text class="text-18px">{{pkFinishItem.name}}</text>
- <text class="text-15px text-grey margin-12px">{{pkFinishItem.score}}分</text>
- </view>
- <view class="flex-direction-row" style="margin-top: 82rpx;">
- <view class="flex flex-direction align-center">
- <text class="text-grey text-12px">时长(秒)</text>
- <text class="text-bold text-16px" style="margin-top: 5rpx;">{{pkFinishItem.consumeTime}}</text>
- </view>
- <view class="flex flex-direction align-center" style="margin: 0 35rpx;">
- <text class="text-grey text-12px">踩中(次)</text>
- <text class="text-bold text-16px" style="margin-top: 5rpx;">{{pkFinishItem.hit}}</text>
- </view>
- <view class="flex flex-direction align-center">
- <text class="text-grey text-12px">失误(次)</text>
- <text class="text-bold text-16px" style="margin-top: 5rpx;">{{pkFinishItem.miss}}</text>
- </view>
- </view>
- <button class="make-bg-bPurple reward-button" @click="buttonMessage('confirm')"><text
- class="text-white text-18px">确定</text> </button>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- title: '',
- content: '',
- lists: [],
- levelRewardIndex: 0,
- promptList: [{
- name: 'gold',
- width: 31,
- height: 31,
- url: '../../../static/common/sideBar/sGold.png',
- explain: ''
- }, {
- name: 'diamond',
- width: 31,
- height: 31,
- url: '../../../static/common/sideBar/sDiamond.png',
- explain: ''
- }, {
- name: 'medal',
- width: 36,
- height: 41,
- url: '../../../static/common/modal/medal.png',
- explain: ''
- }, {
- name: 'questionMark',
- width: 24,
- height: 35,
- url: '../../../static/common/subNVue/prompt-qm@2x.png',
- explain: '未知'
- }],
- rewardList: [{
- name: 'reward-gold',
- width: 98,
- height: 98,
- url: '../../../static/common/subNVue/reward-gold.png',
- explain: ''
- }, {
- name: 'reward-diamond',
- width: 98,
- height: 98,
- url: '../../../static/common/subNVue/reward-diamond.png',
- explain: ''
- }, {
- name: 'reward-medal',
- width: 118,
- height: 135,
- url: '../../../static/common/subNVue/big-medal.png',
- explain: ''
- }],
- currentType: 'none',
- /**
- * 解锁项目
- */
- unlockItem: {
- consumeGold: 0,
- consumeDiamond: 0
- },
- //当前传入操作的item
- operationItem: null,
- //pk 完成后对应的一个item
- pkFinishItem: {
- name: '',
- url: '../../../static/defaultAvatar.png',
- score: 0,
- consumeTime: 0,
- hit: 0,
- miss: 0
- },
- //isSignIn
- isSignIn: false
- }
- },
- created() {
- const vm = this;
- // for (let i = 1; i < 4; i++) {
- // this.lists.push('item' + i);
- // }
- uni.$on('reward-popup', (data) => {
- vm.title = data.title;
- vm.content = data.content;
- vm.lists = [];
- vm.currentType = data.type;
- vm.operationItem = data.operationItem;
- if (vm.currentType == 'prompt') {
- let _item = data.item;
- console.log(_item);
- if (_item.gold && _item.gold != 0) {
- let temp = Object.assign({}, vm.promptList[0]);
- temp.explain = _item.gold + '';
- vm.lists.push(temp);
- } else {
- vm.lists.push(vm.promptList[3]);
- }
- if (_item.diamond && _item.diamond != 0) {
- let temp = Object.assign({}, vm.promptList[1]);
- temp.explain = _item.diamond + '';
- vm.lists.push(temp);
- } else {
- vm.lists.push(vm.promptList[3]);
- }
- if (_item.honor && _item.honor.type != 0) {
- let temp = Object.assign({}, vm.promptList[2]);
- temp.explain = _item.honor.name + '';
- vm.lists.push(temp);
- } else {
- vm.lists.push(vm.promptList[3]);
- }
- } else if (vm.currentType == 'unlock') {
- vm.unlockItem.consumeGold = data.item.consumeGold;
- vm.unlockItem.consumeDiamond = data.item.consumeDiamond;
- } else if (vm.currentType == 'signIn') {
- vm.lists = data.lists;
- //判断是否签到完
- vm.isSignIn = data.isSignIn || vm.lists[vm.lists.length-1].isSelect;
- // console.log(data.isSignIn +" = "+ JSON.stringify(vm.lists[vm.lists.length-1]));
-
- } else if (vm.currentType == "levelReward") {
- let _item = data.item;
- if (_item.gold && _item.gold != 0) {
- let temp = Object.assign({}, vm.rewardList[0]);
- temp.explain = _item.gold + '';
- vm.lists.push(temp);
- }
- if (_item.diamond && _item.diamond != 0) {
- let temp = Object.assign({}, vm.rewardList[1]);
- temp.explain = _item.diamond + '';
- vm.lists.push(temp);
- }
- if (_item.honor && _item.honor.type != 0) {
- let temp = Object.assign({}, vm.rewardList[2]);
- temp.explain = _item.honor.explain + '';
- vm.lists.push(temp);
- }
- vm.levelRewardIndex = 0;
- console.log(vm.lists);
- } else if (vm.currentType == "pkFinish") {
- vm.pkFinishItem = Object.assign({}, data.item);
- console.log('vm.pkFinishItem:', vm.pkFinishItem);
- }
- })
- },
- beforeDestroy() {
- uni.$off('drawer-page')
- },
- methods: {
- sendMessage() {
- const subNVue = uni.getCurrentSubNVue()
- uni.$emit('reward-popup-page', {
- title: '已读完!',
- })
- },
- handle(item, index) {
- const subNVue = uni.getCurrentSubNVue()
- uni.$emit('reward-popup-page', {
- type: 'interactive',
- info: item + ' 该元素被点击了!',
- })
- },
- buttonMessage(buttonEvent) {
- const subNVue = uni.getCurrentSubNVue()
- uni.$emit('reward-popup-page', {
- type: 'button',
- messageType: this.currentType,
- confirm: buttonEvent == 'confirm' ? true : false,
- cancel: buttonEvent == 'cancel' ? true : false,
- info: buttonEvent + ' 该元素被点击了!',
- operationItem: this.operationItem
- })
- if (this.currentType == 'levelReward') {
- if (this.levelRewardIndex == this.lists.length - 1) {
- this.hidePupup();
- } else {
- this.levelRewardIndex++;
- }
- } else {
- this.hidePupup();
- }
- },
- hidePupup() {
- // const subNVue = uni.getCurrentSubNVue();
- // subNVue.hide("auto", 250);
- uni.getCurrentSubNVue().hide('auto', 250);
- setTimeout(() => {
- this.currentType = 'none';
- }, 250);
- }
- }
- }
- </script>
- <style>
- .wrapper {
- justify-content: center;
- }
- .title {
- height: 100rpx;
- line-height: 100rpx;
- border-bottom-style: solid;
- border-bottom-width: 1rpx;
- border-bottom-color: #CBCBCB;
- flex: 0;
- font-size: 30rpx;
- }
- .scroller {
- height: 400rpx;
- padding: 8rpx 15rpx;
- }
- .content {
- color: #555555;
- font-size: 32rpx;
- }
- .message-wrapper {
- flex: 0;
- border-top-style: solid;
- border-top-width: 1rpx;
- border-top-color: #CBCBCB;
- height: 80rpx;
- align-items: flex-end;
- }
- .send-message {
- font-size: 30rpx;
- line-height: 80rpx;
- color: #00CE47;
- margin-left: 20rpx;
- }
- .cell {
- margin: 10rpx;
- padding: 20rpx 0;
- top: 10rpx;
- align-items: center;
- justify-content: center;
- border-radius: 10rpx;
- background-color: #5989B9;
- }
- .text {
- font-size: 30rpx;
- text-align: center;
- color: white;
- }
- /**
- * 奖励样式
- */
- .reward-container {
- flex-direction: column;
- justify-content: space-between;
- padding: 10rpx 15rpx;
- /* background-color: #F4F5F6; */
- border-radius: 4rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- width: 750rpx;
- }
- .reward-item {
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- justify-content: center;
- align-items: center;
- }
- .reward-image {
- width: 180rpx;
- height: 180rpx;
- }
- .reward-button {
- width: 348rpx;
- height: 88rpx;
- margin-top: 50rpx;
- border-color: rgba(151, 151, 255, 1);
- }
- /**
- * 提示奖励部分
- */
- .prompt-title {
- width: 368rpx;
- height: 90rpx;
- }
- .prompt-mid {
- border-width: 14rpx;
- border-style: solid;
- border-color: #E5E5FF;
- border-radius: 10px;
- background-color: #FFFFFF;
- width: 600rpx;
- height: 622rpx;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- /* padding: 0 20px; */
- }
- .prompt-button {
- width: 348rpx;
- height: 88rpx;
- margin-top: 50rpx;
- border-color: rgba(151, 151, 255, 1);
- border-radius: 21px;
- }
- .prompt-cell {
- margin: 20rpx 5rpx 5rpx 5rpx;
- /* padding: 40rpx 0; */
- height: 260rpx;
- top: 10rpx;
- align-items: center;
- justify-content: center;
- border-radius: 10rpx;
- background-color: #F2F2FF;
- }
- .prompt-cell-bg {
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- justify-content: center;
- align-items: center;
- height: 210rpx;
- align-items: center;
- justify-content: center;
- border-radius: 10rpx;
- background-color: #F2F2FF;
- }
- /**
- * 解锁样式
- */
- .unlock-cell {
- height: 80rpx;
- width: 466rpx;
- margin-top: 20rpx;
- margin-bottom: 120rpx;
- background-color: rgba(202, 202, 202, 0.13);
- border-radius: 40rpx;
- }
- .unlock-button {
- width: 208rpx;
- height: 80rpx;
- border-color: rgba(151, 151, 255, 1);
- border-radius: 9px;
- }
- </style>
|