Quellcode durchsuchen

去除保存幸运数字、新增扫码兑奖

hwb0 vor 3 Jahren
Ursprung
Commit
1a6d328424
2 geänderte Dateien mit 22 neuen und 87 gelöschten Zeilen
  1. 1 1
      pages/about/index.vue
  2. 21 86
      pages/lucky/index.vue

+ 1 - 1
pages/about/index.vue

@@ -4,7 +4,7 @@
 		<view class="about">
 			<view class="flex about-logo">
 				<image src="../../static/logo.png" mode=""></image>
-				<view class="edition">v 1.0.10</view>
+				<view class="edition">v 1.0.12</view>
 			</view>
 			<view class="about-action">
 				<u-cell-group :border="false">

+ 21 - 86
pages/lucky/index.vue

@@ -62,7 +62,7 @@
 					</view>
 					<view class="flex luck-info-btn">
 						<view class="btn" @click="pay" v-if="info.status == 1">支付{{ info.salePrice / 100 }}元 立即查看</view>
-						<view class="btn" @click="saveImg" v-else>保存至手机相册</view>
+						<view class="btn" @click="scanCode" v-else>扫码兑奖</view>
 					</view>
 					<view class="flex luck-info-num" v-if="info.status == 2">{{ info.plainLuckyNum }}</view>
 					<view class="flex luck-info-close">
@@ -124,17 +124,19 @@
 				picUrlArr: [],
 				boxInfo: {},
 				prizeList: [],
-				showAction: false
+				showAction: false,
 			};
 		},
 
 		onLoad(options) {
 			if (options.id) {
+				console.log(options.id);
 				this.serialNo = options.id
 			}
 
 			if (options.q) {
 				let url = JSON.stringify(options.q)
+				console.log(url);
 				this.serialNo = url.substring(url.length - 22, url.length - 1)
 			}
 		},
@@ -144,6 +146,22 @@
 			}
 		},
 		methods: {
+			scanCode() {
+				let _this = this
+				uni.scanCode({
+					scanType: ['qrCode'],
+					success(res) {
+						let url = res.result
+						_this.serialNo = url.substring(url.length - 21, url.length)
+						_this.getDetail()
+					},
+					fail(){
+						uni.$u.toast('请扫二维码');
+					}
+				});
+			},
+			
+			
 			getDetail() {
 				uni.showLoading({
 					title: '加载中'
@@ -158,6 +176,7 @@
 						if (res.data.status == 1) {
 							this.info = res.data
 						} else if (res.data.status == 2) {
+							this.info = res.data
 							if (uni.getStorageSync('token')) {
 								uni.redirectTo({
 									url: `/pages/choice/index?id=${ res.data.ticketId }`
@@ -212,48 +231,6 @@
 						if (res.data.status == 2) {
 							_this.info = res.data
 							let num = res.data.plainLuckyNum
-							_this.posterData = {
-								poster: {
-									//根据屏幕大小自动生成图片背景大小
-									url: env.filePublic + _this.info.picUrl, //图片地址
-									r: 10, //圆角半径
-									w: 300, //图片宽度
-									h: 480, //图片高度
-									p: 20 //图片内边距padding
-								},
-								square3: {
-									x: 100,
-									y: 100,
-									r: 0, //圆角半径
-									w: 240, //宽度
-									h: 180, //高度
-									mt: 65
-								},
-								title: {
-									text: "幸运数字", //文本
-									fontSize: 20, //字体大小
-									color: "#000", //颜色
-									lineHeight: 25, //行高
-									mt: 20, //margin-top
-									align: 'center'
-								},
-								num: {
-									text: num + '', //文本
-									fontSize: 40, //字体大小
-									color: "#fff", //颜色
-									lineHeight: 25, //行高
-									mt: 20, //margin-top
-									align: 'center'
-								},
-								txt: {
-									text: res.data.title, //文本
-									fontSize: 16, //字体大小
-									color: "#000", //颜色
-									lineHeight: 25, //行高
-									mt: 20, //margin-top
-									align: 'center'
-								},
-							}
 						} else {
 							let num = 0
 							let time = setInterval(() => {
@@ -270,48 +247,6 @@
 										clearInterval(time)
 										_this.info = res.data
 										let num = res.data.plainLuckyNum
-										_this.posterData = {
-											poster: {
-												//根据屏幕大小自动生成图片背景大小
-												url: env.filePublic + _this.info.picUrl, //图片地址
-												r: 10, //圆角半径
-												w: 300, //图片宽度
-												h: 480, //图片高度
-												p: 20 //图片内边距padding
-											},
-											square3: {
-												x: 100,
-												y: 100,
-												r: 0, //圆角半径
-												w: 240, //宽度
-												h: 180, //高度
-												mt: 65
-											},
-											title: {
-												text: "幸运数字", //文本
-												fontSize: 20, //字体大小
-												color: "#000", //颜色
-												lineHeight: 25, //行高
-												mt: 20, //margin-top
-												align: 'center'
-											},
-											num: {
-												text: num + '', //文本
-												fontSize: 40, //字体大小
-												color: "#fff", //颜色
-												lineHeight: 25, //行高
-												mt: 20, //margin-top
-												align: 'center'
-											},
-											txt: {
-												text: res.data.title, //文本
-												fontSize: 16, //字体大小
-												color: "#000", //颜色
-												lineHeight: 25, //行高
-												mt: 20, //margin-top
-												align: 'center'
-											},
-										}
 									}
 								})
 								if (num == 10) {