hengmei-two/pagesA/signIn/signIn.vue

147 lines
4.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view>
<!-- 状态栏 -->
<status-nav :titleVal="'签到管理'" :statusTitle="true"></status-nav>
<view v-if="loading" :style="{paddingTop: statusHNH+'px'}" class=" fon28 col3">
<view style="position: sticky;z-index: 3;background: #FFFFFF;padding-bottom: 20rpx;" :style="{top:statusHNH+'px'}">
<view class="posir">
<image class="posia width100" src="/static/public/sign-01.png" mode="widthFix"></image>
<view class="posir tc pad-sx20" style="z-index: 5;">
<image v-if="isSigin==0" @tap="siginEv" src="/static/public/sign-02.png" mode="" class="sigin-img"></image>
<image v-else src="/static/public/sigined.png" mode="" class="sigin-img"></image>
<view class="fon20 colf mar-s20">在连续签到可获得积分</view>
<view class="disjcac mar-sx30">
<image src="/static/public/sign-03.png" class="sigin-success" mode=""></image>
<view class="bold colf mar-z10 fon56">{{user_score}}</view>
</view>
<view class="disjb pad-zy30">
<view v-for="(item,index) in timeList" :key="index" class="disjcac fc">
<view class="disjcac fon24 posir sigin-day" :style="{color:item.isSign?'#789CFB':'#FFFFFF',background:item.isSign?'#FFFFFF':''}">
+{{item.num}}
<image v-if="item.isSign==1" class="posia" src="/static/public/gou.png" mode=""></image>
</view>
<view class="fon28 colf mar-s20">{{item.day}}</view>
</view>
</view>
</view>
</view>
<view class="mar-s20 fon28 col3 bold mar-z50">积分签到</view>
</view>
<!-- 获取列表,提现列表 -->
<view class="pad-zy30">
<view class="bacf pad-zy20 pad-x20 radius20">
<scroll-view scroll-y="true" v-if="dataList.length!=0">
<view v-for="(item,index) in dataList" :key="index" class="disjbac bbot pad-sx10">
<view>
<view class="fon26 col3">{{item.title}}</view>
<view class="mar-s10 fon20 col9">{{item.time}}</view>
</view>
<view class="fon36 bold pcol">+{{item.num}}</view>
</view>
</scroll-view>
<view v-else class="fon24 col6 tc pad-s50"></view>
</view>
</view>
</view>
<!-- -->
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
</view>
</template>
<script>
export default {
data() {
return {
statusHNH:uni.getStorageSync('electric_nav_height'),
publicColor:uni.getStorageSync('publicColor'),//主题颜色
timeList:[],
dataList:[
// {title:'签到积分',time:'2021.09.06 10:30:10',num:'1'},
],
user_score:0,//账户余额
page:1,
size:10,
total:'',//总数
isZanw:true,
isSigin:0,
loading:false,
}
},
onReachBottom() {//触底事件
if(this.total!=this.dataList.length){
this.page++
this.checkTime()//调用自主预约列表事件
} else {
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多列表','none',1000,'bottom')
this.isZanw = false
}
},
onShow() {
this.$toolAll.tools.isLogin();
},
onLoad() {
if(uni.getStorageSync('phone_active')!=0){
this.checkTime();
this.checkList();
}
},
methods: {
siginEv(){
this.$toolAll.tools.showToast('正在签到...');
this.$requst.post('sign/online-singIn').then(res=>{
if(res.code==0){
this.$toolAll.tools.showToast('签到成功');
this.checkTime();
this.checkList();
} else {
this.$toolAll.tools.showToast(res.msg);
}
})
},
checkTime(){
this.$requst.post('sign/online-sign-record',{page:this.page,size:this.size}).then(res=>{
if(res.code==0){
if(this.page==1) this.dataList = [];
this.total = res.data.total;
if(res.data.length!=0){
res.data.forEach(item=>{
let obj = {
title:'签到积分',
time:item.created_at,
num:item.score
}
this.dataList.push(obj);
})
}
}
})
},
checkList(){
this.$requst.post('sign/mini-load').then(res=>{
if(res.code==0){
this.timeList = [];
for (let key in res.data.sign_record) {
let obj = {
num:res.data.sign_record[key].record,
day:res.data.sign_record[key].key,
isSign:res.data.sign_record[key].is_sign
}
this.timeList.push(obj)
// console.log(key);
}
this.isSigin = res.data.today_sign_in;//0未签到 1已签到
this.user_score = res.data.user_score;
setTimeout(()=>{
this.loading = true;
},1000)
}
})
}
}
}
</script>
<style>
page{background-color: #FFFFFF;}
</style>