Commit f26863ff7b50ff736f20e9571b597c2bf9f8090c

Authored by youxiw2000
1 parent 06e74a82

remote server

trash-framework/src/main/java/com/trash/framework/web/service/SysLoginService.java
@@ -116,7 +116,7 @@ public class SysLoginService @@ -116,7 +116,7 @@ public class SysLoginService
116 116
117 OkRestClient okCline; 117 OkRestClient okCline;
118 118
119 - public final String LOGIN_URL = "http://183.66.242.6:6001/api/authservice/cs/thirdpart/user"; 119 + public final String LOGIN_URL = "http://183.66.242.6:6001/api/authservice/cs/thirdpart/user"; //登录地址 待配置
120 120
121 public LoginUser loginByRemote(String token) 121 public LoginUser loginByRemote(String token)
122 { 122 {
trash-ui/.env.development
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 ENV = 'development' 2 ENV = 'development'
3 3
4 VUE_APP_BASE_API = '/dev-api' 4 VUE_APP_BASE_API = '/dev-api'
  5 +VUE_REMOTE_API = '/remote'
5 6
6 # 路由懒加载 7 # 路由懒加载
7 VUE_CLI_BABEL_TRANSPILE_MODULES = true 8 VUE_CLI_BABEL_TRANSPILE_MODULES = true
trash-ui/src/api/dict.js 0 → 100644
  1 +import requestRemote from '@/utils/requestRemote'
  2 +
  3 +export function constructionsitesList(data) {
  4 + const req = requestRemote({
  5 + url: '/api/siteservice/cs/constructionsites/search',
  6 + method: 'post',
  7 + data: data
  8 + });
  9 +
  10 + return req;
  11 +}
trash-ui/src/settings.js
@@ -19,7 +19,7 @@ module.exports = { @@ -19,7 +19,7 @@ module.exports = {
19 /** 19 /**
20 * 是否显示logo 20 * 是否显示logo
21 */ 21 */
22 - sidebarLogo: true, 22 + sidebarLogo: false,
23 23
24 /** 24 /**
25 * @type {string | array} 'production' | ['production', 'development'] 25 * @type {string | array} 'production' | ['production', 'development']
trash-ui/src/utils/request.js
@@ -5,6 +5,9 @@ import { getToken } from '@/utils/auth' @@ -5,6 +5,9 @@ import { getToken } from '@/utils/auth'
5 import errorCode from '@/utils/errorCode' 5 import errorCode from '@/utils/errorCode'
6 6
7 axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' 7 axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
  8 +
  9 +// REMOTE_SERVER = http://183.66.242.6:4301/mock/2561/api/siteservice/cs/constructionsites/search
  10 +
8 // 创建axios实例 11 // 创建axios实例
9 const service = axios.create({ 12 const service = axios.create({
10 // axios中请求配置有baseURL选项,表示请求URL公共部分 13 // axios中请求配置有baseURL选项,表示请求URL公共部分
trash-ui/src/utils/requestRemote.js 0 → 100644
  1 +import axios from 'axios'
  2 +import { Notification, MessageBox, Message } from 'element-ui'
  3 +import store from '@/store'
  4 +import { getToken } from '@/utils/auth'
  5 +import errorCode from '@/utils/errorCode'
  6 +
  7 +axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
  8 +
  9 +// REMOTE_SERVER = http://183.66.242.6:4301/mock/2561/api/siteservice/cs/constructionsites/search
  10 +
  11 +// 创建axios实例
  12 +const service = axios.create({
  13 + // 超时
  14 + timeout: 10000
  15 +})
  16 +// request拦截器
  17 +service.interceptors.request.use(config => {
  18 + // 是否需要设置 token
  19 + const isToken = (config.headers || {}).isToken === false
  20 + if (getToken() && !isToken) {
  21 + config.headers['Authorization'] = 'Bearer auth:token:' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
  22 + }
  23 + return config
  24 +}, error => {
  25 + console.log(error)
  26 + Promise.reject(error)
  27 +})
  28 +
  29 +// 响应拦截器
  30 +service.interceptors.response.use(res => {
  31 + // 未设置状态码则默认成功状态
  32 + const code = res.data.code || 200;
  33 + // 获取错误信息
  34 + const msg = errorCode[code] || res.data.msg || errorCode['default']
  35 + if (code === 401) {
  36 + MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
  37 + confirmButtonText: '重新登录',
  38 + cancelButtonText: '取消',
  39 + type: 'warning'
  40 + }
  41 + ).then(() => {
  42 + store.dispatch('LogOut').then(() => {
  43 + location.href = '/index';
  44 + })
  45 + })
  46 + } else if (code === 500) {
  47 + Message({
  48 + message: msg,
  49 + type: 'error'
  50 + })
  51 + return Promise.reject(new Error(msg))
  52 + } else if (code !== 200) {
  53 + Notification.error({
  54 + title: msg
  55 + })
  56 + return Promise.reject('error')
  57 + } else {
  58 + return res.data
  59 + }
  60 + },
  61 + error => {
  62 + console.log('err' + error)
  63 + let { message } = error;
  64 + if (message == "Network Error") {
  65 + message = "后端接口连接异常";
  66 + }
  67 + else if (message.includes("timeout")) {
  68 + message = "系统接口请求超时";
  69 + }
  70 + else if (message.includes("Request failed with status code")) {
  71 + message = "系统接口" + message.substr(message.length - 3) + "异常";
  72 + }
  73 + Message({
  74 + message: message,
  75 + type: 'error',
  76 + duration: 5 * 1000
  77 + })
  78 + return Promise.reject(error)
  79 + }
  80 +)
  81 +
  82 +export default service
trash-ui/src/views/business/ConstructionCredit/index.vue
@@ -198,6 +198,10 @@ @@ -198,6 +198,10 @@
198 historyCredit 198 historyCredit
199 } from "@/api/business/credit"; 199 } from "@/api/business/credit";
200 200
  201 + import {
  202 + constructionsitesList
  203 + } from "@/api/dict";
  204 +
201 export default { 205 export default {
202 name: "ConstructionCredit", 206 name: "ConstructionCredit",
203 data() { 207 data() {
@@ -273,6 +277,16 @@ @@ -273,6 +277,16 @@
273 created() { 277 created() {
274 this.getList(); 278 this.getList();
275 this.getNamesData(); 279 this.getNamesData();
  280 +
  281 + let query = {
  282 + 'page':1,
  283 + 'size':9999,
  284 + 'creditStatus':0
  285 + }
  286 +
  287 + constructionsitesList(query).then(response => {
  288 + console.log(response);
  289 + });
276 }, 290 },
277 methods: { 291 methods: {
278 getDataInfo(row){ 292 getDataInfo(row){
trash-ui/vue.config.js
@@ -39,7 +39,12 @@ module.exports = { @@ -39,7 +39,12 @@ module.exports = {
39 pathRewrite: { 39 pathRewrite: {
40 ['^' + process.env.VUE_APP_BASE_API]: '' 40 ['^' + process.env.VUE_APP_BASE_API]: ''
41 } 41 }
42 - } 42 + },
  43 + ['/api']: {
  44 + target: `http://183.66.242.6:6001`,
  45 + changeOrigin: true,
  46 + },
  47 +
43 }, 48 },
44 disableHostCheck: true 49 disableHostCheck: true
45 }, 50 },