Commit 1402c8c2 authored by zhengke's avatar zhengke

no message

parent 1723e1be
......@@ -28,6 +28,7 @@
</div>
</div>
<div class="FillincommentsMarkB" id="app">
</div>
<div class="submitBForm">
<button onclick="saveGuestSurvey()" class="submitB" id="submitB">确认</button>
......@@ -45,6 +46,7 @@
var priceInfo = null
var dataList = null
var GuestSurveyInfo = null
var importData = []
var texts = [
'非常不满意',
......@@ -60,7 +62,75 @@
getRadio()
getCheckbox()
GetBusSurveyInfo()
// uploadFile()
function delImg(i){
importData.splice(i,1)
RenewalImg()
}
function RenewalImg() {
var str = '<div class="FillincommentsImgF">'
var center = ''
var end = `<div class="FillincommentsAdd" onclick="uploadFile">
<input type="file" multiple style="opacity:0" id="upload"/>
</div>
</div>`
var textHtml = ''
importData.forEach((item,index)=>{
center+=`<div class="FillincommentsImg" id="Img_${index+1}">
<img src="${item.Url}" />
<span class="delimg" onclick="delImg(${index})"></span>
</div>`
})
textHtml = str+center+end
$(`#FillincommentsImgF`).html(textHtml)
}
function uploadFile(){
// 获取文件输入元素
const fileInput = document.getElementById('upload');
// fileInput.click()
// 监听文件输入的变化
fileInput.addEventListener('change', function(e) {
for(let i=0;i<e.target.files.length;i++){
const file = e.target.files[i]; // 获取文件对象
const formData = new FormData(); // 创建FormData对象
formData.append('file', file); // 将文件添加到FormData对象中
// 1 文档 2 数据 3 图片
let typeArr = [{
stringArr: 'GIF|JPG|JPEG|PNG|BMP',
type: 3
},
{
stringArr: 'DOCX|DOC|XLSX|XLS|PPT|PPTX|PDF',
type: 1
},
]
let ft = file.name.substring(file.name.lastIndexOf('.') + 1, file.name.length).toUpperCase();
let fileTypeNumber = 2;
let typeOk = false;
typeArr.forEach(x => {
if (x.stringArr.indexOf(ft) != '-1') {
fileTypeNumber = x.type;
typeOk = true;
}
})
var path = '/Upload/car/'
let newArr = [];
newArr.push(file)
UploadSelfFile(path, newArr, x => {
importData.push({
Content: x.FilePath,
ID: 0,
Type: fileTypeNumber,
Url: getApiUrl().ViittoFileUrl + x.FilePath,
})
RenewalImg()
}, 1);
}
});
}
function clickRadio(i) {
const Radiobox = document.getElementById(`my_Radio${i}`);
Radiobox.click()
......@@ -281,7 +351,14 @@
}
function renderStar() {
var fileHtml = `<h4 class="uploadProof">上传凭证</h4>
<div class="FillincommentsImgF" id="FillincommentsImgF">
<div class="FillincommentsAdd">
<input type="file" multiple style="opacity:0" id="upload" onclick="uploadFile()"/>
</div>
</div>`
var list = []
dataList.forEach((item, i) => {
var str = ''
var mark = ''
......@@ -351,6 +428,9 @@
</div>`
}
var textHtml = str + mark + singleChoice + MultipleChoice + inputText + end
if(i==(dataList.length-1)){
textHtml+=fileHtml
}
element.innerHTML = textHtml
list.push(element)
})
......@@ -566,6 +646,56 @@
.headerTitle {
text-align: center;
}
.uploadProof{
margin-top: 20px;
}
.FillincommentsImgF{
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-top: 20px;
}
.FillincommentsImg{
flex: 0 0 76px;
height: 76px;
border: 1px solid #eee;
margin-right: 8px;
position: relative;
margin-bottom: 20px;
border-radius: 5px;
}
.FillincommentsImg img{
width: 100%;
height: 100%;
display: block;
border-radius: 5px;
}
.delimg{
width: 22px;
height: 22px;
border-radius: 50%;
position: absolute;
right: -8px;
top: -12px;
background: url('../../images/del.png')no-repeat;
background-size: 22px 22px;
z-index: 2;
}
.FillincommentsAdd{
width: 80px;
height: 80px;
overflow: hidden;
border: 1px solid #eee;
margin-right: 10px;
background: url('../../images/addImg.png')no-repeat center;
background-size: 20px 20px;
margin-bottom: 10px;
border-radius: 5px;
}
.FillincommentsAdd input{
width: 100%;
height: 100%;
}
</style>
</html>
......@@ -2,13 +2,15 @@ let locationName = window.location.hostname;
function getApiUrl() {
let url = {
urlPost: "https://reborn.oytour.com/api/common/post",
urlPost: "http://192.168.5.46/api/common/post",//https://reborn.oytour.com/api/common/post
// urlPost: locationName.indexOf('oytour') !== -1 ? "https://reborn.oytour.com/api/common/post" : "http://192.168.2.65:8025/api/common/post",
//urlJava: locationName.indexOf('oytour') !== -1 ? "https://efficient.oytour.com/" : "http://192.168.2.215:9000/"
urlJava: "https://efficient.oytour.com/",
// urlSignalr: "http://newyear.oytour.com/signalr",
// urlSignalr: 'http://192.168.2.65:7838/signalr'
urlSignalr: "http://hpye.oytour.com/signalr"
urlSignalr: "http://hpye.oytour.com/signalr",
UploadUrl: "http://192.168.5.46:8120",//"http://upload.oytour.com"
ViittoFileUrl: 'http://192.168.5.46:8130',//"http://imgfile.oytour.com"
}
return url
}
......@@ -136,4 +138,44 @@ function query (url) {
}
return json
}
\ No newline at end of file
}
function random_string (len) {
len = len || 32;
var chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
var maxPos = chars.length;
var pwd = '';
for (let i = 0; i < len; i++) {
pwd += chars.charAt(Math.floor(Math.random() * maxPos));
}
return pwd;
}
function UploadSelfFile (path, files, successCall, ocr) {
if (files && files.length > 0) {
let nameList = new Array()
for (let index = 0; index < files.length; index++) {
nameList.push(this.random_string());
}
let that = this;
for (let index = 0; index < files.length; index++) {
let fileName = nameList[index]
fileName = path + fileName + "." + files[index].name.split('.').pop()
var formData = new FormData();
var uploadUrl = getApiUrl().UploadUrl + "/Upload/Index?filePath=" + path + '&ocr=' + ocr;
formData.append("myfile", files[index]);
$.ajax({
type: "POST",
url: `${uploadUrl}`,
contentType: false,
data: formData,
processData: false,
async: false,
success: function(res) {
successCall(JSON.parse(res))
},
error: function(message) {
alert('上传失败')
}
});
}
}
}
\ No newline at end of file
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