Browse Source

扫描二维码 api

zhengkaixin 4 years ago
parent
commit
b9f52ab281
2 changed files with 23 additions and 0 deletions
  1. 5 0
      src/projects/business/views/Guest/To/Info.vue
  2. 18 0
      src/utils/wxJsApi.js

+ 5 - 0
src/projects/business/views/Guest/To/Info.vue

@@ -445,6 +445,11 @@
             _this.isLoading = true;
             API_To.update(_this.subForm).then(response => {
               _this.step='3'
+              _this.isLoading = false;
+              //生成二维码
+              _this.$nextTick(() => {
+                _this.qrcode();
+              });
               mui.toast("操作成功");
             }).catch(error => {
               _this.isLoading = false;

+ 18 - 0
src/utils/wxJsApi.js

@@ -90,3 +90,21 @@ export function getLocation() {
 	})
 	return promise;
 }
+
+//扫描二维码
+export function scanQRCode() {
+	let promise = new Promise((resolve, reject) => {
+		wx.scanQRCode({
+			needResult: 1,
+			scanType: ["qrCode"], 
+			success: function (res) {
+ 				var url = res.resultStr;
+				reject(url);
+			},faile: function(res) {
+				reject(res);
+			},
+			complete() {}
+		})
+	});
+	return promise;
+}