123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309 |
- <template>
- <up-popup :show="showPopup" round="8" mode="center" closeable @close="handleCancel">
- <view class="blessings-popup">
- <view class="blessings-title">每日祝福</view>
- <view class="blessings-cont">
- <view class="head">
- <view class="common-title">
- <view class="line"></view>
- <text>随机祝福</text>
- </view>
- <view class="button" @click="getRandomPick">
- <icon name="exchange" />
- <text>换一换</text>
- </view>
- </view>
- <view class="blessings-list">
- <view v-for="(item, index) in list" :key="index" class="blessings-item"
- :class="{ active: activeIndex === index }" @click="handleMsg(index, item)">
- {{ item.clockinText }}
- </view>
- </view>
- <up-textarea class="message-field" v-model="message" placeholder="给 TA 一份暖心的祝福吧~"
- autoHeight></up-textarea>
- </view>
- <view class="blessings-footer">
- <view @click="handleCancel">取消</view>
- <view class="send" @click="handleSend">发送</view>
- </view>
- </view>
- </up-popup>
- <!-- 祝福成功弹窗 -->
- <up-popup :show="sucessPopup" mode="center" @close="handleCancelSucess" bgColor="transparent">
- <view class="sucess-popup" @click="handleCancelSucess">
- <view class="sucess-bg">
- <image class="img" :src="`${config.BASIC_IMG}img/subTreePage/blessing-sucess.png`"></image>
- </view>
- <view class="button-group" @click="handlePage">
- <view class="btn">开心收下</view>
- <up-icon class="close" name="close-circle-fill" size="30" color="rgba(255, 255, 255, 0.7)"></up-icon>
- </view>
- </view>
- </up-popup>
- </template>
- <script setup>
- import config from "@/api/config.js"
- import {
- onActivated,
- onMounted,
- ref,
- watch
- } from "vue";
- const props = defineProps({
- show: {
- type: Boolean,
- defalut: false,
- },
- farmBuyId: {
- type: [Number, String],
- defalut: "",
- },
- });
- const handlePage = () => {
- // if (userInfo.value.tel) {
- // router.push('/guard_tree')
- // } else {
- // router.push('/lj_home')
- // }
- }
- const showPopup = ref(false);
- const message = ref("");
- const activeIndex = ref(null);
- const list = ref([]);
- const handleCancel = () => {
- activeIndex.value = null;
- message.value = "";
- showPopup.value = false;
- };
- const handleCancelSucess = () => {
- sucessPopup.value = false;
- };
- const getRandomPick = () => {
- list.value = [{
- id: 1,
- clockinText: '晨曦微露,阳光洒满大地'
- },
- {
- id: 2,
- clockinText: '新的一天,新的挑战,新的机会'
- },
- {
- id: 3,
- clockinText: '记住,每一次挫折都是成功的垫脚石'
- },
- {
- id: 4,
- clockinText: '道阻且长,行则将至,行而不辍,未来可期。'
- },
- {
- id: 5,
- clockinText: '每日数据的更替,是日积月累的结果'
- },
- {
- id: 6,
- clockinText: '不必在意他人目光与期待'
- }
- ]
- // VE_API.guard_tree.randomPick({
- // count: 6
- // }).then(({
- // data
- // }) => {
- // list.value = data || [];
- // if (activeIndex.value != null) {
- // message.value = data[activeIndex.value].clockinText;
- // }
- // });
- };
- const handleMsg = (index, item) => {
- activeIndex.value = index;
- message.value = item.clockinText;
- };
- const sucessPopup = ref(false);
- const handleSend = () => {
- const params = {
- farmBuyId: props.farmBuyId,
- clockinType: 3,
- msg: message.value,
- };
- handleCancel();
- sucessPopup.value = true;
- // VE_API.guard_tree.clockin(params).then((res) => {
- // if (res.code === 0) {
- // handleCancel();
- // sucessPopup.value = true;
- // }
- // });
- };
- onMounted(() => {
- getRandomPick();
- });
- watch(
- () => props.show,
- () => {
- showPopup.value = true;
- }
- );
- </script>
- <style scoped lang="scss">
- @import "@/static/style/mixin.scss";
- .blessings-popup {
- width: 90vw;
- padding: 40rpx 30rpx;
- box-sizing: border-box;
- position: relative;
- &::before {
- content: '';
- position: absolute;
- bottom: 190rpx;
- right: 0;
- z-index: 2;
- @include ossBg("subTreePage/blessing-bg.png");
- width: 336rpx;
- height: 336rpx;
- }
- .blessings-title {
- font-size: 48rpx;
- text-align: center;
- font-family: "PangMenZhengDao";
- }
- .blessings-cont {
- margin: 40rpx 0 48rpx;
- .head {
- display: flex;
- align-items: center;
- justify-content: space-between;
- .common-title {
- display: flex;
- align-items: center;
- font-weight: 500;
- .line {
- width: 8rpx;
- height: 32rpx;
- border-radius: 10rpx;
- background: #F3C11D;
- margin-right: 14rpx;
- }
- }
- .button {
- font-size: 24rpx;
- color: #f3c11d;
- padding: 8rpx 24rpx;
- border-radius: 40rpx;
- background: rgba(243, 193, 29, 0.1);
- border: 1px solid #f3c11d;
- display: flex;
- align-items: center;
- justify-content: center;
- text {
- margin-left: 10rpx;
- }
- }
- }
- .blessings-list {
- display: flex;
- align-items: flex-start;
- flex-direction: column;
- padding-bottom: 24rpx;
- margin-bottom: 24rpx;
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
- .blessings-item {
- font-size: 24rpx;
- padding: 8rpx 20rpx;
- border-radius: 40rpx;
- background: #f4f6f8;
- margin-top: 20rpx;
- &.active {
- background: #fff2c4;
- }
- }
- }
- }
- .blessings-footer {
- display: flex;
- view {
- text-align: center;
- flex: 1;
- color: #666666;
- font-size: 32rpx;
- padding: 16rpx;
- border: 1px solid #999999;
- border-radius: 50rpx;
- }
- .send {
- margin-left: 26rpx;
- color: #fff;
- background-image: linear-gradient(120deg, #ffd887, #ed9e1e);
- border: none;
- }
- }
- }
- .sucess-popup {
- width: 100vw;
- height: 100vh;
- background: rgba(0, 0, 0, 0.6);
- .sucess-bg {
- width: 100%;
- height: 920rpx;
- @include ossBg("subTreePage/light-effect-bg.png");
- display: flex;
- align-items: flex-end;
- justify-content: center;
- .img {
- width: 82%;
- height: 410rpx;
- }
- }
- .button-group {
- margin: 46rpx auto;
- width: 312rpx;
- .btn {
- font-size: 44rpx;
- padding: 20rpx 0;
- border-radius: 50rpx;
- font-family: "PangMenZhengDao";
- color: #954600;
- background: linear-gradient(120deg, #FFE6B2, #FFC339);
- text-align: center;
- }
- .close{
- margin-top: 80rpx;
- justify-content: center;
- }
- }
- }
-
- </style>
|