Bladeren bron

08.25 修改

zhuohongkui 1 jaar geleden
bovenliggende
commit
f1ab6e4db7
3 gewijzigde bestanden met toevoegingen van 65 en 16 verwijderingen
  1. 6 1
      pages/deal/deal.vue
  2. 38 15
      pages/deal/productInfo.vue
  3. 21 0
      vite.config.js

+ 6 - 1
pages/deal/deal.vue

@@ -855,7 +855,12 @@ border-radius: 30rpx;
 		font-size: 20rpx;
 		font-size: 20rpx;
 		width: 100%;
 		width: 100%;
 		text-align: center;
 		text-align: center;
-		color: #999999;
+		
 		line-height: 30rpx;
 		line-height: 30rpx;
+		a{
+			color: #999999;
+			text-decoration: none;
+		}
+		
 	}
 	}
 </style>
 </style>

+ 38 - 15
pages/deal/productInfo.vue

@@ -333,6 +333,9 @@ getGoodsDetail({goods_id:id.value,rand_num:rand_num.value}).then(res=>{
 		isLoading.value=false
 		isLoading.value=false
 		item.value=res.data
 		item.value=res.data
 		// item.value.detail=getspan(item.value.detail)
 		// item.value.detail=getspan(item.value.detail)
+	    setTimeout(_=>{
+			createCanvas()
+		},100)
 	})
 	})
 	// getsimpleimages().then(res=>{
 	// getsimpleimages().then(res=>{
 	// 	let arr=res.data
 	// 	let arr=res.data
@@ -342,6 +345,7 @@ getGoodsDetail({goods_id:id.value,rand_num:rand_num.value}).then(res=>{
 	// 		}
 	// 		}
 	// 	})
 	// 	})
 	// })
 	// })
+
 })
 })
 	})
 	})
 	function getspan(str) {
 	function getspan(str) {
@@ -422,21 +426,23 @@ getGoodsDetail({goods_id:id.value,rand_num:rand_num.value}).then(res=>{
 		// 	url.value = canvas.toDataURL("image/png");
 		// 	url.value = canvas.toDataURL("image/png");
 		// 	show.value = true
 		// 	show.value = true
 		// });
 		// });
-		var swiper = document.getElementById('copyswiperItem'); // 获取dom元素
-		var dom = document.getElementById('content1'); // 获取dom元素
-		var dom1 = document.getElementById('copycontent'); // 获取dom元素
-		  dom1.innerHTML=dom.innerHTML
-		  let res = domTrans(dom1)
-		  // console.log(1223,res)
-		          let html = forFn(res)
-				  dom1.innerHTML=html
-		  html2canvas(swiper,{
-			   allowTaint: true,
-			  useCORS: true
-		  }).then((canvas) => {
-		    url.value = canvas.toDataURL("image/png").replace('image/png', 'image/octet-stream');
-			show.value=true
-		  });  
+		// var swiper = document.getElementById('copyswiperItem'); // 获取dom元素
+		// var dom = document.getElementById('content1'); // 获取dom元素
+		// var dom1 = document.getElementById('copycontent'); // 获取dom元素
+		//   dom1.innerHTML=dom.innerHTML
+		//   let res = domTrans(dom1)
+		//   // console.log(1223,res)
+		//           let html = forFn(res)
+		// 		  dom1.innerHTML=html
+		//   html2canvas(swiper,{
+		// 	   allowTaint: true,
+		// 	  useCORS: true
+		//   }).then((canvas) => {
+		//     url.value = canvas.toDataURL("image/png").replace('image/png', 'image/octet-stream');
+		// 	show.value=true
+		//   });  
+		url.value=canvasValue.value.toDataURL("image/png").replace('image/png', 'image/octet-stream');
+		show.value=true
 	}
 	}
 	let url = ref()
 	let url = ref()
 	let content = `
 	let content = `
@@ -602,6 +608,23 @@ getGoodsDetail({goods_id:id.value,rand_num:rand_num.value}).then(res=>{
                 }
                 }
  
  
             }
             }
+	let canvasValue=ref({})
+	function createCanvas() {
+		var swiper = document.getElementById("copyswiperItem"); // 获取dom元素
+		var dom = document.getElementById("content1"); // 获取dom元素
+		var dom1 = document.getElementById("copycontent"); // 获取dom元素
+		dom1.innerHTML = dom.innerHTML;
+		let res = domTrans(dom1);
+		let html = forFn(res);
+		dom1.innerHTML = html;
+		html2canvas(swiper, {
+			allowTaint: true,
+			useCORS: true,
+		}).then((canvas) => {
+			canvasValue.value=canvas
+		});
+	}
+
 </script>
 </script>
 
 
 
 

+ 21 - 0
vite.config.js

@@ -0,0 +1,21 @@
+import {
+	defineConfig
+} from "vite"
+import uni from "@dcloudio/vite-plugin-uni"; // 注意此处,特别重要
+
+export default defineConfig({
+	plugins: [
+		uni()
+	],
+	server: {
+		proxy: {
+			'/api': {
+				target: 'http://banma8188.com/',
+				changeOrigin: true,
+
+				// rewrite 这个,需要根据具体项目进行判断是否需要
+				rewrite: (path) => path.replace(/^\/api/, '')
+			},
+		}
+	}
+})