Ver código fonte

接口地址配置项,法律法规接口

Bella 2 anos atrás
pai
commit
d07fe700d1
7 arquivos alterados com 11849 adições e 125 exclusões
  1. 11646 1
      package-lock.json
  2. 19 0
      src/api/url.js
  3. 6 3
      src/main.js
  4. 120 99
      src/utils/request.js
  5. 34 4
      src/views/LawView.vue
  6. 3 1
      src/views/Login.vue
  7. 21 17
      vue.config.js

Diferenças do arquivo suprimidas por serem muito extensas
+ 11646 - 1
package-lock.json


+ 19 - 0
src/api/url.js

@@ -0,0 +1,19 @@
+/**
+ * 接口访问地址
+ */
+export default {
+  //   登录接口
+  loginUrl: "/oauth/user/login",
+  //   获取用户列表
+  getUserInfo: "/oauth/api/user/getUserInfo",
+  //   请求DMS数据列表
+  selectContentListInfo: "/proxy_dms/content/selectContentListInfo",
+  //   添加标记
+  addConllection: "/conllection/conllection/addConllection",
+  //   根据用户获取标记
+  selectByUser: "/conllection/conllection/selectByUser",
+  //   删除标记
+  deleteConllection: "/conllection/conllection/deleteConllection",
+  //   修改标记
+  updateConllection: "/conllection/conllection/updateConllection",
+};

+ 6 - 3
src/main.js

@@ -9,14 +9,17 @@ import "element-ui/lib/theme-chalk/index.css";
 // 添加字体(优设标题黑)
 import "./assets/font/font.css";
 import "./assets/global.css";
-import SvgIcon from '@/components/SvgIcon'
-Vue.component('svg-icon', SvgIcon);
+import SvgIcon from "@/components/SvgIcon";
+Vue.component("svg-icon", SvgIcon);
 import $ from "jquery";
 import { drag } from "./directives/drag";
-import { post } from "./utils/request.js";
+import { post, postform } from "./utils/request.js";
+import urls from "./api/url";
 
 Vue.directive("drag", drag);
 Vue.prototype.$Post = post;
+Vue.prototype.$PostForm = postform
+Vue.prototype.urlsCollection = urls;
 Vue.config.productionTip = false;
 
 Vue.use(ElementUI);

+ 120 - 99
src/utils/request.js

@@ -1,27 +1,25 @@
-import Vue from 'vue'
+import Vue from "vue";
 import store from "../store";
-import axios from 'axios'
-import {
-  VueAxios
-} from './axios'
+import axios from "axios";
+import { VueAxios } from "./axios";
 
 // 创建 axios 实例
 const service = axios.create({
   // baseURL: 'http://121.43.55.7:8888',
   timeout: 60000, // 请求超时时间,
   headers: {
-    'Content-Type': 'application/form-data'
-  }
-})
+    "Content-Type": "application/form-data",
+  },
+});
 
 const fileService = axios.create({
-  baseURL: '',
+  baseURL: "",
   timeout: 60000, // 请求超时时间,
   headers: {
-    'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
+    "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
   },
-  responseType: 'blob'
-})
+  responseType: "blob",
+});
 
 const err = (error) => {
   if (error.response) {
@@ -32,25 +30,26 @@ const err = (error) => {
     //   description: data.message || 'Try Again Later.'
     // })
   }
-  return Promise.reject(error)
-}
+  return Promise.reject(error);
+};
 
-service.interceptors.request.use(config => {
+service.interceptors.request.use((config) => {
   // 可在此处添加请求自定义 token 请根据实际情况自行修改
   // const token = Vue.ls.get('Access-Token')
-  config.headers.Authorization = 'jwt ' + window.localStorage.getItem('changeAccess_token')
-  return config
-}, err)
+  config.headers.Authorization =
+    "jwt " + window.localStorage.getItem("changeAccess_token");
+  return config;
+}, err);
 
 // response interceptor
-service.interceptors.response.use(response => response.data, err)
+service.interceptors.response.use((response) => response.data, err);
 
 const installer = {
   vm: {},
   install(Vue) {
-    Vue.use(VueAxios, service)
-  }
-}
+    Vue.use(VueAxios, service);
+  },
+};
 
 /**
  * 整合url中拼接的参数
@@ -59,162 +58,184 @@ const installer = {
  * @return {String} 返回的参数字符串 例:keyword=黄河&number=1&string=huanghe
  */
 function splicingParam(params) {
-  let str = ""
+  let str = "";
   for (const key in params) {
-    if (Object.prototype.hasOwnProperty.call(Object, 'key')) {
-      str += "&" + key + "=" + params[key]
+    if (Object.prototype.hasOwnProperty.call(Object, "key")) {
+      str += "&" + key + "=" + params[key];
     }
   }
-  return str.substr(1, str.length)
+  return str.substr(1, str.length);
 }
 
 function get(url, params) {
   return new Promise((resolve, reject) => {
     service({
-      method: 'GET',
+      method: "GET",
       url,
-      params: params
-    }).then(res => {
-      resolve(res)
-    }).catch(err => {
-      reject(err)
+      params: params,
     })
-  })
+      .then((res) => {
+        resolve(res);
+      })
+      .catch((err) => {
+        reject(err);
+      });
+  });
 }
 
 function getFile(url) {
   return new Promise((resolve, reject) => {
     fileService({
-      method: 'GET',
-      url
-    }).then(res => {
-      resolve(res)
-    }).catch(err => {
-      reject(err)
+      method: "GET",
+      url,
     })
-  })
+      .then((res) => {
+        resolve(res);
+      })
+      .catch((err) => {
+        reject(err);
+      });
+  });
 }
 
 function post(url, data) {
   return new Promise((resolve, reject) => {
     service({
-      method: 'POST',
+      method: "POST",
       url,
       data: data,
       headers: {
-        'token': localStorage.getItem('TOKEN'),
-        'Content-Type': 'multipart/form-data;'
-      }
-    }).then(res => {
-      resolve(res)
-    }).catch(err => {
-      reject(err)
+        token: localStorage.getItem("TOKEN"),
+        "Content-Type": "multipart/form-data;",
+      },
     })
-  })
+      .then((res) => {
+        resolve(res);
+      })
+      .catch((err) => {
+        reject(err);
+      });
+  });
 }
 
 function postform(url, data) {
   return new Promise((resolve, reject) => {
     service({
-      method: 'POST',
+      method: "POST",
       url,
       data: JSON.stringify(data),
       headers: {
-        'Content-Type': 'application/x-www-form-urlencoded;'
-      }
-    }).then(res => {
-      resolve(res)
-    }).catch(err => {
-      reject(err)
+        token: localStorage.getItem("TOKEN"),
+        "Content-Type": "multipart/form-data;",
+      },
+      // headers: {
+      //   'Content-Type': 'application/x-www-form-urlencoded;'
+      // }
     })
-  })
+      .then((res) => {
+        resolve(res);
+      })
+      .catch((err) => {
+        reject(err);
+      });
+  });
 }
 
 function put(url, data) {
   return new Promise((resolve, reject) => {
     service({
-      method: 'PUT',
+      method: "PUT",
       url,
       data: data,
       headers: {
-        'Content-Type': 'application/json;'
-      }
-    }).then(res => {
-      resolve(res)
-    }).catch(err => {
-      reject(err)
+        "Content-Type": "application/json;",
+      },
     })
-  })
+      .then((res) => {
+        resolve(res);
+      })
+      .catch((err) => {
+        reject(err);
+      });
+  });
 }
 
 function putform(url, data) {
   return new Promise((resolve, reject) => {
     service({
-      method: 'PUT',
+      method: "PUT",
       url,
       data: JSON.stringify(data),
       headers: {
-        'Content-Type': 'application/x-www-form-urlencoded;'
-      }
-    }).then(res => {
-      resolve(res)
-    }).catch(err => {
-      reject(err)
+        "Content-Type": "application/x-www-form-urlencoded;",
+      },
     })
-  })
+      .then((res) => {
+        resolve(res);
+      })
+      .catch((err) => {
+        reject(err);
+      });
+  });
 }
 
 function del(url, data) {
   return new Promise((resolve, reject) => {
     service({
-      method: 'DELETE',
+      method: "DELETE",
       url,
       data: data,
       headers: {
-        'Content-Type': 'application/json;'
-      }
-    }).then(res => {
-      resolve(res)
-    }).catch(err => {
-      reject(err)
+        "Content-Type": "application/json;",
+      },
     })
-  })
+      .then((res) => {
+        resolve(res);
+      })
+      .catch((err) => {
+        reject(err);
+      });
+  });
 }
 
 function delform(url, data) {
   return new Promise((resolve, reject) => {
     service({
-      method: 'DELETE',
+      method: "DELETE",
       url,
       data: JSON.stringify(data),
       headers: {
-        'Content-Type': 'application/x-www-form-urlencoded;'
-      }
-    }).then(res => {
-      resolve(res)
-    }).catch(err => {
-      reject(err)
+        "Content-Type": "application/x-www-form-urlencoded;",
+      },
     })
-  })
+      .then((res) => {
+        resolve(res);
+      })
+      .catch((err) => {
+        reject(err);
+      });
+  });
 }
 
 function postFile(url, data) {
   return new Promise((resolve, reject) => {
     service({
-      method: 'POST',
+      method: "POST",
       url,
       data: data,
       contentType: false,
       processData: false,
       headers: {
-        'Content-Type': 'multipart/form-data',
-      }
-    }).then(res => {
-      resolve(res)
-    }).catch(err => {
-      reject(err)
+        "Content-Type": "multipart/form-data",
+      },
     })
-  })
+      .then((res) => {
+        resolve(res);
+      })
+      .catch((err) => {
+        reject(err);
+      });
+  });
 }
 
 export {
@@ -229,5 +250,5 @@ export {
   postform,
   delform,
   postFile,
-  getFile
-}
+  getFile,
+};

+ 34 - 4
src/views/LawView.vue

@@ -42,7 +42,11 @@
         <div class="query-btn" @click="queryEvent">查询</div>
       </div>
       <div class="center">
-        <el-table :data="tableData" style="width: 100%" @current-change="handleClick">
+        <el-table
+          :data="tableData"
+          style="width: 100%"
+          @current-change="handleClick"
+        >
           <el-table-column type="index" width="70"> </el-table-column>
           <el-table-column prop="code" label="编号" align="center" width="150">
           </el-table-column>
@@ -131,13 +135,18 @@ export default {
         pageSizes: [5, 10, 20, 50],
         total: 200,
         currentChange: (val) => {
-          this.handleCurrentChange(val);
+          this.getTableData(val);
         },
         handleSizeChange: (val) => {
           this.handleSizeChange(val);
         },
       },
     };
+  },
+  created() {
+    this.getTableData(1)
+
+    
   },
   methods: {
     queryEvent() {
@@ -147,9 +156,30 @@ export default {
       console.log("重置");
     },
     // 切换页
-    handleCurrentChange(val) {
+    getTableData(val) {
       console.log(`当前页: ${val}`);
-      this.paginationData.currentPage = val;
+
+      let params = new FormData();
+      let columnId = 56;
+      let search = [
+        { field: "title", searchType: 2, content: { value: "1234" } },
+      ];
+      params = {
+        columnId: columnId,
+        search: search,
+      };
+
+      this.$Post(this.urlsCollection.selectContentListInfo, params).then(
+        (res) => {
+          if (res.code === 200) {
+            console.log(res.content, "查询到的法律法规相关的数据");
+            this.paginationData.currentPage = val;
+          }
+        },
+        (error) => {
+          console.log(error);
+        }
+      );
     },
     // 切换条数
     handleSizeChange(val) {

+ 3 - 1
src/views/Login.vue

@@ -124,7 +124,8 @@ export default {
       param.append("userName", this.userName);
       param.append("password", this.password);
       param.append("clientId", "1");
-      this.$Post("/oauth/user/login", param).then(
+      console.log(param,"paramdata");
+      this.$Post(this.urlsCollection.loginUrl, param).then(
         res => {
           // 登录成功
           if (res.code == 200) {
@@ -135,6 +136,7 @@ export default {
               localStorage.setItem("_PASSWORD", publicFun.Encrypt(this.password));
             }
             localStorage.setItem("TOKEN", res.message);
+            localStorage.setItem("USER_ID",res.content.id)
             this.$router.push("/");
             const h = this.$createElement;
             this.$notify({

+ 21 - 17
vue.config.js

@@ -1,30 +1,31 @@
-const path = require('path')
-const webpack = require('webpack')
+const path = require("path");
+const webpack = require("webpack");
 
 function resolve(dir) {
-  return path.join(__dirname, dir)
+  return path.join(__dirname, dir);
 }
 // vue.config.js
 module.exports = {
   chainWebpack: (config) => {
     config.resolve.alias
-      .set('@$', resolve('src'))
-      .set('@static', resolve('public/static'));
+      .set("@$", resolve("src"))
+      .set("@static", resolve("public/static"));
 
     // svg图标加载
-    config.module.rule('svg')
-      .exclude
-      .add(path.join(__dirname, resolve('src/assets/icons/svg')))
+    config.module
+      .rule("svg")
+      .exclude.add(path.join(__dirname, resolve("src/assets/icons/svg")))
       .end();
 
-    config.module.rule('icons')
+    config.module
+      .rule("icons")
       .test(/\.svg$/)
-      .include.add(path.join(__dirname, resolve('src/assets/icons/svg')))
+      .include.add(path.join(__dirname, resolve("src/assets/icons/svg")))
       .end()
-      .use('svg-sprite')
-      .loader('svg-sprite-loader')
+      .use("svg-sprite")
+      .loader("svg-sprite-loader")
       .options({
-        symbolId: 'icon-[name]'
+        symbolId: "icon-[name]",
       })
       .end();
   },
@@ -36,7 +37,10 @@ module.exports = {
       },
       "/proxy_dms": {
         target: "http://121.43.55.7:2101",
-      }
-    }
-  }
-}
+      },
+      "/conllection": {
+        target: "http://121.43.55.7:10088",
+      },
+    },
+  },
+};

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff