123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470 |
- <template>
- <!-- 每日签到 -->
- <view>
- <view style="background-color: $color-white !important;">
- <u-navbar :back-text="i18n('Back')" :back-text-style="backStyle" back-icon-color="#fff" title-color="#fff"
- :background="background" title-width="300" :title="i18n('getEveryDay')"></u-navbar>
- </view>
- <view class="content">
- <view class="top-pic">
- <view class="pic-text">
- <view class="big-text">{{$i18n.locale=='zh'?'立即签到':'Sign in immediately'}}</view>
- <view class="little-text">
- {{$i18n.locale=='zh'?'连续签到,奖励更丰富!':'Continuous check-in, more rich reward!'}}
- </view>
- </view>
- </view>
- <view class="body-day" v-if="flag==1">
- <view class="get-every">
- <view :class="index.charAt(index.length - 1)<=GetLength.length?'getDay1':'getDay'"
- v-for=" (item,index) in getSignIn" :key="index" @tap="getDailyIntetral(index)">
- <view :class="index.charAt(index.length - 1)<=GetLength.length?'dayImg1':'dayImg'">
- <view :class="index.charAt(index.length - 1)<=GetLength.length?'dayNum1':'dayNum'">
- {{$i18n.locale=='zh'?'第':'Day'}}{{index.charAt(index.length - 1)}}{{$i18n.locale=='zh'?'天':''}}
- </view>
- <image src="@/static/user-gave.png" class="img-pic" />
- <view :class="index.charAt(index.length - 1)<=GetLength.length?'imgText1':'imgText'">
- {{item}}{{$i18n.locale=='zh'?'积分':'Intetral'}}
- </view>
- </view>
- </view>
- </view>
- <u-button class="ntegrate-history" type="custom" shape="circle">
- {{$i18n.locale=='zh'?'积分签到获取历史':'Integral sign-in to obtain history'}}
- </u-button>
- </view>
- <view class="body-day" v-if="flag!=1">
- <view class="get-every">
- <view :class="index.charAt(index.length - 1)<=GetLength.length?'getDay1':'getDay'"
- v-for=" (item,index) in getSignIn" :key="index" @tap="getDailyIntetral(index)">
- <view :class="index.charAt(index.length - 1)<=GetLength.length?'dayImg1':'dayImg'">
- <view :class="index.charAt(index.length - 1)<=GetLength.length?'dayNum1':'dayNum'">
- {{$i18n.locale=='zh'?'第':'Day'}}{{index.charAt(index.length - 1)}}{{$i18n.locale=='zh'?'天':''}}
- </view>
- <image src="@/static/user-gave.png" class="img-pic" />
- <view :class="index.charAt(index.length - 1)<=GetLength.length?'imgText1':'imgText'">
- {{item}}{{$i18n.locale=='zh'?'积分':'Intetral'}}
- </view>
- </view>
- </view>
- </view>
- <u-button class="ntegrate-history" type="custom" shape="circle">
- {{$i18n.locale=='zh'?'积分签到获取历史':'Integral sign-in to obtain history'}}
- </u-button>
- </view>
- <view class="kong-ui"></view>
- <view class="title">
- <view class="title-list">{{$i18n.locale=='zh'?'日期':'Date'}}</view>
- <view class="title-list">{{$i18n.locale=='zh'?'分数':'Score'}}</view>
- <view class="title-list">{{$i18n.locale=='zh'?'备注':'Remark'}}</view>
- </view>
- <view v-if="flag==1" class="detail-list" v-for="(getList,index) in getInfo" :key="index">
- <view class="list-time get-details">{{getList.updateDate|time('YYYY-MM-DD')}}</view>
- <view class="list-integrate get-details">+{{getList.point}}</view>
- <view class="list-info get-details">{{$i18n.locale=='zh'?getList.title:getList.titleEn}}</view>
- </view>
- <view v-if="flag!=1" class="detail-list" v-for="(getList,index) in getInfo" :key="index">
- <view class="list-time get-details">{{getList.updateDate|time('YYYY-MM-DD')}}</view>
- <view class="list-integrate get-details">+{{getList.point}}</view>
- <view class="list-info get-details">{{$i18n.locale=='zh'?getList.title:getList.titleEn}}</view>
- </view>
- <uni-load-more :status="status" v-show="this.total>10"></uni-load-more>
- </view>
- <uni-popup ref="message">
- <uni-popup-message style="border-radius: 10px;" :type="msgType" :message="messageText" :duration="1000">
- </uni-popup-message>
- </uni-popup>
- </view>
- </template>
- <script>
- import moment from "moment";
- import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
- import uniPopupMessage from '@/components/uni-popup/uni-popup-message.vue'
- import uniPopup from '@/components/uni-popup/uni-popup.vue'
- import {
- addSignPointDetail
- } from '@/api/address'
- export default {
- components: {
- uniPopupDialog,
- uniPopupMessage,
- uniPopup
- },
- data() {
- return {
- flag: '1',
- background: {
- backgroundImage: 'linear-gradient(270deg, #4BC0E2 0%, #538BE7 100%)',
- },
- backStyle: {
- color: '#FFFFFF',
- },
- // getBtnEd: true,
- getInfo: {},
- getSignIn: {},
- GetLength: {},
- msgType: 'success',
- messageText: `请稍后...`,
- pageSize: "10",
- pageNo: "1",
- total: null,
- status: 'more',
- index: '',
- };
- },
- onShow() {
- this.findBasicInfo();
- this.getEveryDays();
- console.log(this.flag, '判断');
- },
- onReachBottom() {
- let allTotal = this.pageNo * this.pageSize
- if (allTotal < this.total) {
- console.log(this.total);
- //当前条数小于总条数 则增加请求页数
- this.status = 'loading';
- this.pageSize++;
- this.getIntegrate() //调用加载数据方法
- } else {
- this.status = 'noMore';
- // console.log('已加载全部数据')
- }
- },
- onPullDownRefresh() {
- //调用获取数据方法
- this.getIntegrate()
- setTimeout(() => {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- filters: {
- twoDecimal(value) {
- return parseFloat(string(value)).toFixed(2);
- },
- time(data, type) {
- return moment(data).format(type);
- }
- },
- methods: {
- i18n(data) {
- return this.$t('common.' + data);
- },
- change(e) {
- console.log('当前模式:' + e.type + ',状态:' + e.show);
- },
- async getDailyIntetral(index) {
- console.log(this.GetLength);
- //用户第一次签到
- if (this.GetLength.length === 0) {
- const tokendata = await this.$myRequest({
- url: '/sys/token',
- method: 'get'
- });
- addSignPointDetail({
- taskDict: "point_task_sign",
- point: this.getSignIn[`day${this.GetLength.length+1}`],
- },
- tokendata.data
- ).then(() => {
- this.$refs.message.open()
- if (this.$i18n.locale == 'zh') {
- this.messageText = `签到成功`
- this.findBasicInfo();
- this.getEveryDays();
- this.flag += '1'
- return this.flag
- } else {
- this.messageText = `Sign in successfully`
- this.findBasicInfo();
- this.getEveryDays();
- this.flag += '1'
- return this.flag
- }
- })
- }
- //用户非第一次签到
- else {
- let todayDate = moment(new Date()).format("YYYY-MM-DD");
- var length = this.GetLength.length;
- var data = parseInt(length - 1);
- let lastSingIn = moment(
- this.GetLength[data].updateDate
- ).format("YYYY-MM-DD");
- console.log(todayDate);
- console.log(lastSingIn);
- if (todayDate != lastSingIn) {
- const tokendata = await this.$myRequest({
- url: '/sys/token',
- method: 'get'
- });
- addSignPointDetail({
- taskDict: "point_task_sign",
- point: this.getSignIn[`day${this.GetLength.length+1}`],
- },
- tokendata.data
- ).then(() => {
- this.$refs.message.open()
- if (this.$i18n.locale == 'zh') {
- this.messageText = `签到成功!`
- this.findBasicInfo();
- this.getEveryDays();
- this.flag += '1'
- return this.flag
- } else {
- this.messageText = `Sign in successfully`
- this.findBasicInfo();
- this.getEveryDays();
- this.flag += '1'
- return this.flag
- }
- });
- } else {
- this.$refs.message.open()
- if (this.$i18n.locale == 'zh') {
- this.messageText = `今天已签到!`
- this.findBasicInfo();
- this.getEveryDays();
- this.flag += '1'
- return this.flag
- } else {
- this.messageText = `Have signed in today`
- this.findBasicInfo();
- this.getEveryDays();
- this.flag += '1'
- return this.flag
- }
- }
- }
- },
- async findBasicInfo() {
- const result = await this.$myRequest({
- url: '/uc/userCenter/findBasicInfo',
- data: {},
- });
- this.form = result.data;
- this.getIntegrate();
- },
- async getIntegrate() {
- const res = await this.$myRequest({
- url: '/uc/umsUserPointDetailss/getUserPointDetailsPage',
- data: {
- "pageSize": this.pageSize,
- "pageNo": this.pageNo,
- "taskDict": "point_task_sign"
- }
- });
- // console.log(res);
- this.getInfo = res.data.umsUserPointDetailss
- this.total = res.data.page.totalCount
- },
- async getEveryDays() {
- const res = await this.$myRequest({
- url: '/uc/umsUserTasks/getUserTaskComplete',
- data: {
- }
- });
- // console.log(res, '===========');
- this.GetLength = res.data.sign ? res.data.sign : [],
- console.log(this.GetLength, res.data.sign, '大数据');
- this.getSignIn = res.data.signTask.taskPoint
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .content {
- // background-color: #4592FE;
- .top-pic {
- height: 400rpx;
- background-image: url('@/static/bgc-blue.jpg');
- background-size: 100% 400rpx;
- .pic-text {
- width: 64%;
- height: 64%;
- background: rgba(255, 255, 255, 0.3);
- margin-left: 50%;
- border: 1rpx solid #fff;
- transform: translateX(-50%) translateY(28%);
- .big-text {
- font-size: 38rpx;
- font-weight: 700;
- color: #fff;
- text-align: center;
- transform: translateY(46%);
- }
- .little-text {
- font-size: 28rpx;
- text-align: center;
- color: #fff;
- transform: translateY(110%);
- }
- }
- }
- .sign-in {
- height: 60rpx;
- line-height: 60rpx;
- background-color: #73d502ff;
- width: 150rpx;
- text-align: center;
- font-size: 30rpx;
- font-weight: 700;
- border-radius: 50rpx;
- margin-left: 75%;
- }
- .body-day {
- background-color: #fff;
- .get-every {
- width: 96%;
- margin-left: 2%;
- height: 360rpx;
- display: flex;
- flex-flow: wrap;
- justify-content: space-evenly;
- .getDay {
- width: 24%;
- height: 150rpx;
- border-radius: 20rpx;
- text-align: center;
- border: 1rpx solid #e566934d;
- background-color: #fef8ea;
- .dayImg {
- transform: translateY(-10rpx);
- .dayNum {
- border: 1rpx solid skyblue;
- border-radius: 50rpx;
- width: 100rpx;
- margin-left: 50%;
- transform: translateX(-50%);
- height: 45rpx;
- line-height: 45rpx;
- background-color: #fbb086ff;
- color: #fff;
- }
- .imgText {
- transform: translateY(-10rpx);
- font-size: 28rpx;
- color: #fbb086ff;
- }
- .img-pic {
- width: 70rpx;
- height: 70rpx;
- }
- }
- }
- .getDay:last-child {
- width: 49%;
- }
- .getDay1 {
- width: 24%;
- height: 150rpx;
- border-radius: 20rpx;
- text-align: center;
- border: 1rpx solid #00ff004d;
- background-color: #ccf6df;
- .dayImg1 {
- transform: translateY(-10rpx);
- .img-pic {
- width: 70rpx;
- height: 70rpx;
- }
- .dayNum1 {
- border: 1rpx solid skyblue;
- border-radius: 50rpx;
- width: 100rpx;
- margin-left: 50%;
- transform: translateX(-50%);
- height: 45rpx;
- line-height: 45rpx;
- background-color: #76d509ff;
- color: #fff;
- }
- .imgText1 {
- transform: translateY(-10rpx);
- font-size: 28rpx;
- color: #76d509ff;
- }
- }
- }
- .getDay1:last-child {
- width: 49%;
- }
- }
- .ntegrate-history {
- width: 60%;
- height: 80rpx;
- line-height: 80rpx;
- font-size: 30rpx;
- background-color: #4592fe;
- color: #fff;
- margin-top: 10rpx;
- }
- }
- .kong-ui {
- height: 35rpx;
- background-color: #ffffff;
- }
- .title {
- height: 60rpx;
- display: flex;
- justify-content: space-evenly;
- .title-list {
- width: 33%;
- line-height: 60rpx;
- text-align: center;
- }
- }
- .detail-list {
- display: flex;
- justify-content: space-evenly;
- height: 80rpx;
- background-color: #fff;
- .get-details {
- line-height: 80rpx;
- width: 33%;
- text-align: center;
- font-size: 28rpx;
- }
- .list-integrate {
- font-size: 32rpx;
- color: #E02020FF;
- font-weight: 700;
- }
- }
- }
- </style>
|