commit fcdd9fd33c51fc66223a4fc5dfd2bef04a6da752 Author: A1300399510 Date: Wed Jul 17 16:32:57 2024 +0800 no message diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8ee54e8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +.DS_Store +dist +dist-ssr +coverage +*.local + +/cypress/videos/ +/cypress/screenshots/ + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +*.tsbuildinfo diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..a7cea0b --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["Vue.volar"] +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..a5cbacd --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# suno + +This template should help get you started developing with Vue 3 in Vite. + +## Recommended IDE Setup + +[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur). + +## Customize configuration + +See [Vite Configuration Reference](https://vitejs.dev/config/). + +## Project Setup + +```sh +npm install +``` + +### Compile and Hot-Reload for Development + +```sh +npm run dev +``` + +### Compile and Minify for Production + +```sh +npm run build +``` diff --git a/index.html b/index.html new file mode 100644 index 0000000..99f583a --- /dev/null +++ b/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite App + + +
+ + + diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 0000000..5a1f2d2 --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "paths": { + "@/*": ["./src/*"] + } + }, + "exclude": ["node_modules", "dist"] +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..4585735 --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "suno", + "version": "0.0.0", + "private": true, + "type": "module", + "scripts": { + "dev": "vite --host", + "build": "vite build", + "preview": "vite preview" + }, + "dependencies": { + "@element-plus/icons-vue": "^2.3.1", + "axios": "^1.7.2", + "element-plus": "^2.7.7", + "qs": "^6.12.3", + "vue": "^3.4.29", + "vue-router": "^4.3.3" + }, + "devDependencies": { + "@vitejs/plugin-vue": "^5.0.5", + "less": "^4.2.0", + "vite": "^5.3.1" + } +} diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..df36fcf Binary files /dev/null and b/public/favicon.ico differ diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..881fe3c --- /dev/null +++ b/src/App.vue @@ -0,0 +1,1165 @@ + + + + + diff --git a/src/assets/base.css b/src/assets/base.css new file mode 100644 index 0000000..e69de29 diff --git a/src/assets/img/dot.svg b/src/assets/img/dot.svg new file mode 100644 index 0000000..936dc81 --- /dev/null +++ b/src/assets/img/dot.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/img/icon12.svg b/src/assets/img/icon12.svg new file mode 100644 index 0000000..79d6b89 --- /dev/null +++ b/src/assets/img/icon12.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/img/loop-c.png b/src/assets/img/loop-c.png new file mode 100644 index 0000000..1da24f2 Binary files /dev/null and b/src/assets/img/loop-c.png differ diff --git a/src/assets/img/loop.png b/src/assets/img/loop.png new file mode 100644 index 0000000..64a347d Binary files /dev/null and b/src/assets/img/loop.png differ diff --git a/src/assets/img/play-icon.png b/src/assets/img/play-icon.png new file mode 100644 index 0000000..af87ea7 Binary files /dev/null and b/src/assets/img/play-icon.png differ diff --git a/src/assets/img/question-icon.svg b/src/assets/img/question-icon.svg new file mode 100644 index 0000000..ef010d4 --- /dev/null +++ b/src/assets/img/question-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/img/single-c.png b/src/assets/img/single-c.png new file mode 100644 index 0000000..6fa0fec Binary files /dev/null and b/src/assets/img/single-c.png differ diff --git a/src/assets/img/single.png b/src/assets/img/single.png new file mode 100644 index 0000000..1c8207e Binary files /dev/null and b/src/assets/img/single.png differ diff --git a/src/assets/img/suspend.png b/src/assets/img/suspend.png new file mode 100644 index 0000000..f339f4f Binary files /dev/null and b/src/assets/img/suspend.png differ diff --git a/src/assets/main.css b/src/assets/main.css new file mode 100644 index 0000000..eead539 --- /dev/null +++ b/src/assets/main.css @@ -0,0 +1,70 @@ +/* @import './base.css'; + +#app { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + font-weight: normal; +} + +a, +.green { + text-decoration: none; + color: hsla(160, 100%, 37%, 1); + transition: 0.4s; + padding: 3px; +} + +@media (hover: hover) { + a:hover { + background-color: hsla(160, 100%, 37%, 0.2); + } +} + +@media (min-width: 1024px) { + body { + display: flex; + place-items: center; + } + + #app { + display: grid; + grid-template-columns: 1fr 1fr; + padding: 0 2rem; + } +} */ + + +* { + padding: 0; + margin: 0; + box-sizing: border-box; +} + +.flexflex { + display: flex; +} + +.flexcenter { + display: flex; + justify-content: center; + align-items: center; +} + +.flexjcenter { + display: flex; + justify-content: center; +} + +.flexacenter { + display: flex; + align-items: center; +} + +.flex1 { + flex: 1; +} + +body { + background-color: #000; +} \ No newline at end of file diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue new file mode 100644 index 0000000..5fb372c --- /dev/null +++ b/src/components/HelloWorld.vue @@ -0,0 +1,44 @@ + + + + + diff --git a/src/components/TheWelcome.vue b/src/components/TheWelcome.vue new file mode 100644 index 0000000..dab9536 --- /dev/null +++ b/src/components/TheWelcome.vue @@ -0,0 +1,88 @@ + + + diff --git a/src/components/WelcomeItem.vue b/src/components/WelcomeItem.vue new file mode 100644 index 0000000..ac366d0 --- /dev/null +++ b/src/components/WelcomeItem.vue @@ -0,0 +1,86 @@ + + + diff --git a/src/components/icons/IconCommunity.vue b/src/components/icons/IconCommunity.vue new file mode 100644 index 0000000..2dc8b05 --- /dev/null +++ b/src/components/icons/IconCommunity.vue @@ -0,0 +1,7 @@ + diff --git a/src/components/icons/IconDocumentation.vue b/src/components/icons/IconDocumentation.vue new file mode 100644 index 0000000..6d4791c --- /dev/null +++ b/src/components/icons/IconDocumentation.vue @@ -0,0 +1,7 @@ + diff --git a/src/components/icons/IconEcosystem.vue b/src/components/icons/IconEcosystem.vue new file mode 100644 index 0000000..c3a4f07 --- /dev/null +++ b/src/components/icons/IconEcosystem.vue @@ -0,0 +1,7 @@ + diff --git a/src/components/icons/IconSupport.vue b/src/components/icons/IconSupport.vue new file mode 100644 index 0000000..7452834 --- /dev/null +++ b/src/components/icons/IconSupport.vue @@ -0,0 +1,7 @@ + diff --git a/src/components/icons/IconTooling.vue b/src/components/icons/IconTooling.vue new file mode 100644 index 0000000..660598d --- /dev/null +++ b/src/components/icons/IconTooling.vue @@ -0,0 +1,19 @@ + + diff --git a/src/main.js b/src/main.js new file mode 100644 index 0000000..65521f6 --- /dev/null +++ b/src/main.js @@ -0,0 +1,20 @@ +import "./assets/main.css" + +import { createApp } from "vue" +import ElementPlus from "element-plus" +import "element-plus/dist/index.css" +// 如果您正在使用CDN引入,请删除下面一行。 +import * as ElementPlusIconsVue from "@element-plus/icons-vue" + +import App from "./App.vue" +import router from "./router" + +const app = createApp(App) +for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component) +} +app.use(ElementPlus) + +app.use(router) + +app.mount("#app") diff --git a/src/router/index.js b/src/router/index.js new file mode 100644 index 0000000..a49ae50 --- /dev/null +++ b/src/router/index.js @@ -0,0 +1,23 @@ +import { createRouter, createWebHistory } from 'vue-router' +import HomeView from '../views/HomeView.vue' + +const router = createRouter({ + history: createWebHistory(import.meta.env.BASE_URL), + routes: [ + { + path: '/', + name: 'home', + component: HomeView + }, + { + path: '/about', + name: 'about', + // route level code-splitting + // this generates a separate chunk (About.[hash].js) for this route + // which is lazy-loaded when the route is visited. + component: () => import('../views/AboutView.vue') + } + ] +}) + +export default router diff --git a/src/utils/api.js b/src/utils/api.js new file mode 100644 index 0000000..750b3ac --- /dev/null +++ b/src/utils/api.js @@ -0,0 +1,32 @@ +import Http from "@/utils/http" + +// 获取二维码 +export const getQrcode = params => { + return Http.post("/api/login/qrcode", params) +} + +// 监听扫码登录 状态 +export const monitorState = params => { + return Http.post("/api/login/monitor", params) +} + +// 获取列表 +export const getList = params => { + return Http.post("/api/lists", params) +} + +// 点击创建音乐 +export const Generate = params => { + return Http.post("/api/music/generate", params) +} + +// 监听音乐生成状态 +export const monitorMusic = params => { + return Http.post("/api/music/monitor", params) +} +// 获取音乐详情 +export const getDetails = params => { + return Http.post("/api/details", params) +} + + diff --git a/src/utils/http.js b/src/utils/http.js new file mode 100644 index 0000000..ef8d946 --- /dev/null +++ b/src/utils/http.js @@ -0,0 +1,78 @@ +import axios from 'axios'; +import QS from 'qs'; +import { ElMessage } from "element-plus"; + + +axios.defaults.baseURL = 'https://suno.ansnid.com' +axios.defaults.emulateJSON = true +axios.defaults.withCredentials = true + +axios.interceptors.request.use( //响应拦截 + async config => { + // 开发时登录用的,可以直接替换小程序的 authorization + const token = localStorage.getItem('token') || '' + config['headers']['token'] = process.env.NODE_ENV !== "production" && token + config['headers']['Content-Type'] = "application/json;charset=utf-8" + return config; + }, + error => { + return Promise.error(error); + }) +// 响应拦截器 +axios.interceptors.response.use(response => { + if (response.status === 200) return Promise.resolve(response); //进行中 + else return Promise.reject(response); //失败 +}, error => { // 服务器状态码不是200的情况 + if (error.response.status) { + switch (error.response.status) { + // 401: 未登录 + case 401: + // goTologin() // 跳转登录页面 + break + default: + } + return Promise.reject(error.response); + } +}); + +/** + * get方法,对应get请求 + * @param {String} url [请求的url地址] + * @param {Object} params [请求时携带的参数] + */ +const get = (url, params) => { + return new Promise((resolve, reject) => { + axios.get(url, { params }).then(res => resolve(res.data)).catch(err => reject(err.data)) + }); +} +/** + * post方法,对应post请求 + * @param {String} url [请求的url地址] + * @param {Object} params [请求时携带的参数] + */ +const post = (url, params) => { + return new Promise((resolve, reject) => { + //是将对象 序列化成URL的形式,以&进行拼接 + // axios.post(url, QS.stringify(params)).then(res => { + axios.post(url, params).then(res => { + let data = res.data + if (data.code == 401 && !process.server) goLogin() + resolve(data) + }).catch(err => { + if (err.data.code == 401) { + goLogin() + resolve(err.data); + } else reject(err.data) + }) + }); +} + +// 打开登录 +const goLogin = () => { + if (typeof ajax_login === "function") ajax_login() +} + +export default { + get, + post, +} \ No newline at end of file diff --git a/src/views/AboutView.vue b/src/views/AboutView.vue new file mode 100644 index 0000000..756ad2a --- /dev/null +++ b/src/views/AboutView.vue @@ -0,0 +1,15 @@ + + + diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue new file mode 100644 index 0000000..6bb706f --- /dev/null +++ b/src/views/HomeView.vue @@ -0,0 +1,9 @@ + + + diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..5c45e1d --- /dev/null +++ b/vite.config.js @@ -0,0 +1,16 @@ +import { fileURLToPath, URL } from 'node:url' + +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [ + vue(), + ], + resolve: { + alias: { + '@': fileURLToPath(new URL('./src', import.meta.url)) + } + } +})