@ -1,211 +1,183 @@ |
|||||||
<template> |
<template> |
||||||
<view class="sign"> |
<view class="sign"> |
||||||
<view class="header bg-color-red"> |
<view class="header bg-color-red"> |
||||||
<view class="headerCon acea-row row-between-wrapper"> |
<view class="headerCon acea-row row-between-wrapper"> |
||||||
<view class="left acea-row row-between-wrapper"> |
<view class="left acea-row row-between-wrapper"> |
||||||
<view class="pictrue"> |
<view class="pictrue"> |
||||||
<image :src="userInfo.avatar" /> |
<image :src="userInfo.avatar" /> |
||||||
</view> |
</view> |
||||||
<view class="text"> |
<view class="text"> |
||||||
<view class="line1">{{ userInfo.nickname }}</view> |
<view class="line1">{{ userInfo.nickname }}</view> |
||||||
<view class="integral acea-row"> |
<view class="integral acea-row"> |
||||||
<text>积分: {{ userInfo.integral }}</text> |
<text>积分: {{ userInfo.integral }}</text> |
||||||
</view> |
</view> |
||||||
</view> |
</view> |
||||||
</view> |
</view> |
||||||
<view @click="goSignRecord()" class="right acea-row row-middle"> |
<view @click="goSignRecord()" class="right acea-row row-middle"> |
||||||
<view class="iconfont icon-caidan"></view> |
<view class="iconfont icon-caidan"></view> |
||||||
<view>明细</view> |
<view>明细</view> |
||||||
</view> |
</view> |
||||||
</view> |
</view> |
||||||
</view> |
</view> |
||||||
<view class="wrapper"> |
<view class="wrapper"> |
||||||
<view class="list acea-row row-between-wrapper"> |
<view class="list acea-row row-between-wrapper"> |
||||||
<view |
<view class="item" v-for="(item, signSystemListIndex) in signSystemList" :key="signSystemListIndex"> |
||||||
class="item" |
<view :class="signSystemListIndex + 1 === signSystemList.length ? 'rewardTxt' : ''">{{ item.day }}</view> |
||||||
v-for="(item, signSystemListIndex) in signSystemList" |
<view class="venus" :class=" (signSystemListIndex + 1 === signSystemList.length ? 'reward' : '') +' ' + (sign_index >= signSystemListIndex + 1 ? 'venusSelect' : '')"></view> |
||||||
:key="signSystemListIndex" |
<view class="num" :class="sign_index >= signSystemListIndex + 1 ? 'on' : ''">+{{ item.sign_num }}</view> |
||||||
> |
</view> |
||||||
<view |
</view> |
||||||
:class="signSystemListIndex + 1 === signSystemList.length ? 'rewardTxt' : ''" |
<!--加在 but 上 on 为已签到--> |
||||||
>{{ item.day }}</view> |
<view class="but bg-color-red" :class="userInfo.is_day_sgin ? 'on' : ''" @click="goSign">{{ userInfo.isDaySign ? "已签到" : "立即签到" }}</view> |
||||||
<view |
<view class="lock"></view> |
||||||
class="venus" |
</view> |
||||||
:class=" |
<view class="wrapper wrapper2"> |
||||||
(signSystemListIndex + 1 === signSystemList.length ? 'reward' : '') + |
<view class="tip">已累计签到</view> |
||||||
' ' + |
<view class="list2 acea-row row-center row-bottom"> |
||||||
(sign_index >= signSystemListIndex + 1 ? 'venusSelect' : '') |
<view class="item" v-for="(item, signCountIndex) in signCount" :key="signCountIndex">{{ item || 0 }}</view> |
||||||
" |
<view class="data">天</view> |
||||||
></view> |
</view> |
||||||
<view |
<view class="tip2">据说连续签到第{{ day }}天可获得超额积分,一定要坚持签到哦~~~</view> |
||||||
class="num" |
<view class="list3"> |
||||||
:class="sign_index >= signSystemListIndex + 1 ? 'on' : ''" |
<view class="item acea-row row-between-wrapper" v-for="(item, signListIndex) in signList" :key="signListIndex"> |
||||||
>+{{ item.signNum }}</view> |
<view> |
||||||
</view> |
<view class="name line1">{{ item.title }}</view> |
||||||
</view> |
<view class="data">{{ item.addTime }}</view> |
||||||
<!--加在 but 上 on 为已签到--> |
</view> |
||||||
<view |
<view class="num font-color-red">+{{ item.number }}</view> |
||||||
class="but bg-color-red" |
</view> |
||||||
:class="userInfo.is_day_sgin ? 'on' : ''" |
<view @click="goSignRecord()" class="Loads acea-row row-center-wrapper" v-if="signList.length > 0"> |
||||||
@click="goSign" |
点击加载更多 |
||||||
>{{ userInfo.isDaySign ? "已签到" : "立即签到" }}</view> |
<view class="iconfont icon-xiangyou acea-row row-center-wrapper"></view> |
||||||
<view class="lock"></view> |
</view> |
||||||
</view> |
</view> |
||||||
<view class="wrapper wrapper2"> |
</view> |
||||||
<view class="tip">已累计签到</view> |
<view class="signTip acea-row row-center-wrapper" :class="active === true ? 'on' : ''"> |
||||||
<view class="list2 acea-row row-center row-bottom"> |
<view class="signTipLight loadingpic"> |
||||||
<view |
<image src="@/static/images/light.png" /> |
||||||
class="item" |
</view> |
||||||
v-for="(item, signCountIndex) in signCount" |
<view class="signTipCon"> |
||||||
:key="signCountIndex" |
<view class="state">签到成功</view> |
||||||
>{{ item || 0 }}</view> |
<view class="integral">获得{{ integral }}积分</view> |
||||||
<view class="data">天</view> |
<view class="signTipBnt" @click="close">好的</view> |
||||||
</view> |
</view> |
||||||
<view class="tip2">据说连续签到第{{ day }}天可获得超额积分,一定要坚持签到哦~~~</view> |
</view> |
||||||
<view class="list3"> |
<view class="mask" @touchmove.prevent :hidden="active === false"></view> |
||||||
<view |
</view> |
||||||
class="item acea-row row-between-wrapper" |
|
||||||
v-for="(item, signListIndex) in signList" |
|
||||||
:key="signListIndex" |
|
||||||
> |
|
||||||
<view> |
|
||||||
<view class="name line1">{{ item.title }}</view> |
|
||||||
<view class="data">{{ item.addTime }}</view> |
|
||||||
</view> |
|
||||||
<view class="num font-color-red">+{{ item.number }}</view> |
|
||||||
</view> |
|
||||||
<view |
|
||||||
@click="goSignRecord()" |
|
||||||
class="Loads acea-row row-center-wrapper" |
|
||||||
v-if="signList.length > 0" |
|
||||||
> |
|
||||||
点击加载更多 |
|
||||||
<view class="iconfont icon-xiangyou acea-row row-center-wrapper"></view> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
<view class="signTip acea-row row-center-wrapper" :class="active === true ? 'on' : ''"> |
|
||||||
<view class="signTipLight loadingpic"> |
|
||||||
<image :src="$VUE_APP_RESOURCES_URL+'/images/light.png'" /> |
|
||||||
</view> |
|
||||||
<view class="signTipCon"> |
|
||||||
<view class="state">签到成功</view> |
|
||||||
<view class="integral">获得{{ integral }}积分</view> |
|
||||||
<view class="signTipBnt" @click="close">好的</view> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
<view class="mask" @touchmove.prevent :hidden="active === false"></view> |
|
||||||
</view> |
|
||||||
</template> |
</template> |
||||||
<style scoped lang="less"> |
<style scoped lang="less"> |
||||||
.Loads .iconfont { |
.Loads .iconfont { |
||||||
font-size: 0.25*100rpx; |
font-size: 0.25*100rpx; |
||||||
margin: 0.02*100rpx 0 0 0.1*100rpx; |
margin: 0.02*100rpx 0 0 0.1*100rpx; |
||||||
} |
} |
||||||
</style> |
</style> |
||||||
<script> |
<script> |
||||||
import { |
import { |
||||||
postSignUser, |
postSignUser, |
||||||
getSignConfig, |
getSignConfig, |
||||||
postSignIntegral, |
postSignIntegral, |
||||||
getSignList |
getSignList |
||||||
} from "@/api/user"; |
} from "@/api/user"; |
||||||
import { add } from "@/utils/bc"; |
import { |
||||||
|
add |
||||||
|
} from "@/utils/bc"; |
||||||
|
|
||||||
export default { |
export default { |
||||||
name: "Sign", |
name: "Sign", |
||||||
components: {}, |
components: {}, |
||||||
props: {}, |
props: {}, |
||||||
data: function() { |
data: function() { |
||||||
return { |
return { |
||||||
userInfo: {}, |
userInfo: {}, |
||||||
integral: 0, |
integral: 0, |
||||||
signCount: [], |
signCount: [], |
||||||
sign_index: 0, |
sign_index: 0, |
||||||
signSystemList: [], |
signSystemList: [], |
||||||
signList: [], |
signList: [], |
||||||
page: 1, |
page: 1, |
||||||
limit: 3, |
limit: 3, |
||||||
active: false, |
active: false, |
||||||
day: "" |
day: "" |
||||||
}; |
}; |
||||||
}, |
}, |
||||||
mounted: function() { |
mounted: function() { |
||||||
this.signUser(); |
this.signUser(); |
||||||
this.signConfig(); |
this.signConfig(); |
||||||
this.getSignList(); |
this.getSignList(); |
||||||
}, |
}, |
||||||
methods: { |
methods: { |
||||||
goSignRecord() { |
goSignRecord() { |
||||||
this.$yrouter.push("/pages/user/signIn/SignRecord/index"); |
this.$yrouter.push("/pages/user/signIn/SignRecord/index"); |
||||||
}, |
}, |
||||||
// js给数字补0;num:需要补0的数字,length:长度(补到多少位); |
// js给数字补0;num:需要补0的数字,length:长度(补到多少位); |
||||||
PrefixInteger: function(num, length) { |
PrefixInteger: function(num, length) { |
||||||
return (Array(length).join("0") + num).slice(-length).split(""); |
return (Array(length).join("0") + num).slice(-length).split(""); |
||||||
}, |
}, |
||||||
//数字转中文 |
//数字转中文 |
||||||
Rp: function(n) { |
Rp: function(n) { |
||||||
var cnum = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"]; |
var cnum = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"]; |
||||||
var s = ""; |
var s = ""; |
||||||
n = "" + n; // 数字转为字符串 |
n = "" + n; // 数字转为字符串 |
||||||
for (var i = 0; i < n.length; i++) { |
for (var i = 0; i < n.length; i++) { |
||||||
s += cnum[parseInt(n.charAt(i))]; |
s += cnum[parseInt(n.charAt(i))]; |
||||||
} |
} |
||||||
return s; |
return s; |
||||||
}, |
}, |
||||||
// 获取用户信息 |
// 获取用户信息 |
||||||
signUser: function() { |
signUser: function() { |
||||||
let that = this; |
let that = this; |
||||||
postSignUser({ sign: 1 }).then(res => { |
postSignUser({ |
||||||
res.data.integral = parseInt(res.data.integral); |
sign: 1 |
||||||
var sumSginDay = res.data.sumSignDay; |
}).then(res => { |
||||||
that.userInfo = res.data; |
res.data.integral = parseInt(res.data.integral); |
||||||
that.signCount = that.PrefixInteger(sumSginDay, 4); |
var sumSginDay = res.data.sumSignDay; |
||||||
that.sign_index = parseInt(res.data.signNum); |
that.userInfo = res.data; |
||||||
}); |
that.signCount = that.PrefixInteger(sumSginDay, 4); |
||||||
}, |
that.sign_index = parseInt(res.data.signNum); |
||||||
// 签到配置 |
}); |
||||||
signConfig: function() { |
}, |
||||||
let that = this; |
// 签到配置 |
||||||
getSignConfig().then(res => { |
signConfig: function() { |
||||||
that.signSystemList = res.data; |
let that = this; |
||||||
that.day = that.Rp(that.signSystemList.length); |
getSignConfig().then(res => { |
||||||
}); |
that.signSystemList = res.data; |
||||||
}, |
that.day = that.Rp(that.signSystemList.length); |
||||||
// 用户签到 |
}); |
||||||
goSign: function() { |
}, |
||||||
let that = this, |
// 用户签到 |
||||||
sumSginDay = that.userInfo.sumSignDay; |
goSign: function() { |
||||||
if (that.userInfo.is_day_sgin){ |
let that = this, |
||||||
uni.showToast({ |
sumSginDay = that.userInfo.sumSignDay; |
||||||
title: "您今日已签到!", |
if (that.userInfo.is_day_sgin) { |
||||||
icon: "none", |
uni.showToast({ |
||||||
duration: 2000 |
title: "您今日已签到!", |
||||||
}); |
icon: "none", |
||||||
return |
duration: 2000 |
||||||
} |
}); |
||||||
postSignIntegral().then(res => { |
return |
||||||
that.active = true; |
} |
||||||
that.integral = res.data.integral; |
postSignIntegral().then(res => { |
||||||
let sign_index = parseInt(that.sign_index + 1); |
that.active = true; |
||||||
that.sign_index = |
that.integral = res.data.integral; |
||||||
sign_index > that.signSystemList.length ? 1 : sign_index; |
let sign_index = parseInt(that.sign_index + 1); |
||||||
that.signCount = that.PrefixInteger(sumSginDay + 1, 4); |
that.sign_index = |
||||||
that.userInfo.is_day_sgin = true; |
sign_index > that.signSystemList.length ? 1 : sign_index; |
||||||
that.userInfo.integral = add(that.userInfo.integral, res.data.integral); |
that.signCount = that.PrefixInteger(sumSginDay + 1, 4); |
||||||
that.getSignList(); |
that.userInfo.is_day_sgin = true; |
||||||
}); |
that.userInfo.integral = add(that.userInfo.integral, res.data.integral); |
||||||
}, |
that.getSignList(); |
||||||
// 获取签到列表; |
}); |
||||||
getSignList: function() { |
}, |
||||||
let that = this; |
// 获取签到列表; |
||||||
getSignList(that.page, that.limit).then(res => { |
getSignList: function() { |
||||||
that.signList = res.data; |
let that = this; |
||||||
}); |
getSignList(that.page, that.limit).then(res => { |
||||||
}, |
that.signList = res.data; |
||||||
close: function() { |
}); |
||||||
this.active = false; |
}, |
||||||
} |
close: function() { |
||||||
} |
this.active = false; |
||||||
}; |
} |
||||||
</script> |
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 191 KiB |
Before Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 6.9 KiB |