From 084393a1f81876fbd2fbbd9e417fa4ac6a81b77c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=99=93=E7=90=AA?= Date: Tue, 16 Aug 2022 16:57:07 +0800 Subject: [PATCH] =?UTF-8?q?app=20=E4=B8=80=E5=8D=A1=E9=80=9A=E6=B5=81?= =?UTF-8?q?=E6=B0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../learun-mpui/learun-ui-mp/upload.vue | 90 ++++++- .../LearunApp-2.2.0/config.js | 5 +- .../LearunApp-2.2.0/pages.json | 6 + .../pages/MealCardRunTab/list.vue | 239 ++++++++++++++++++ .../LearunApp-2.2.0/pages/home/more.vue | 2 +- .../LearunApp-2.2.0/pages/welcome/list.vue | 25 +- 6 files changed, 354 insertions(+), 13 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/MealCardRunTab/list.vue diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-mpui/learun-ui-mp/upload.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-mpui/learun-ui-mp/upload.vue index 590a06395..d5c17cdb0 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-mpui/learun-ui-mp/upload.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-mpui/learun-ui-mp/upload.vue @@ -2,14 +2,15 @@ + @@ -71,18 +72,66 @@ export default { let {tempFilePaths,tempFiles} = res if(!this.validate(tempFiles))return const newList = JSON.parse(JSON.stringify(this.imgList || [])).concat( - tempFilePaths + tempFilePaths.map(item=>{ + return{ + url:item, + id:'' + } + }) ); this.imgList = newList this.$emit("update:value", newList); this.$emit("input", newList); - this.$emit("change"); + this.$emit("change",newList); this.$emit("add"); }, }); }, + uploadImage(){ + // 单图上传 多图没写 + return new Promise(async (reslove,reject)=>{ + if(this.imgList.length){ + var postData = { + Base64Url: await this.imgToBase64(this.imgList[0].url) + } + this.HTTP_POST('StuInfoFresh/savePhoto', postData, '图片上传失败!').then((data) => { + if (data) { + reslove([{ + url:data.Url, + id:data.AnnexesFileId + }]) + }else{ + reject('图片上传失败!') + } + }) + }else{ + reslove("") + } + }) + + }, + + imgToBase64(url){ + return new Promise((resolve,reject)=>{ + var canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d'), + img = new Image; + + img.crossOrigin = 'Anonymous'; + img.onload = function () { + canvas.height = img.height; + canvas.width = img.width; + ctx.drawImage(img, 0, 0); + var dataURL = canvas.toDataURL('image/png'); + canvas = null; + resolve(dataURL) + }; + img.src = url; + }) + }, + validate(array){ let type = array.every(item=>{ return item.type && item.type.substring(0,6) == "image/" @@ -107,9 +156,40 @@ export default { current: this.imgList[index], }); }, + + // 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() { - this.imgList = JSON.parse(JSON.stringify(this.value)) + this.imgList = JSON.parse(JSON.stringify(this.value.map(item=>{ + item.isUploaded = true + return item + }))) + // [{url:"",id:""}] } }; diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js index 007172edc..6b208c6b5 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js @@ -22,11 +22,12 @@ export default { // ], "apiHost": [ // "http://localhost:31173/" - "http://192.168.10.58:31173/" + "http://192.168.10.58:8012/" ], // 开发环境下自动填充登录账号密码,与接口地址一一对应,只在开发环境下显示 "devAccount": [ - { username: "21364200000400266", password: "www.qj.com" } + // 20201130230 + { username: "420528200606205026", password: "www.qj.com" } ], //是否分布式部署 指WebApi与Web不在一台服务器 "isDistributed":true, diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json index 8de4a6aa1..edc93d780 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json @@ -998,6 +998,12 @@ "style": { "navigationBarTitleText": "会议扫码签到" } + }, + { + "path": "pages/MealCardRunTab/list", + "style": { + "navigationBarTitleText": "一卡通流水" + } } diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/MealCardRunTab/list.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/MealCardRunTab/list.vue new file mode 100644 index 000000000..bdcdaf117 --- /dev/null +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/MealCardRunTab/list.vue @@ -0,0 +1,239 @@ + + + + + diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/home/more.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/home/more.vue index fac0dfe5c..9d9f0567b 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/home/more.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/home/more.vue @@ -197,7 +197,7 @@ export default { // 获取列表分组 groupList() { - const typeTable = mapValues(keyBy(Object.values(this.GET_GLOBAL('dataDictionary').function), 'value'), 'text') + const typeTable = mapValues(keyBy(Object.values(this.GET_GLOBAL('dataDictionary')?this.GET_GLOBAL('dataDictionary').function:()=>{}), 'value'), 'text') return mapKeys( groupBy(this.allList.filter(item => item.F_Name.includes(this.searchText)), 'F_Type'), diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/welcome/list.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/welcome/list.vue index d65988c88..c0ef8e316 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/welcome/list.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/welcome/list.vue @@ -18,6 +18,8 @@ 采集照片信息 @@ -73,6 +75,7 @@ export default { data() { return { photo:[], + uploadVisiable:true, imgSrc: '', scheme: { PartyFaceNo: { @@ -134,21 +137,26 @@ export default { _this.LOADING('加载数据…'); _this.HTTP_GET('StuInfoFresh/stuInfoFreshEntity', _this.userInfo.account, '加载数据时出错').then(res => { this.HIDE_LOADING(); - console.log(res,"==="); _this.StuInfoFreshEntity = _this.COPY(res.StuInfoFreshEntity)||{}; _this.queryData.StuInfoFreshFamilyEntities = _this.COPY(res.StuInfoFreshFamilyList); _this.queryData.StuInfoFreshEmergePeopleEntities = _this.COPY(res.StuInfoFreshEmergePeopleList); _this.queryData.ID = res.StuInfoFreshEntity.ID; _this.queryData.Photo = res.StuInfoFreshEntity.Photo; + _this.photo = [{url:res.StuInfoFreshEntity.Photo}]; + _this.refreshComponent() _this.queryData.telephone = res.StuInfoFreshEntity.telephone; _this.queryData.FamilyAddress = res.StuInfoFreshEntity.FamilyAddress; _this.queryData.RegionNo = res.StuInfoFreshEntity.RegionNo; - _this.imgSrc = this.API.slice(0,-1) + res.Url; + // _this.imgSrc = this.API.slice(0,-1) + res.Url; }); }, - tapBtn() { - console.log(this.queryData) + async tapBtn() { this.LOADING('正在提交数据…'); + let res = await this.$refs["upload"].uploadImage() + if(res){ + this.queryData.Photo = res[0]["AnnexesFileId"]; + } + console.log(this.queryData) this.HTTP_GET('StuInfoFresh/saveStuInfoFresh', this.queryData, '加载数据时出错').then(res => { this.HIDE_LOADING(); // console.log(res); @@ -165,7 +173,14 @@ export default { del(str, num) { this.queryData[str].splice(num, 1) }, - + + refreshComponent(){ + this.uploadVisiable = false + this.$nextTick(()=>{ + this.uploadVisiable = true + }) + }, + // 显示列表中的标题项 displayListItem(item, field) { const fieldItem = this.scheme[field];