duanshenglang 7 kuukautta sitten
vanhempi
commit
53ee31bf1f
1 muutettua tiedostoa jossa 22 lisäystä ja 17 poistoa
  1. 22 17
      lottery/index.html

+ 22 - 17
lottery/index.html

@@ -715,7 +715,6 @@
 	}
 	.img_list {
 		width: 100%;
-		display: flex;
 		overflow-x: auto;
 		padding: 0 35rem;
 	}
@@ -757,9 +756,10 @@
 					<img class="close-text" id="closeText" src="./img/close-text.png" mode="widthFix" />
 					<textarea class="textarea_style" id="textarea"></textarea>
 					<div class="img_list">
-						<div id="imageGallery" class="imageGallery"></div>
-						<img class="photo-btn" id="photoBtn" src="./img/photo-btn.png" mode="widthFix" onclick="uploadImage()" />
-						<input type="file" id="uploadfile" style="display: none;" multiple accept='image/*'>
+						<div id="imageGallery" class="imageGallery">
+							<img class="photo-btn" id="photoBtn" src="./img/photo-btn.png" mode="widthFix" onclick="uploadImage()" />
+							<input type="file" id="uploadfile" style="display: none;" multiple accept='image/*'>
+						</div>
 					</div>
 				</div>
 				<button class="send_text" onclick="handleSendText()">发送</button>
@@ -882,6 +882,15 @@
 		</div>
 	</div>
 	<script>
+		let h5Type = 20
+		let mpClientId = ''
+		let credentials = {
+			bucket: '',
+			Authorization: '',
+			secretId: '',
+			serverDomain: ''
+		}
+		let imgList = []
 		function uploadImage() {
 		    let uploaInput = document.getElementById('uploadfile');
 			document.getElementById('uploadfile').click();
@@ -912,11 +921,14 @@
 		    			success:function(res){
 		    				imgList.push(res.data.url)
 							const gallery = document.getElementById('imageGallery');  
-							imgList.forEach( item=> { // 假设data是一个包含图片URL的数组  
+							const photoBtn = document.getElementById('photoBtn');  
+							// imgList.forEach( item=> { // 假设data是一个包含图片URL的数组  
 								const img = document.createElement('img');  
-								img.src = item; // 假设每个图片对象都有一个url属性
-								gallery.appendChild(img); // 将图片添加到div中  
-							}); 
+								img.src = res.data.url; // 假设每个图片对象都有一个url属性
+								// gallery.appendChild(img); // 将图片添加到div中
+								gallery.insertBefore(img,photoBtn);
+							// }); 
+							console.log('sdd', imgList);
 		    			},
 		    			error:function(error){
 		    				//异常处理;
@@ -926,15 +938,6 @@
 		    	}
 		    }
 		}
-		let h5Type = 20
-		let mpClientId = ''
-		let credentials = {
-			bucket: '',
-			Authorization: '',
-			secretId: '',
-			serverDomain: ''
-		}
-		let imgList = []
 		window.onload = function() {
 			if (getQueryParam('openId')) {
 				if(!getQueryParam('externalUserid')) {
@@ -1059,6 +1062,7 @@
 					if (res.code == 1) {
 						mui.toast('发送成功');
 						document.getElementById('dialogText').style.display = 'none';
+						imgList = []
 					} else {
 						mui.toast(res.msg);
 					}
@@ -1119,6 +1123,7 @@
 		});
 		document.getElementById('closeText').addEventListener('click', function() {
 			document.getElementById('dialogText').style.display = 'none';
+			imgList = []
 		});
 		// 截取url中的数据
 		function getQueryParam(paramName) {