fix: 签到文案样式修改

pull/8/head
kele 2023-03-31 18:20:50 +08:00
parent 77e224afc2
commit 2ecf86f486
1 changed files with 403 additions and 433 deletions

View File

@ -17,30 +17,20 @@
<!-- 切换年月 --> <!-- 切换年月 -->
<view class="bar ss-flex ss-col-center ss-row-center"> <view class="bar ss-flex ss-col-center ss-row-center">
<view class="previous" @tap="handleCalendar(0)"><text class="cicon-back"></text></view> <view class="previous" @tap="handleCalendar(0)"><text class="cicon-back"></text></view>
<view class="date ss-m-x-20" <view class="date ss-m-x-20">{{ state.cur_year || '--' }} {{ state.cur_month || '--' }} </view>
>{{ state.cur_year || '--' }} {{ state.cur_month || '--' }} </view
>
<view class="next" @tap="handleCalendar(1)"><text class="cicon-forward"></text></view> <view class="next" @tap="handleCalendar(1)"><text class="cicon-forward"></text></view>
</view> </view>
<!-- 显示星期 --> <!-- 显示星期 -->
<view class="week ss-flex"> <view class="week ss-flex">
<view <view class="week-item ss-flex ss-row-center" v-for="(item, index) in state.weeks_ch" :key="index">
class="week-item ss-flex ss-row-center"
v-for="(item, index) in state.weeks_ch"
:key="index"
>
{{ item.title }} {{ item.title }}
</view> </view>
</view> </view>
<!-- 日历表 --> <!-- 日历表 -->
<view class="myDateTable"> <view class="myDateTable">
<view <view v-for="(item, j) in state.data.days" :key="j" class="dateCell ss-flex ss-row-center ss-col-center">
v-for="(item, j) in state.data.days"
:key="j"
class="dateCell ss-flex ss-row-center ss-col-center"
>
<!-- 空格 --> <!-- 空格 -->
<view class="ss-flex ss-row-center ss-col-center"> <view class="ss-flex ss-row-center ss-col-center">
<text :decode="true">&nbsp;&nbsp;</text> <text :decode="true">&nbsp;&nbsp;</text>
@ -49,494 +39,474 @@
<!-- 已签到日期 --> <!-- 已签到日期 -->
<view v-if="item.is_sign" class="is-sign ss-flex ss-row-center"> <view v-if="item.is_sign" class="is-sign ss-flex ss-row-center">
<view class="is-sign-num">{{ item.day < 10 ? '0' + item.day : item.day }}</view> <view class="is-sign-num">{{ item.day < 10 ? '0' + item.day : item.day }}</view>
<image <image class="is-sign-image" :src="sheep.$url.static('/static/img/shop/app/correct.png')">
class="is-sign-image" </image>
:src="sheep.$url.static('/static/img/shop/app/correct.png')" </view>
> <!-- 未签到日期 -->
</image> <view class="is-sign ss-flex ss-row-center" v-if="item.is_replenish == 1"
@tap="onShowRetroactive(item.date)">
<view class="cell-num">{{ item.day < 10 ? '0' + item.day : item.day }}</view>
<text class="cicon-title"></text>
</view>
<view class="is-sign ss-flex ss-row-center" v-if="item.is_replenish == 0 && !item.is_sign">
<view class="cell-num">{{ item.day < 10 ? '0' + item.day : item.day }}</view>
</view>
</view>
</view>
<!-- 签到按钮 -->
<view class="ss-flex ss-col-center ss-row-center sign-box ss-m-y-40">
<button class="ss-reset-button sign-btn" v-if="state.isSign === 0" @tap="onSign"></button>
<button class="ss-reset-button already-btn" v-if="state.isSign === 1" disabled>已签到</button>
</view>
</view> </view>
<!-- 未签到日期 --> </view>
<view <view class="bg-white ss-m-t-16 ss-p-t-30 ss-p-b-60 ss-p-x-40">
class="is-sign ss-flex ss-row-center" <view class="activity-title ss-m-b-30">签到说明</view>
v-if="item.is_replenish == 1" <view class="activity-des">
@tap="onShowRetroactive(item.date)" 1每日签到固定 {{ state.data.rules.everyday }} 积分
> <text v-if="state.data.rules.is_inc == '1'">
<view class="cell-num">{{ item.day < 10 ? '0' + item.day : item.day }}</view> 次日递增奖励 {{ state.data.rules.inc_num }} 积分直到
<text class="cicon-title"></text> {{ state.data.rules.until_day }} 天之后不再增加
</text>
</view> </view>
<view <view class="activity-des" v-if="state.data.rules.discounts?.length > 0">
class="is-sign ss-flex ss-row-center" 2<text class="" v-for="i in state.data.rules.discounts" :key="i">
v-if="item.is_replenish == 0 && !item.is_sign" 连续签到 {{ i.full }} 奖励 {{ i.value }} 积分
> </text>
<view class="cell-num">{{ item.day < 10 ? '0' + item.day : item.day }}</view> </view>
<view class="activity-des" v-if="state.data.rules.is_replenish == '1'">
{{ state.data.rules.discounts?.length > 0 ? '3' : '2' }}用户在
{{ state.data.rules.replenish_limit }} 天内可补签
{{ state.data.rules.replenish_days }} 每次补签消耗
{{ state.data.rules.replenish_num }}积分
</view> </view>
</view> </view>
</view> </view>
<s-empty v-else-if="!state.data && !state.loading" icon="/static/data-empty.png" text="签到活动还未开始">
<!-- 签到按钮 --> </s-empty>
<view class="ss-flex ss-col-center ss-row-center sign-box ss-m-y-40"> <su-popup :show="state.showModel" type="center" round="10" :isMaskClick="false">
<button class="ss-reset-button sign-btn" v-if="state.isSign === 0" @tap="onSign" <view class="model-box ss-flex-col">
>签到</button <view class="ss-m-t-56 ss-flex-col ss-col-center">
> <text class="cicon-check-round"></text>
<button class="ss-reset-button already-btn" v-if="state.isSign === 1" disabled <view class="score-title">{{ state.signin.score }}积分</view>
>已签到</button <view class="model-title ss-flex ss-col-center ss-m-t-22 ss-m-b-30">
> 已连续打卡{{ state.continue_days }}
</view> </view>
</view> </view>
</view> <view class="model-bg ss-flex-col ss-col-center ss-row-right">
<view class="bg-white ss-m-t-16 ss-p-t-30 ss-p-b-60 ss-p-x-40"> <view class="title ss-m-b-64">签到成功</view>
<view class="activity-title ss-m-b-30">签到说明</view> <view class="ss-m-b-40">
<view class="activity-des"> <button class="ss-reset-button confirm-btn" @tap="onConfirm"></button>
1每日签到固定 {{ state.data.rules.everyday }} 积分 </view>
<text v-if="state.data.rules.is_inc == '1'"> </view>
次日递增奖励 {{ state.data.rules.inc_num }} 积分直到 </view>
{{ state.data.rules.until_day }} 天之后不再增加 </su-popup>
</text> <su-popup :show="state.showRetroactive" type="center" round="10" :isMaskClick="false">
</view> <view class="model-box ss-flex-col">
<view class="activity-des" v-if="state.data.rules.discounts?.length > 0"> <view class="ss-m-t-56 ss-flex-col ss-col-center">
2 <text class="cicon-check-round"></text>
<text class="" v-for="i in state.data.rules.discounts" :key="i"> <view class="score-title">消耗{{ state.data?.rules.replenish_num }}积分</view>
连续签到 {{ i.full }} 奖励 {{ i.value }} 积分 <view class="model-title ss-flex ss-col-center ss-m-t-22 ss-m-b-30">
</text> 已连续打卡{{ state.continue_days }}
</view> </view>
<view class="activity-des" v-if="state.data.rules.is_replenish == '1'"> </view>
{{ state.data.rules.discounts?.length > 0 ? '3' : '2' }} 用户在 <view class="model-bg ss-flex-col ss-col-center ss-row-right">
{{ state.data.rules.replenish_limit }} 天内可补签 <view class="title ss-m-b-64">确认补签</view>
{{ state.data.rules.replenish_days }} 每次补签消耗 <view class="ss-m-b-40 ss-flex">
{{ state.data.rules.replenish_num }}积分 <button class="ss-reset-button cancel-btn" @tap="state.showRetroactive = false">取消</button>
</view> <button class="ss-reset-button confirm-btn" @tap="onRetroactive"></button>
</view> </view>
</view> </view>
<s-empty </view>
v-else-if="!state.data && !state.loading" </su-popup>
icon="/static/data-empty.png"
text="签到活动还未开始"
>
</s-empty>
<su-popup :show="state.showModel" type="center" round="10" :isMaskClick="false">
<view class="model-box ss-flex-col">
<view class="ss-m-t-56 ss-flex-col ss-col-center">
<text class="cicon-check-round"></text>
<view class="score-title">{{ state.signin.score }}积分</view>
<view class="model-title ss-flex ss-col-center ss-m-t-22 ss-m-b-30">
已连续打卡{{ state.continue_days }}
</view>
</view>
<view class="model-bg ss-flex-col ss-col-center ss-row-right">
<view class="title ss-m-b-64">签到成功</view>
<view class="ss-m-b-40">
<button class="ss-reset-button confirm-btn" @tap="onConfirm"></button>
</view>
</view>
</view>
</su-popup>
<su-popup :show="state.showRetroactive" type="center" round="10" :isMaskClick="false">
<view class="model-box ss-flex-col">
<view class="ss-m-t-56 ss-flex-col ss-col-center">
<text class="cicon-check-round"></text>
<view class="score-title">消耗{{ state.data?.rules.replenish_num }}积分</view>
<view class="model-title ss-flex ss-col-center ss-m-t-22 ss-m-b-30">
已连续打卡{{ state.continue_days }}
</view>
</view>
<view class="model-bg ss-flex-col ss-col-center ss-row-right">
<view class="title ss-m-b-64">确认补签</view>
<view class="ss-m-b-40 ss-flex">
<button class="ss-reset-button cancel-btn" @tap="state.showRetroactive = false"
>取消</button
>
<button class="ss-reset-button confirm-btn" @tap="onRetroactive"></button>
</view>
</view>
</view>
</su-popup>
</s-layout> </s-layout>
</template> </template>
<script setup> <script setup>
import sheep from '@/sheep'; import sheep from '@/sheep';
import { onLoad, onReady } from '@dcloudio/uni-app'; import { onLoad, onReady } from '@dcloudio/uni-app';
import { computed, reactive } from 'vue'; import { computed, reactive } from 'vue';
const headerBg = sheep.$url.css('/static/img/shop/app/sign.png'); const headerBg = sheep.$url.css('/static/img/shop/app/sign.png');
const state = reactive({ const state = reactive({
data: { data: {
days: [], // days: [], //
rules: {}, // rules: {}, //
},
cur_year: 0, //
cur_month: 0, //
cur_day: 0, //
weeks_ch: [
{
title: '日',
value: '0',
}, },
cur_year: 0, // {
cur_month: 0, // title: '一',
cur_day: 0, // value: '1',
weeks_ch: [ },
{ {
title: '日', title: '二',
value: '0', value: '2',
}, },
{ {
title: '一', title: '三',
value: '1', value: '3',
}, },
{ {
title: '二', title: '四',
value: '2', value: '4',
}, },
{ {
title: '三', title: '五',
value: '3', value: '5',
}, },
{ {
title: '四', title: '六',
value: '4', value: '6',
}, },
{ ], //
title: '五', showModel: false, //
value: '5', continue_days: 0, //
}, signin: {}, //
{ showRetroactive: false, //
title: '六', date: '', //
value: '6', isSign: 0, //
}, loading: true,
], // });
showModel: false, // async function onSign() {
continue_days: 0, // const { error, data } = await sheep.$api.activity.signAdd();
signin: {}, // if (error === 0) {
showRetroactive: false, // state.showModel = true;
date: '', // state.signin = data;
isSign: 0, // // getData();
loading: true,
});
async function onSign() {
const { error, data } = await sheep.$api.activity.signAdd();
if (error === 0) {
state.showModel = true;
state.signin = data;
// getData();
}
} }
}
function onShowRetroactive(e) { function onShowRetroactive(e) {
state.showRetroactive = true; state.showRetroactive = true;
state.date = e; state.date = e;
} }
// //
function onConfirm() { function onConfirm() {
state.showModel = false; state.showModel = false;
getData();
}
//
async function onRetroactive() {
const { error, data } = await sheep.$api.activity.replenish({
date: state.date,
});
if (error === 0) {
state.showRetroactive = false;
getData(); getData();
} }
// }
async function onRetroactive() {
const { error, data } = await sheep.$api.activity.replenish({
date: state.date,
});
if (error === 0) {
state.showRetroactive = false;
getData();
}
}
async function getData(mouth) { async function getData(mouth) {
const { error, data } = await sheep.$api.activity.signList(mouth); const { error, data } = await sheep.$api.activity.signList(mouth);
if (error === 0) { if (error === 0) {
state.data = data; state.data = data;
} else { } else {
state.data = null; state.data = null;
} }
state.loading = false; state.loading = false;
if (state.data) { if (state.data) {
state.data.days.forEach((i, index) => {
if (index < i.week) {
index++;
var obj = {
day: null,
is_sign: false,
};
state.data.days.unshift(obj);
}
if (index == 1) {
let arr = i.date.split('-');
state.cur_year = arr[0];
state.cur_month = arr[1];
}
});
if (state.data.days[0].day == null) {
state.data.days.forEach((i, index) => { state.data.days.forEach((i, index) => {
if (index < i.week) { if (i.current == 'today') {
index++; state.isSign = i.is_sign;
var obj = {
day: null,
is_sign: false,
};
state.data.days.unshift(obj);
}
if (index == 1) {
let arr = i.date.split('-');
state.cur_year = arr[0];
state.cur_month = arr[1];
} }
}); });
if (state.data.days[0].day == null) { }
state.data.days.forEach((i, index) => { state.continue_days = data.continue_days;
if (i.current == 'today') { }
state.isSign = i.is_sign; }
}
}); onReady(() => {
} getData();
state.continue_days = data.continue_days; });
//
const handleCalendar = (type) => {
const cur_year = parseInt(state.cur_year);
const cur_month = parseInt(state.cur_month);
var newMonth;
var newYear = cur_year;
if (type === 0) {
//
newMonth = cur_month - 1;
if (newMonth < 1) {
newYear = cur_year - 1;
newMonth = 12;
} else if (newMonth < 10) {
newMonth = '0' + newMonth;
}
} else {
newMonth = cur_month + 1;
if (newMonth > 12) {
newYear = cur_year + 1;
newMonth = 1;
} else if (newMonth < 10) {
newMonth = '0' + newMonth;
} }
} }
getData({
onReady(() => { month: newYear + '-' + newMonth,
getData();
}); });
};
//
const handleCalendar = (type) => {
const cur_year = parseInt(state.cur_year);
const cur_month = parseInt(state.cur_month);
var newMonth;
var newYear = cur_year;
if (type === 0) {
//
newMonth = cur_month - 1;
if (newMonth < 1) {
newYear = cur_year - 1;
newMonth = 12;
} else if (newMonth < 10) {
newMonth = '0' + newMonth;
}
} else {
newMonth = cur_month + 1;
if (newMonth > 12) {
newYear = cur_year + 1;
newMonth = 1;
} else if (newMonth < 10) {
newMonth = '0' + newMonth;
}
}
getData({
month: newYear + '-' + newMonth,
});
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.header-box { .header-box {
border-top: 2rpx solid rgba(#dfdfdf, 0.5); border-top: 2rpx solid rgba(#dfdfdf, 0.5);
} }
// //
.calendar { .calendar {
background: #fff; background: #fff;
.sign-everyday { .sign-everyday {
height: 100rpx; height: 100rpx;
background: rgba(255, 255, 255, 1); background: rgba(255, 255, 255, 1);
border: 2rpx solid rgba(223, 223, 223, 0.4); border: 2rpx solid rgba(223, 223, 223, 0.4);
.sign-everyday-title { .sign-everyday-title {
font-size: 32rpx; font-size: 32rpx;
color: rgba(51, 51, 51, 1); color: rgba(51, 51, 51, 1);
font-weight: 500; font-weight: 500;
}
.sign-num-box {
font-size: 26rpx;
font-weight: 500;
color: rgba(153, 153, 153, 1);
.sign-num {
font-size: 30rpx;
font-weight: 600;
color: #ff6000;
padding: 0 10rpx;
font-family: OPPOSANS;
}
}
} }
// .sign-num-box {
.bar { font-size: 26rpx;
height: 100rpx; font-weight: 500;
color: rgba(153, 153, 153, 1);
.date { .sign-num {
font-size: 30rpx; font-size: 30rpx;
font-weight: 600;
color: #ff6000;
padding: 0 10rpx;
font-family: OPPOSANS; font-family: OPPOSANS;
font-weight: 500;
color: #333333;
line-height: normal;
}
}
.cicon-back {
margin-top: 6rpx;
font-size: 30rpx;
color: #c4c4c4;
line-height: normal;
}
.cicon-forward {
margin-top: 6rpx;
font-size: 30rpx;
color: #c4c4c4;
line-height: normal;
}
//
.week {
.week-item {
font-size: 24rpx;
font-weight: 500;
color: rgba(153, 153, 153, 1);
flex: 1;
}
}
//
.myDateTable {
display: flex;
flex-wrap: wrap;
.dateCell {
width: calc(750rpx / 7);
height: 80rpx;
font-size: 26rpx;
font-weight: 400;
color: rgba(51, 51, 51, 1);
} }
} }
} }
.is-sign { //
width: 48rpx; .bar {
height: 48rpx; height: 100rpx;
position: relative;
.is-sign-num { .date {
font-size: 24rpx; font-size: 30rpx;
font-family: OPPOSANS; font-family: OPPOSANS;
font-weight: 500; font-weight: 500;
color: #333333;
line-height: normal; line-height: normal;
} }
.is-sign-image {
position: absolute;
left: 0;
top: 0;
width: 48rpx;
height: 48rpx;
}
} }
.cell-num { .cicon-back {
margin-top: 6rpx;
font-size: 30rpx;
color: #c4c4c4;
line-height: normal;
}
.cicon-forward {
margin-top: 6rpx;
font-size: 30rpx;
color: #c4c4c4;
line-height: normal;
}
//
.week {
.week-item {
font-size: 24rpx;
font-weight: 500;
color: rgba(153, 153, 153, 1);
flex: 1;
}
}
//
.myDateTable {
display: flex;
flex-wrap: wrap;
.dateCell {
width: calc(750rpx / 7);
height: 80rpx;
font-size: 26rpx;
font-weight: 400;
color: rgba(51, 51, 51, 1);
}
}
}
.is-sign {
width: 48rpx;
height: 48rpx;
position: relative;
.is-sign-num {
font-size: 24rpx; font-size: 24rpx;
font-family: OPPOSANS; font-family: OPPOSANS;
font-weight: 500; font-weight: 500;
color: #333333;
line-height: normal; line-height: normal;
} }
.cicon-title { .is-sign-image {
position: absolute; position: absolute;
right: -10rpx; left: 0;
top: -6rpx; top: 0;
font-size: 20rpx; width: 48rpx;
color: red; height: 48rpx;
}
}
.cell-num {
font-size: 24rpx;
font-family: OPPOSANS;
font-weight: 500;
color: #333333;
line-height: normal;
}
.cicon-title {
position: absolute;
right: -10rpx;
top: -6rpx;
font-size: 20rpx;
color: red;
}
//
.sign-box {
height: 140rpx;
width: 100%;
.sign-btn {
width: 710rpx;
height: 80rpx;
border-radius: 35rpx;
font-size: 30rpx;
font-weight: 500;
box-shadow: 0 0.2em 0.5em rgba(#ff6000, 0.4);
background: linear-gradient(90deg, #ff6000, #fe832a);
color: #fff;
} }
// .already-btn {
.sign-box { width: 710rpx;
height: 140rpx; height: 80rpx;
width: 100%; border-radius: 35rpx;
font-size: 30rpx;
font-weight: 500;
}
}
.sign-btn { .model-box {
width: 710rpx; width: 520rpx;
height: 80rpx; // height: 590rpx;
border-radius: 35rpx; background: linear-gradient(177deg, #ff6000 0%, #fe832a 100%);
font-size: 30rpx; // background: linear-gradient(177deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
font-weight: 500; border-radius: 10rpx;
box-shadow: 0 0.2em 0.5em rgba(#ff6000, 0.4);
background: linear-gradient(90deg, #ff6000, #fe832a);
color: #fff;
}
.already-btn { .cicon-check-round {
width: 710rpx; font-size: 70rpx;
height: 80rpx; color: #fff;
border-radius: 35rpx;
font-size: 30rpx;
font-weight: 500;
}
} }
.model-box { .score-title {
font-size: 34rpx;
font-family: OPPOSANS;
font-weight: 500;
color: #fcff00;
}
.model-title {
font-size: 28rpx;
font-weight: 500;
color: #ffffff;
}
.model-bg {
width: 520rpx; width: 520rpx;
// height: 590rpx; height: 344rpx;
background: linear-gradient(177deg, #ff6000 0%, #fe832a 100%); background-size: 100% 100%;
// background: linear-gradient(177deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient)); background-image: v-bind(headerBg);
border-radius: 10rpx; background-repeat: no-repeat;
border-radius: 0 0 10rpx 10rpx;
.cicon-check-round { .title {
font-size: 70rpx;
color: #fff;
}
.score-title {
font-size: 34rpx; font-size: 34rpx;
font-family: OPPOSANS; font-weight: bold;
font-weight: 500; // color: var(--ui-BG-Main);
color: #fcff00; color: #ff6000;
} }
.model-title { .subtitle {
font-size: 26rpx;
font-weight: 500;
color: #999999;
}
.cancel-btn {
width: 220rpx;
height: 70rpx;
border: 2rpx solid #ff6000;
border-radius: 35rpx;
font-size: 28rpx;
font-weight: 500;
color: #ff6000;
line-height: normal;
margin-right: 10rpx;
}
.confirm-btn {
width: 220rpx;
height: 70rpx;
background: linear-gradient(90deg, #ff6000, #fe832a);
box-shadow: 0 0.2em 0.5em rgba(#ff6000, 0.4);
border-radius: 35rpx;
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
color: #ffffff; color: #ffffff;
} line-height: normal;
.model-bg {
width: 520rpx;
height: 344rpx;
background-size: 100% 100%;
background-image: v-bind(headerBg);
background-repeat: no-repeat;
border-radius: 0 0 10rpx 10rpx;
.title {
font-size: 34rpx;
font-weight: bold;
// color: var(--ui-BG-Main);
color: #ff6000;
}
.subtitle {
font-size: 26rpx;
font-weight: 500;
color: #999999;
}
.cancel-btn {
width: 220rpx;
height: 70rpx;
border: 2rpx solid #ff6000;
border-radius: 35rpx;
font-size: 28rpx;
font-weight: 500;
color: #ff6000;
line-height: normal;
margin-right: 10rpx;
}
.confirm-btn {
width: 220rpx;
height: 70rpx;
background: linear-gradient(90deg, #ff6000, #fe832a);
box-shadow: 0 0.2em 0.5em rgba(#ff6000, 0.4);
border-radius: 35rpx;
font-size: 28rpx;
font-weight: 500;
color: #ffffff;
line-height: normal;
}
} }
} }
}
// //
.activity-title { .activity-title {
font-size: 32rpx; font-size: 32rpx;
font-weight: 500; font-weight: 500;
color: #333333; color: #333333;
line-height: normal; line-height: normal;
} }
.activity-des { .activity-des {
font-size: 26rpx; font-size: 26rpx;
font-weight: 500; font-weight: 500;
color: #666666; color: #666666;
line-height: 40rpx; line-height: 40rpx;
} }
</style> </style>