Bladeren bron

增员二维码无法分享问题

@dongkboy 1 jaar geleden
bovenliggende
commit
6d8836186e
4 gewijzigde bestanden met toevoegingen van 151 en 22 verwijderingen
  1. 1 1
      config/baseUrl.js
  2. 7 3
      manifest.json
  3. 125 18
      pages/tools/addStaff/addStaff.vue
  4. 18 0
      pages/wallet/transactionDetails.vue

+ 1 - 1
config/baseUrl.js

@@ -4,7 +4,7 @@ let socketUrl = "";
 if (process.env.NODE_ENV === 'development') {
 	// 开发环境
 	// baseUrl = "https://test.baoxianzhanggui.com/dx/"; //屈晨
-	// baseUrl = "http://192.168.0.55:8080"; //董鑫
+	// baseUrl = "http://192.168.0.115:8080"; //董鑫
 	// baseUrl = "http://192.168.0.253:8080"; //田智
 	// baseUrl = "https://test.baoxianzhanggui.com/web-api"; //测试
 	// h5BaseUrl = "https://test.baoxianzhanggui.com/h5";

+ 7 - 3
manifest.json

@@ -7,8 +7,8 @@
 		"sizes": "分辨率,192x192",
 		"src": "图片路径"
 	}],
-	"versionName": "3.0.9",
-	"versionCode": 309,
+	"versionName": "3.1.2",
+	"versionCode": 312,
 	"app-plus": {
 		"error": {
 			"url": "hybrid/html/error.html"
@@ -186,7 +186,11 @@
 		},
 		"usingComponents": true,
 		"appid": "wxe57ddfbe230bcfba",
-		"permission": {}
+		"permission": {
+			"photos": {
+				"desc": "你的应用程序需要保存图片到相册"
+			}
+		}
 	},
 	"h5": {
 		"template": "template.h5.html",

+ 125 - 18
pages/tools/addStaff/addStaff.vue

@@ -17,11 +17,11 @@
 						inactive-color="#81869B" bar-width="80"></u-tabs>
 				</view>
 				<view class="dis a-c j-c f-c " v-if="current==0">
-					<view class="" style="position: relative;margin: 40px 0;">
-						<image :src="recommendImg" mode="widthFix" lazy-load style="width: 110px;height: 110px;">
-						</image>
-						<image src="../../../static/image/addStaff/zgcx.png" mode=""
-							style="width: 26px;height: 26px;position: absolute;top: 50%;left: 50%; transform: translate(-50%, -50%);">
+					<view class="" id="panelcanvas" style="margin: 40px 0;position: relative;">
+						<image :src="recommendImg" mode="widthFix" lazy-load style="width: 110px;height: 110px; ">
+							<image :src="logoImg" mode=""
+								style="width: 26px;height: 26px;position: absolute;top: 0;left: 0;right: 0;bottom: 0; margin: auto;">
+							</image>
 						</image>
 					</view>
 					<view class="shareMethod dis a-c j-s ">
@@ -49,9 +49,9 @@
 					<view class="qodeurl dis j-c a-c">
 						<text>{{Downloadurl}}</text>
 					</view>
-					<!-- 	<view class="btn mt-4" @click="downloadUrl(Downloadurl)">
+					<view class="btn mt-4" @click="downloadUrl(Downloadurl)">
 						<text>复制链接</text>
-					</view> -->
+					</view>
 					<view class="tioop dis a-c j-c">
 						<text>下载APP,请点击复制链接后发送给好友,然后使用浏览器访问。</text>
 					</view>
@@ -65,12 +65,13 @@
 						inactive-color="#81869B" bar-width="80"></u-tabs>
 				</view>
 				<view class="dis a-c j-c f-c " v-if="current1==0">
-					<view class="" style="position: relative;margin: 40px 0;">
+					<view class="" id="panelcanvas" style="margin: 40px 0;position: relative;">
 						<image :src="orderissuerImg" mode="widthFix" lazy-load style="width: 110px;height: 110px;">
+							<image :src="logoImg" mode=""
+								style="width: 26px;height: 26px;position: absolute;top: 0;left: 0;right: 0;bottom: 0; margin: auto;">
+							</image>
 						</image>
-						<image src="../../../static/image/addStaff/zgcx.png" mode=""
-							style="width: 26px;height: 26px;position: absolute;top: 50%;left: 50%; transform: translate(-50%, -50%);">
-						</image>
+
 					</view>
 					<view class="shareMethod dis a-c j-s ">
 						<view class="dis f-c a-c" @click="save">
@@ -142,6 +143,9 @@
 	export default {
 		data() {
 			return {
+				loading: true,
+				logoImg: "", //二维码logo
+				posterUrl: "", //页面截图
 				Downloadurl: "", //app下载链接
 				recommendImg: "",
 				recommendUrl: "", //注册链接
@@ -181,6 +185,17 @@
 			this.codeDownload();
 			this.orderissuer();
 			this.$http.get('/sysMenuRecord/add?type=1&menuType=4')
+			uni.getImageInfo({
+				src: '../../../static/image/addStaff/zgcx.png',
+				success: image => {
+					pathToBase64(image.path)
+						.then(base64 => {
+							this.logoImg = base64;
+						})
+						.catch(error => {});
+				},
+				fail: err => {}
+			});
 			// #ifdef APP
 			if (window.plus) {
 				plusReady();
@@ -192,12 +207,8 @@
 			...mapState(['userInfo', 'sources']),
 		},
 		methods: {
-			//保存图片
 			save() {
-				let url = this.sources == '1' ? this.recommendImg : this.orderissuerImg;
-				let base64Data = url.replace("data:image/gif;base64,", "");
-				let pdfBase64 = `data:image/png;base64,${base64Data}`;
-				base64ToPath(pdfBase64)
+				base64ToPath(this.posterUrl)
 					.then(path => {
 						uni.saveImageToPhotosAlbum({ //保存图片到系统相册。
 							filePath: path, //图片文件路径
@@ -216,6 +227,45 @@
 						});
 					})
 			},
+			//保存图片
+			// save() {
+			// 	let url = this.sources == '1' ? this.recommendImg : this.orderissuerImg;
+			// 	let base64Data = url.replace("data:image/gif;base64,", "");
+			// 	let base64 = `data:image/png;base64,${base64Data}`;
+			// 	console.log(base64);
+			// 	const bitmap = new plus.nativeObj.Bitmap("test");
+			// 	bitmap.loadBase64Data(base64, function() {
+			// 		const url = "_doc/" + new Date().getTime() + ".png"; // url为时间戳命名方式
+			// 		console.log('saveHeadImgFile', url)
+			// 		bitmap.save(url, {
+			// 			overwrite: true, // 是否覆盖
+			// 			// quality: 'quality'  // 图片清晰度
+			// 		}, (i) => {
+			// 			uni.saveImageToPhotosAlbum({
+			// 				filePath: url,
+			// 				success: function() {
+			// 					uni.showToast({
+			// 						title: '图片保存成功',
+			// 						icon: 'none'
+			// 					})
+			// 					bitmap.clear()
+			// 				}
+			// 			});
+			// 		}, (e) => {
+			// 			uni.showToast({
+			// 				title: '图片保存失败',
+			// 				icon: 'none'
+			// 			})
+			// 			bitmap.clear()
+			// 		});
+			// 	}, (e) => {
+			// 		uni.showToast({
+			// 			title: '图片保存失败',
+			// 			icon: 'none'
+			// 		})
+			// 		bitmap.clear()
+			// 	});
+			// },
 			downloadUrl(value) {
 				uni.setClipboardData({
 					data: value, //要被复制的内容
@@ -268,7 +318,7 @@
 			recommendCode() {
 				let id = this.userInfo.sysUser.id;
 				this.recommendImg = QR.createQrCodeImg(this.$base.h5BaseUrl + "/#/pages/register/register?id=" + id, {
-					size: parseInt(200) //二维码大小  
+					size: parseInt(300) //二维码大小  
 				})
 				this.recommendUrl = this.$base.h5BaseUrl + "/#/pages/register/register?id=" + id;
 				// this.recommendUrl = "http://192.168.0.20/h5/#/pages/register/register?id=" + id;
@@ -297,7 +347,7 @@
 			orderissuer() {
 				let id = this.userInfo.sysUser.id;
 				this.orderissuerImg = QR.createQrCodeImg(this.$base.h5BaseUrl + "/#/pages/register/orderissuer?id=" + id, {
-					size: parseInt(200) //二维码大小  
+					size: parseInt(300) //二维码大小  
 				})
 				this.orderissuerUrl = this.$base.h5BaseUrl + "/#/pages/register/orderissuer?id=" + id;
 				// this.orderissuerUrl = "http://192.168.0.20/h5/#/pages/register/orderissuer?id=" + id;
@@ -319,10 +369,67 @@
 					url: '/pages/tools/addStaff/employeeAdditionCount',
 				}, "navigateTo", true);
 			},
+			//页面截图转路径
+			receiveRenderData(val) {
+				this.posterUrl = val.replace(/[\r\n]/g, ''); // 去除base64位中的空格
+				// 将base64转化为临时地址
+				// base64ToPath(imageStr).then(path => {
+				// 	this.payImg = path;
+				// }).catch(error => {
+				// 	console.log(error);
+				// });
+			},
+			showLoading() {
+				uni.showLoading({
+					title: '正在生成图片'
+				});
+			},
+			hideLoading() {
+				uni.hideLoading();
+				this.loading = false;
+			},
 		}
 	}
 </script>
+<script module="canvasImage" lang="renderjs">
+	import html2canvas from 'html2canvas'
+	export default {
+		data() {
+			return {
 
+			}
+		},
+		mounted() {
+			setTimeout(() => {
+				this.canvasImage.generateImage()
+			}, 1000);
+		},
+		methods: {
+			generateImage() {
+				setTimeout(() => {
+					this.$ownerInstance.callMethod('showLoading')
+					const dom = document.getElementById('panelcanvas') // 需要生成图片内容的 dom 节点
+					html2canvas(dom, {
+						width: dom.clientWidth, //dom 原始宽度
+						height: dom.clientHeight,
+						scrollY: 0, // html2canvas默认绘制视图内的页面,需要把scrollY,scrollX设置为0
+						scrollX: 0,
+						useCORS: true, //支持跨域
+						// allowTaint: false,
+						scale: 2, // 设置生成图片的像素比例,默认是1,如果生成的图片模糊的话可以开启该配置项
+					}).then((canvas) => {
+						// 生成成功
+						this.$ownerInstance.callMethod('hideLoading')
+						this.$ownerInstance.callMethod('receiveRenderData', canvas.toDataURL('image/png'))
+					}).catch(err => {
+						// 生成失败 弹出提示弹窗
+						this.$ownerInstance.callMethod('_errAlert', `【生成图片失败,请重试】${err}`)
+					})
+				}, 300)
+			}
+		},
+	}
+</script>
 <style lang="scss" scoped>
 	/deep/ {
 		.u-tab-bar {

+ 18 - 0
pages/wallet/transactionDetails.vue

@@ -134,6 +134,7 @@
 					</view>
 				</view>
 			</view>
+			<u-loadmore v-if="dataList.length!=0" :status="status" />
 		</view>
 		<!-- 回到顶部 -->
 		<u-picker v-model="startShow" mode="time" :params="params" @confirm="startconfirm"></u-picker>
@@ -148,6 +149,8 @@
 	export default {
 		data() {
 			return {
+				status: 'loadmore',
+				totalPages: 0, //订单总页数
 				params: {
 					year: true, //年
 					month: true, //月
@@ -226,6 +229,20 @@
 			...mapState(['userInfo'])
 		},
 		onShow() {},
+		onReachBottom() {
+			if (this.pageRequest.pageNum >= this.totalPages) return;
+			this.status = 'loading';
+			this.pageRequest.pageNum = ++this.pageRequest.pageNum;
+			setTimeout(async () => {
+				let res = await this.$http.post('/sysUserAccount/findMyIncomeAndExpensesByUserId', this
+					.pageRequest);
+				if (res.code == '200') {
+					this.dataList = [...this.dataList, ...res.data.data.content];
+				}
+				if (this.pageRequest.pageNum >= this.totalPages) this.status = 'nomore';
+				else this.status = 'loading';
+			}, 1000)
+		},
 		onLoad() {
 			this.pageRequest.userId = this.userInfo.sysUser.id;
 			this.getDictionary('businessSegmentsSZType'); //业务板块
@@ -325,6 +342,7 @@
 				let res = await this.$http.post('/sysUserAccount/findMyIncomeAndExpensesByUserId', this.pageRequest);
 				if (res.code == '200') {
 					this.dataList = res.data.data.content;
+					this.totalPages = res.data.data.totalPages;
 					this.sumAmountSR = res.data.sumAmountSR;
 					this.sumAmountZC = res.data.sumAmountZC;
 					this.feeView = res.data.feeView;