diff --git a/.env b/.env new file mode 100644 index 0000000..d4432fc --- /dev/null +++ b/.env @@ -0,0 +1 @@ +VITE_MODE = Dev \ No newline at end of file diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..2ee1b39 --- /dev/null +++ b/.env.development @@ -0,0 +1 @@ +VITE_MODE = dev \ No newline at end of file diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..eb2b8c4 --- /dev/null +++ b/.env.production @@ -0,0 +1,5 @@ +VITE_MODE = production +VITE_HOST = https://hd.xglpa.com +VITE_CDN = https://cdn.xglpa.com +VITE_FOLDER = /vite-4 +VITE_API = /vite-api \ No newline at end of file diff --git a/.env.test b/.env.test new file mode 100644 index 0000000..cbb40de --- /dev/null +++ b/.env.test @@ -0,0 +1,5 @@ +VITE_MODE = test +VITE_HOST = https://test.szxgl.cn +VITE_CDN = https://test.szxgl.cn +VITE_FOLDER = /vite +VITE_API = /vite-api \ No newline at end of file diff --git a/index.html b/index.html index 795e4fb..eb6c75e 100644 --- a/index.html +++ b/index.html @@ -1,13 +1,15 @@ - + - - - - - Vite + Vue - - -
- - - + + + + + <%- title%> + + + +
+ + + \ No newline at end of file diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 0000000..b05253c --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "baseUrl": "./", + "allowJs": true, + "paths": { + "@/*": [ + "src/*" + ] + } + } +} \ No newline at end of file diff --git a/package.json b/package.json index abca8ff..7f1f64c 100644 --- a/package.json +++ b/package.json @@ -5,14 +5,32 @@ "type": "module", "scripts": { "dev": "vite", - "build": "vite build", + "test": "vite --mode test", + "build:test": "vite build --mode test", + "build:pro": "vite build --mode production", "preview": "vite preview" }, "dependencies": { - "vue": "^3.2.41" + "axios": "^1.6.3", + "gsap": "^3.12.4", + "howler": "^2.2.4", + "pinia": "^2.1.7", + "qs": "^6.11.2", + "vant": "^3.6.12", + "vconsole": "^3.15.1", + "vue": "^3.2.41", + "weixin-js-sdk": "^1.6.5" }, "devDependencies": { + "@vant/auto-import-resolver": "^1.0.2", "@vitejs/plugin-vue": "^3.2.0", - "vite": "^3.2.3" + "postcss-px-to-viewport-8-plugin": "^1.2.3", + "sass": "^1.68.0", + "sass-loader": "^13.3.2", + "unplugin-auto-import": "^0.17.3", + "unplugin-vue-components": "^0.26.0", + "vite": "^3.2.3", + "vite-plugin-compression": "^0.5.1", + "vite-plugin-html": "^3.2.1" } -} \ No newline at end of file +} diff --git a/share.html b/share.html new file mode 100644 index 0000000..f7ebc54 --- /dev/null +++ b/share.html @@ -0,0 +1,15 @@ + + + + + + + <%- title%> + + + +
+ + + \ No newline at end of file diff --git a/src/App.vue b/src/App.vue deleted file mode 100644 index 6febdb7..0000000 --- a/src/App.vue +++ /dev/null @@ -1,31 +0,0 @@ - - - - - diff --git a/src/api/Axios.js b/src/api/Axios.js new file mode 100644 index 0000000..c362b19 --- /dev/null +++ b/src/api/Axios.js @@ -0,0 +1,33 @@ +import axios from 'axios' +import QS from 'qs'; + +// 创建axios +const service = axios.create({ + baseURL: import.meta.env.VITE_API, + timeout: 50000, +}); + + + +// 添加请求拦截器 +service.interceptors.request.use((config) => { + // 在发送请求之前做些什么 + config + return config; +}, function (error) { + // 对请求错误做些什么 + return Promise.reject(error); +}); + +// 添加响应拦截器 +service.interceptors.response.use( + (response) => { + + return response.data; + }, (error) => { + + + return Promise.reject(error); + }); + +export default service; \ No newline at end of file diff --git a/src/api/api.js b/src/api/api.js new file mode 100644 index 0000000..daae096 --- /dev/null +++ b/src/api/api.js @@ -0,0 +1,9 @@ +import http from './http' + +export function addSurveyed(data, authorization) { + return http.post("/api/user/addSurveyed", + data, + true, + authorization + ); +} \ No newline at end of file diff --git a/src/api/http.js b/src/api/http.js new file mode 100644 index 0000000..efa51c5 --- /dev/null +++ b/src/api/http.js @@ -0,0 +1,73 @@ +import service from './Axios' +import qs from "qs"; + + +// json格式请求头 +const headerJSON = { + "Content-Type": "application/json;charset=UTF-8", +}; +// FormData格式请求头 +const headerFormData = { + "Content-Type": "application/x-www-form-urlencoded", +}; + + +const http = { + /** + * methods: 请求 + * @param url 请求地址 + * @param params 请求参数 + * @param json 判断数据发送是否是json格式: true-为是 false-为否 + */ + get(url, params, json, authorization) { + if (authorization) { + headerJSON['authorization'] = authorization + } + const config = { + method: "get", + url: url, + headers: json ? headerJSON : headerFormData + }; + if (params) config.params = params; + return service(config); + }, + post(url, params, json, authorization) { + + if (authorization) { + headerJSON['authorization'] = authorization + } + + const config = { + method: "post", + url: url, + headers: json ? headerJSON : headerFormData + }; + + if (params) config.data = json ? params : qs.stringify(params); + + return service(config); + }, + put(url, params, json) { + const config = { + method: "put", + url: url, + headers: headerFormData + }; + if (params) config.params = params; + return service(config); + }, + delete(url, params, json) { + const config = { + method: "delete", + url: url, + headers: headerFormData + }; + if (params) config.params = params; + return service(config); + }, + +} + + +//导出 +export default http; \ No newline at end of file diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue index 91f9bfc..5927807 100644 --- a/src/components/HelloWorld.vue +++ b/src/components/HelloWorld.vue @@ -1,16 +1,19 @@