diff --git a/bookmark_front/.editorconfig b/bookmark_front/.editorconfig
index c24743d..5c5a774 100644
--- a/bookmark_front/.editorconfig
+++ b/bookmark_front/.editorconfig
@@ -4,4 +4,4 @@ indent_size = 2
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
-max_line_length = 100
+max_line_length = 150
diff --git a/bookmark_front/babel.config.js b/bookmark_front/babel.config.js
index c6d82ab..d6bc123 100644
--- a/bookmark_front/babel.config.js
+++ b/bookmark_front/babel.config.js
@@ -1,6 +1,4 @@
module.exports = {
- presets: ["@vue/cli-plugin-babel/preset"],
- plugins: [
- ["import", { libraryName: "ant-design-vue", libraryDirectory: "es", style: "css" }] // `style: true` 会加载 less 文件
- ]
+ presets: ["@vue/app"],
+ plugins: [["import", { libraryName: "ant-design-vue", libraryDirectory: "es", style: "css" }]]
};
diff --git a/bookmark_front/package.json b/bookmark_front/package.json
index aa62bf2..b849f71 100644
--- a/bookmark_front/package.json
+++ b/bookmark_front/package.json
@@ -8,7 +8,7 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
- "ant-design-vue": "^1.6.2",
+ "ant-design-vue": "^1.6.3",
"axios": "^0.19.2",
"babel-plugin-import": "^1.13.0",
"core-js": "^3.6.5",
diff --git a/bookmark_front/src/components/public/Switch.vue b/bookmark_front/src/components/public/Switch.vue
new file mode 100644
index 0000000..540900e
--- /dev/null
+++ b/bookmark_front/src/components/public/Switch.vue
@@ -0,0 +1,51 @@
+
+
+
+ 登录
+
+ 注册
+
+ 重置密码
+
+
+
+
+
+
diff --git a/bookmark_front/src/components/layout/Bottom.vue b/bookmark_front/src/layout/main/Bottom.vue
similarity index 100%
rename from bookmark_front/src/components/layout/Bottom.vue
rename to bookmark_front/src/layout/main/Bottom.vue
diff --git a/bookmark_front/src/components/layout/Content.vue b/bookmark_front/src/layout/main/Content.vue
similarity index 100%
rename from bookmark_front/src/components/layout/Content.vue
rename to bookmark_front/src/layout/main/Content.vue
diff --git a/bookmark_front/src/components/layout/Top.vue b/bookmark_front/src/layout/main/Top.vue
similarity index 100%
rename from bookmark_front/src/components/layout/Top.vue
rename to bookmark_front/src/layout/main/Top.vue
diff --git a/bookmark_front/src/main.js b/bookmark_front/src/main.js
index 3a47006..0c3d1b0 100644
--- a/bookmark_front/src/main.js
+++ b/bookmark_front/src/main.js
@@ -1,11 +1,19 @@
import Vue from "vue";
+import { Button, FormModel, Input, Icon, message, Checkbox } from "ant-design-vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
+Vue.component(Button.name, Button);
+Vue.use(FormModel);
+Vue.component(Input.name, Input);
+Vue.component(Icon.name, Icon);
+Vue.use(Checkbox);
+
+Vue.prototype.$message = message;
Vue.config.productionTip = false;
-new Vue({
+window.vueInstance = new Vue({
router,
store,
render: h => h(App)
diff --git a/bookmark_front/src/router/index.js b/bookmark_front/src/router/index.js
index d1b6a0c..cc18d0b 100644
--- a/bookmark_front/src/router/index.js
+++ b/bookmark_front/src/router/index.js
@@ -12,7 +12,6 @@ Vue.use(VueRouter);
const routes = [
{
path: "/",
- name: "Main",
component: Main,
children: [
{
diff --git a/bookmark_front/src/util/HttpUtil.js b/bookmark_front/src/util/HttpUtil.js
index 0d1aab7..0734b34 100644
--- a/bookmark_front/src/util/HttpUtil.js
+++ b/bookmark_front/src/util/HttpUtil.js
@@ -20,13 +20,15 @@ async function request(url, method, params, body, isForm, redirect) {
headers["Content-Type"] = "multipart/form-data";
}
try {
- const { code, data, message } = await http.default.request({
+ const res = await http.default.request({
url,
baseURL: "/bookmark/api",
+ method,
params,
data: body,
headers
});
+ const { code, data, message } = res.data;
if (code === 1) {
return data;
}
@@ -35,10 +37,9 @@ async function request(url, method, params, body, isForm, redirect) {
router.replace(`/public/login?redirect=${encodeURIComponent(router.currentRoute.fullPath)}`);
return null;
}
- console.log(`请求异常:${message}`);
+ window.vueInstance.$message.error(message);
throw new Error(message);
} catch (err) {
- console.error(err);
throw new Error(err);
}
}
diff --git a/bookmark_front/src/views/main/Main.vue b/bookmark_front/src/views/main/Main.vue
index 6bbc027..0aa7f17 100644
--- a/bookmark_front/src/views/main/Main.vue
+++ b/bookmark_front/src/views/main/Main.vue
@@ -9,9 +9,9 @@
-
+
diff --git a/bookmark_front/vue.config.js b/bookmark_front/vue.config.js
new file mode 100644
index 0000000..7ed59d0
--- /dev/null
+++ b/bookmark_front/vue.config.js
@@ -0,0 +1,17 @@
+module.exports = {
+ lintOnSave: false,
+ devServer: {
+ proxy: {
+ "/bookmark/api": {
+ //这里最好有一个 /
+ target: "http://localhost:8088", // 服务器端接口地址
+ ws: true, //如果要代理 websockets,配置这个参数
+ // 如果是https接口,需要配置这个参数
+ changeOrigin: true, //是否跨域
+ pathRewrite: {
+ "^/bookmark/api": "/bookmark/api"
+ }
+ }
+ }
+ }
+};