浏览代码

解决跨域问题

zaijin 3 年之前
父节点
当前提交
bfb037c76c
共有 3 个文件被更改,包括 7 次插入3 次删除
  1. 5 1
      common/config.js
  2. 1 1
      pages/patrolManagement/deviceAbnormalRecords/deviceAbnormalRecords.vue
  3. 1 1
      vue.config.js

+ 5 - 1
common/config.js

@@ -1,4 +1,8 @@
+let baseUrl = 'http://wx.hw.hongweisoft.com/parking/'
+if (process.env.NODE_ENV === 'development') {
+	baseUrl = '/api'
+}
 export const config = {
 export const config = {
-	baseUrl: 'https://wx.hw.hongweisoft.com/parking/',
+	baseUrl,
 	version: '0.1.5'
 	version: '0.1.5'
 }
 }

+ 1 - 1
pages/patrolManagement/deviceAbnormalRecords/deviceAbnormalRecords.vue

@@ -41,7 +41,7 @@
 			getRecordList() {
 			getRecordList() {
 				uni.$u.api.deviceAbnormalApi.getDeviceAbnormalListApi({
 				uni.$u.api.deviceAbnormalApi.getDeviceAbnormalListApi({
 					pageNum: this.page,
 					pageNum: this.page,
-					pageSize: 10
+					pageSize: 15
 				}).then(res => {
 				}).then(res => {
 					if (res.code === 200) {
 					if (res.code === 200) {
 						this.recordList = this.recordList.concat(res.data.rows)
 						this.recordList = this.recordList.concat(res.data.rows)

+ 1 - 1
vue.config.js

@@ -4,7 +4,7 @@ module.exports = {
 		disableHostCheck:true,
 		disableHostCheck:true,
 		proxy:{
 		proxy:{
 			'/api':{
 			'/api':{
-				target: 'http://parking.hw.hongweisoft.com/pudprod-api/',
+				target: 'http://wx.hw.hongweisoft.com/parking/',
 				changeOrigin: true,
 				changeOrigin: true,
 				pathRewrite:{
 				pathRewrite:{
 					'^/api': ''
 					'^/api': ''