Browse Source

修改基本配置

zaijin 3 years ago
parent
commit
02787dfb66
7 changed files with 29 additions and 161 deletions
  1. 2 1
      README.md
  2. 2 2
      common/apiurl.js
  3. 6 1
      common/config.js
  4. 2 2
      common/http.api.js
  5. 3 5
      common/http.interceptor.js
  6. 0 146
      static/html/wxPayCallback - 副本.html
  7. 14 4
      vue.config.js

+ 2 - 1
README.md

@@ -3,10 +3,11 @@
 - 发行 => 自定义发行 => build:dev(测试环境) / build:pro (正式环境)
 - 如果api地址有变动   修改package.json 中的环境变量配置
 - common/config.js  本地运行地址修改
+- 新项目中的点金计划页面修改static/html/wxPayCallback.html中(jumpOutUrl)修改为需要跳转的页面
 
 #### iconfont
 - [iconfont 自定义图标](https://www.uviewui.com/guide/customIcon.html)
 - [字体默认不再生成 .eot、.svg 和 Base64](https://github.com/thx/iconfont-plus/issues/1948)
 
 #### 安装vue-jsonp
-`npm install vue-jsonp --save`
+`npm install vue-jsonp --save` 用作通过经纬度获取所在城市跨域处理

+ 2 - 2
common/apiurl.js

@@ -29,14 +29,14 @@ const apiurl = {
 	// 设置为默认车辆
 	setDefaultCarUrl: '/client/membervehicle/modifyDefault/',
 	//室内停车订单列表
-	getRoomparkingList:'/client/parking-orderinfo/pageList',
+	getRoomparkingList: '/client/parking-orderinfo/pageList',
 	// 获取订单列表
 	getOrderListUrl: '/client/orderinfo',
 	// 获取支付订单详情
 	getOrderinfoUrl: '/client/orderinfo/paydetail/',
 	// 获取订单详情
 	getOrderDetailUrl: '/client/orderinfo/detail/',
-	getRoomOrderDetailUrl:'/client/parking-orderinfo/detail/',
+	getRoomOrderDetailUrl: '/client/parking-orderinfo/detail/',
 	//获取信息列表
 	getMessageListUrl: '/client/membernews',
 	//消息已读接口

+ 6 - 1
common/config.js

@@ -1,10 +1,15 @@
+/**
+ * 在package.json中定义的H_NODE_ENV
+ * 在本地运行该环境为未定义,设置初始baseUrl
+ * 只有在打包环境下才会有H_NODE_ENV
+ */
 const node_dev = process.env.H_NODE_ENV
 let baseUrl = 'https://wx.hw.hongweisoft.com/parking'
 if (node_dev) {
 	baseUrl = process.env.H_BASE_URL
 }
 const config = {
-	wxAppid: 'wx45c3cf2b632f5fd5', // 正式wxAppid
+	wxAppid: 'wx45c3cf2b632f5fd5',
 	baseUrl
 }
 

+ 2 - 2
common/http.api.js

@@ -38,7 +38,7 @@ const install = (Vue, vm) => {
 
 	let getOrderList = (params = {}) => vm.$u.get(apiurl.getOrderListUrl, params);
 	//室内停车订单列表api
-	let getRoomParkingApi =(params = {}) => vm.$u.get(apiurl.getRoomparkingList, params)
+	let getRoomParkingApi = (params = {}) => vm.$u.get(apiurl.getRoomparkingList, params)
 	let getOrderinfo = (params = {}) => vm.$u.get(apiurl.getOrderinfoUrl + params.id);
 	let getRoomOrderDetail = (params = {}) => vm.$u.get(apiurl.getRoomOrderDetailUrl + params.id, {
 		showLoading: false
@@ -100,7 +100,7 @@ const install = (Vue, vm) => {
 	let getOrderStateExportApi = (params = {}) => vm.$u.post(apiurl.getOrderStateExportUrl, params)
 	let quickPayExportApi = (params = {}) => vm.$u.post(apiurl.quickPayExportUrl, params)
 	let polyPayExportApi = (params = {}) => vm.$u.post(apiurl.polyPayExportUrl, params)
-	
+
 	// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
 	vm.$u.api = {
 		feedbackAdd,

+ 3 - 5
common/http.interceptor.js

@@ -1,19 +1,17 @@
-import { config } from '@/common/config.js';
-import store  from '../store/index.js'
 // vm,就是我们在vue文件里面的this,所以我们能在这里获取vuex的变量,比如存放在里面的token
 const install = (Vue, vm) => {
 	Vue.prototype.$u.http.setConfig({
-		baseUrl: config.baseUrl
+		baseUrl: vm.config.baseUrl
 	});
 	// 请求拦截,配置Token等参数
 	Vue.prototype.$u.http.interceptor.request = (config) => {
 		if(vm.vuex_token){
 			config.header.Authorization = `Bearer ${vm.vuex_token}`;
 		}
+		let noTokenList = ['/client/auth/sendSmsCodeV2', '/client/auth/verifyCodeV2'];
+		if(noTokenList.includes(config.url)) config.header.noToken = true;
 		// 请求地址加时间戳
 		config.url = config.url + '?t=' + Date.now()
-		let noTokenList = ['/client/wechat/h5/code/', '/client/auth/sendSmsCodeV2', '/client/auth/verifyCodeV2'];
-		if(noTokenList.includes(config.url)) config.header.noToken = true;
 		return config; 
 	}
 	// 响应拦截,判断状态码是否通过

+ 0 - 146
static/html/wxPayCallback - 副本.html

@@ -1,146 +0,0 @@
-<html>
-<head>
-	<meta charset="utf-8">
-	<meta http-equiv="X-UA-Compatible" content="IE=edge">
-	<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
-	<link rel="shortcut icon" type="image/x-icon" href="./../favicon.ico">
-	<title>城市智慧停车中转页面</title>
-	<style type="text/css">
-		html,
-		body,
-		div {
-			margin: 0;
-			padding: 0;
-		}
-		.container {
-			height: calc(100% - 26vh);
-			padding: 13vh 0;
-			text-align: center;
-			background: linear-gradient(138deg, #7EBAB8 0%, #48999A 100%);
-			box-shadow: 0px 2px 4px 0px #0B7C7D;
-		}
-		.text-img {
-			height: 21vh;
-			background-size: contain;
-			background-repeat: no-repeat;
-			background-position: center center;
-			background-image: url('./../img/text-html-bg.png');
-		}
-		.car-img {
-			height: 40vh;
-			margin-top: 39px;
-			background-size: contain;
-			background-repeat: no-repeat;
-			background-position: 19px center;
-			background-image: url('./../img/car-html-bg.png');
-		}
-		.button {
-			width: calc(100% - 84px);
-			height: 6vh;
-			margin-top: 4vh;
-			outline: none;
-			border: none;
-			background: #FFFFFF;
-			box-shadow: 0px 7px 13px 0px rgba(0, 105, 106, 0.26);
-			border-radius: 10px;
-			font-size: 1.1em;
-			font-weight: 500;
-			color: #1D8587;
-			font-family: 'PingFangSC-Medium, PingFang SC';
-		}
-	</style>
-</head>
-<body>
-	<div class="container">
-		<div class="text-img"></div>
-		<div class="car-img"></div>
-		<button type="button" class="button" onclick="goToBgzchina()">回到普定智慧停车</button>
-	</div>
-	<!-- <script type="text/javascript" src="https://cdn.bootcss.com/vConsole/3.3.0/vconsole.min.js"></script> -->
-	<script type="text/javascript" src="https://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
-	<script type="text/javascript" charset="UTF-8" src="https://wx.gtimg.com/pay_h5/goldplan/js/jgoldplan-1.0.0.js"></script>
-	<script>
-		// 测试环境
-		// const baseUrl = 'https://wx.hw.hongweisoft.com/parking'
-		// 正式环境
-		const baseUrl = 'https://parking.pdzhtc.com'
-		
-		//	初始化console.log(?)
-		// const vConsole = new VConsole();
-		
-		// 尽量在页面加载完成后实现“点金计划”的相关代码
-		// 函数-获取返回页面参数
-		function getParameters(key) {
-			const params =  window.location.search.substring(1);
-			const vars = params.split("&");
-			for (let i = 0; i < vars.length; i++) {
-					const kvPair = vars[i].split("=");
-					if (kvPair[0] == key) return kvPair[1];
-			}
-			return null;
-		};
-		// end getParameters(key)
-	
-		//测试微信通知过来的参数【非必需】
-		var sub_mch_id = getParameters("sub_mch_id"); //特约商户号
-		console.log("1、特约商户号=" + sub_mch_id);
-		var out_trade_no = getParameters("out_trade_no"); //商户订单号
-		console.log("2、商户订单号=" + out_trade_no);
-		var check_code = getParameters("check_code"); //md5校验码。如果需要计算(参考说明文档)校验则需要后台完成
-		console.log("3、md5校验码=" + check_code);
-		// 跳转地址
-		let jump_url = 'https://h5.pdzhtc.com'
-		if (out_trade_no) {
-			getOrderId(out_trade_no)
-		}
-		//初始化微信点金计划小票【必需,否则在微信不能展示该页面】
-		let mchData = {
-			action: 'onIframeReady',
-			displayStyle: 'SHOW_CUSTOM_PAGE',
-			height: 960,
-		};
-		//高度可选(参考说明文档)
-		const postData = JSON.stringify(mchData);
-		parent.postMessage(postData, 'https://payapp.weixin.qq.com');
-
-		//测试跳转到其他页面【非必需】
-		function goToBgzchina() {
-				const mchData = {
-						action: 'jumpOut',
-						jumpOutUrl: jump_url // 要跳转到的页面。注意:不支持跳转到小程序
-				};
-				const postData = JSON.stringify(mchData);
-				parent.postMessage(postData, 'https://payapp.weixin.qq.com');
-		}
-		// end goToBgzchina
-		
-		// 通过商户订单号获取跳转地址
-		function getOrderId(id) {
-			const localToken = JSON.parse(localStorage.getItem('lifeData') ?? '{}')
-			const token = localToken?.data?.vuex_token
-			$.ajax({
-				//请求方式
-				type : "get",
-				//请求地址
-				url : baseUrl + '/client/orderinfo/orderListByPoly/' + id,
-				// token
-				beforeSend: function(request) {
-					request.setRequestHeader("Authorization", 'Bearer ' + token);
-				},
-				//请求成功
-				success: function(result) {
-						if (result.code === 200) {
-							jump_url = result?.data?.jumpUrl ?? 'https://h5.pdzhtc.com'
-						} else {
-							alert(result.msg)
-						}
-				},
-				//请求失败,包含具体的错误信息
-				error: function(e){
-						alert('程序错误!')
-				}
-		});
-		}
-	</script>
-</body>
-</html>

+ 14 - 4
vue.config.js

@@ -3,11 +3,21 @@ module.exports = {
 	configureWebpack: {
 		devServer: {
 			disableHostCheck: true,
-			https:false
+			https: false
 		}
 	},
 	devServer: {
-		sockHost: '172.16.90.25:8080',
-		disableHostCheck: true,
-	}
+		port: '8890',
+		disableHostCheck:true,
+		proxy:{
+			'/api':{
+				target: 'https://wx.hw.hongweisoft.com/parking/',
+				changeOrigin: true,
+				pathRewrite:{
+					'^/api': ''
+				}
+			}
+		}
+	},
+	
 }