Skip to content

Commit

Permalink
feat: 完整接口地址可用于生产
Browse files Browse the repository at this point in the history
lixunchang committed Mar 19, 2024
1 parent 41e58b8 commit 854f31b
Showing 6 changed files with 18,215 additions and 6 deletions.
18,207 changes: 18,207 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@
"@rushstack/eslint-patch": "^1.3.3",
"@tsconfig/node20": "^20.1.2",
"@types/jsdom": "^21.1.6",
"@types/node": "^20.11.25",
"@types/node": "^20.11.29",
"@vitejs/plugin-vue": "^5.0.4",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"@vue/eslint-config-prettier": "^8.0.0",
4 changes: 2 additions & 2 deletions src/api/api.ts
Original file line number Diff line number Diff line change
@@ -31,10 +31,10 @@ export class DictionaryService {
* @return {HttpResponse} result
*/
static async getWordList() {
return request('/lyc8503/baicizhan-word-meaning-API/data/list.json', {}, 'get')
return request('https://cdn.jsdelivr.net/gh/lyc8503/baicizhan-word-meaning-API/data/list.json', {}, 'get')
}

static async getWordMean(word: string) {
return request(`/lyc8503/baicizhan-word-meaning-API/data/words/${word}.json`, {}, 'get')
return request(`https://cdn.jsdelivr.net/gh/lyc8503/baicizhan-word-meaning-API/data/words/${word}.json`, {}, 'get')
}
}
2 changes: 1 addition & 1 deletion src/api/request.ts
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ axios.interceptors.request.use(
config.headers = {
//'Content-Type':'application/x-www-form-urlencoded', // 传参方式表单
'Content-Type': 'application/json;charset=UTF-8', // 传参方式json
token: '80c483d59ca86ad0393cf8a98416e2a1' // 这里自定义配置,这里传的是token
// token: '80c483d59ca86ad0393cf8a98416e2a1' // 这里自定义配置,这里传的是token
}
return config
},
4 changes: 2 additions & 2 deletions src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createRouter, createWebHistory } from 'vue-router'
import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
history: createWebHashHistory(import.meta.env.BASE_URL), //createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
2 changes: 2 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ import VueDevTools from 'vite-plugin-vue-devtools'

// https://vitejs.dev/config/
export default defineConfig({
base: process.env.NODE_ENV === 'production' ? './' : '/',
plugins: [vue(), vueJsx(), VueDevTools()],
resolve: {
alias: {
@@ -18,6 +19,7 @@ export default defineConfig({
proxy: {
'/lyc8503': {
target: 'https://cdn.jsdelivr.net/gh/lyc8503',
"secure": false,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/lyc8503/, '')
}

0 comments on commit 854f31b

Please sign in to comment.