Commit 41c4aff3 authored by youjie's avatar youjie

意见调查

parent 8a1eb67c
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
var newMsg = {} var newMsg = {}
var priceInfo = null var priceInfo = null
var dataList = null var dataList = null
var dataListAll = null
var GuestSurveyInfo = null var GuestSurveyInfo = null
var userInfo = getLocalStorage() var userInfo = getLocalStorage()
...@@ -71,7 +72,6 @@ ...@@ -71,7 +72,6 @@
t: userInfo.t, t: userInfo.t,
g: userInfo.g, g: userInfo.g,
} }
}else{ }else{
qMsg = query() qMsg = query()
} }
...@@ -83,9 +83,10 @@ ...@@ -83,9 +83,10 @@
getCheckbox() getCheckbox()
GetBusSurveyInfo() GetBusSurveyInfo()
function clickRadio(i) { function clickRadio(i,index,ID) {
const Radiobox = document.getElementById(`my_Radio${i}`); const Radiobox = document.getElementById(`my_Radio${i}`);
Radiobox.click() Radiobox.click()
dataList[index].ScoreNum = ID
} }
function getRadio() { function getRadio() {
...@@ -96,15 +97,27 @@ ...@@ -96,15 +97,27 @@
radio.addEventListener('click', function() { radio.addEventListener('click', function() {
x.ScoreNum = radio.value x.ScoreNum = radio.value
}); });
if(x.SurveyType==2&&y.IsCheck=='1'&&radio.value==y.ID){
radio.click()
x.ScoreNum = radio.value
}
}); });
}) })
}) })
} }
function clickCheckbox(i) { function clickCheckbox(i,index,index2,ID) {
const checkbox = document.getElementById(`my_checkbox${i}`); const checkbox = document.getElementById(`my_checkbox${i}`);
checkbox.click() checkbox.click()
let findIndex = dataList[index].IsCheckS.findIndex(item=>item==ID)
if(findIndex==-1) {
dataList[index].IsCheckS.push(ID)
}else{
dataList[index].IsCheckS = dataList[index].IsCheckS.filter(item=>item!=ID)
}
} }
function getCheckbox() { function getCheckbox() {
...@@ -113,11 +126,14 @@ ...@@ -113,11 +126,14 @@
const checkbox = document.getElementsByName(`my_checkbox${i+1}`); const checkbox = document.getElementsByName(`my_checkbox${i+1}`);
checkbox.forEach(checkbox => { checkbox.forEach(checkbox => {
checkbox.addEventListener('click', function() { checkbox.addEventListener('click', function() {
if (checkbox.checked) y.IsCheckS.push(checkbox.value) if (checkbox.checked) x.IsCheckS.push(checkbox.value)
if (!checkbox.checked) y.IsCheckS = y.IsCheckS.filter(z => { if (!checkbox.checked) x.IsCheckS = y.IsCheckS.filter(z => {
return z != checkbox.value return z != checkbox.value
}) })
}); });
if(x.SurveyType==3&&y.IsCheck=='1'&&checkbox.value==y.ID){
checkbox.click()
}
}); });
}) })
}) })
...@@ -130,6 +146,9 @@ ...@@ -130,6 +146,9 @@
if (word && word.value) { if (word && word.value) {
x.TextContent = word.value x.TextContent = word.value
} }
if(x.TextContent){
word.value = x.TextContent
}
}) })
} }
...@@ -154,12 +173,15 @@ ...@@ -154,12 +173,15 @@
if (item.SurveyType == 2) { if (item.SurveyType == 2) {
if (item.ScoreNum == y.ID) { if (item.ScoreNum == y.ID) {
y.IsCheck = "1"; y.IsCheck = "1";
}else{
y.IsCheck = "0";
} }
} }
//多选 //多选
if (item.SurveyType == 3) { if (item.SurveyType == 3) {
y.IsCheck = "0"; y.IsCheck = "0";
if (y.IsCheckS) { let fildIndex = item.IsCheckS.findIndex(x=> x==y.ID)
if (fildIndex!=-1) {
y.IsCheck = "1"; y.IsCheck = "1";
} }
} }
...@@ -178,12 +200,13 @@ ...@@ -178,12 +200,13 @@
data: getAjaxData("survey_post_SetGuestSurvey", postMsg), data: getAjaxData("survey_post_SetGuestSurvey", postMsg),
async: false, async: false,
success: function(res) { success: function(res) {
$('#submitB').attr('disabled', false)
if (res.resultCode === 1) { if (res.resultCode === 1) {
return
window.location.href = 'success.html' window.location.href = 'success.html'
} else { } else {
layer.msg(res.message) layer.msg(res.message)
} }
$('#submitB').attr('disabled', false)
document.getElementById("submitB").classList.remove("active") document.getElementById("submitB").classList.remove("active")
}, },
error: function(message) { error: function(message) {
...@@ -243,21 +266,22 @@ ...@@ -243,21 +266,22 @@
let data = res.data let data = res.data
data.map(item => { data.map(item => {
if (item.SurveyType === 2) { if (item.SurveyType === 2) {
item.SurveyOptionsList.map((cItem, cIndex) => { item.IsCheckS = false
cItem.IsCheckS = false
})
} }
if (item.SurveyType === 3) { if (item.SurveyType === 3) {
item.SurveyOptionsList.map((cItem, cIndex) => { item.IsCheckS = []
cItem.IsCheckS = []
})
} }
if (item.SurveyType === 1) { if (item.SurveyType === 1) {
item.ScoreNum = 5; item.ScoreNum = 5;
} }
}) })
dataListAll = data
dataList = data dataList = data
if(localStorage.TakeoutVersion==1){
getSurveyDetails()
}else{
renderStar() renderStar()
}
} else { } else {
layer.msg(res.message) layer.msg(res.message)
} }
...@@ -299,6 +323,49 @@ ...@@ -299,6 +323,49 @@
}); });
} }
function getSurveyDetails() {
var msg = {
...newMsg,
type: userInfo.type,
guestMobile: userInfo.guestMobile,
TCID: '',
}
$.ajax({
type: "POST",
url: `${getApiUrl().urlPost}`,
contentType: "application/json",
data: getAjaxData("miniProgram_price_GetGuestByPhone_V2", msg),
async: false,
success: function(res) {
if (res.resultCode === 1) {
if(res.data&&res.data.length>0&&res.data[0].SurverList.length > 0){
let data = res.data[0].SurverList
data.map(item => {
if (item.SurveyType === 3) {
item.IsCheckS = []
}
})
dataList = data
for(let i=0;i<dataListAll.length;i++){
let findIndex = dataList.findIndex(item=>item.ID==dataListAll[i].ID)
if(findIndex==-1){
dataList.push(dataListAll[i])
}
}
renderStar()
getTextarea()
}else renderStar()
} else {
layer.msg(res.message)
}
},
error: function(message) {
alert(JSON.stringify(message));
}
});
}
function chgStar(num, i) { function chgStar(num, i) {
dataList[i].ScoreNum = num dataList[i].ScoreNum = num
var item = dataList[i] var item = dataList[i]
...@@ -353,7 +420,7 @@ ...@@ -353,7 +420,7 @@
let radioList = [] let radioList = []
if (item.SurveyOptionsList.length > 0) item.SurveyOptionsList.forEach((radio, index) => { if (item.SurveyOptionsList.length > 0) item.SurveyOptionsList.forEach((radio, index) => {
radioList.push( radioList.push(
`<div><input type="radio" value="${radio.ID}" name="my_Radio${i+1}" id="my_Radio${i+1}${index+1}"/><span onclick="clickRadio(${i+1}${index+1})">${radio.OptionsName}</span></div>` `<div><input type="radio" value="${radio.ID}" name="my_Radio${i+1}" id="my_Radio${i+1}${index+1}"/><span onclick="clickRadio(${i+1}${index+1},${i},${radio.ID})">${radio.OptionsName}</span></div>`
) )
}) })
if (radioList.length > 0) { if (radioList.length > 0) {
...@@ -368,7 +435,7 @@ ...@@ -368,7 +435,7 @@
let MultipleList = [] let MultipleList = []
if (item.SurveyOptionsList.length > 0) item.SurveyOptionsList.forEach((radio, index) => { if (item.SurveyOptionsList.length > 0) item.SurveyOptionsList.forEach((radio, index) => {
MultipleList.push( MultipleList.push(
`<div><input type="checkbox" value="${radio.ID}" name="my_checkbox${i+1}" id="my_checkbox${i+1}${index+1}"/><span onclick="clickCheckbox(${i+1}${index+1})">${radio.OptionsName}</span></div>` `<div><input type="checkbox" value="${radio.ID}" name="my_checkbox${i+1}" id="my_checkbox${i+1}${index+1}"/><span onclick="clickCheckbox(${i+1}${index+1},${i},${index},${radio.ID})">${radio.OptionsName}</span></div>`
) )
}) })
if (MultipleList.length > 0) { if (MultipleList.length > 0) {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<div class="login_contentBox"> <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 id="buttonSJ" onclick="changeLoginType(1)">手机号验证</button> <button id="buttonSJ" class="active" onclick="changeLoginType(1)">手机号验证</button>
<button id="buttonHZ" onclick="changeLoginType(2)">护照号验证</button> <button id="buttonHZ" onclick="changeLoginType(2)">护照号验证</button>
</div> </div>
</div> </div>
...@@ -153,6 +153,7 @@ ...@@ -153,6 +153,7 @@
t: query().t, t: query().t,
g: query().g, g: query().g,
guestMobile: msg.guestMobile, guestMobile: msg.guestMobile,
type: msg.type,
} }
localStorage.userInfo = JSON.stringify(datas) localStorage.userInfo = JSON.stringify(datas)
window.location.href = `guestSign.html` window.location.href = `guestSign.html`
......
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