From 7dbe13c2f734f9d19200be3b8beaadda794edeaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=99=93=E7=90=AA?= Date: Tue, 30 Aug 2022 15:08:01 +0800 Subject: [PATCH] =?UTF-8?q?app2.0=20=E4=BC=9A=E8=AE=AE=E6=89=AB=E7=A0=81?= =?UTF-8?q?=E7=AD=BE=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LearunApp-2.2.0/common/js/scanCodeFun.js | 48 ++++++---- .../common/js/weixin-js-sdk.js | 1 + .../components/upload-file.vue | 95 ------------------- .../SYS_ReceiveMessage/list.vue | 2 +- .../SYS_ReceiveMessage/single.vue | 8 +- .../Sys_ReceiveFile/single.vue | 8 +- .../PersonnelManagement/MeetingMy/list.vue | 2 +- .../MeetingSignInScan/list.vue | 11 ++- 8 files changed, 48 insertions(+), 127 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/js/weixin-js-sdk.js diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/js/scanCodeFun.js b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/js/scanCodeFun.js index 509568d1b..e2a9127f1 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/js/scanCodeFun.js +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/js/scanCodeFun.js @@ -1,28 +1,38 @@ +import { conforms } from 'lodash'; +import wx from './weixin-js-sdk.js'; export default { scanCodeFun() { const promise = new Promise((resolve, reject) => { - // #ifdef APP-PLUS || MP-WEIXIN - uni.scanCode({ - success: function(res) { - // console.log(res) - // console.log('条码类型:' + res.scanType); - // console.log('条码内容:' + res.result); - resolve(res) - }, - fail: function(res) { + this.HTTP_GET("weixinapi/getweixinwebaccess_token?url=" + encodeURIComponent(window.location.href)).then((success)=>{ + if(!success){ resolve(false) + return } - }); - // #endif - - // #ifndef APP-PLUS || MP-WEIXIN - resolve(false) - uni.showToast({ - title: '请下载app或者到微信浏览器打开网页', - icon: 'none', - mask: false + wx.config({ + debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 + appId: success.appid, // 必填,公众号的唯一标识 + timestamp: success.timestamp, // 必填,生成签名的时间戳 + nonceStr: success.noncestr, // 必填,生成签名的随机串 + signature: success.certificate, // 必填,签名 + jsApiList: ["scanQRCode"] // 必填,需要使用的JS接口列表 + }); + wx.ready(() => { + wx.scanQRCode({ + needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果, + scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有 + success: function (res) { + var result = res.resultStr; // 当 needResult 为 1 时,扫码返回的结果 + var resultArr = result.split(','); // 扫描结果以逗号分割数组 + var codeContent = resultArr[resultArr.length - 1]; // 获取数组最后一个元素,也就是最终的内容 + resolve(result) + }, + fail: error => { + this.TOAST("调用扫码失败") + resolve(false) + } + }); + }) }) - // #endif }) return promise } diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/js/weixin-js-sdk.js b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/js/weixin-js-sdk.js new file mode 100644 index 000000000..1b5014bfc --- /dev/null +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/js/weixin-js-sdk.js @@ -0,0 +1 @@ +!function(e,n){"function"==typeof define&&(define.amd||define.cmd)?define(function(){return n(e)}):n(e,!0)}(window,function(o,e){if(!o.jWeixin){var n,c={config:"preVerifyJSAPI",onMenuShareTimeline:"menu:share:timeline",onMenuShareAppMessage:"menu:share:appmessage",onMenuShareQQ:"menu:share:qq",onMenuShareWeibo:"menu:share:weiboApp",onMenuShareQZone:"menu:share:QZone",previewImage:"imagePreview",getLocation:"geoLocation",openProductSpecificView:"openProductViewWithPid",addCard:"batchAddCard",openCard:"batchViewCard",chooseWXPay:"getBrandWCPayRequest",openEnterpriseRedPacket:"getRecevieBizHongBaoRequest",startSearchBeacons:"startMonitoringBeacons",stopSearchBeacons:"stopMonitoringBeacons",onSearchBeacons:"onBeaconsInRange",consumeAndShareCard:"consumedShareCard",openAddress:"editAddress"},a=function(){var e={};for(var n in c)e[c[n]]=n;return e}(),i=o.document,t=i.title,r=navigator.userAgent.toLowerCase(),s=navigator.platform.toLowerCase(),d=!(!s.match("mac")&&!s.match("win")),u=-1!=r.indexOf("wxdebugger"),l=-1!=r.indexOf("micromessenger"),p=-1!=r.indexOf("android"),f=-1!=r.indexOf("iphone")||-1!=r.indexOf("ipad"),m=(n=r.match(/micromessenger\/(\d+\.\d+\.\d+)/)||r.match(/micromessenger\/(\d+\.\d+)/))?n[1]:"",g={initStartTime:L(),initEndTime:0,preVerifyStartTime:0,preVerifyEndTime:0},h={version:1,appId:"",initTime:0,preVerifyTime:0,networkType:"",isPreVerifyOk:1,systemType:f?1:p?2:-1,clientVersion:m,url:encodeURIComponent(location.href)},v={},S={_completes:[]},y={state:0,data:{}};O(function(){g.initEndTime=L()});var I=!1,_=[],w={config:function(e){B("config",v=e);var t=!1!==v.check;O(function(){if(t)M(c.config,{verifyJsApiList:C(v.jsApiList),verifyOpenTagList:C(v.openTagList)},function(){S._complete=function(e){g.preVerifyEndTime=L(),y.state=1,y.data=e},S.success=function(e){h.isPreVerifyOk=0},S.fail=function(e){S._fail?S._fail(e):y.state=-1};var t=S._completes;return t.push(function(){!function(){if(!(d||u||v.debug||m<"6.0.2"||h.systemType<0)){var i=new Image;h.appId=v.appId,h.initTime=g.initEndTime-g.initStartTime,h.preVerifyTime=g.preVerifyEndTime-g.preVerifyStartTime,w.getNetworkType({isInnerInvoke:!0,success:function(e){h.networkType=e.networkType;var n="https://open.weixin.qq.com/sdk/report?v="+h.version+"&o="+h.isPreVerifyOk+"&s="+h.systemType+"&c="+h.clientVersion+"&a="+h.appId+"&n="+h.networkType+"&i="+h.initTime+"&p="+h.preVerifyTime+"&u="+h.url;i.src=n}})}}()}),S.complete=function(e){for(var n=0,i=t.length;n { - this.LOADING('正在上传…'); - this.HTTP_UPLOAD2('StuInfoFresh/upload', params.url, { - folderId: this.folderId - }).then((data) => { - this.HIDE_LOADING(); - if (data) { - // this.HTTP_GET('StuInfoFresh/upload', {fileId:data}) - this.imgList[params.index] = [{ - id: data.F_Id, - name: data.F_FileName, - url: data.F_FilePath, - type: data.F_FileType - }] - reslove(this.imgList[params.index]) - } else { - reject('上传失败!') - } - }) - }) - } - let array = this.imgList.map(item => { - if (item.id) { - return "" - } else { - return { - url: "learun/adms/annexes/upload" - } - } - }) - this.promiseAllLimit(2, [1, 2, 3, 4, 5, 6, 7, 8, 9], a).then(res => { - console.log(res) - }) - }, - - /** - * @description 控制promise.all并发数量 - * @param limit 并发数 - * @param array 参数列表 - * @param apiFn 执行函数 - * @returns {Promise[]>} - */ - async promiseAllLimit(limit, array, apiFn) { - const ret = [] // 用于存放所有的promise实例 - const executing = [] // 用于存放目前正在执行的promise - for (const item of array) { - const p = apiFn(item) - ret.push(p) - if (limit <= array.length) { - // then回调中,当这个promise状态变为fulfilled后,将其从正在执行的promise列表executing中删除 - const e = p.then(() => executing.splice(executing.indexOf(e), 1)) - executing.push(e) - if (executing.length >= limit) { - // 一旦正在执行的promise列表数量等于限制数,就使用Promise.race等待某一个promise状态发生变更, - // 状态变更后,就会执行上面then的回调,将该promise从executing中删除, - // 然后再进入到下一次for循环,生成新的promise进行补充 - await Promise.race(executing) - } - } - } - return Promise.all(ret) - }, - validate(array) { // let type = array.every(item=>{ // return item.type && item.type.substring(0,6) == "image/" @@ -233,33 +165,6 @@ }); } }, - - // previewFile() { - // var file = document.querySelector('input[type=file]').files[0]; - // var reader = new FileReader(); - // // fileReader.readAsDataURL(blob); - // // fileReader.onerror = () => { - // // reject(new Error('blobToBase64 error')); - // // }; - // // var encodedData = window.btoa("Hello, world"); - // reader.onloadend = function () { - // //$('#PhotoImg').attr('src', reader.result); - // var postData = { - // Base64Url: reader.result - // } - // this.HTTP_POST(config.webapi + "StuInfoFresh/savePhoto", postData, (data) => { - // if (data) { - // $('#Photo').val(data.AnnexesFileId); - // $('#PhotoImg').attr('src', config.web + data.Url); - // } else { - // learun.layer.toast('采集照片信息失败!'); - // } - // }); - // } - // if (file) { - // reader.readAsDataURL(file); - // } - // }, }, created() { console.log(this.value) diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/SYS_ReceiveMessage/list.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/SYS_ReceiveMessage/list.vue index 5a6592cd6..9149ade63 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/SYS_ReceiveMessage/list.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/SYS_ReceiveMessage/list.vue @@ -70,7 +70,7 @@ - + diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/SYS_ReceiveMessage/single.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/SYS_ReceiveMessage/single.vue index bcfd2aa52..a24dcdbe9 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/SYS_ReceiveMessage/single.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/SYS_ReceiveMessage/single.vue @@ -45,8 +45,8 @@ - - - + + --> diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/Sys_ReceiveFile/single.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/Sys_ReceiveFile/single.vue index d1642f563..adb8edb70 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/Sys_ReceiveFile/single.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/Sys_ReceiveFile/single.vue @@ -60,8 +60,8 @@ - - - + + --> diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/PersonnelManagement/MeetingMy/list.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/PersonnelManagement/MeetingMy/list.vue index 1a2b42a8f..1f5209251 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/PersonnelManagement/MeetingMy/list.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/PersonnelManagement/MeetingMy/list.vue @@ -1,4 +1,4 @@ -