添加打赏支付
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, onBeforeUnmount } from "vue";
|
||||
import { ref, computed, onMounted, onBeforeUnmount, watch } from "vue";
|
||||
import { onShow, onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
|
||||
import Container from "@/components/Container.vue";
|
||||
import PointRecord from "@/components/PointRecord.vue";
|
||||
@@ -32,7 +32,6 @@ const isIOS = computed(() => {
|
||||
const showModal = ref(false);
|
||||
const showTip = ref(false);
|
||||
const data = ref({
|
||||
yellowRate: 0,
|
||||
weeksCheckIn: [],
|
||||
});
|
||||
|
||||
@@ -45,7 +44,21 @@ const toListPage = () => {
|
||||
});
|
||||
};
|
||||
|
||||
onShow(async () => {
|
||||
const onSignin = () => {
|
||||
showModal.value = true;
|
||||
};
|
||||
|
||||
const startScoring = () => {
|
||||
if (user.value.id) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/point-book-create",
|
||||
});
|
||||
} else {
|
||||
showModal.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
const loadData = async () => {
|
||||
const result = await getPointBookListAPI(1);
|
||||
list.value = result.slice(0, 3);
|
||||
const result2 = await getPointBookStatisticsAPI();
|
||||
@@ -61,21 +74,18 @@ onShow(async () => {
|
||||
setTimeout(() => {
|
||||
drawHeatMap(rect.width, rect.height, result2.weekArrows);
|
||||
}, 500);
|
||||
});
|
||||
|
||||
const onSignin = () => {
|
||||
showModal.value = true;
|
||||
};
|
||||
|
||||
const startScoring = () => {
|
||||
if (user.value.id) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/point-book-create",
|
||||
});
|
||||
} else {
|
||||
showModal.value = true;
|
||||
watch(
|
||||
() => user.value.id,
|
||||
(id) => {
|
||||
if (id) loadData();
|
||||
}
|
||||
};
|
||||
);
|
||||
|
||||
onShow(async () => {
|
||||
if (user.value.id) loadData();
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
uni.$on("point-book-signin", onSignin);
|
||||
@@ -188,23 +198,27 @@ onShareTimeline(() => {
|
||||
</view>
|
||||
<view class="statistics">
|
||||
<view>
|
||||
<text>{{ data.todayTotalArrow }}</text>
|
||||
<text>{{ data.todayTotalArrow || "-" }}</text>
|
||||
<text>今日射箭(箭)</text>
|
||||
</view>
|
||||
<view>
|
||||
<text>{{ data.totalArrow }}</text>
|
||||
<text>{{ data.totalArrow || "-" }}</text>
|
||||
<text>累计射箭(箭)</text>
|
||||
</view>
|
||||
<view>
|
||||
<text>{{ data.totalDay }}</text>
|
||||
<text>{{ data.totalDay || "-" }}</text>
|
||||
<text>已训练天数(天)</text>
|
||||
</view>
|
||||
<view>
|
||||
<text>{{ data.averageRing }}</text>
|
||||
<text>{{ data.averageRing || "-" }}</text>
|
||||
<text>平均环数(箭)</text>
|
||||
</view>
|
||||
<view>
|
||||
<text>{{ Number(data.yellowRate * 100).toFixed(2) }}</text>
|
||||
<text>{{
|
||||
data.yellowRate !== undefined
|
||||
? Number(data.yellowRate * 100).toFixed(2)
|
||||
: "-"
|
||||
}}</text>
|
||||
<text>黄心率(%)</text>
|
||||
</view>
|
||||
<view>
|
||||
@@ -229,7 +243,7 @@ onShareTimeline(() => {
|
||||
</button>
|
||||
</view>
|
||||
<RingBarChart :data="data.ringRate" />
|
||||
<view class="title">
|
||||
<view class="title" v-if="user.id">
|
||||
<image src="../static/point-book-title2.png" mode="widthFix" />
|
||||
</view>
|
||||
<block v-for="(item, index) in list" :key="index">
|
||||
@@ -249,7 +263,7 @@ onShareTimeline(() => {
|
||||
<Signin :onClose="() => (showModal = false)" :noBg="true" />
|
||||
</SModal>
|
||||
<ScreenHint2 :show="showTip" :onClose="() => (showTip = false)">
|
||||
<RewardUs />
|
||||
<RewardUs :show="showTip" :onClose="() => (showTip = false)" />
|
||||
</ScreenHint2>
|
||||
</Container>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user