很久以后得整理

This commit is contained in:
zilong 2023-01-29 15:06:46 +08:00
parent b7c25adeee
commit a3c872c7d7
37 changed files with 2488 additions and 2165 deletions

3
.env
View File

@ -1,3 +1,4 @@
# 网易云音乐API地址 # 网易云音乐API地址
VITE_NETEASECLOUD_API = http://localhost:3300 # VITE_NETEASECLOUD_API = http://localhost:3300
VITE_NETEASECLOUD_API = http://175.178.45.26:7082/

View File

@ -1,3 +1,3 @@
# 网易云音乐API地址 # 网易云音乐API地址
VITE_NETEASECLOUD_API = http://localhost:3300 # VITE_NETEASECLOUD_API = http://localhost:3300

View File

@ -6,13 +6,13 @@ let exec = require('child_process').exec;
const isDev = process.env.IS_DEV == "true" ? true : false; const isDev = process.env.IS_DEV == "true" ? true : false;
//计算NMApi路径 //计算NMApi路径
let NMApiPath = isDev ? '../NMApi.asar' : path.join(process.resourcesPath, 'NMApi.asar') // let NMApiPath = isDev ? '../NMApi.asar' : path.join(process.resourcesPath, 'NMApi.asar')
let p = require('path').join(NMApiPath + '/node_modules'); // let p = require('path').join(NMApiPath + '/node_modules');
require('module').globalPaths.unshift(p); //加入到module的路径列表 // require('module').globalPaths.unshift(p); //加入到module的路径列表
console.log(process.resourcesPath, NMApiPath) // console.log(process.resourcesPath, NMApiPath)
let svc // let svc
if(!isDev)svc = require(NMApiPath + '/app.js') // if(!isDev)svc = require(NMApiPath + '/app.js')
function createWindow() { function createWindow() {
// Create the browser window. // Create the browser window.

View File

@ -1,6 +1,6 @@
{ {
"name": "zmusic", "name": "zmusic",
"version": "0.1.0", "version": "0.1.1",
"author": "zlyum", "author": "zlyum",
"main": "electron/electron.js", "main": "electron/electron.js",
"scripts": { "scripts": {
@ -30,6 +30,7 @@
"mockjs": "^1.1.0", "mockjs": "^1.1.0",
"pubsub-js": "^1.9.3", "pubsub-js": "^1.9.3",
"spark-md5": "^3.0.2", "spark-md5": "^3.0.2",
"styled-components": "^5.3.3",
"unplugin-vue-components": "^0.15.6", "unplugin-vue-components": "^0.15.6",
"vue": "^3.2.16", "vue": "^3.2.16",
"vue-router": "^4.0.0-0", "vue-router": "^4.0.0-0",
@ -38,7 +39,9 @@
"vuex": "^4.0.0-0" "vuex": "^4.0.0-0"
}, },
"devDependencies": { "devDependencies": {
"@tauri-apps/cli": "^1.2.2",
"@vitejs/plugin-vue": "^1.9.3", "@vitejs/plugin-vue": "^1.9.3",
"@vitejs/plugin-vue-jsx": "^1.3.3",
"@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0", "@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0", "@vue/cli-plugin-router": "~4.5.0",
@ -51,14 +54,14 @@
"concurrently": "^6.3.0", "concurrently": "^6.3.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"electron": "^15.1.2", "electron": "^15.1.2",
"electron-builder": "^22.13.1", "electron-builder": "^23.0.1",
"electron-devtools-installer": "^3.1.0", "electron-devtools-installer": "^3.1.0",
"eslint": "^6.7.2", "eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.3.1", "eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-vue": "^7.0.0", "eslint-plugin-vue": "^7.0.0",
"less": "^3.0.4", "less": "^3.0.4",
"less-loader": "^5.0.0", "less-loader": "^5.0.0",
"naive-ui": "^2.24.5", "naive-ui": "^2.33.0",
"postcss": "^8.4.5", "postcss": "^8.4.5",
"prettier": "^2.2.1", "prettier": "^2.2.1",
"svg-sprite-loader": "^6.0.11", "svg-sprite-loader": "^6.0.11",
@ -83,12 +86,7 @@
"dist/**/*", "dist/**/*",
"electron/**/*" "electron/**/*"
], ],
"extraResources": [ "extraResources": [],
{
"from": "NMApi.asar",
"to": ""
}
],
"directories": { "directories": {
"buildResources": "assets", "buildResources": "assets",
"output": "dist_electron" "output": "dist_electron"

View File

@ -1,4 +1,3 @@
# Generated by Cargo # Generated by Cargo
# will have compiled files and executables # will have compiled files and executables
/target/ /target/
WixTools

2652
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -6,19 +6,23 @@ authors = ["you"]
license = "" license = ""
repository = "" repository = ""
default-run = "app" default-run = "app"
edition = "2018" edition = "2021"
build = "src/build.rs" rust-version = "1.59"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies] [build-dependencies]
tauri-build = { version = "1.0.0-beta.4" } tauri-build = { version = "1.2.1", features = [] }
[dependencies] [dependencies]
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.0.0-beta.8", features = ["api-all"] } tauri = { version = "1.2.2", features = ["api-all", "devtools"] }
[features] [features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = [ "custom-protocol" ] default = [ "custom-protocol" ]
# this feature is used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = [ "tauri/custom-protocol" ] custom-protocol = [ "tauri/custom-protocol" ]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 974 B

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 903 B

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -1,14 +0,0 @@
max_width = 100
hard_tabs = false
tab_spaces = 2
newline_style = "Auto"
use_small_heuristics = "Default"
reorder_imports = true
reorder_modules = true
remove_nested_parens = true
edition = "2018"
merge_derives = true
use_try_shorthand = false
use_field_init_shorthand = false
force_explicit_abi = true
imports_granularity = "Crate"

View File

@ -1,19 +1,27 @@
{ {
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
"build": {
"beforeBuildCommand": "yarn build:for:electron",
"beforeDevCommand": "yarn dev",
"devPath": "http://localhost:3301",
"distDir": "../dist"
},
"package": { "package": {
"productName": "zmusic", "productName": "zmusic",
"version": "0.1.0" "version": "0.1.0"
}, },
"build": {
"distDir": "Injected by vite-plugin-tauri",
"devPath": "Injected by vite-plugin-tauri",
"beforeDevCommand": "",
"beforeBuildCommand": ""
},
"tauri": { "tauri": {
"allowlist": {
"all": true
},
"bundle": { "bundle": {
"active": true, "active": true,
"targets": "all", "category": "DeveloperTool",
"identifier": "com.tauri.dev", "copyright": "",
"deb": {
"depends": []
},
"externalBin": [],
"icon": [ "icon": [
"icons/32x32.png", "icons/32x32.png",
"icons/128x128.png", "icons/128x128.png",
@ -21,47 +29,41 @@
"icons/icon.icns", "icons/icon.icns",
"icons/icon.ico" "icons/icon.ico"
], ],
"resources": [], "identifier": "com.zlyum.zmusic",
"externalBin": [],
"copyright": "",
"category": "DeveloperTool",
"shortDescription": "",
"longDescription": "", "longDescription": "",
"deb": {
"depends": [],
"useBootstrapper": false
},
"macOS": { "macOS": {
"frameworks": [], "entitlements": null,
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": "", "exceptionDomain": "",
"signingIdentity": null, "frameworks": [],
"entitlements": null "providerShortName": null,
"signingIdentity": null
}, },
"resources": [],
"shortDescription": "",
"targets": "all",
"windows": { "windows": {
"certificateThumbprint": null, "certificateThumbprint": null,
"digestAlgorithm": "sha256", "digestAlgorithm": "sha256",
"timestampUrl": "" "timestampUrl": ""
} }
},
"security": {
}, },
"updater": { "updater": {
"active": false "active": false
}, },
"allowlist": {
"all": true
},
"windows": [ "windows": [
{ {
"title": "zmusic", "fullscreen": false,
"width": 800,
"height": 600, "height": 600,
"resizable": true, "resizable": true,
"fullscreen": false "title": "zmusic",
"width": 800,
"minWidth": 800,
"minHeight": 600
} }
], ]
"security": {
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'"
}
} }
} }

View File

@ -259,7 +259,7 @@ button.n-button{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100vh; height: 100vh;
user-select: none; // user-select: none;
#top { #top {
height: 40px; height: 40px;
display: flex; display: flex;

View File

@ -36,5 +36,6 @@ const svgClass = computed(()=> {
height: 1em; height: 1em;
fill: currentColor; fill: currentColor;
vertical-align: middle; vertical-align: middle;
overflow: hidden;
} }
</style> </style>

View File

@ -75,6 +75,7 @@ const routes = [
path: "v", path: "v",
name: "videos.v", name: "videos.v",
component: () => import("../views/videos/V.vue"), component: () => import("../views/videos/V.vue"),
// component: () => import("../views/videos/V.jsx"),
}, },
{ {
path: "mv", path: "mv",

View File

@ -11,16 +11,22 @@ const router = useRouter()
<NSpace id="nav" justify="end"> <NSpace id="nav" justify="end">
<n-button circle size="small" @click="router.back()" > <n-button circle size="small" @click="router.back()" >
<template #icon> <template #icon>
<n-icon> <!-- <n-icon>
<ChevronBack /> <ChevronBack />
</n-icon> </n-icon> -->
<!-- <n-icon> -->
<svg-icon name="ChevronBack" class="" />
<!-- </n-icon> -->
</template> </template>
</n-button> </n-button>
<n-button circle size="small" @click="router.forward()"> <n-button circle size="small" @click="router.forward()">
<template #icon> <template #icon>
<n-icon> <!-- <n-icon>
<ChevronForward /> <ChevronForward />
</n-icon> </n-icon> -->
<!-- <n-icon> -->
<svg-icon name="ChevronForward" class="" />
<!-- </n-icon> -->
</template> </template>
</n-button> </n-button>
</NSpace> </NSpace>

View File

@ -101,7 +101,7 @@ const play = async (id, im = true) => {
await getSongUrl(id) await getSongUrl(id)
.then((res) => { .then((res) => {
if (null !== res.data.data[0].url) { if (null !== res.data.data[0].url) {
audioEl.value.src = res.data.data[0].url; audioEl.value.src = res.data.data[0].url.replace('http://', 'https://');
store.commit("saveSettings", { store.commit("saveSettings", {
songId: id, songId: id,
}); });

View File

@ -12,7 +12,7 @@
v-for="(b, idx) in banners" v-for="(b, idx) in banners"
:key="idx" :key="idx"
> >
<img class="carousel-img" :src="b.imageUrl" @click="clickBanner(b.targetId, b.targetType)" /> <img class="carousel-img" :src="b.imageUrl.replace('http://', 'https://')" @click="clickBanner(b.targetId, b.targetType)" />
<span class="title">{{ b.typeTitle }}</span> <span class="title">{{ b.typeTitle }}</span>
</div> </div>
</n-carousel> </n-carousel>
@ -44,7 +44,7 @@
> >
<div class="c2-list"> <div class="c2-list">
<div class="play-btn" @click="play(song.id)"> <div class="play-btn" @click="play(song.id)">
<img v-lazy="song.album.blurPicUrl" /> <img v-lazy="song.album.blurPicUrl.replace('http://', 'https://')" />
<n-button <n-button
text text
class="start-play-bg" class="start-play-bg"
@ -99,30 +99,39 @@
推荐MV 推荐MV
<svg-icon name="ChevronForward" class="mx-1" /> <svg-icon name="ChevronForward" class="mx-1" />
</div> </div>
<div class=" mt-1 grid grid-cols-4 gap-5"> <div class="mt-1 grid grid-cols-4 gap-4">
<div <div
v-for="(mv, idx) in personalizedMV" v-for="(mv, idx) in personalizedMV"
:key="mv.id" :key="mv.id"
class=" border border-gray-200 rounded-md class=" border border-gray-200 rounded-md
" "
> >
<div class="relative"> <div class="relative group cursor-pointer">
<img :src="mv.picUrl" class="rounded-t-md object-cover xs:h-14 sm:h-16 md:h-20 w-full" /> <img :src="mv.picUrl" class="rounded-t-md object-cover w-full aspect-video" />
<div class="m-1 h-7 w-7 bg-white bg-opacity-70 <div class="w-full aspect-video flex justify-center items-center absolute top-0 pt-2 group-hover:visible invisible">
<div class="rounded-full bg-white/75 w-7 h-7 md:w-9 md:h-9"></div>
</div>
<div class="w-full aspect-video flex justify-center items-center absolute top-0 pt-2 pl-[3px] md:pl-[5px] group-hover:visible invisible">
<svg-icon name="Play" class="text-xl md:text-3xl" :style="{
color: store.state.theme.themeOverrides.common.primaryColor,
}" />
</div>
<!-- <div class="m-1 h-7 w-7 bg-white bg-opacity-70
absolute bottom-0 right-0 absolute bottom-0 right-0
rounded-full"></div> rounded-full
<div class=" group-hover:visible invisible"></div>
<div class="group-hover:visible invisible
text-xl text-xl
absolute absolute right-[6px] bottom-[8px]
flex items-center" flex items-center"
:style="{ :style="{
color: store.state.theme.themeOverrides.common.primaryColor, color: store.state.theme.themeOverrides.common.primaryColor,
bottom: 8 + 'px', //bottom: 8 + 'px',
right: 2 + 'px', //right: 2 + 'px',
}" }"
> >
<svg-icon name="Play" class="mx-1" /> <svg-icon name="Play" class="" />
</div> </div> -->
</div> </div>
<div class="mx-1 mt-1 text-gray-800 text-sm truncate"> <div class="mx-1 mt-1 text-gray-800 text-sm truncate">
@ -195,8 +204,30 @@
</n-grid-item> </n-grid-item>
</n-grid> </n-grid>
</div> --> </div> -->
<!-- tailwind 推荐MV -->
<div class="
mt-4
text-xl
flex items-center"
:style="{
color: store.state.theme.themeOverrides.common.primaryColor,
}"
>
推荐歌单
<svg-icon name="ChevronForward" class="mx-1" />
</div>
<div class=" mt-1 grid grid-cols-4 gap-4">
<div v-for="p in personalized" :key="p.id"
class="rounded-md border border-gray-200"
>
<img :src="p.picUrl" class="rounded-t-md object-cover aspect-square" />
<div class="m-1 text-sm text-gray-500 card-span">
{{ p.name }}
</div>
</div>
</div>
<!-- 推荐歌单 --> <!-- 推荐歌单 -->
<div> <!-- <div>
<n-button <n-button
text text
icon-placement="right" icon-placement="right"
@ -230,7 +261,7 @@
</n-card> </n-card>
</n-grid-item> </n-grid-item>
</n-grid> </n-grid>
</div> </div> -->
</div> </div>
</template> </template>

61
src/views/videos/V.jsx Normal file
View File

@ -0,0 +1,61 @@
import { withModifiers, defineComponent, ref } from "vue";
import styled from "vue3-styled-components";
// const V = defineComponent({
// setup() {
// const count = ref(0);
// const inc = () => {
// count.value++;
// };
// return () => (
// <div onClick={inc}>{count.value}</div>
// );
// },
// });
const wp = styled.div`
color: red;
font-size: 32px;
`
const V = {
setup(){
const desc = ref('说明测试哈啊哈')
return {desc}
},
data() {
return {
visible: true,
title: '这是一个标题测试',
};
},
mounted(){
console.log('mounted');
},
render() {
const clsBtn = `px-4 py-1 text-sm text-purple-600 font-semibold
rounded-full border border-purple-200
hover:text-white hover:bg-purple-600 hover:border-transparent
focus:outline-none focus:ring-2 focus:ring-purple-600 focus:ring-offset-2`
return <>
<div>{this.title}<br/>
{this.desc}<br/>
{this.visible.toString()}</div>
<input
className=" p-1 rounded text-xs border"
vShow={this.visible}
vModel={this.title}
/>
<button className={clsBtn}>
按钮
</button>
<div className={`px-4 py-1 text-sm text-purple-600`}>
class测试
</div>
<wp>这是一个测试div</wp>
</>;
},
};
export default V;

View File

@ -1,6 +1,7 @@
<script setup> <script setup>
import { NButton, NSpace, NIcon } from "naive-ui"; import { NButton, NSpace, NIcon } from "naive-ui";
import PlayCircle from '@/assets/svgs/PlayCircle.svg' import PlayCircle from '@/assets/svgs/PlayCircle.svg'
import ChevronForward from "@/assets/svgs/ChevronForward.svg";
import {ref} from 'vue' import {ref} from 'vue'
import sparkMD from 'spark-md5' import sparkMD from 'spark-md5'
import CryptoJS from 'crypto-js'; import CryptoJS from 'crypto-js';
@ -58,9 +59,32 @@ const fileChange = (e) => {
</script> </script>
<template> <template>
<div> <n-button circle>
<template #icon>
</div> <svg-icon name="HeartOutline" />
</template>
</n-button>
<n-button
text
icon-placement="right"
size="large"
type="primary"
style="font-size: 1.3em; margin-top: 6px"
>
<template #icon>
<n-icon>
<svg-icon name="ChevronForward" class="" />
</n-icon>
</template>
最新音乐
</n-button>
<svg-icon name="Play" class="text-xl md:text-3xl text-blue-500" />
<svg-icon name="ChevronForward" class="mx-1 text-orange-500" />
<n-icon class=" text-red-500">
<PlayCircle />
</n-icon>
</template> </template>
<script> <script>
@ -69,4 +93,4 @@ export default {};
<style lang="less" scoped> <style lang="less" scoped>
</style>> </style>

View File

@ -1,4 +1,5 @@
module.exports = { module.exports = {
// mode:'jit',
content: [ content: [
// Example content paths... // Example content paths...
'./index.html', './index.html',

View File

@ -3,6 +3,7 @@ import vue from '@vitejs/plugin-vue'
import path from 'path' import path from 'path'
import svgLoader from 'vite-svg-loader' import svgLoader from 'vite-svg-loader'
import { svgBuilder } from './src/plugins/svgBuilder' import { svgBuilder } from './src/plugins/svgBuilder'
import vueJsx from '@vitejs/plugin-vue-jsx'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
@ -11,8 +12,16 @@ export default defineConfig({
'@': path.resolve(__dirname, '/src'), '@': path.resolve(__dirname, '/src'),
}, },
}, },
base: process.env.ELECTRON=="true" ? './' : "", // base: process.env.ELECTRON=="true" ? './' : "",
plugins: [vue(), svgLoader(), svgBuilder('./src/assets/svgs/')], base: './' ,
plugins: [
vue(),
vueJsx({
// options are passed on to @vue/babel-plugin-jsx
}),
svgLoader(),
svgBuilder('./src/assets/svgs/')
],
// server:{ // server:{
// fs:{ // fs:{
// strict: false, // strict: false,

1687
yarn.lock

File diff suppressed because it is too large Load Diff