-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 完成小鱼干签到页面 * feat: 修改签到url并完善签到页面功能 * feat: 修改一些bug * perf: 小优化 * perf: 将一些图标放入图床 --------- Co-authored-by: foliet <[email protected]>
- Loading branch information
1 parent
2eb672d
commit 7344238
Showing
27 changed files
with
1,177 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export interface UserCheckInResp { | ||
getFish: boolean; | ||
getFishNum: number; | ||
getFishTimes: number; | ||
} | ||
|
||
export interface getMissionResp { | ||
SignInTime: number; | ||
LikeTime: number; | ||
CommentTime: number; | ||
ContentTime: number; | ||
SignInFishes: number[]; | ||
LikeFishes: number[]; | ||
CommentFishes: number[]; | ||
ContentFishes: number[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { | ||
UserCheckInResp, | ||
getMissionResp | ||
} from "@/apis/incentive/incentive-interfaces"; | ||
|
||
export async function userCheckIn() { | ||
return await new Promise<UserCheckInResp>((resolve, reject) => { | ||
uni.request({ | ||
url: "/incentive/check_in", | ||
method: "GET", | ||
success(res: UniNamespace.RequestSuccessCallbackResult) { | ||
if (res.statusCode !== 200) { | ||
reject(res); | ||
} | ||
const data = res.data as UserCheckInResp; | ||
resolve(data); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
export async function getUserMission() { | ||
return await new Promise<getMissionResp>((resolve, reject) => { | ||
uni.request({ | ||
url: "/incentive/get_mission", | ||
method: "GET", | ||
success(res: UniNamespace.RequestSuccessCallbackResult) { | ||
if (res.statusCode !== 200) { | ||
reject(res); | ||
} | ||
const data = res.data as getMissionResp; | ||
resolve(data); | ||
} | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
<template> | ||
<view class="moment-task-box"> | ||
<view class="content"> | ||
<text class="title">每日评论</text> | ||
<text class="detail" | ||
>评论可以获得{{ | ||
userData.CommentFishes[0] | ||
}}小鱼干,每日可共获得3次</text | ||
> | ||
<view class="finish-times"> | ||
<text class="times">完成情况:</text> | ||
<image | ||
v-for="commenttime in commentTimes" | ||
:key="commenttime" | ||
:src=" | ||
userData.CommentTime >= commenttime | ||
? Icons.FinishedTask | ||
: Icons.UnFinishedTask | ||
" | ||
class="icon" | ||
:style="{ marginLeft: commenttime === 1 ? '0' : '1vw' }" | ||
/> | ||
</view> | ||
</view> | ||
<view class="get-fish-number"> | ||
<img :src="Icons.LittleFish" class="fish-unit" /> | ||
<text class="fish-num">X{{ userData.CommentFishes[0] }}</text> | ||
</view> | ||
<view | ||
v-if="userData.CommentTime >= 3" | ||
class="button" | ||
style="background-color: #cccccc" | ||
> | ||
<view class="option">已完成</view> | ||
</view> | ||
<view v-else class="button" @click="goToCommunity()"> | ||
<view class="option">去完成</view> | ||
</view> | ||
</view> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { Icons, Pages } from "@/utils/url"; | ||
import { ref } from "vue"; | ||
import { getMissionResp } from "@/apis/incentive/incentive-interfaces"; | ||
import { getUserMission } from "@/apis/incentive/incentive"; | ||
const goToCommunity = () => { | ||
uni.navigateTo({ | ||
url: Pages.FirstPage | ||
}); | ||
}; | ||
const userData = ref<getMissionResp>({ | ||
SignInTime: 0, | ||
LikeTime: 0, | ||
CommentTime: 0, | ||
ContentTime: 0, | ||
SignInFishes: [], | ||
LikeFishes: [], | ||
CommentFishes: [], | ||
ContentFishes: [] | ||
}); | ||
// const a = ref([]); | ||
// getUserMission().then((res) => { | ||
// a.value = res.SignInFishes; | ||
// }); | ||
getUserMission().then((res) => { | ||
userData.value.SignInTime = res.SignInTime; | ||
userData.value.LikeTime = res.LikeTime; | ||
userData.value.CommentTime = res.CommentTime; | ||
userData.value.ContentTime = res.ContentTime; | ||
userData.value.SignInFishes = res.SignInFishes; | ||
userData.value.ContentFishes = res.ContentFishes; | ||
userData.value.LikeFishes = res.LikeFishes; | ||
userData.value.CommentFishes = res.CommentFishes; | ||
}); | ||
const commentTimes = Array.from({ length: 3 }, (_, index) => index + 1); | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.moment-task-box { | ||
display: flex; | ||
flex-direction: row; | ||
width: 95vw; | ||
height: 21.28vw; | ||
border-radius: 3vw; | ||
background-color: #f4f9ff; | ||
margin-left: 2.5vw; | ||
.content { | ||
display: flex; | ||
flex-direction: column; | ||
.title { | ||
margin-left: 5vw; | ||
margin-top: 3.5vw; | ||
font-weight: bold; | ||
font-size: 4.5vw; | ||
letter-spacing: 0.1vw; | ||
} | ||
.detail { | ||
color: #00000078; | ||
font-size: 2.8vw; | ||
font-weight: bold; | ||
margin-left: 5vw; | ||
margin-top: 1vw; | ||
} | ||
.finish-times { | ||
margin-left: 5vw; | ||
display: flex; | ||
flex-direction: row; | ||
.times { | ||
color: #00000078; | ||
font-size: 2.8vw; | ||
font-weight: bold; | ||
} | ||
.icon { | ||
margin-top: 1vw; | ||
width: 2.56vw; | ||
height: 2.56vw; | ||
} | ||
} | ||
} | ||
.get-fish-number { | ||
margin-left: 8vw; | ||
margin-top: 6.5vw; | ||
display: flex; | ||
flex-direction: row; | ||
.fish-unit { | ||
width: 6vw; | ||
height: 6vw; | ||
} | ||
.fish-num { | ||
color: #48282d; | ||
font-size: 3.5vw; | ||
font-weight: bold; | ||
margin-top: 0.5vw; | ||
} | ||
} | ||
.button { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
margin-top: 5.5vw; | ||
margin-left: 2vw; | ||
width: 16.15vw; | ||
height: 6.67vw; | ||
background-color: #1f6bff; | ||
border-radius: 5.89vw; | ||
.option { | ||
color: #ffffff; | ||
font-size: 3.5vw; | ||
font-weight: bold; | ||
letter-spacing: 0.1vw; | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.