From 304201ef803a4bb19bf5c6221d1915e3f4005de0 Mon Sep 17 00:00:00 2001 From: AceDataCloud Date: Sun, 3 Apr 2022 09:13:04 +0800 Subject: [PATCH] update preview --- README.md | 32 ++++++++++++++++++++++----- certs/.gitignore | 2 ++ package.json | 8 +++++-- src/components/course/PreviewCard.vue | 13 ++++++++++- src/pages/auth/Callback.vue | 7 ++++-- src/pages/auth/Login.vue | 2 +- src/router/index.ts | 4 ++-- src/store/index.ts | 3 +-- vite.config.ts | 8 +++++++ yarn.lock | 21 +++++++++++++++++- 10 files changed, 83 insertions(+), 17 deletions(-) create mode 100644 certs/.gitignore diff --git a/README.md b/README.md index beaefd60..f361d831 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,31 @@ -# Vue 3 + Typescript + Vite +# Adademy -This template should help get you started developing with Vue 3 and Typescript in Vite. +## Setup domain -## Recommended IDE Setup +Modify the host file, like `/etc/hosts`, add this line: -- [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar) +``` +127.0.0.1 academy.local.zhishuyun.com +``` -## Type Support For `.vue` Imports in TS +Then save it. -Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's `.vue` type support plugin by running `Volar: Switch TS Plugin on/off` from VSCode command palette. +### Generate certs + +Run below command to generate certs: + +``` +yarn run init:https +``` + +Then install the `.crt` file and trust it. + +### Start server + +Run below command to start local server: + +``` +sudo yarn start +``` + +Then open `https://academy.local.zhishuyun.com` to view the content. diff --git a/certs/.gitignore b/certs/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/certs/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/package.json b/package.json index c0ba6638..1d7dd0bc 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,12 @@ "name": "zhishuyun-auth", "version": "0.1.0", "scripts": { - "start": "vite --host", + "start": "vite", "build": "vue-tsc --noEmit && vite build", - "serve": "vite preview" + "serve": "vite preview", + "init:https": "yarn run init:ca && yarn run init:cert", + "init:ca": "npx mkcert create-ca --validity 36500 --key certs/academy.local.zhishuyun.com.ca.key --cert certs/academy.local.zhishuyun.com.ca.crt", + "init:cert": "npx mkcert create-cert --ca-key certs/academy.local.zhishuyun.com.ca.key --ca-cert certs/academy.local.zhishuyun.com.ca.crt --validity 36500 --key certs/academy.local.zhishuyun.com.cert.key --cert certs/academy.local.zhishuyun.com.cert.crt --domains academy.local.zhishuyun.com" }, "dependencies": { "@element-plus/icons-vue": "^0.2.7", @@ -33,6 +36,7 @@ "eslint-config-prettier": "^8.3.0", "eslint-plugin-vue": "^7.17.0", "husky": "^7.0.2", + "mkcert": "^1.5.0", "postcss": "^8.3.6", "prettier": "^2.3.2", "rollup-plugin-string": "^3.0.0", diff --git a/src/components/course/PreviewCard.vue b/src/components/course/PreviewCard.vue index 5d53c438..6fd3a331 100644 --- a/src/components/course/PreviewCard.vue +++ b/src/components/course/PreviewCard.vue @@ -1,6 +1,16 @@