Skip to content

Commit

Permalink
🦄 refactor(helper): update
Browse files Browse the repository at this point in the history
  • Loading branch information
CakeAL committed Nov 15, 2024
1 parent 053a63a commit d7402cc
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ustb-wifi-tools",
"private": true,
"version": "0.8.8",
"version": "0.8.9",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ustb-wifi-tools"
version = "0.8.8"
version = "0.8.9"
description = "A Tauri App that can be used to get information of the USTB Wifi"
authors = ["CakeAL"]
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"productName": "ustb-wifi-tools",
"mainBinaryName": "ustb-wifi-tools",
"version": "0.8.8",
"version": "0.8.9",
"identifier": "ustb.wifi.tools",
"build": {
"beforeDevCommand": "pnpm dev",
Expand Down
8 changes: 8 additions & 0 deletions src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,11 @@ export const railStyle = ({
export const mb2gb = (mb: number | undefined) => {
return parseFloat(((mb as number) / 1024).toFixed(2));
};

export const min2hour = (min: number | undefined) => {
return parseFloat(((min as number) / 60).toFixed(2));
};

export const min2day = (min: number | undefined) => {
return parseFloat(((min as number) / 60 / 24).toFixed(2));
};
2 changes: 1 addition & 1 deletion src/pages/About.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const show1 = ref(false);
<p>4. 通过 pt 站下载大型软件(比如 Photoshop 等)</p>
<p>5. 自建/使用 ipv6 代理服务器</p>
<br />
<p>当前 version = "0.8.8"</p>
<p>当前 version = "0.8.9"</p>
</n-space>
</n-card>
</div>
Expand Down
11 changes: 1 addition & 10 deletions src/pages/MonthPay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { invoke } from "@tauri-apps/api/core";
import { onMounted, ref } from "vue";
import { useLoadingBar, useMessage } from "naive-ui";
import { mb2gb } from "../helper";
import { mb2gb, min2day, min2hour } from "../helper";
interface MonthlyData {
month: number;
Expand Down Expand Up @@ -78,15 +78,6 @@ const load_month_pay = async () => {
// console.log(month_pay.value);
loadingBar.finish();
};
const min2hour = (min: number | undefined) => {
return parseFloat(((min as number) / 60).toFixed(2));
};
const min2day = (min: number | undefined) => {
return parseFloat(((min as number) / 60 / 24).toFixed(2));
};
</script>

<template>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/MonthlyUserLog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { onMounted, ref } from "vue";
import { invoke } from "@tauri-apps/api/core";
import { EveryLoginData } from "./UserLoginLog.vue";
import { useLoadingBar, useMessage } from "naive-ui";
import { railStyle, mb2gb } from "../helper";
import { railStyle, mb2gb, min2hour } from "../helper";
import dayjs from "dayjs";
const pop_message = useMessage();
Expand Down Expand Up @@ -226,7 +226,7 @@ const select_mb_or_gb = (value: string) => {
<td>花费:</td>
<td>{{ item.cost.toFixed(2) }} 元</td>
<td>使用时长:</td>
<td>{{ (item.used_duration / 60).toFixed(2) }} h</td>
<td>{{ min2hour(item.used_duration) }} h</td>
</tr>
</tbody>
</n-table>
Expand Down

0 comments on commit d7402cc

Please sign in to comment.