diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..18ce451 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..639900d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..8f76392 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vue-frame.iml b/.idea/vue-frame.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/vue-frame.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/components.d.ts b/components.d.ts index ba916b6..3694a04 100644 --- a/components.d.ts +++ b/components.d.ts @@ -7,6 +7,13 @@ export {} declare module 'vue' { export interface GlobalComponents { + ElAffix: typeof import('element-plus/es')['ElAffix'] + ElButton: typeof import('element-plus/es')['ElButton'] + ElCarousel: typeof import('element-plus/es')['ElCarousel'] + ElCarouselItem: typeof import('element-plus/es')['ElCarouselItem'] + ElMenu: typeof import('element-plus/es')['ElMenu'] + ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] + ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] Foot: typeof import('./src/components/Foot.vue')['default'] Head: typeof import('./src/components/Head.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/index.html b/index.html index 11603f8..9515510 100644 --- a/index.html +++ b/index.html @@ -1,9 +1,12 @@ - + - + Vite App diff --git a/src/api/base-service.ts b/src/api/base-service.ts index b6ae170..850d2e9 100644 --- a/src/api/base-service.ts +++ b/src/api/base-service.ts @@ -12,19 +12,23 @@ import axios from 'axios' //引入 axios库 import qs from 'qs' //引入 node中自带的qs模块(数据格式转换) /* 2.全局默认配置 */ let baseURL -let process: any +let process: any = { + env: { + NODE_ENV: 'development' + } +} // 判断开发环境(一般用于本地代理) if (process.env.NODE_ENV === 'development') { // 开发环境 - baseURL = 'http://www.liulongbin.top:3006' // 你设置的本地代理请求(跨域代理),下文会详细介绍怎么进行跨域代理 + baseURL = 'https://api.vvhan.com/' // 你设置的本地代理请求(跨域代理),下文会详细介绍怎么进行跨域代理 } else { // 编译环境 if (process.env.type === 'test') { // 测试环境 - baseURL = 'http://www.liulongbin.top:3006' + baseURL = 'https://api.vvhan.com/' } else { // 正式环境 - baseURL = 'http://www.liulongbin.top:3006' + baseURL = 'https://api.vvhan.com/' } } // 配置axios的属性 @@ -63,6 +67,7 @@ Axios.interceptors.request.use( return Promise.reject(error) } ) + Axios.interceptors.response.use( (res) => { //请求响应后拦截 diff --git a/src/services/home.ts b/src/services/home.ts index 24975b7..24da9fe 100644 --- a/src/services/home.ts +++ b/src/services/home.ts @@ -1,47 +1,31 @@ -/* - * @Description: {{ByRuin}} - * @Version: 2.0 - * @Author: Ruin 🍭 - * @Date: 2022-01-25 17:42:57 - * @LastEditors: 刘引 - * @LastEditTime: 2022-01-25 18:04:29 - */ - -import Axios from "../api/base-service"; // 导入配置好的axios文件 +import Axios from '@/api/base-service' // 导入配置好的axios文件 // 封装axios请求函数,并用export导出 -export function getInfo(datas: unknown) { +// get请求 +const getInfo = (params: unknown) => { return Axios({ - url: "/api.php?key=free&appid=0&msg=鹅鹅鹅", - method: "GET", + url: '/api/horoscope', + method: 'get', headers: { - "content-type": "application/json", + 'Content-Type': 'application/x-www-form-urlencoded' //设置请求头请求格式form }, - data: datas, - }); + params + }) } -export function getInfoA(datas: unknown) { + +// post请求 +const getItem = (data: unknown) => { return Axios({ - url: "/api/getbooks", - method: "get", + url: '/api/getItem', + method: 'post', headers: { - "Content-Type": "application/x-www-form-urlencoded", //设置请求头请求格式form + 'Content-Type': 'application/json' //设置请求头请求格式为json }, - data: datas, - }); + data + }) } -export function getItem(datas: unknown) { - return Axios({ - url: "/api/getItem", - method: "post", - headers: { - "Content-Type": "application/json", //设置请求头请求格式为json - }, - data: datas, - }); -} -export function getItemInfo(datas: unknown) { - return Axios({ - url: "/api/getItemInfo" + datas, - method: "get", - }); + +const HomeApi = { + getInfo, + getItem } +export default HomeApi diff --git a/src/utils/other.ts b/src/utils/other.ts deleted file mode 100644 index e2b46b8..0000000 --- a/src/utils/other.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * @Description: {{ByRuin}} - * @Version: 2.0 - * @Author: Ruin 🍭 - * @Date: 2022-01-25 17:45:05 - * @LastEditors: 刘引 - * @LastEditTime: 2022-01-25 17:47:27 - */ -import axios from "axios"; -const otherApi = axios.create({ - baseURL: "http://baidu.com", -}); -export default otherApi; diff --git a/src/utils/request/request.ts b/src/utils/request/request.ts deleted file mode 100644 index af31315..0000000 --- a/src/utils/request/request.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * @Description: {{ByRuin}} - * @Version: 2.0 - * @Author: Ruin 🍭 - * @Date: 2022-01-25 17:36:26 - * @LastEditors: 刘引 - * @LastEditTime: 2022-01-25 17:46:39 - */ -import axios from 'axios' -const homeApi = axios.create({ - baseURL: 'http://baidu.com' -}) -export default homeApi diff --git a/src/views/home/index.vue b/src/views/home/index.vue index c16c81d..a67fdbd 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -1,11 +1,3 @@ - - \ No newline at end of file + diff --git a/src/views/index.vue b/src/views/index.vue index ac67e42..f0de20f 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -1,12 +1,15 @@