feat:

This commit is contained in:
john 2024-07-19 19:33:22 +08:00
parent cb5f785a24
commit 9ce033624f
12 changed files with 84 additions and 29 deletions

11
.env.test Normal file
View File

@ -0,0 +1,11 @@
###
# @LastEditors: John
# @Date: 2024-07-19 17:45:49
# @LastEditTime: 2024-07-19 18:14:36
# @Author: John
###
VITE_BASE_URL=
VITE_BASE_API_URL=
VITE_TG_COMMUNITY=sctSCT_bot
VITE_TG_BOT_NAME=sctSCT_bot
VITE_TG_BOT_WEBAPP_NAME=SCT

View File

@ -6,6 +6,7 @@
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "tsc -b && vite build", "build": "tsc -b && vite build",
"build:test": "tsc -b && vite build --mode test",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview", "preview": "vite preview",
"iconfont": "npx iconfont-h5" "iconfont": "npx iconfont-h5"

View File

@ -1,7 +1,7 @@
body, body,
html, html,
#root { #root {
height: var(--tg-viewport-height); min-height: var(--tg-viewport-height);
background-image: url("./assets/home_bg.svg"); background-image: url("./assets/home_bg.svg");
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: cover;

View File

@ -1,7 +1,7 @@
/* /*
* @LastEditors: John * @LastEditors: John
* @Date: 2024-07-13 10:21:58 * @Date: 2024-07-13 10:21:58
* @LastEditTime: 2024-07-19 14:15:42 * @LastEditTime: 2024-07-19 19:10:34
* @Author: John * @Author: John
*/ */
import { MemoryRouter, Route, Routes } from "react-router-dom"; import { MemoryRouter, Route, Routes } from "react-router-dom";

View File

@ -1,7 +1,7 @@
/* /*
* @LastEditors: John * @LastEditors: John
* @Date: 2024-07-13 16:08:30 * @Date: 2024-07-13 16:08:30
* @LastEditTime: 2024-07-19 15:57:27 * @LastEditTime: 2024-07-19 19:06:35
* @Author: John * @Author: John
*/ */
/* /*
@ -63,7 +63,7 @@ export default function () {
updateFriends(1); updateFriends(1);
}} }}
> >
Level 1 Level 1 friends
</span> </span>
<span <span
className={cn( className={cn(
@ -75,7 +75,7 @@ export default function () {
updateFriends(2); updateFriends(2);
}} }}
> >
Level 2 Level 2 friends
</span> </span>
</div> </div>
{frends?.map((v, i) => ( {frends?.map((v, i) => (

View File

@ -1,5 +1,5 @@
.guide { .guide {
height: 100%; height: var(--tg-viewport-height);
background-image: url("../assets/guide_bg.svg"); background-image: url("../assets/guide_bg.svg");
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: cover;

View File

@ -1,7 +1,7 @@
/* /*
* @LastEditors: John * @LastEditors: John
* @Date: 2024-07-18 14:42:58 * @Date: 2024-07-18 14:42:58
* @LastEditTime: 2024-07-18 17:07:14 * @LastEditTime: 2024-07-19 19:13:27
* @Author: John * @Author: John
*/ */
import { import {
@ -15,7 +15,7 @@ import guide_icon from "@/assets/guide_icon.svg";
import dianbao from "@/assets/dianbao.svg"; import dianbao from "@/assets/dianbao.svg";
import youguang from "@/assets/youguang.svg"; import youguang from "@/assets/youguang.svg";
import tuite from "@/assets/tuite.svg"; import tuite from "@/assets/tuite.svg";
import { api_login } from "@/server/api"; import { api_get_user_information, api_login } from "@/server/api";
import useUserStore from "@/store/User"; import useUserStore from "@/store/User";
export default function () { export default function () {
@ -66,6 +66,9 @@ export default function () {
}, },
}); });
if (data?.data.token) UpdateToken(data?.data.token); if (data?.data.token) UpdateToken(data?.data.token);
const { data: userData } = await api_get_user_information().send({});
UpdateInvitationCode(userData?.data.shareCode || "");
}} }}
/> />
</> </>

View File

@ -1,7 +1,7 @@
/* /*
* @LastEditors: John * @LastEditors: John
* @Date: 2024-07-13 10:50:24 * @Date: 2024-07-13 10:50:24
* @LastEditTime: 2024-07-19 17:05:08 * @LastEditTime: 2024-07-19 19:03:45
* @Author: John * @Author: John
*/ */
import classes from "./Home-m.module.css"; import classes from "./Home-m.module.css";
@ -91,6 +91,7 @@ export default function () {
title="Follow starcraft Telegram" title="Follow starcraft Telegram"
buttom_text="Follow" buttom_text="Follow"
button_disable={v.taskType == 1} button_disable={v.taskType == 1}
reward={v.opValue}
onTaskSuccess={() => { onTaskSuccess={() => {
UpdateHomeData(); UpdateHomeData();
UpdateTaskList(); UpdateTaskList();
@ -105,6 +106,7 @@ export default function () {
title="Join starcraft Telegram" title="Join starcraft Telegram"
buttom_text="Joined" buttom_text="Joined"
button_disable={v.taskType == 1} button_disable={v.taskType == 1}
reward={v.opValue}
onTaskSuccess={() => { onTaskSuccess={() => {
UpdateHomeData(); UpdateHomeData();
UpdateTaskList(); UpdateTaskList();
@ -119,6 +121,7 @@ export default function () {
title="Follow @starcraft Twitter" title="Follow @starcraft Twitter"
buttom_text="Follow" buttom_text="Follow"
button_disable={v.taskType == 1} button_disable={v.taskType == 1}
reward={v.opValue}
onTaskSuccess={() => { onTaskSuccess={() => {
UpdateHomeData(); UpdateHomeData();
UpdateTaskList(); UpdateTaskList();
@ -133,6 +136,7 @@ export default function () {
title="Like on @starcraft Twitter" title="Like on @starcraft Twitter"
buttom_text="Like" buttom_text="Like"
button_disable={v.taskType == 1} button_disable={v.taskType == 1}
reward={v.opValue}
onTaskSuccess={() => { onTaskSuccess={() => {
UpdateHomeData(); UpdateHomeData();
UpdateTaskList(); UpdateTaskList();
@ -147,6 +151,7 @@ export default function () {
title="Retweet @starcraft Twitter" title="Retweet @starcraft Twitter"
buttom_text="Follow" buttom_text="Follow"
button_disable={v.taskType == 1} button_disable={v.taskType == 1}
reward={v.opValue}
onTaskSuccess={() => { onTaskSuccess={() => {
UpdateHomeData(); UpdateHomeData();
UpdateTaskList(); UpdateTaskList();
@ -161,6 +166,7 @@ export default function () {
title="Quote @starcraft Twitter" title="Quote @starcraft Twitter"
buttom_text="Quote" buttom_text="Quote"
button_disable={v.taskType == 1} button_disable={v.taskType == 1}
reward={v.opValue}
onTaskSuccess={() => { onTaskSuccess={() => {
UpdateHomeData(); UpdateHomeData();
UpdateTaskList(); UpdateTaskList();
@ -198,6 +204,7 @@ function TaskItem({
task_url, task_url,
type, type,
buttom_text, buttom_text,
reward,
button_disable, button_disable,
onTaskSuccess, onTaskSuccess,
}: { }: {
@ -206,6 +213,7 @@ function TaskItem({
title: string; title: string;
type: taskConfigurationListItem["type"]; type: taskConfigurationListItem["type"];
buttom_text: string; buttom_text: string;
reward: string;
button_disable?: boolean; button_disable?: boolean;
onTaskSuccess?: () => void; onTaskSuccess?: () => void;
}) { }) {
@ -232,7 +240,7 @@ function TaskItem({
</div> </div>
<div className={classes.social_task_item_bottom}> <div className={classes.social_task_item_bottom}>
<span>Reward</span> <span>Reward</span>
<span>+1,000 SCTT</span> <span>+{reward} SCTT</span>
</div> </div>
</li> </li>
); );

View File

@ -7,5 +7,5 @@
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"strict": true "strict": true
}, },
"include": ["vite.config.ts"] "include": ["./vite.config.ts"]
} }

File diff suppressed because one or more lines are too long

View File

@ -9,24 +9,24 @@ import react from "@vitejs/plugin-react";
import path from "path"; import path from "path";
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
server: { server: {
host: "192.168.10.167", host: "192.168.10.167",
port: 8082, port: 8082,
proxy: { proxy: {
"/dev": { "/dev": {
target: "http://192.168.10.100:8096", target: "http://192.168.10.100:8096",
changeOrigin: true, changeOrigin: true,
rewrite: function (path) { rewrite: function (path) {
return path.replace(/^\/dev/, ""); return path.replace(/^\/dev/, "");
},
},
}, },
},
}, },
}, plugins: [react()],
plugins: [react()], resolve: {
resolve: { alias: {
alias: { "@": path.resolve(__dirname, "./src"),
"@": path.resolve(__dirname, "./src"), },
}, },
}, css: {},
css: {},
}); });

32
vite.config.ts Normal file
View File

@ -0,0 +1,32 @@
/*
* @LastEditors: John
* @Date: 2024-07-13 10:21:58
* @LastEditTime: 2024-07-18 14:47:48
* @Author: John
*/
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
// https://vitejs.dev/config/
export default defineConfig({
server: {
host: "192.168.10.167",
port: 8082,
proxy: {
"/dev": {
target: "http://192.168.10.100:8096",
changeOrigin: true,
rewrite: function (path) {
return path.replace(/^\/dev/, "");
},
},
},
},
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
css: {},
});