Browse Source

我的投递码

lilei 4 năm trước cách đây
mục cha
commit
4bfe6d2a79
5 tập tin đã thay đổi với 60 bổ sung10 xóa
  1. 1 1
      App.vue
  2. 13 0
      package-lock.json
  3. 2 1
      package.json
  4. 3 3
      pages/index/index.vue
  5. 41 5
      pages/userCenter/myCode/myCode.vue

+ 1 - 1
App.vue

@@ -1,6 +1,6 @@
 <script>
 	// const uat_URL = 'https://carwash.test.zyucgj.com/gc-shop/' // 预发布
-	const uat_URL = 'http://192.168.16.103:8302/gc-shop/' // 本地
+	const uat_URL = 'http://192.168.16.102:8302/gc-shop/' // 本地
 	const pro_URL = 'https://carwash.zyucgj.com/gc-shop/'  // 生产
 	const buildType = 0 // 打包环境对应类型,1 生产 0 预发布
 	const buildURL = buildType ? pro_URL : uat_URL // 打包后实际对应的url

+ 13 - 0
package-lock.json

@@ -4,6 +4,11 @@
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
+    "extend": {
+      "version": "3.0.2",
+      "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
+      "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="
+    },
     "moment": {
       "version": "2.29.1",
       "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
@@ -13,6 +18,14 @@
       "version": "1.7.8",
       "resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-1.7.8.tgz",
       "integrity": "sha512-9mc3FbpvN7knmmdBmlGv9eF6us16co/bvTPrFEsS8QrSo9AZyrFyET9KHIdESwURP79jv1SLtR01VEb3HGSN8A=="
+    },
+    "weapp-qrcode": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/weapp-qrcode/-/weapp-qrcode-1.0.0.tgz",
+      "integrity": "sha512-4sa3W0rGDVJ9QaeZpAKlAuUxVyjhDwiUqHyGK/jJMsRMXnhb4yO8qWU/pZruMo+iT5J6CraS67lDMFb1VY+RaA==",
+      "requires": {
+        "extend": "^3.0.2"
+      }
     }
   }
 }

+ 2 - 1
package.json

@@ -15,6 +15,7 @@
   "license": "ISC",
   "dependencies": {
     "moment": "^2.29.1",
-    "uview-ui": "^1.7.7"
+    "uview-ui": "^1.7.7",
+    "weapp-qrcode": "^1.0.0"
   }
 }

+ 3 - 3
pages/index/index.vue

@@ -259,9 +259,9 @@
 						}
 						// 小程序码,用户核销
 						if(e.scanType == 'WX_CODE'){
-							// uni.navigateTo({
-							// 	url: '/pages/checkOut/checkOut'
-							// })
+							uni.navigateTo({
+								url: '/pages/checkOut/checkOut'
+							})
 						}
 					},
 					fail(err) {

+ 41 - 5
pages/userCenter/myCode/myCode.vue

@@ -1,22 +1,58 @@
 <template>
-	<view>
-		asdf
+	<view class="codes">
+		<view class="canvasbox">
+			<canvas style="width: 200px;height: 200px;" canvas-id="myQrcode"></canvas>
+		</view>
+		<view class="text">
+			请将二维码对准设备摄像头
+		</view>
 	</view>
 </template>
 
 <script>
+	import drawQrcode from 'weapp-qrcode'
 	export default {
 		data() {
 			return {
-				
+				qrcode: null
 			}
 		},
+		onLoad() {
+			this.creatQrCode()
+		},
 		methods: {
-			
+			creatQrCode() {
+			  let userData = this.$store.state.vuex_userData
+			  console.log(userData)
+			  drawQrcode({
+			    width: 200,
+			    height: 200,
+			    canvasId: 'myQrcode',
+			    text: `userId=${userData.customNo}&type=user`
+			  })
+			}
 		}
 	}
 </script>
 
 <style>
-
+.codes{
+	width: 100%;
+	padding: 50rpx;
+}
+.canvasbox{
+	box-shadow: 3upx 3upx 6upx #eee;
+	background: #FFFFFF;
+	height: 230px;
+	width: 230px;
+	display: flex;
+	justify-content: center;
+	align-items: center;
+	margin: 50rpx auto;
+}
+.text{
+	text-align: center;
+	padding: 20rpx;
+	color: #999999;
+}
 </style>