Commit b3faf297 authored by youjie's avatar youjie

外卖系统意见调查

parent cdcb1df3
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
<h4 class="ganxiecydc"></h4> <h4 class="ganxiecydc"></h4>
<div class="FillincommentsIn"> <div class="FillincommentsIn">
<div class="FillincommentsInLD"> <div class="FillincommentsInLD">
<div><span>领队:</span><span class="lindui"></span></div> <div id="lindui"><span>领队:</span><span class="lindui"></span></div>
<div><span>导游:</span><span class="daoyou"></span></div> <div id="daoyou"><span>导游:</span><span class="daoyou"></span></div>
</div> </div>
<div class="FillincommentsInT"> <div class="FillincommentsInT">
<div><span>团期:</span><span class="tuanqi1"></span></div> <div><span>团期:</span><span class="tuanqi1"></span></div>
...@@ -44,10 +44,12 @@ ...@@ -44,10 +44,12 @@
<script src="../../js/layer/layer.js"></script> <script src="../../js/layer/layer.js"></script>
<script src="../../js/mian.js"></script> <script src="../../js/mian.js"></script>
<script> <script>
var qMsg = query() var qMsg = {}
var newMsg = {}
var priceInfo = null var priceInfo = null
var dataList = null var dataList = null
var GuestSurveyInfo = null var GuestSurveyInfo = null
var userInfo = getLocalStorage()
var texts = [ var texts = [
'非常不满意', '非常不满意',
...@@ -57,7 +59,23 @@ ...@@ -57,7 +59,23 @@
'非常满意' '非常满意'
] ]
var STAR_IMG = new Array("../../images/Star1.png", "../../images/Star2.png"); var STAR_IMG = new Array("../../images/Star1.png", "../../images/Star2.png");
$('.ganxiecydc').html('感谢' + decodeURIComponent(qMsg.SurName) + (qMsg.Sex == 1 ? "先生" : "女士") + '参与意见调查') if(localStorage.TakeoutVersion==1){
qMsg = {
GuestId: userInfo.GuestId,
SurName: userInfo.SurName,
Sex: userInfo.Sex,
guestMobile: userInfo.guestMobile,
}
newMsg = {
c: userInfo.c,
t: userInfo.t,
g: userInfo.g,
}
}else{
qMsg = query()
}
$('.ganxiecydc').html('感谢' + decodeURIComponent(qMsg.SurName) + `${qMsg.Sex == 1?'先生':qMsg.Sex == 2?'女士':'先生/女士'}参与意见调查`)
getPriceInfo() getPriceInfo()
GetSurveyShowList() GetSurveyShowList()
...@@ -121,9 +139,15 @@ ...@@ -121,9 +139,15 @@
var postMsg = []; var postMsg = [];
if (dataList && dataList.length > 0) { if (dataList && dataList.length > 0) {
dataList.forEach(item => { dataList.forEach(item => {
item.GuestId = qMsg.GuestId; if(localStorage.TakeoutVersion==1){
item.c = newMsg.c
item.t = newMsg.t
item.g = newMsg.g
}else{
item.TCID = qMsg.TCID; item.TCID = qMsg.TCID;
item.OrderID = qMsg.OrderId; item.OrderID = qMsg.OrderId
}
item.GuestId = qMsg.GuestId
if (item.SurveyType === 2 || item.SurveyType === 3) { if (item.SurveyType === 2 || item.SurveyType === 3) {
item.SurveyOptionsList.forEach(y => { item.SurveyOptionsList.forEach(y => {
//单选 //单选
...@@ -142,6 +166,7 @@ ...@@ -142,6 +166,7 @@
}) })
item.ScoreNum = 0; item.ScoreNum = 0;
} }
postMsg.push(item); postMsg.push(item);
}) })
} }
...@@ -170,14 +195,16 @@ ...@@ -170,14 +195,16 @@
} }
function GetBusSurveyInfo() { function GetBusSurveyInfo() {
var msg = {
IsShow: 1,
SurveyType: -1,
...newMsg
}
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: `${getApiUrl().urlPost}`, url: `${getApiUrl().urlPost}`,
contentType: "application/json", contentType: "application/json",
data: getAjaxData("survey_post_GetGuestSurveyInfo", { data: getAjaxData("survey_post_GetGuestSurveyInfo", msg),
IsShow: 1,
SurveyType: -1
}),
async: false, async: false,
success: function(res) { success: function(res) {
if (res.resultCode === 1) { if (res.resultCode === 1) {
...@@ -200,14 +227,16 @@ ...@@ -200,14 +227,16 @@
} }
function GetSurveyShowList() { function GetSurveyShowList() {
var msg = {
IsShow: 1,
SurveyType: -1,
...newMsg
}
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: `${getApiUrl().urlPost}`, url: `${getApiUrl().urlPost}`,
contentType: "application/json", contentType: "application/json",
data: getAjaxData("survey_post_GetSurveyShowList", { data: getAjaxData("survey_post_GetSurveyShowList", msg),
IsShow: 1,
SurveyType: -1
}),
async: false, async: false,
success: function(res) { success: function(res) {
if (res.resultCode === 1) { if (res.resultCode === 1) {
...@@ -240,20 +269,24 @@ ...@@ -240,20 +269,24 @@
} }
function getPriceInfo() { function getPriceInfo() {
var msg = {
tcid: qMsg.TCID,
...newMsg
}
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: `${getApiUrl().urlPost}`, url: `${getApiUrl().urlPost}`,
contentType: "application/json", contentType: "application/json",
data: getAjaxData("miniProgram_post_GetBasePrice", { data: getAjaxData("miniProgram_post_GetBasePrice", msg),
tcid: this.qMsg.TCID
}),
async: false, async: false,
success: function(res) { success: function(res) {
if (res.resultCode === 1) { if (res.resultCode === 1) {
let data = res.data let data = res.data
priceInfo = data priceInfo = data
if (priceInfo && priceInfo.LeaderName && priceInfo.LeaderName != '') $('.lindui').html(priceInfo.LeaderName) if (priceInfo && priceInfo.LeaderName && priceInfo.LeaderName != '') $('.lindui').html(priceInfo.LeaderName)
else $('#lindui').hide()
if (priceInfo && priceInfo.GuideName && priceInfo.GuideName != '') $('.daoyou').html(priceInfo.GuideName) if (priceInfo && priceInfo.GuideName && priceInfo.GuideName != '') $('.daoyou').html(priceInfo.GuideName)
else $('#daoyou').hide()
if (priceInfo && priceInfo.StartDateStr && priceInfo.StartDateStr != '') $('.tuanqi1').html(priceInfo.StartDateStr) if (priceInfo && priceInfo.StartDateStr && priceInfo.StartDateStr != '') $('.tuanqi1').html(priceInfo.StartDateStr)
if (priceInfo && priceInfo.EndDateStr && priceInfo.EndDateStr != '') $('.tuanqi2').html(priceInfo.EndDateStr) if (priceInfo && priceInfo.EndDateStr && priceInfo.EndDateStr != '') $('.tuanqi2').html(priceInfo.EndDateStr)
} else { } else {
...@@ -474,12 +507,12 @@ ...@@ -474,12 +507,12 @@
margin-top: 20px; margin-top: 20px;
margin-bottom: 20px; margin-bottom: 20px;
border-radius: 5px; border-radius: 5px;
background-color: #EE4554; background-color: #419efd;
color: #fff; color: #fff;
} }
.submitB.active { .submitB.active {
background-color: rgba(238, 69, 84, .5); background-color: rgba(65, 158, 253 .5);
} }
.pinfen img { .pinfen img {
......
...@@ -14,10 +14,11 @@ ...@@ -14,10 +14,11 @@
<title>验证</title> <title>验证</title>
</head> </head>
<body> <body>
<div class="login_contentBox">
<div class="login_content" id="login_content"> <div class="login_content" id="login_content">
<div class="login_button" id="login_button"> <div class="login_button" id="login_button">
<button onclick="changeLoginType(1)">手机号验证</button> <button id="buttonSJ" onclick="changeLoginType(1)">手机号验证</button>
<button onclick="changeLoginType(2)">护照号验证</button> <button id="buttonHZ" onclick="changeLoginType(2)">护照号验证</button>
</div> </div>
</div> </div>
<div class="Passport_phone" id="login_phone"> <div class="Passport_phone" id="login_phone">
...@@ -25,9 +26,6 @@ ...@@ -25,9 +26,6 @@
<h3>身份确认</h3> <h3>身份确认</h3>
<input type="phone" class="form-control" id="loginFormT" autocomplete="new-password" placeholder="请输入手机号码" onblur="activeFun(1)"> <input type="phone" class="form-control" id="loginFormT" autocomplete="new-password" placeholder="请输入手机号码" onblur="activeFun(1)">
<button onclick="guestLogin()" class="PassportB" id="loginB">确认</button> <button onclick="guestLogin()" class="PassportB" id="loginB">确认</button>
<div class="loginBackBox">
<img class="BackImg" onclick="goBack()" src="../../images/login/login_arrowleft.png" />
</div>
</div> </div>
</div> </div>
<div class="Passport_phone" id="Passport_phone"> <div class="Passport_phone" id="Passport_phone">
...@@ -35,12 +33,9 @@ ...@@ -35,12 +33,9 @@
<h3>身份确认</h3> <h3>身份确认</h3>
<input type="phone" class="form-control" id="PassportFormT" autocomplete="new-password" placeholder="请输入护照号" onblur="activeFun(2)"> <input type="phone" class="form-control" id="PassportFormT" autocomplete="new-password" placeholder="请输入护照号" onblur="activeFun(2)">
<button onclick="guestLogin()" class="PassportB" id="PassportB">确认</button> <button onclick="guestLogin()" class="PassportB" id="PassportB">确认</button>
<div class="loginBackBox">
<img class="BackImg" onclick="goBack()" src="../../images/login/login_arrowleft.png" />
</div> </div>
</div> </div>
</div> </div>
<script src="../../js/md5.js"></script> <script src="../../js/md5.js"></script>
<script type="text/javascript" src="../../js/autosize.js"></script> <script type="text/javascript" src="../../js/autosize.js"></script>
<script type="text/javascript" src="../../js/jquery-1.10.2.js"></script> <script type="text/javascript" src="../../js/jquery-1.10.2.js"></script>
...@@ -50,13 +45,43 @@ ...@@ -50,13 +45,43 @@
var phoneReg = /^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/ var phoneReg = /^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/
var IsNumEn = /^[a-zA-Z0-9]+$/ var IsNumEn = /^[a-zA-Z0-9]+$/
var msg = { var msg = {
type: 0, //1-手机号码验证登录,2-护照号码验证登录 type: 1, //1-手机号码验证登录,2-护照号码验证登录
//E75385750 13970261014 //E75385750 13970261014
guestMobile: "", //1-为手机号码,2-护照号码 guestMobile: "", //1-为手机号码,2-护照号码
TCID: query().TCID TCID: ""
}
var userInfo = {}
var oldUserInfo = getLocalStorage()
if(query().c&&query().t&&query().g){
localStorage.TakeoutVersion = 1
msg.c = query().c
msg.t = query().t
msg.g = query().g
if(oldUserInfo.c==msg.c&&oldUserInfo.t==msg.t&&oldUserInfo.g==msg.g){
setTimeout(() => {
if(localStorage.TakeoutVersion==1)
window.location.href = `guestSign.html`
}, 300);
}else{
userInfo = {
...getLocalStorage(),
c: msg.c,
t: msg.t,
g: msg.g,
}
localStorage.userInfo = JSON.stringify(userInfo)
}
}else{
localStorage.TakeoutVersion = 0
msg.TCID = query().TCID
if(userInfo&&userInfo.guestMobile) localStorage.removeItem("userInfo")
} }
$('#login_content').show() $('#login_content').show()
$('#login_phone').hide() $('#login_phone').show()
document.getElementById("buttonSJ").classList.add("active")
$('#Passport_phone').hide() $('#Passport_phone').hide()
function goBack() { function goBack() {
...@@ -66,9 +91,18 @@ ...@@ -66,9 +91,18 @@
} }
function changeLoginType(type) { function changeLoginType(type) {
$('#login_content').hide() if (type == 1) {
if (type == 1) $('#login_phone').show() $('#login_phone').show()
if (type == 2) $('#Passport_phone').show() $('#Passport_phone').hide()
document.getElementById("buttonSJ").classList.add("active")
document.getElementById("buttonHZ").classList.remove("active")
}
if (type == 2) {
$('#Passport_phone').show()
$('#login_phone').hide()
document.getElementById("buttonHZ").classList.add("active")
document.getElementById("buttonSJ").classList.remove("active")
}
msg.type = type msg.type = type
} }
...@@ -77,25 +111,28 @@ ...@@ -77,25 +111,28 @@
let phone = $(`#loginFormT`).val() let phone = $(`#loginFormT`).val()
let obj = $(`#loginB`) let obj = $(`#loginB`)
//电话验证 //电话验证
if (!phoneReg.test(phone)) { if(localStorage.TakeoutVersion==1){
obj.attr('disabled', true); if(phone.length==0) return layer.msg('请输入手机号码!');
return layer.msg('请输入有效的手机号码!'); }else {
if(!phoneReg.test(phone)) return layer.msg('请输入有效的手机号码!');
} }
msg.guestMobile = phone msg.guestMobile = phone
} }
if (msg.type == 2) { if (msg.type == 2) {
let Passport = $(`#PassportFormT`).val() let Passport = $(`#PassportFormT`).val()
// let objPassport = $(`#PassportB`) let objPassport = $(`#PassportB`)
// //电话验证 //护照验证
if(localStorage.TakeoutVersion==1){
if (Passport.length==0) {
return layer.msg('请输入护照号!');
}
}else{
// if (!IsNumEn.test(Passport)) { // if (!IsNumEn.test(Passport)) {
// objPassport.attr('disabled', true);
// return layer.msg('请输入有效的护照号!'); // return layer.msg('请输入有效的护照号!');
// } else {
// objPassport.attr('disabled', false);
// } // }
}
msg.guestMobile = Passport msg.guestMobile = Passport
} }
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: `${getApiUrl().urlPost}`, url: `${getApiUrl().urlPost}`,
...@@ -106,6 +143,19 @@ ...@@ -106,6 +143,19 @@
if (res.resultCode === 1) { if (res.resultCode === 1) {
var tempData = res.data var tempData = res.data
if (tempData && tempData.length > 0) { if (tempData && tempData.length > 0) {
if(localStorage.TakeoutVersion==1){
var datas = {
GuestId: tempData[0].Id,
SurName: tempData[0].SurName ? tempData[0].SurName : tempData[0].Name,
Sex: tempData[0].Sex,
c: query().c,
t: query().t,
g: query().g,
guestMobile: msg.guestMobile,
}
localStorage.userInfo = JSON.stringify(datas)
window.location.href = `guestSign.html`
}else{
var datas = { var datas = {
TCID: msg.TCID, TCID: msg.TCID,
GuestId: tempData[0].Id, GuestId: tempData[0].Id,
...@@ -113,12 +163,17 @@ ...@@ -113,12 +163,17 @@
Sex: tempData[0].Sex, Sex: tempData[0].Sex,
OrderId: tempData[0].OrderId, OrderId: tempData[0].OrderId,
} }
//记录订单id GuestId
if (msg.type == 1) window.location.href = 'MobileVerification.html?TCID=' + datas.TCID + '&GuestId=' + datas if (msg.type == 1) window.location.href = 'MobileVerification.html?TCID=' + datas.TCID + '&GuestId=' + datas
.GuestId + '&SurName=' + datas.SurName + '&Sex=' + datas.Sex + '&OrderId=' + datas.OrderId + '&phone=' + .GuestId + '&SurName=' + datas.SurName + '&Sex=' + datas.Sex + '&OrderId=' + datas.OrderId + '&phone=' +
msg.guestMobile msg.guestMobile
if (msg.type == 2) window.location.href = 'guestSign.html?TCID=' + datas.TCID + '&GuestId=' + datas.GuestId + if (msg.type == 2) window.location.href = 'guestSign.html?TCID=' + datas.TCID + '&GuestId=' + datas.GuestId +
'&SurName=' + datas.SurName + '&Sex=' + datas.Sex + '&OrderId=' + datas.OrderId + '&phone=' + msg.guestMobile '&SurName=' + datas.SurName + '&Sex=' + datas.Sex + '&OrderId=' + datas.OrderId + '&phone=' + msg.guestMobile
} }
}else{
layer.msg("此账号已完成意见调查,请勿重复提交!")
}
} else { } else {
layer.msg(res.message) layer.msg(res.message)
} }
...@@ -130,47 +185,51 @@ ...@@ -130,47 +185,51 @@
} }
function activeFun(type) { function activeFun(type) {
msg.type = type
if (type == 1) { if (type == 1) {
let phone = $(`#loginFormT`).val() let phone = $(`#loginFormT`).val()
let obj = $(`#loginB`) let obj = $(`#loginB`)
//电话验证 //电话验证
if (!phoneReg.test(phone)) { if (localStorage.TakeoutVersion==1) {
obj.attr('disabled', true); if(phone.length==0) return layer.msg('请输入手机号码!');
return layer.msg('请输入有效的手机号码!'); }else{
} else { if(!phoneReg.test(phone)) return layer.msg('请输入有效的手机号码!');
obj.attr('disabled', false);
} }
msg.guestMobile = phone
} }
if (type == 2) { if (type == 2) {
// let Passport = $(`#PassportFormT`).val() let Passport = $(`#PassportFormT`).val()
// let objPassport = $(`#PassportB`) let objPassport = $(`#PassportB`)
// //电话验证 //护照验证
if(localStorage.TakeoutVersion==1){
if(Passport.length==0) return layer.msg('请输入护照号!');
}else{
// if (!IsNumEn.test(Passport)) { // if (!IsNumEn.test(Passport)) {
// objPassport.attr('disabled', true); // layer.msg('请输入有效的护照号!');
// return layer.msg('请输入有效的护照号!');
// } else {
// objPassport.attr('disabled', false);
// } // }
} }
msg.guestMobile = Passport
}
} }
</script> </script>
</body> </body>
<style> <style>
.login_content { .login_contentBox{
height: 100%; height: 100vh;
overflow: hidden;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; }
justify-content: center; .login_content {
} }
.login_button { .login_button {
width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: row;
align-items: center; align-items: center;
padding: 0 10%; padding: 50px 5% 30px 5%;
} }
.login_button button { .login_button button {
...@@ -178,17 +237,21 @@ ...@@ -178,17 +237,21 @@
height: 40px; height: 40px;
margin-bottom: 20px; margin-bottom: 20px;
border: 0; border: 0;
background-color: #419EFD;
color: #fff;
border-radius: 5px; border-radius: 5px;
} }
.login_button button:last-child { .login_button button:last-child {
background-color: #67C239; /* background-color: #67C239; */
/* background-color: rgba(65, 158, 253,.5); */
margin-left: 20px;
}
.login_button button.active{
color: #fff;
background-color: #419EFD;
box-shadow: 0 0 3px 0px #419EFD;
} }
.login_phone { .login_phone {
padding: 0 10%; padding: 0 5%;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
...@@ -251,15 +314,17 @@ ...@@ -251,15 +314,17 @@
} }
.Passport_phone { .Passport_phone {
height: 100%; margin: 0 5%;
overflow: hidden; padding: 30px 5%;
padding: 0 10%; border: 1px solid #ddd;
border-radius: 5px;
box-shadow: 0 0 3px 0px #ddd;
} }
.PassportForm { .PassportForm {
margin-top: 50px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding-bottom: 10px;
} }
.PassportForm input { .PassportForm input {
...@@ -276,9 +341,14 @@ ...@@ -276,9 +341,14 @@
height: 40px; height: 40px;
margin-top: 20px; margin-top: 20px;
border-radius: 5px; border-radius: 5px;
background-color: #EE4554; background-color: #419EFD;
color: #fff; color: #fff;
} }
.form-control{
height: 38px;
-webkit-box-shadow: inherit;
box-shadow: inherit
}
</style> </style>
</html> </html>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<div class="tipBox" id="tipBox"> <div class="tipBox" id="tipBox">
<div class="tipImgBox"> <div class="tipImgBox">
<div class="tipImg"> <div class="tipImg">
<img src="../../images/login/gou_big.png"/> <img src="../../images/login/gou_big_blue.png"/>
<h4>&nbsp;&nbsp;&nbsp;提交意见成功!</h4> <h4>&nbsp;&nbsp;&nbsp;提交意见成功!</h4>
</div> </div>
</div> </div>
......
...@@ -2,7 +2,9 @@ let locationName = window.location.hostname; ...@@ -2,7 +2,9 @@ let locationName = window.location.hostname;
function getApiUrl() { function getApiUrl() {
//ERP接口地址 //ERP接口地址
let erpApiUrl = "http://192.168.5.46/api/common/post"; let erpApiUrl = "http://192.168.5.204:8030/api/common/post";
let erpApiUrlTakVer = "http://192.168.5.204:8065/api/common/post";//外卖版本
//ERP-Jave接口地址 //ERP-Jave接口地址
let erpJavaApiUrl = "http://192.168.2.215:9000/"; let erpJavaApiUrl = "http://192.168.2.215:9000/";
let urlSignalrUrl = "http://192.168.2.65:7838/signalr"; let urlSignalrUrl = "http://192.168.2.65:7838/signalr";
...@@ -10,13 +12,15 @@ function getApiUrl() { ...@@ -10,13 +12,15 @@ function getApiUrl() {
let erpViittoFileUrl = "http://192.168.5.46:8130" let erpViittoFileUrl = "http://192.168.5.46:8130"
if (locationName.indexOf('oytour') !== -1) { if (locationName.indexOf('oytour') !== -1) {
erpApiUrl = "https://reborn.oytour.com/api/common/post"; erpApiUrl = "https://reborn.oytour.com/api/common/post";
erpApiUrlTakVer = "http://htapi.oytour.com/api/common/post";//外卖版本
erpJavaApiUrl = "https://efficient.oytour.com/" erpJavaApiUrl = "https://efficient.oytour.com/"
urlSignalrUrl = "http://hpye.oytour.com/signalr"; urlSignalrUrl = "http://hpye.oytour.com/signalr";
erpUploadUrl = "http://upload.oytour.com"; erpUploadUrl = "http://upload.oytour.com";
erpViittoFileUrl = "http://imgfile.oytour.com" erpViittoFileUrl = "http://imgfile.oytour.com"
} }
let url = { let url = {
urlPost: erpApiUrl, urlPost: localStorage.TakeoutVersion==0?erpApiUrl:erpApiUrlTakVer,
urlJava: erpJavaApiUrl, urlJava: erpJavaApiUrl,
urlSignalr: urlSignalrUrl, urlSignalr: urlSignalrUrl,
UploadUrl: erpUploadUrl, UploadUrl: erpUploadUrl,
...@@ -140,16 +144,49 @@ function getJavaA(msg, tk) { ...@@ -140,16 +144,49 @@ function getJavaA(msg, tk) {
function query(url) { function query(url) {
url = location.href url = location.href
let str = url.substr(url.indexOf('?') + 1) let str = url.substr(url.indexOf('?') + 1)
const arr = str.split('&') let arr = str.split('&')
let json = {} let json = {}
for (let i = 0; i < arr.length; i++) { json = parseUrlParams(url)
let item = arr[i].split('=') // for (let i = 0; i < arr.length; i++) {
json[item[0]] = item[1] // let item = arr[i].split('=')
} // json[item[0]] = item[1]
// }
return json return json
} }
function parseUrlParams(url) {
const params = {};
// 提取查询字符串(问号后的部分)
const queryString = url.split('?')[1] || '';
// 分割键值对(按 & 分割)
const keyValuePairs = queryString.split('&');
for (const pair of keyValuePairs) {
if (!pair) continue; // 跳过空字符串(如 ?&a=b 的情况)
// 分割键和值(按第一个 = 分割,处理值中含 = 的情况)
const eqIndex = pair.indexOf('=');
const key = eqIndex === -1 ? pair : pair.slice(0, eqIndex);
const value = eqIndex === -1 ? '' : pair.slice(eqIndex + 1);
// 解码 URL 编码(处理 %20、中文等)
const decodedKey = key //decodeURIComponent(key.replace(/\+/g, ' ')); // 替换 + 为空格(兼容表单提交)
const decodedValue = value //decodeURIComponent(value.replace(/\+/g, ' '));
// 处理重复键(可选:若键已存在,转为数组存储)
if (params.hasOwnProperty(decodedKey)) {
if (!Array.isArray(params[decodedKey])) {
params[decodedKey] = [params[decodedKey]]; // 初始转为数组
}
params[decodedKey].push(decodedValue);
} else {
params[decodedKey] = decodedValue;
}
}
return params;
}
function random_string(len) { function random_string(len) {
len = len || 32; len = len || 32;
var chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'; var chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment