当前位置: 首页 > news >正文

出入库管理系统vue2前端开发服务器地址配置

【精选】vue.config.js 的完整配置(超详细)_vue.config.js配置_web学生网页设计的博客-CSDN博客

本项目需要修改两处:

1、vue开发服务器地址:config\index.js

'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.const path = require('path')module.exports = {dev: {// PathsassetsSubDirectory: 'static',assetsPublicPath: '/',proxyTable: {},// Various Dev Server settingshost: '10.0.180.203', //'localhost', // can be overwritten by process.env.HOSTport: 8081, // can be overwritten by process.env.PORT, if port is in use, a free one will be determinedautoOpenBrowser: 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: true,// If true, eslint errors and warnings will also be shown in the error overlay// in the browser.showEslintErrorsInOverlay: false,/*** Source Maps*/// https://webpack.js.org/configuration/devtool/#developmentdevtool: '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#cachebustingcacheBusting: true,cssSourceMap: true},build: {// Template for index.htmlindex: path.resolve(__dirname, '../dist/index.html'),// PathsassetsRoot: path.resolve(__dirname, '../dist'),assetsSubDirectory: 'static',assetsPublicPath: './',/*** Source Maps*/productionSourceMap: true,// https://webpack.js.org/configuration/devtool/#productiondevtool: '#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-pluginproductionGzip: true,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 offbundleAnalyzerReport: true}
}

2、后台接口地址:src\utils\request.js

import axios from 'axios'
import {message, Modal, notification} from 'ant-design-vue'
import moment from 'moment'
import store from '../store'
import db from 'utils/localstorage'
moment.locale('zh-cn')// 统一配置
let FEBS_REQUEST = axios.create({baseURL: 'http://10.0.180.203:9527/', // 'http://127.0.0.1:9527/',responseType: 'json',validateStatus (status) {// 200 外的状态码都认定为失败return status === 200}
})// 拦截请求
FEBS_REQUEST.interceptors.request.use((config) => {let expireTime = store.state.account.expireTimelet now = moment().format('YYYYMMDDHHmmss')// 让token早10秒种过期,提升“请重新登录”弹窗体验if (now - expireTime >= -10) {Modal.error({title: '登录已过期',content: '很抱歉,登录已过期,请重新登录',okText: '重新登录',mask: false,onOk: () => {return new Promise((resolve, reject) => {db.clear()location.reload()})}})}// 有 token就带上if (store.state.account.token) {config.headers.Authentication = store.state.account.token}return config
}, (error) => {return Promise.reject(error)
})// 拦截响应
FEBS_REQUEST.interceptors.response.use((config) => {return config
}, (error) => {if (error.response) {let errorMessage = error.response.data === null ? '系统内部异常,请联系网站管理员' : error.response.data.messageswitch (error.response.status) {case 404:notification.error({message: '系统提示',description: '很抱歉,资源未找到',duration: 4})breakcase 403:case 401:notification.warn({message: '系统提示',description: '很抱歉,您无法访问该资源,可能是因为没有相应权限或者登录已失效',duration: 4})breakdefault:notification.error({message: '系统提示',description: errorMessage,duration: 4})break}}return Promise.reject(error)
})const request = {post (url, params) {return FEBS_REQUEST.post(url, params, {transformRequest: [(params) => {let result = ''Object.keys(params).forEach((key) => {if (!Object.is(params[key], undefined) && !Object.is(params[key], null)) {result += encodeURIComponent(key) + '=' + encodeURIComponent(params[key]) + '&'}})return result}],headers: {'Content-Type': 'application/x-www-form-urlencoded'}})},put (url, params) {return FEBS_REQUEST.put(url, params, {transformRequest: [(params) => {let result = ''Object.keys(params).forEach((key) => {if (!Object.is(params[key], undefined) && !Object.is(params[key], null)) {result += encodeURIComponent(key) + '=' + encodeURIComponent(params[key]) + '&'}})return result}],headers: {'Content-Type': 'application/x-www-form-urlencoded'}})},get (url, params) {let _paramsif (Object.is(params, undefined)) {_params = ''} else {_params = '?'for (let key in params) {if (params.hasOwnProperty(key) && params[key] !== null) {_params += `${key}=${params[key]}&`}}}return FEBS_REQUEST.get(`${url}${_params}`)},delete (url, params) {let _paramsif (Object.is(params, undefined)) {_params = ''} else {_params = '?'for (let key in params) {if (params.hasOwnProperty(key) && params[key] !== null) {_params += `${key}=${params[key]}&`}}}return FEBS_REQUEST.delete(`${url}${_params}`)},export (url, params = {}) {message.loading('导出数据中')return FEBS_REQUEST.post(url, params, {transformRequest: [(params) => {let result = ''Object.keys(params).forEach((key) => {if (!Object.is(params[key], undefined) && !Object.is(params[key], null)) {result += encodeURIComponent(key) + '=' + encodeURIComponent(params[key]) + '&'}})return result}],responseType: 'blob'}).then((r) => {const content = r.dataconst blob = new Blob([content])const fileName = `${new Date().getTime()}_导出结果.xlsx`if ('download' in document.createElement('a')) {const elink = document.createElement('a')elink.download = fileNameelink.style.display = 'none'elink.href = URL.createObjectURL(blob)document.body.appendChild(elink)elink.click()URL.revokeObjectURL(elink.href)document.body.removeChild(elink)} else {navigator.msSaveBlob(blob, fileName)}}).catch((r) => {console.error(r)message.error('导出失败')})},download (url, params, filename) {message.loading('文件传输中')return FEBS_REQUEST.post(url, params, {transformRequest: [(params) => {let result = ''Object.keys(params).forEach((key) => {if (!Object.is(params[key], undefined) && !Object.is(params[key], null)) {result += encodeURIComponent(key) + '=' + encodeURIComponent(params[key]) + '&'}})return result}],responseType: 'blob'}).then((r) => {const content = r.dataconst blob = new Blob([content])if ('download' in document.createElement('a')) {const elink = document.createElement('a')elink.download = filenameelink.style.display = 'none'elink.href = URL.createObjectURL(blob)document.body.appendChild(elink)elink.click()URL.revokeObjectURL(elink.href)document.body.removeChild(elink)} else {navigator.msSaveBlob(blob, filename)}}).catch((r) => {console.error(r)message.error('下载失败')})},upload (url, params) {return FEBS_REQUEST.post(url, params, {headers: {'Content-Type': 'multipart/form-data'}})}
}export default request

解析vue中的process.env_vue process-CSDN博客

相关文章:

出入库管理系统vue2前端开发服务器地址配置

【精选】vue.config.js 的完整配置(超详细)_vue.config.js配置_web学生网页设计的博客-CSDN博客 本项目需要修改两处: 1、vue开发服务器地址:config\index.js use strict // Template version: 1.3.1 // see http://vuejs-templa…...

民安智库(第三方满意度调研公司):助力奢侈品品牌提升客户满意度

在奢侈品行业中,客户满意度是衡量品牌价值和市场竞争力的关键因素。为了准确了解客户的需求和反馈,民安智库(北京第三方社会调查评估)以其专业的满意度调查方法,受委托对某奢侈品品牌进行全面的客户满意度调查。 此次…...

蓝牙特征值示例1-迈金L308自行车尾灯夜骑智能表情尾灯的

了解商品级蓝牙特征值 1 服务器(设备)描述 0x02-01-06 05-03-0F180A18 09-FF-FFFF166B001C0101 0A-09-4C3330385F37393937 01设备标识 03服务UUID FF厂商自定义数据(厂家编号:FFFF-166B001C0101) 完整设备名称: L308-7997 2 服…...

Three 笔记

一:常用函数封装 1、实例化three 场景、相机、渲染器 import * as THREE from three;/*** 实例化three 场景、相机、渲染器* param container: dom容器 * param fov: 视野角度 * param near: 相机视锥体近裁截面相对相机的距离 * param far: 相机视锥体远裁截面相…...

Crypto | Affine password 第二届“奇安信”杯网络安全技能竞赛

题目描述: 明文经过仿射函数y3x9加密之后变为JYYHWVPIDCOZ,请对其进行解密,flag的格式为flag{明文的大写形式}。 密文: JYYHWVPIDCOZ解题思路: 1、使用在线网站直接破解或手工计算破解,获得flag。&#xf…...

android使用notification消息通知(工具类封装)

代码直接复制粘贴就可以用了,参数可以更具自己需求添加 private NotificationManager manager;private Notification notification;private static final String NORMAL_CHANNEL_ID "my_notification_normal";private static final String IMPORTANT_CHA…...

PicoDiagnostics (NVH设备软件)-PS软件设置文件类型介绍

作为远程技术指导人员&#xff0c;下面这个功能对你来说可能非常有帮助。 在PicoScope 7 软件的文件保存格式里&#xff0c;通常选择的是<PS 数据文件>类型&#xff0c;容易忽略其他实用的保存文件类型&#xff0c;下面我们介绍<PS设置文件>类型。 PS 数据文件&…...

Linux 定时删除7天前的文件

一、编写脚本 #!/bin/bash find /home/kafka/logs -mtime 10 -name "*.*" -exec rm -rf {} \;保存到home目录下的logs_delete.sh 二、解释 # 命令格式 find 对应目录 -mtime 天数 -name "文件名" -exec rm -rf {} \; # 示例命令&#xff0c;将/home/kaf…...

VISA机制

需要用到VISA的3种机制&#xff1a;属性机制、锁定机制和事件机制。以写资源为例&#xff0c;3种机制的作用如图 &#xff08;1&#xff09;属性机制 属性机制用来控制资源的各种属性&#xff0c;这些属性分为两种&#xff1a;只读属性和可读可写属性。 &#xff08;2&#xf…...

基于开源项目OCR做一个探究(chineseocr_lite)

背景&#xff1a;基于图片识别的技术有很多&#xff0c;应用与各行各业&#xff0c;我们公司围绕电子身份证识别自动录入需求开展&#xff0c;以下是我的研究心得 技术栈&#xff1a;python3.6&#xff0c;chineseocr_lite的onnx推理 环境部署&#xff1a;直接上截图&#xff…...

工作常遇,Web自动化测试疑难解答,测试老鸟带你一篇打通...

目录&#xff1a;导读 前言一、Python编程入门到精通二、接口自动化项目实战三、Web自动化项目实战四、App自动化项目实战五、一线大厂简历六、测试开发DevOps体系七、常用自动化测试工具八、JMeter性能测试九、总结&#xff08;尾部小惊喜&#xff09; 前言 1、自动化测试中隐…...

H5判断当前环境是否为微信小程序

H5判断当前环境是否为微信小程序 场景代码 场景 H5需要判断当前环境是否为微信小程序&#xff0c;然后做一些交互调整。 代码 isWxMiniCodeWebviewEnv() {return navigator.userAgent.match(/miniprogram/i) || window.__wxjs_environment miniprogram }...

桌面云架构讲解(VDI、IDV、VOI/TCI、RDS)

目录 云桌面架构 VDI 虚拟桌面基础架构 IDV 智能桌面虚拟化 VOI/TCI VOI 虚拟系统架构 TCI 透明计算机架构 RDS 远程桌面服务 不同厂商云桌面架构 桌面传输协议 什么是云桌面 桌面云是虚拟化技术成熟后发展起来的一种应用&#xff0c;桌面云通常也称为云桌面、VDI等 …...

计算图片中两个任意形状多边形相交部分的大小

一张图片中两个任意多边形相交的面积计算方法。本文参考https://blog.csdn.net/PanYHHH/article/details/110940428&#xff1b;加了一个简单的示例&#xff0c;也对代码做了一点清淅化。原博客中还有其他链接&#xff0c;是C代码&#xff0c;没有看原理&#xff0c;但以下代码…...

JavaScript的函数

在JavaScript中&#xff0c;函数是一种强大而灵活的工具&#xff0c;它们不仅可以执行特定的任务&#xff0c;还可以作为变量、参数和返回值进行传递。本文将介绍JavaScript函数的各个方面&#xff0c;包括函数的定义和调用、函数参数和返回值、匿名函数和箭头函数&#xff0c;…...

stm32 - Cortex

stm32 - Cortex 概念Cortex-M4 的工作模式和工作状态寄存器 概念 Cortex-M4 的工作模式和工作状态 处理模式 当处理器发生了异常或者中断&#xff0c;则进入处理模式进行处理&#xff0c;处理完成后返回到线程模式 权限大&#xff0c;访问处理器中所有的资源 线程模式 芯片复…...

计算机组成原理之概述

概述 计组主要讲的是计算机的硬件实现方式。 机器字长 比如8080处理器&#xff0c;如果想处理16位数的整数运算&#xff0c;就需要执行两次。 可见&#xff0c;机器字长会影响到数据的处理速度。 计算机硬件的基本组成 早期的冯诺依曼机 冯诺依曼提出了“存储程序”的概念&…...

思维导图软件 Xmind mac中文版软件特点

XMind mac是一款思维导图软件&#xff0c;可以帮助用户创建各种类型的思维导图和概念图。 XMind mac软件特点 - 多样化的导图类型&#xff1a;XMind提供了多种类型的导图&#xff0c;如鱼骨图、树形图、机构图等&#xff0c;可以满足不同用户的需求。 - 强大的功能和工具&#…...

群晖 DSM 7.0 Synology Photos IOS | Android 客户端下载

安卓版本低-官方说明&#xff1a;https://www.synology.com/zh-tw/dsm/7.1/software_spec/synology_photos Synology Photos Android 客户端下载大全&#xff1a; https://archive.synology.cn/download/Mobile 官网-Synology Photos | 群暉科技 Synology Inc. 全新的 DSM…...

@CacheInvalidate(name = “xxx“, key = “#results.![a+b]“,multi = true)是什么意思

@CacheInvalidate 注解是 JetCache 框架提供的注解,它是由阿里巴巴开源的组织 Alibaba Group 开发和维护的。JetCache 是一款基于注解的缓存框架,提供了丰富的缓存功能和灵活的配置选项,可用于增强应用程序的性能和可扩展性。JetCache 支持多种缓存后端,包括内存缓存、Redi…...

谷歌浏览器插件

项目中有时候会用到插件 sync-cookie-extension1.0.0&#xff1a;开发环境同步测试 cookie 至 localhost&#xff0c;便于本地请求服务携带 cookie 参考地址&#xff1a;https://juejin.cn/post/7139354571712757767 里面有源码下载下来&#xff0c;加在到扩展即可使用FeHelp…...

业务系统对接大模型的基础方案:架构设计与关键步骤

业务系统对接大模型&#xff1a;架构设计与关键步骤 在当今数字化转型的浪潮中&#xff0c;大语言模型&#xff08;LLM&#xff09;已成为企业提升业务效率和创新能力的关键技术之一。将大模型集成到业务系统中&#xff0c;不仅可以优化用户体验&#xff0c;还能为业务决策提供…...

大数据零基础学习day1之环境准备和大数据初步理解

学习大数据会使用到多台Linux服务器。 一、环境准备 1、VMware 基于VMware构建Linux虚拟机 是大数据从业者或者IT从业者的必备技能之一也是成本低廉的方案 所以VMware虚拟机方案是必须要学习的。 &#xff08;1&#xff09;设置网关 打开VMware虚拟机&#xff0c;点击编辑…...

蓝桥杯 2024 15届国赛 A组 儿童节快乐

P10576 [蓝桥杯 2024 国 A] 儿童节快乐 题目描述 五彩斑斓的气球在蓝天下悠然飘荡&#xff0c;轻快的音乐在耳边持续回荡&#xff0c;小朋友们手牵着手一同畅快欢笑。在这样一片安乐祥和的氛围下&#xff0c;六一来了。 今天是六一儿童节&#xff0c;小蓝老师为了让大家在节…...

【JavaWeb】Docker项目部署

引言 之前学习了Linux操作系统的常见命令&#xff0c;在Linux上安装软件&#xff0c;以及如何在Linux上部署一个单体项目&#xff0c;大多数同学都会有相同的感受&#xff0c;那就是麻烦。 核心体现在三点&#xff1a; 命令太多了&#xff0c;记不住 软件安装包名字复杂&…...

【碎碎念】宝可梦 Mesh GO : 基于MESH网络的口袋妖怪 宝可梦GO游戏自组网系统

目录 游戏说明《宝可梦 Mesh GO》 —— 局域宝可梦探索Pokmon GO 类游戏核心理念应用场景Mesh 特性 宝可梦玩法融合设计游戏构想要素1. 地图探索&#xff08;基于物理空间 广播范围&#xff09;2. 野生宝可梦生成与广播3. 对战系统4. 道具与通信5. 延伸玩法 安全性设计 技术选…...

基于TurtleBot3在Gazebo地图实现机器人远程控制

1. TurtleBot3环境配置 # 下载TurtleBot3核心包 mkdir -p ~/catkin_ws/src cd ~/catkin_ws/src git clone -b noetic-devel https://github.com/ROBOTIS-GIT/turtlebot3.git git clone -b noetic https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git git clone -b noetic-dev…...

Java数值运算常见陷阱与规避方法

整数除法中的舍入问题 问题现象 当开发者预期进行浮点除法却误用整数除法时,会出现小数部分被截断的情况。典型错误模式如下: void process(int value) {double half = value / 2; // 整数除法导致截断// 使用half变量 }此时...

DiscuzX3.5发帖json api

参考文章&#xff1a;PHP实现独立Discuz站外发帖(直连操作数据库)_discuz 发帖api-CSDN博客 简单改造了一下&#xff0c;适配我自己的需求 有一个站点存在多个采集站&#xff0c;我想通过主站拿标题&#xff0c;采集站拿内容 使用到的sql如下 CREATE TABLE pre_forum_post_…...

人工智能 - 在Dify、Coze、n8n、FastGPT和RAGFlow之间做出技术选型

在Dify、Coze、n8n、FastGPT和RAGFlow之间做出技术选型。这些平台各有侧重&#xff0c;适用场景差异显著。下面我将从核心功能定位、典型应用场景、真实体验痛点、选型决策关键点进行拆解&#xff0c;并提供具体场景下的推荐方案。 一、核心功能定位速览 平台核心定位技术栈亮…...