From fa55f3e359c066934ea34a01b111d671d171166a Mon Sep 17 00:00:00 2001 From: yma16 <1432448610@qq.com> Date: Sun, 17 Apr 2022 19:27:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:api=E8=B7=A8=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/index.js | 143 +++++++++++++++-------------- src/comment/ArticleComment.vue | 6 +- src/components/Article.vue | 2 +- src/components/Csslearn.vue | 2 +- src/components/Login.vue | 94 +++++++++---------- src/components/Mavoneditor.vue | 2 +- src/components/Onlinewebsocket.vue | 4 +- src/components/Register.vue | 2 +- 8 files changed, 132 insertions(+), 123 deletions(-) diff --git a/config/index.js b/config/index.js index 324e89c..f4ca898 100644 --- a/config/index.js +++ b/config/index.js @@ -1,85 +1,94 @@ -'use strict' +"use strict"; // Template version: 1.3.1 // see http://vuejs-templates.github.io/webpack for documentation. -const path = require('path') +const path = require("path"); module.exports = { - dev: { - // Paths - assetsSubDirectory: 'static', - assetsPublicPath: '/', - proxyTable: { - '/api': { - target: 'http://yongma16.xyz', //后端接口地址 - ws: true, //接受websocket请求 - changeOrigin: true, //是否允许跨越 - chunkOrigins: true, - pathRewrite: { - '^/api': '' //重写, - } - } + dev: { + // Paths + assetsSubDirectory: "static", + assetsPublicPath: "/", + proxyTable: { + "/api/": { + target: "http://114.116.52.53/", //后端接口地址 + ws: true, //接受websocket请求 + changeOrigin: true, //是否允许跨越 + chunkOrigins: true, + pathRewrite: { + "^/api": "", //重写, }, + }, + "/ws_api/": { + target: "ws://114.116.52.53/", + ws: true, //接受websocket请求 + changeOrigin: true, //是否允许跨越 + chunkOrigins: true, + pathRewrite: { + "^/ws_api": "", //重写, + }, + }, + }, - // Various Dev Server settings - host: 'localhost', // can be overwritten by process.env.HOST - port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined - autoOpenBrowser: false, - errorOverlay: true, - notifyOnErrors: true, - poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- + // Various Dev Server settings + host: "localhost", // can be overwritten by process.env.HOST + port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined + autoOpenBrowser: false, + errorOverlay: true, + notifyOnErrors: true, + poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- - // Use Eslint Loader? - // If true, your code will be linted during bundling and - // linting errors and warnings will be shown in the console. - useEslint: false, - // If true, eslint errors and warnings will also be shown in the error overlay - // in the browser. - showEslintErrorsInOverlay: false, + // Use Eslint Loader? + // If true, your code will be linted during bundling and + // linting errors and warnings will be shown in the console. + useEslint: false, + // If true, eslint errors and warnings will also be shown in the error overlay + // in the browser. + showEslintErrorsInOverlay: false, - /** - * Source Maps - */ + /** + * Source Maps + */ - // https://webpack.js.org/configuration/devtool/#development - devtool: 'cheap-module-eval-source-map', + // https://webpack.js.org/configuration/devtool/#development + devtool: "cheap-module-eval-source-map", - // If you have problems debugging vue-files in devtools, - // set this to false - it *may* help - // https://vue-loader.vuejs.org/en/options.html#cachebusting - cacheBusting: true, + // If you have problems debugging vue-files in devtools, + // set this to false - it *may* help + // https://vue-loader.vuejs.org/en/options.html#cachebusting + cacheBusting: true, - cssSourceMap: true - }, + cssSourceMap: true, + }, - build: { - // Template for index.html - index: path.resolve(__dirname, '../dist/index.html'), + build: { + // Template for index.html + index: path.resolve(__dirname, "../dist/index.html"), - // Paths - assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', - assetsPublicPath: './', + // Paths + assetsRoot: path.resolve(__dirname, "../dist"), + assetsSubDirectory: "static", + assetsPublicPath: "./", - /** - * Source Maps - */ + /** + * Source Maps + */ - productionSourceMap: true, - // https://webpack.js.org/configuration/devtool/#production - devtool: '#source-map', + productionSourceMap: true, + // https://webpack.js.org/configuration/devtool/#production + devtool: "#source-map", - // Gzip off by default as many popular static hosts such as - // Surge or Netlify already gzip all static assets for you. - // Before setting to `true`, make sure to: - // npm install --save-dev compression-webpack-plugin - productionGzip: false, - productionGzipExtensions: ['js', 'css'], + // Gzip off by default as many popular static hosts such as + // Surge or Netlify already gzip all static assets for you. + // Before setting to `true`, make sure to: + // npm install --save-dev compression-webpack-plugin + productionGzip: false, + productionGzipExtensions: ["js", "css"], - // Run the build command with an extra argument to - // View the bundle analyzer report after build finishes: - // `npm run build --report` - // Set to `true` or `false` to always turn it on or off - bundleAnalyzerReport: process.env.npm_config_report - } -} + // Run the build command with an extra argument to + // View the bundle analyzer report after build finishes: + // `npm run build --report` + // Set to `true` or `false` to always turn it on or off + bundleAnalyzerReport: process.env.npm_config_report, + }, +}; diff --git a/src/comment/ArticleComment.vue b/src/comment/ArticleComment.vue index 08c2840..5ac597a 100644 --- a/src/comment/ArticleComment.vue +++ b/src/comment/ArticleComment.vue @@ -45,7 +45,7 @@ export default { return { noneMsg: "还没人评论>_<", msg: "评论区", - baseurl: "http://114.116.52.53/comment/", + baseurl: "api", // baseurl: "http://yongma16.xyz/comment/", userImg: "", username: "匿名", @@ -97,7 +97,7 @@ export default { }; console.log("获取评论id", params.articleId); axios - .post(that.baseurl + "get/", params) + .post(that.baseurl + "comment/get/", params) .then((res) => { try { let resData = res.data; @@ -141,7 +141,7 @@ export default { content: content, }; axios - .post(that.baseurl + "post/", params) + .post(that.baseurl + "comment/post/", params) .then((res) => { that.articleCommit = null; try { diff --git a/src/components/Article.vue b/src/components/Article.vue index 2dfeb00..56917f8 100644 --- a/src/components/Article.vue +++ b/src/components/Article.vue @@ -224,7 +224,7 @@ export default { data() { return { // baseurl: '/api/', - baseurl: "http://114.116.52.53/", + baseurl: "/api/", // baseurl: "http://yongma16.xyz/", msg: "内容", commmentSlogan: "评论区", diff --git a/src/components/Csslearn.vue b/src/components/Csslearn.vue index e0fb5c5..29f0983 100644 --- a/src/components/Csslearn.vue +++ b/src/components/Csslearn.vue @@ -37,7 +37,7 @@ export default { msg: "css练习:", css_length: "", // baseurl: 'http://127.0.0.1:1998', - baseurl: "http://114.116.52.53/", + baseurl: "/api/", // baseurl: "http://yongma16.xyz/", css_title: [], css_path: [], diff --git a/src/components/Login.vue b/src/components/Login.vue index 5ac9c15..e2595ee 100644 --- a/src/components/Login.vue +++ b/src/components/Login.vue @@ -43,36 +43,36 @@