parent
3377801fcd
commit
081be29323
@ -1,32 +1,39 @@
|
||||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
||||
|
||||
## Getting Started
|
||||
|
||||
First, run the development server:
|
||||
|
||||
```bash
|
||||
npm i
|
||||
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3001](http://localhost:3001) with your browser to see the result.
|
||||
|
||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||
|
||||
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
|
||||
|
||||
## Learn More
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
||||
|
||||
## Deploy on Vercel
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
||||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
||||
|
||||
## Getting Started
|
||||
|
||||
First, run the development server:
|
||||
|
||||
```bash
|
||||
npm i
|
||||
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3001](http://localhost:3001) with your browser to see the result.
|
||||
|
||||
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
|
||||
|
||||
如果遇到代码飘红报错 [试一下这个方法](https://juejin.cn/post/6844904069304156168#heading-6)
|
||||
|
||||
## Learn More
|
||||
|
||||
需要了解 Next.js 的相关信息,可以查看以下资源
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - 了解Next.js功能和API
|
||||
- [Learn Next.js](https://nextjs.org/learn) - 交互式Next.js教程
|
||||
- [Learn Next.js APP router](https://nextjs.org/learn/dashboard-app) - 交互式的 Next.js APP router教程。
|
||||
|
||||
## Deploy on Vercel
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
||||
|
||||
## todo
|
||||
- [ ] 首页
|
||||
- [ ] 底部播放器
|
||||
- [ ] loading skeleton
|
||||
- [ ] api 封装
|
||||
- [ ] MP4 资源加密
|
||||
- [ ] SEO [meta](https://nextjs.org/learn/dashboard-app/adding-metadata)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,49 +1,50 @@
|
||||
{
|
||||
"name": "queyue-h5",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -p 3001",
|
||||
"build": "next build",
|
||||
"start": "next start -p 3001",
|
||||
"lint": "eslint src --fix --ext .ts,.tsx,.js,.jsx,.mdx,.md,.json,.mjs --max-warnings 0"
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "14.1.3",
|
||||
"react": "^18",
|
||||
"react-dom": "^18"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^19.1.0",
|
||||
"@commitlint/config-conventional": "^19.1.0",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^18",
|
||||
"@types/react-dom": "^18",
|
||||
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
||||
"@unocss/postcss": "^0.58.6",
|
||||
"autoprefixer": "^10.0.1",
|
||||
"eslint": "^8",
|
||||
"eslint-config-next": "14.1.3",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"husky": "^9.0.11",
|
||||
"lint-staged": "^15.2.2",
|
||||
"postcss": "^8",
|
||||
"postcss-flexbugs-fixes": "^5.0.2",
|
||||
"postcss-preset-env": "^9.5.1",
|
||||
"prettier": "^3.2.5",
|
||||
"typescript": "^5.2.2",
|
||||
"unocss": "^0.58.6"
|
||||
},
|
||||
"lint-staged": {
|
||||
"src/**/*.{js,jsx,ts,tsx,json}": [
|
||||
"npm run lint",
|
||||
"prettier --write"
|
||||
]
|
||||
},
|
||||
"browserslist": [
|
||||
"iOS >= 7",
|
||||
"Android >= 4"
|
||||
]
|
||||
}
|
||||
{
|
||||
"name": "queyue-h5",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -p 3001",
|
||||
"build": "next build",
|
||||
"start": "next start -p 3001",
|
||||
"lint": "eslint src --fix --ext .ts,.tsx,.js,.jsx,.mdx,.md,.json,.mjs --max-warnings 0"
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "14.1.3",
|
||||
"react": "^18",
|
||||
"react-dom": "^18",
|
||||
"react-redux": "^9.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^19.1.0",
|
||||
"@commitlint/config-conventional": "^19.1.0",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^18",
|
||||
"@types/react-dom": "^18",
|
||||
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
||||
"@unocss/postcss": "^0.58.6",
|
||||
"autoprefixer": "^10.0.1",
|
||||
"eslint": "^8",
|
||||
"eslint-config-next": "14.1.3",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"husky": "^9.0.11",
|
||||
"lint-staged": "^15.2.2",
|
||||
"postcss": "^8",
|
||||
"postcss-flexbugs-fixes": "^5.0.2",
|
||||
"postcss-preset-env": "^9.5.1",
|
||||
"prettier": "^3.2.5",
|
||||
"typescript": "^5.2.2",
|
||||
"unocss": "^0.58.6"
|
||||
},
|
||||
"lint-staged": {
|
||||
"src/**/*.{js,jsx,ts,tsx,json}": [
|
||||
"npm run lint",
|
||||
"prettier --write"
|
||||
]
|
||||
},
|
||||
"browserslist": [
|
||||
"iOS >= 7",
|
||||
"Android >= 4"
|
||||
]
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* get client cookie
|
||||
* @param {String} name cookie name
|
||||
*/
|
||||
export const getCookie = (name: string): string | undefined => {
|
||||
const value = `; ${typeof window === 'undefined' ? '' : document.cookie}`;
|
||||
const parts = value.split(`; ${name}=`);
|
||||
|
||||
if (parts.length === 2) {
|
||||
const ppop = parts.pop();
|
||||
if (ppop) {
|
||||
return ppop.split(';').shift();
|
||||
}
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
/**
|
||||
* delete client cookie
|
||||
* @param {String} name cookie name
|
||||
*/
|
||||
export const deleteCookie = (name: string) => {
|
||||
const date = new Date();
|
||||
date.setTime(date.getTime() - 10000);
|
||||
document.cookie = name + '=; expire=' + date.toString();
|
||||
};
|
||||
|
||||
/**
|
||||
* set client cookie
|
||||
* @param {String} name cookie name
|
||||
* @param {String} value cookie value
|
||||
*/
|
||||
|
||||
export const setCookie = (name: string, value: string) => {
|
||||
const Days = 30;
|
||||
const exp = new Date();
|
||||
exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
|
||||
document.cookie = name + '=' + value + ';expires=' + exp.toString();
|
||||
};
|
@ -1,31 +0,0 @@
|
||||
import localFont from 'next/font/local';
|
||||
|
||||
export const RegularFont = localFont({
|
||||
src: '../../public/fonts/ping-fang-hei-ti-zhun-jian.ttf',
|
||||
display: 'swap',
|
||||
});
|
||||
|
||||
export const MediumFont = localFont({
|
||||
src: '../../public/fonts/pingfang-sc-medium.otf',
|
||||
display: 'swap',
|
||||
});
|
||||
|
||||
export const SemiboldFont = localFont({
|
||||
src: '../../public/fonts/pingfangsc-semibold.otf',
|
||||
display: 'swap',
|
||||
});
|
||||
|
||||
export const AbhayaFont = localFont({
|
||||
src: '../../public/fonts/AlibabaPuHuiTi-3-65-Medium.woff2',
|
||||
display: 'swap',
|
||||
});
|
||||
|
||||
export const AbhayaSemiboldFont = localFont({
|
||||
src: '../../public/fonts/abhayalibre-semibold.ttf',
|
||||
display: 'swap',
|
||||
});
|
||||
|
||||
export const XinYiJiXiangSongFont = localFont({
|
||||
src: '../../public/fonts/Fontquan-XinYiJiXiangSong.ttf',
|
||||
display: 'swap',
|
||||
});
|
@ -0,0 +1,2 @@
|
||||
export { default as request } from './request';
|
||||
export { default as verifyResponse } from './verifyResponse';
|
@ -0,0 +1,17 @@
|
||||
// server端
|
||||
import { cookies } from 'next/headers';
|
||||
|
||||
export const nextFetchGet = async (api: string) => {
|
||||
const nextCookies = cookies();
|
||||
const token = nextCookies.get('token') || '';
|
||||
const role = nextCookies.get('role');
|
||||
const roleId = nextCookies.get('roleId');
|
||||
const url = `${process.env.BASE_FETCH_URL}/api/be${api}`;
|
||||
const res = await fetch(url, {
|
||||
headers: token ? { Authorization: 'Bearer ' + token } : {},
|
||||
});
|
||||
if (!res.ok) {
|
||||
throw new Error('Failed to fetch data');
|
||||
}
|
||||
return res.json();
|
||||
};
|
Loading…
Reference in new issue