bug fix: 如果未登录, 只显示日期
This commit is contained in:
parent
5291890134
commit
53d3fa2f17
@ -5,10 +5,10 @@
|
|||||||
<div class="calen-list">
|
<div class="calen-list">
|
||||||
<li v-for="(item,index) in current" :key="index">
|
<li v-for="(item,index) in current" :key="index">
|
||||||
<div class="weiqiandao" v-if="item.type == -1">
|
<div class="weiqiandao" v-if="item.type == -1">
|
||||||
<img src="./../../assets/home/Icon_xross.png" alt="">
|
<img src="@/assets/home/Icon_xross.png" alt="">
|
||||||
</div>
|
</div>
|
||||||
<div class="qiandao" v-if="item.type == 1">
|
<div class="qiandao" v-if="item.type == 1">
|
||||||
<img src="./../../assets/home/Checkmark.png" alt="">
|
<img src="@/assets/home/Checkmark.png" alt="">
|
||||||
</div>
|
</div>
|
||||||
<div class="weidaoshijian" v-if="item.type == 0">{{ index+1 }}</div>
|
<div class="weidaoshijian" v-if="item.type == 0">{{ index+1 }}</div>
|
||||||
</li>
|
</li>
|
||||||
@ -17,7 +17,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getToken } from './../../utils/cookies.js'
|
import { getToken } from '@/utils/cookies.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@ -65,17 +65,31 @@ export default {
|
|||||||
|
|
||||||
// 获取签到列表
|
// 获取签到列表
|
||||||
async getCheckInit(){
|
async getCheckInit(){
|
||||||
let dayTime = Math.round(new Date())
|
// let dayTime = Math.round(new Date())
|
||||||
let token = getToken()
|
let token = getToken()
|
||||||
let res = await this.$axios.get(`/api/user/checkin/list/1month`, {
|
let datas = []
|
||||||
params: "",
|
// 如果没登录, 就只显示日期
|
||||||
headers: { Authorization: `Bearer ${token}` }
|
if (!token) {
|
||||||
})
|
this.current.forEach(item => {
|
||||||
|
item.type = 0
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
let res = await this.$axios.get(`/api/user/checkin/list/1month`, {
|
||||||
|
params: "",
|
||||||
|
headers: { Authorization: `Bearer ${token}` }
|
||||||
|
})
|
||||||
|
datas = res.data?.data ? res.data.data : []
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
|
||||||
for(let i = 0; i < this.current.length; i++) {
|
for(let i = 0; i < this.current.length; i++) {
|
||||||
for(let j = 0; j < res.data.data.length; j++) {
|
for(let j = 0; j < datas.length; j++) {
|
||||||
if(this.current[i].time > res.data.data[0].day) {
|
if(this.current[i].time > datas[0].day) {
|
||||||
this.current[i].type = 0
|
this.current[i].type = 0
|
||||||
} else if (this.current[i].time == res.data.data[j].day) {
|
} else if (this.current[i].time == datas[j].day) {
|
||||||
this.current[i].type = 1
|
this.current[i].type = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,15 +166,15 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.weiqiandao {
|
.weiqiandao {
|
||||||
background: url('./../../assets/home/Missed.png') no-repeat;
|
background: url('@/assets/home/Missed.png') no-repeat;
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
}
|
}
|
||||||
.qiandao {
|
.qiandao {
|
||||||
background: url('./../../assets/home/Done.png') no-repeat;
|
background: url('@/assets/home/Done.png') no-repeat;
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
}
|
}
|
||||||
.weidaoshijian {
|
.weidaoshijian {
|
||||||
background: url('./../../assets/home/Laag 5.png') no-repeat;
|
background: url('@/assets/home/Laag 5.png') no-repeat;
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user