From 324bde530f246d920f37971404a24c8c9782e6bd Mon Sep 17 00:00:00 2001 From: chen <2659004835@qq.com> Date: Fri, 29 Apr 2022 18:35:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=9B=BE=E7=89=87=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E9=80=89=E6=8B=A9=E9=A2=84=E8=A7=88=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 2 +- commons/base.css | 2 +- components/choose-imgs/choose-img-one.vue | 10 +- .../custom-preview/img-video-preview.vue | 155 ++++++++++++++++ .../editor/{editor.vue => custom-editor.vue} | 16 +- .../function-list/column/column-function.vue | 78 ++++++++ components/function-list/column/readme.md | 43 +++++ .../gong-ge/gong-ge-function.vue | 86 +++++++++ components/function-list/gong-ge/readme.md | 47 +++++ .../function-list/swiper-gong-ge/readme.md | 57 ++++++ .../swiper-gong-ge/swiper-gong-ge.vue | 173 ++++++++++++++++++ components/status-navs/status-nav.vue | 2 +- jsFile/img/yy-img.js | 168 +++++++++++++++++ jsFile/tools.js | 5 +- jsFile/video/yy-video.js | 138 ++++++++++++++ pages.json | 30 ++- pages/tabbar/pagehome/pagehome.vue | 23 ++- pagesA/yy-img/yy-img.vue | 60 ++++++ pagesA/yy-video/yy-video.vue | 63 +++++++ .../custom-editor.vue} | 12 +- static/deleteImg/flying-img01.png | Bin 60290 -> 0 bytes static/deleteImg/flying-img02.png | Bin 74705 -> 0 bytes static/deleteImg/flying-img03.png | Bin 71568 -> 0 bytes static/deleteImg/flying-img04.png | Bin 76186 -> 0 bytes static/deleteImg/flying-img05.png | Bin 66259 -> 0 bytes static/deleteImg/flying-img06.png | Bin 15851 -> 0 bytes static/public/icom-home-logo.png | Bin 10896 -> 0 bytes static/public/icon-account-address.png | Bin 1641 -> 0 bytes static/public/icon-account-time.png | Bin 1185 -> 0 bytes static/public/icon-close.png | Bin 867 -> 0 bytes static/public/icon-electronic-logo.png | Bin 14035 -> 0 bytes static/public/icon-evaluate-pen.png | Bin 752 -> 0 bytes static/public/icon-guide.png | Bin 166061 -> 0 bytes static/public/icon-home-abnormalSingle.png | Bin 2096 -> 0 bytes static/public/icon-home-banner.png | Bin 96656 -> 0 bytes static/public/icon-home-checkCustomer.png | Bin 1779 -> 0 bytes static/public/icon-home-checkProject.png | Bin 1493 -> 0 bytes static/public/icon-home-checkSparePart.png | Bin 1768 -> 0 bytes static/public/icon-home-commission.png | Bin 2050 -> 0 bytes static/public/icon-home-dealt.png | Bin 1948 -> 0 bytes static/public/icon-home-largeScreen.png | Bin 1384 -> 0 bytes static/public/icon-home-maintain.png | Bin 1961 -> 0 bytes static/public/icon-home-message.png | Bin 794 -> 0 bytes static/public/icon-home-movingScreen.png | Bin 1335 -> 0 bytes static/public/icon-home-notice.png | Bin 1189 -> 0 bytes static/public/icon-home-overdueSingle.png | Bin 1994 -> 0 bytes static/public/icon-home-overtime.png | Bin 2470 -> 0 bytes static/public/icon-home-patrol.png | Bin 2400 -> 0 bytes static/public/icon-home-phone.png | Bin 1144 -> 0 bytes static/public/icon-home-product.png | Bin 2116 -> 0 bytes static/public/icon-home-received.png | Bin 1879 -> 0 bytes static/public/icon-home-repair.png | Bin 1366 -> 0 bytes static/public/icon-home-repairIng.png | Bin 1630 -> 0 bytes static/public/icon-home-reportForm.png | Bin 1451 -> 0 bytes static/public/icon-home-returnVisit.png | Bin 1541 -> 0 bytes static/public/icon-home-screeRemoval.png | Bin 1816 -> 0 bytes static/public/icon-home-solution.png | Bin 1325 -> 0 bytes static/public/icon-home-stayAssign.png | Bin 1496 -> 0 bytes static/public/icon-home-stayBatch.png | Bin 1876 -> 0 bytes static/public/icon-home-stayCollection.png | Bin 1840 -> 0 bytes static/public/icon-home-stayImplement.png | Bin 1879 -> 0 bytes static/public/icon-home-stayRepair.png | Bin 1176 -> 0 bytes static/public/icon-home-staySingle.png | Bin 2060 -> 0 bytes static/public/icon-home-urge.png | Bin 1472 -> 0 bytes static/public/icon-home-workOrderPool.png | Bin 2236 -> 0 bytes static/public/icon-login.png | Bin 45910 -> 0 bytes static/public/icon-my-account.png | Bin 2977 -> 0 bytes static/public/icon-my-certificates.png | Bin 1634 -> 0 bytes static/public/icon-my-creditScore.png | Bin 740 -> 0 bytes static/public/icon-my-evaluate.png | Bin 2139 -> 0 bytes static/public/icon-my-head.png | Bin 16777 -> 0 bytes static/public/icon-my-headimg.png | Bin 3068 -> 0 bytes static/public/icon-my-information.png | Bin 1499 -> 0 bytes static/public/icon-my-level.png | Bin 7420 -> 0 bytes static/public/icon-my-logo.png | Bin 11115 -> 0 bytes static/public/icon-my-notEvaluated.png | Bin 1273 -> 0 bytes static/public/icon-my-projectNum.png | Bin 1294 -> 0 bytes static/public/icon-my-service.png | Bin 2494 -> 0 bytes static/public/icon-my-set.png | Bin 1875 -> 0 bytes static/public/icon-password.png | Bin 827 -> 0 bytes static/public/icon-people.png | Bin 868 -> 0 bytes static/public/icon-personInfo-upload.png | Bin 3506 -> 0 bytes static/public/icon-plan-fire.png | Bin 2642 -> 0 bytes static/public/icon-register.png | Bin 112989 -> 0 bytes static/public/icon-unit.png | Bin 981 -> 0 bytes 85 files changed, 1146 insertions(+), 24 deletions(-) create mode 100644 components/custom-preview/img-video-preview.vue rename components/editor/{editor.vue => custom-editor.vue} (99%) create mode 100644 components/function-list/column/column-function.vue create mode 100644 components/function-list/column/readme.md create mode 100644 components/function-list/gong-ge/gong-ge-function.vue create mode 100644 components/function-list/gong-ge/readme.md create mode 100644 components/function-list/swiper-gong-ge/readme.md create mode 100644 components/function-list/swiper-gong-ge/swiper-gong-ge.vue create mode 100644 jsFile/img/yy-img.js create mode 100644 jsFile/video/yy-video.js create mode 100644 pagesA/yy-img/yy-img.vue create mode 100644 pagesA/yy-video/yy-video.vue rename pagesB/{editor/editor.vue => custom-editor/custom-editor.vue} (51%) delete mode 100644 static/deleteImg/flying-img01.png delete mode 100644 static/deleteImg/flying-img02.png delete mode 100644 static/deleteImg/flying-img03.png delete mode 100644 static/deleteImg/flying-img04.png delete mode 100644 static/deleteImg/flying-img05.png delete mode 100644 static/deleteImg/flying-img06.png delete mode 100644 static/public/icom-home-logo.png delete mode 100644 static/public/icon-account-address.png delete mode 100644 static/public/icon-account-time.png delete mode 100644 static/public/icon-close.png delete mode 100644 static/public/icon-electronic-logo.png delete mode 100644 static/public/icon-evaluate-pen.png delete mode 100644 static/public/icon-guide.png delete mode 100644 static/public/icon-home-abnormalSingle.png delete mode 100644 static/public/icon-home-banner.png delete mode 100644 static/public/icon-home-checkCustomer.png delete mode 100644 static/public/icon-home-checkProject.png delete mode 100644 static/public/icon-home-checkSparePart.png delete mode 100644 static/public/icon-home-commission.png delete mode 100644 static/public/icon-home-dealt.png delete mode 100644 static/public/icon-home-largeScreen.png delete mode 100644 static/public/icon-home-maintain.png delete mode 100644 static/public/icon-home-message.png delete mode 100644 static/public/icon-home-movingScreen.png delete mode 100644 static/public/icon-home-notice.png delete mode 100644 static/public/icon-home-overdueSingle.png delete mode 100644 static/public/icon-home-overtime.png delete mode 100644 static/public/icon-home-patrol.png delete mode 100644 static/public/icon-home-phone.png delete mode 100644 static/public/icon-home-product.png delete mode 100644 static/public/icon-home-received.png delete mode 100644 static/public/icon-home-repair.png delete mode 100644 static/public/icon-home-repairIng.png delete mode 100644 static/public/icon-home-reportForm.png delete mode 100644 static/public/icon-home-returnVisit.png delete mode 100644 static/public/icon-home-screeRemoval.png delete mode 100644 static/public/icon-home-solution.png delete mode 100644 static/public/icon-home-stayAssign.png delete mode 100644 static/public/icon-home-stayBatch.png delete mode 100644 static/public/icon-home-stayCollection.png delete mode 100644 static/public/icon-home-stayImplement.png delete mode 100644 static/public/icon-home-stayRepair.png delete mode 100644 static/public/icon-home-staySingle.png delete mode 100644 static/public/icon-home-urge.png delete mode 100644 static/public/icon-home-workOrderPool.png delete mode 100644 static/public/icon-login.png delete mode 100644 static/public/icon-my-account.png delete mode 100644 static/public/icon-my-certificates.png delete mode 100644 static/public/icon-my-creditScore.png delete mode 100644 static/public/icon-my-evaluate.png delete mode 100644 static/public/icon-my-head.png delete mode 100644 static/public/icon-my-headimg.png delete mode 100644 static/public/icon-my-information.png delete mode 100644 static/public/icon-my-level.png delete mode 100644 static/public/icon-my-logo.png delete mode 100644 static/public/icon-my-notEvaluated.png delete mode 100644 static/public/icon-my-projectNum.png delete mode 100644 static/public/icon-my-service.png delete mode 100644 static/public/icon-my-set.png delete mode 100644 static/public/icon-password.png delete mode 100644 static/public/icon-people.png delete mode 100644 static/public/icon-personInfo-upload.png delete mode 100644 static/public/icon-plan-fire.png delete mode 100644 static/public/icon-register.png delete mode 100644 static/public/icon-unit.png diff --git a/App.vue b/App.vue index e3e15e4..ae15700 100644 --- a/App.vue +++ b/App.vue @@ -4,7 +4,7 @@ projectname:'', // 项目名称 lat:'', // 公司地址维度 lng:'' ,// 公司地址经度 - hostapi:'http://maintain.7and5.cn' // 域名配置 + hostapi:'https://www.baidu.com' // 域名配置 }, // 优先于show方法 onLaunch: function() { diff --git a/commons/base.css b/commons/base.css index edf9e19..e55a4e5 100644 --- a/commons/base.css +++ b/commons/base.css @@ -73,7 +73,7 @@ button:after{content: none!important;} .bbot{border-bottom: 2rpx solid #EEEEEE;} .borbot-df{border: 2rpx solid #DFDFDF;} .borbot-cc{border: 2rpx solid #CCCCCC;} -.bleft {border-left: 1rpx solid #EEEEEE;} +.bleft {border-left: 2rpx solid #EEEEEE;} /* 行高 */ .line-h30{line-height: 30rpx;} diff --git a/components/choose-imgs/choose-img-one.vue b/components/choose-imgs/choose-img-one.vue index a7fd3b8..2c88246 100644 --- a/components/choose-imgs/choose-img-one.vue +++ b/components/choose-imgs/choose-img-one.vue @@ -46,6 +46,7 @@ + + \ No newline at end of file diff --git a/components/editor/editor.vue b/components/editor/custom-editor.vue similarity index 99% rename from components/editor/editor.vue rename to components/editor/custom-editor.vue index 0ac6e95..eb1b19f 100644 --- a/components/editor/editor.vue +++ b/components/editor/custom-editor.vue @@ -74,13 +74,19 @@ diff --git a/components/function-list/column/column-function.vue b/components/function-list/column/column-function.vue new file mode 100644 index 0000000..314aebc --- /dev/null +++ b/components/function-list/column/column-function.vue @@ -0,0 +1,78 @@ + + + + + \ No newline at end of file diff --git a/components/function-list/column/readme.md b/components/function-list/column/readme.md new file mode 100644 index 0000000..40af453 --- /dev/null +++ b/components/function-list/column/readme.md @@ -0,0 +1,43 @@ +第一步:引入组件 + + import columnFunction from '@/components/function-list/column/column-function.vue'; + +第二步:注册组件 + + export default { + components:{ + columnFunction + } + } + +第三步:使用组件 + + + +参数说明 + + list:列表数据,默认以下数组: + [ + {iconsrc:'',iconWidth:60,iconHeight:60,title:'标题一',content:'',contentColor:'#999999',ifNext:true}, + {iconsrc:'',iconWidth:60,iconHeight:60,title:'标题二',content:'',contentColor:'#999999',ifNext:true}, + {iconsrc:'',iconWidth:60,iconHeight:60,title:'标题三',content:'',contentColor:'#999999',ifNext:true}, + ] + titlec:标题颜色,默认#000000 + ifIcon:是否显示左侧图标,默认false + ifLine:是否显示下划线,默认true + linec:下划线颜色,默认#EEEEEE + ifLastLine:是否显示最后一条下划线,默认true + +方法使用 + + export default { + methods:{ + chooseEv(obj) { + console.log(obj); + }, + } + } \ No newline at end of file diff --git a/components/function-list/gong-ge/gong-ge-function.vue b/components/function-list/gong-ge/gong-ge-function.vue new file mode 100644 index 0000000..e8bd663 --- /dev/null +++ b/components/function-list/gong-ge/gong-ge-function.vue @@ -0,0 +1,86 @@ + + + + \ No newline at end of file diff --git a/components/function-list/gong-ge/readme.md b/components/function-list/gong-ge/readme.md new file mode 100644 index 0000000..d00645b --- /dev/null +++ b/components/function-list/gong-ge/readme.md @@ -0,0 +1,47 @@ +第一步:引入组件 + + import gongGeFunction from '@/components/function-list/gong-ge/gong-ge-function.vue'; + +第二步:注册组件 + + export default { + components:{ + gongGeFunction + } + } + +第三步:使用组件 + + + +参数说明 + + list:列表数据,默认以下数组: + [ + {url:'',iconsrc:'',iconWidth:60,iconHeight:60,title:'标题一'}, + {url:'',iconsrc:'',iconWidth:60,iconHeight:60,title:'标题二'}, + {url:'',iconsrc:'',iconWidth:60,iconHeight:60,title:'标题三'}, + {url:'',iconsrc:'',iconWidth:60,iconHeight:60,title:'标题四'}, + {url:'',iconsrc:'',iconWidth:60,iconHeight:60,title:'标题五'}, + {url:'',iconsrc:'',iconWidth:60,iconHeight:60,title:'标题五'}, + {url:'',iconsrc:'',iconWidth:60,iconHeight:60,title:'标题五'}, + ] + rowNum:一排显示数量,默认5 + titlec:标题颜色,默认#000000 + fonts:字体大小,默认28rpx + titleTop:字体距离图标的距离,默认20rpx + itemTop:item的顶部距离,默认30rpx + +方法使用 + + export default { + methods:{ + chooseGe(obj) { + console.log(obj); + }, + } + } \ No newline at end of file diff --git a/components/function-list/swiper-gong-ge/readme.md b/components/function-list/swiper-gong-ge/readme.md new file mode 100644 index 0000000..f486743 --- /dev/null +++ b/components/function-list/swiper-gong-ge/readme.md @@ -0,0 +1,57 @@ +第一步:引入组件 + + import swiperGongGe from '@/components/function-list/swiper-gong-ge/swiper-gong-ge.vue'; + +第二步:注册组件 + + export default { + components:{ + swiperGongGe + } + } + +第三步:使用组件 + + + +参数说明 + + list:列表数据,默认以下数组: + [ + [ + {url:'',iconsrc:'/static/tabbar/icon-select-person.png',iconWidth:60,iconHeight:60,title:'标题一'}, + {url:'',iconsrc:'/static/tabbar/icon-select-fun.png',iconWidth:60,iconHeight:60,title:'标题二'}, + {url:'',iconsrc:'/static/tabbar/icon-select-home.png',iconWidth:60,iconHeight:60,title:'标题三'}, + {url:'',iconsrc:'/static/tabbar/icon-select-news.png',iconWidth:60,iconHeight:60,title:'标题四'}, + {url:'',iconsrc:'/static/tabbar/icon-select-news.png',iconWidth:60,iconHeight:60,title:'标题四'}, + {url:'',iconsrc:'/static/tabbar/icon-select-news.png',iconWidth:60,iconHeight:60,title:'标题四'}, + ], + [ + {url:'',iconsrc:'/static/tabbar/icon-select-person.png',iconWidth:60,iconHeight:60,title:'标题一'}, + {url:'',iconsrc:'/static/tabbar/icon-select-fun.png',iconWidth:60,iconHeight:60,title:'标题二'}, + {url:'',iconsrc:'/static/tabbar/icon-select-home.png',iconWidth:60,iconHeight:60,title:'标题三'}, + {url:'',iconsrc:'/static/tabbar/icon-scan.png',iconWidth:60,iconHeight:60,title:'标题五'}, + ] + ] + ifAutoplay:是否自动轮播,默认false + rowNum:一排显示数量,默认5 + titlec:标题颜色,默认#000000 + fonts:字体大小,默认28rpx + titleTop:字体距离图标的距离,默认20rpx + itemTop:item的顶部距离,默认30rpx + activeStop:选中时指示点的颜色,默认rgba(0,0,0,1) + moStop:未选中时指示点的颜色,默认rgba(0,0,0,.2) + +方法使用 + + export default { + methods:{ + chooseGe(obj) { + console.log(obj); + }, + } + } \ No newline at end of file diff --git a/components/function-list/swiper-gong-ge/swiper-gong-ge.vue b/components/function-list/swiper-gong-ge/swiper-gong-ge.vue new file mode 100644 index 0000000..97e4296 --- /dev/null +++ b/components/function-list/swiper-gong-ge/swiper-gong-ge.vue @@ -0,0 +1,173 @@ + + + + \ No newline at end of file diff --git a/components/status-navs/status-nav.vue b/components/status-navs/status-nav.vue index 48651c4..7e56e2b 100644 --- a/components/status-navs/status-nav.vue +++ b/components/status-navs/status-nav.vue @@ -51,7 +51,7 @@ // 默认导航栏高度 navBarHeight: { type:String, - default:'40px' + default:'50px' }, //是否显示返回键 ifReturn:{ diff --git a/jsFile/img/yy-img.js b/jsFile/img/yy-img.js new file mode 100644 index 0000000..f2c4dd6 --- /dev/null +++ b/jsFile/img/yy-img.js @@ -0,0 +1,168 @@ +const imgTools = { + /** + * @description 图片多选,并返回图片数组 + * @param {Number} count 1 + */ + chooseImg(count=1) { + return new Promise((resolve,reject)=>{ + let imgArr = []; + uni.chooseImage({ + count:count, + sizeType:['compressed'], + sourceType:['album'], + success: (res) => { + let files = res.tempFilePaths + files.forEach(item=>{ + imgArr.push(item); + }) + resolve(imgArr); + } + }) + }) + }, + /** + * @description 选择图片并压缩图片 + * @param {Number} cutQuality 80 + * @param {Number} cutWidth 200 + * @param {Number} cutWidth 200 + */ + chooseCompressImg(cutQuality=80,cutWidth=200,cutHeight=200) { + return new Promise((resolve, reject) => { + uni.chooseImage({ + count:1, + sourceType:['album','camera'], + extension:['png'],//选择图片类型 + crop:{//图像裁剪参数,设置后 sizeType 失效 + quality:cutQuality,//1~100 + width:cutWidth, + height:cutHeight, + resize:false//是否将width和height作为裁剪保存图片真实的像素值。默认值为true。注:设置为false时在裁剪编辑界面显示图片的像素值,设置为true时不显示 + }, + success: (res) => { + uni.compressImage({ + src: res.tempFilePaths[0], + quality:100,//压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效) + width:cutWidth, + height:cutHeight, + rotate:0,//旋转度数,范围0~360 + success: res => { + resolve(res.tempFilePath) + } + }) + } + }) + }) + }, + /** + * @description 预览图片 + * @param {Number} current 0 + * @param {Array} imgArr [] + */ + previewImg(current=0,imgArr=[]) { + uni.previewImage({ + current:current, + urls: imgArr, + indicator:'number',//图片指示器样式,可取值:"default" - 底部圆点指示器; "number" - 顶部数字指示器; "none" - 不显示指示器。 + loop:false,//是否可循环预览,默认值为 false + longPressActions: { + itemList: ['发送给朋友', '保存图片', '收藏'], + itemColor:'#000000',//按钮的文字颜色,字符串格式,默认为"#000000" + success:(data)=> { + // console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片'); + switch (data.tapIndex){ + case 0: + // 发送给朋友 + break; + case 1: + // 保存图片 + this.saveImg(imgArr[data.index]); + break; + case 2: + // 收藏 + break; + } + } + } + }); + }, + /** + * @description 保存图片 + * @param {String} src + */ + saveImg(src) { + uni.saveImageToPhotosAlbum({ + filePath: src, + success: ()=> {} + }); + }, + /** + * @description 压缩图片 + * @param {String} imgsrc + * @param {Number} quality 裁剪质量(1~100),默认:80 + * @param {Number} width 裁剪宽度,默认:不设置 + * @param {Number} height 裁剪宽度,默认:不设置 + * @param {Number} rotate 裁剪角度(0~360),默认:0 + */ + compressImg(imgsrc, quality=80, width='', height='', rotate=0) { + return new Promise((resolve, reject)=>{ + uni.compressImage({ + src: imgsrc, + quality,//压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效) + width, + height, + rotate,//旋转度数,范围0~360 + success: res => { + resolve(res.tempFilePath); + } + }) + }) + }, + /** + * @description 获取图片信息 + * @param {String} src + */ + getImgInfo(src) { + return new Promise((resolve, reject)=>{ + uni.getImageInfo({ + src, + success: (image)=> { + resolve(image) + } + }); + }) + }, + /** + * @description 选择并裁剪图片 + * @param {Number} cutQuality 裁剪质量(1~100),默认:100 + * @param {Number} cutWidth 裁剪宽度,默认:200 + * @param {Number} cutHeight 裁剪高度,默认:200 + * @param {Number} cutRotate 裁剪角度(0~360),默认:0 + */ + cutImg(cutQuality=100,cutWidth=200,cutHeight=200, cutRotate=0) { + return new Promise((resolve, reject)=>{ + uni.chooseImage({ + count:1, + sourceType:['album','camera'], + crop:{//图像裁剪参数,设置后 sizeType 失效 + quality:cutQuality,//1~100 + width:cutWidth, + height:cutHeight, + resize:false//是否将width和height作为裁剪保存图片真实的像素值。默认值为true。注:设置为false时在裁剪编辑界面显示图片的像素值,设置为true时不显示 + }, + success: (res) => { + uni.compressImage({ + src: res.tempFilePaths[0], + quality:100,//压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效) + width:cutWidth, + height:cutHeight, + rotate:cutRotate,//旋转度数,范围0~360 + success: res => { + resolve(res.tempFilePath) + } + }) + } + }) + }) + } +} +export default imgTools; \ No newline at end of file diff --git a/jsFile/tools.js b/jsFile/tools.js index 4492e62..aa21056 100644 --- a/jsFile/tools.js +++ b/jsFile/tools.js @@ -265,8 +265,9 @@ const tools = { return arrEntities[t]; }) .replace(']*src=['"]([^'"]+)[^>]*>/gi, (match, p1) => { + return ` -1 ? p1 : 'https://oss.hmzfyy.cn' + p1}' />` + }) }, /** * @description 检查网络状态 diff --git a/jsFile/video/yy-video.js b/jsFile/video/yy-video.js new file mode 100644 index 0000000..9d0c7d7 --- /dev/null +++ b/jsFile/video/yy-video.js @@ -0,0 +1,138 @@ +const videoTools = { + /** + * @description 视频选择,并返回 + */ + chooseVideo() { + return new Promise((resolve,reject)=>{ + let videoObj = {}; + uni.chooseVideo({ + sourceType: ['camera', 'album'], + compressed:true,//是否压缩所选的视频源文件,默认值为 true,需要压缩。 + maxDuration:60,//拍摄视频最长拍摄时间,单位秒。最长支持 60 秒。 + camera: 'back',//'front'、'back',默认'back' + success: (res)=> { + console.log(res,'视频'); + // #ifdef H5 + videoObj = { + size:res.size,//视频大小 + path:res.name,//视频名称 + lastModified:res.tempFile.lastModified,//最后修改时间 + type:res.tempFile.type,//视频类型 + } + // #endif + + // #ifdef APP-PLUS || MP-WEIXIN + videoObj = { + size:res.size,//视频大小 + path:res.tempFilePath,//视频名称 + duration:res.duration,//播放总时长单位秒 + width:res.width,//视频宽 + height:res.height,//视频高 + } + // #endif + resolve(videoObj) + } + }); + }) + }, + /** + * @description 选择视频并压缩视频,不支持H5 + */ + chooseCompressVideo() { + return new Promise((resolve, reject)=>{ + uni.chooseVideo({ + sourceType: ['camera', 'album'], + compressed:true,//是否压缩所选的视频源文件,默认值为 true,需要压缩。 + maxDuration:60,//拍摄视频最长拍摄时间,单位秒。最长支持 60 秒。 + camera: 'back',//'front'、'back',默认'back' + success: (res)=> { + let exit = res.tempFilePath.split('.').includes('mp4'); + if(exit) { + // #ifdef APP-PLUS || MP-WEIXIN + uni.compressVideo({ + src:res.tempFilePath, + quality:'medium',//low:低 medium:中 high:高 + bitrate: 100000,//码率,单位 kbps + fps: 100,//帧率 + resolution:1,//相对于原视频的分辨率比例,取值范围(0, 1] + success: rescomp => { + resolve({path:rescomp.tempFilePath,size:rescomp.size}) + } + }) + // #endif + } else { + uni.showToast({title:'请选择mp4格式的视频',icon:'none'}) + } + } + }); + }) + }, + /** + * @description 预览视频,仅仅微信小程序生效 + * @param {Number} current 0 + * @param {Array} videoArr [{url:'',type:'video',poster:''}] + */ + previewVideo(current=0,videoArr=[]) { + // #ifdef MP-WEIXIN + uni.previewMedia({ + current:current, + sources:videoArr + }) + // #endif + }, + /** + * @description 保存视频,不支持H5 + * @param {String} src + */ + saveVideo(src) { + uni.saveVideoToPhotosAlbum({ + filePath: src, + success: ()=> {} + }); + }, + /** + * @description 压缩视频,不支持H5 + * @param {String} src + */ + compressVideo(src) { + return new Promise((resolve, reject)=>{ + // #ifdef APP-PLUS || MP-WEIXIN + uni.compressVideo({ + src, + quality:'medium',//low:低 medium:中 high:高 + bitrate: 100000,//码率,单位 kbps + fps: 100,//帧率 + resolution:1,//相对于原视频的分辨率比例,取值范围(0, 1] + success: rescomp => { + resolve({path:rescomp.tempFilePath,size:rescomp.size}) + } + }) + // #endif + }) + }, + /** + * @description 获取视频信息 + * @param {String} src + */ + getVideoInfo(src) { + return new Promise((resolve, reject)=>{ + uni.getVideoInfo({ + src, + success: (video)=> { + let obj = { + orientation:video.orientation,//画面方向 微信小程序、App(3.1.14+) + type:video.type,//视频格式 微信小程序、App(3.1.14+) + duration:video.duration,//视频长度 微信小程序、App(3.1.10+)、H5 + size:video.size,//视频大小,单位 kB 微信小程序、App(3.1.10+)、H5 + height:video.height,//视频的长,单位 px 微信小程序、App(3.1.10+)、H5 + width:video.width,//视频的宽,单位 px 微信小程序、App(3.1.10+)、H5 + fps:video.fps,//视频帧率 微信小程序、App(3.1.14+) + bitrate:video.bitrate,//视频码率,单位 kbps 微信小程序、App(3.1.14+) + } + resolve(obj) + } + }); + }) + } +} +export default videoTools; \ No newline at end of file diff --git a/pages.json b/pages.json index 964bdc7..6fc2cf9 100644 --- a/pages.json +++ b/pages.json @@ -44,15 +44,41 @@ "enablePullDownRefresh": false } } + ,{ + "path" : "yy-video/yy-video", + "style" : + { + "navigationBarTitleText": "", + "enablePullDownRefresh": false + } + + } + ,{ + "path" : "yy-img/yy-img", + "style" : + { + "navigationBarTitleText": "", + "enablePullDownRefresh": false + } + + } ] }, { //B包 "root": "pagesB", - "pages": [] + "pages": [ + { + "path" : "custom-editor/custom-editor", + "style" : { + "navigationBarTitleText": "", + "enablePullDownRefresh": false + } + } + ] } ], "preloadRule": { - "pages/tabbar/pagehome/pagehome": { + "pages/tabbar/my/my": { "network": "all", "packages": ["pagesA"] } diff --git a/pages/tabbar/pagehome/pagehome.vue b/pages/tabbar/pagehome/pagehome.vue index 69bbc24..4801b81 100644 --- a/pages/tabbar/pagehome/pagehome.vue +++ b/pages/tabbar/pagehome/pagehome.vue @@ -4,6 +4,9 @@ + + + @@ -15,11 +18,17 @@ import swiperTab from '@/components/swiper-tab/swiper-tab.vue'; import footTab from '@/components/foot-tabs/foot-tab.vue'; import chooseImgOne from '@/components/choose-imgs/choose-img-one.vue'; + import columnFunction from '@/components/function-list/column/column-function.vue'; + import gongGeFunction from '@/components/function-list/gong-ge/gong-ge-function.vue'; + import swiperGongGe from '@/components/function-list/swiper-gong-ge/swiper-gong-ge.vue'; export default { components:{ 'foot-tab' :footTab, swiperTab, - chooseImgOne + chooseImgOne, + columnFunction, + gongGeFunction, + swiperGongGe }, data() { return { @@ -34,6 +43,12 @@ {title:'标题七'}, {title:'标题八'}, {title:'标题九'}, + ], + funList:[ + {url:'/pagesA/my-address/my-address',title:'地址选择',iconsrc:'',iconWidth:60,iconHeight:60,content:'',contentColor:'#999999',ifNext:true}, + {url:'/pagesB/custom-editor/custom-editor',title:'富文本编辑',iconsrc:'',iconWidth:60,iconHeight:60,content:'',contentColor:'#999999',ifNext:true}, + {url:'/pagesA/yy-img/yy-img',title:'图片',iconsrc:'',iconWidth:60,iconHeight:60,content:'',contentColor:'#999999',ifNext:true}, + {url:'/pagesA/yy-video/yy-video',title:'视频',iconsrc:'',iconWidth:60,iconHeight:60,content:'',contentColor:'#999999',ifNext:true}, ] } }, @@ -48,6 +63,12 @@ // 图片选择事件 chooseEv(arr) { console.log(arr,'图片数组'); + }, + chooseEv(obj) { + console.log(obj); + }, + chooseGe(obj) { + console.log(obj); } } } diff --git a/pagesA/yy-img/yy-img.vue b/pagesA/yy-img/yy-img.vue new file mode 100644 index 0000000..05a4c74 --- /dev/null +++ b/pagesA/yy-img/yy-img.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/pagesA/yy-video/yy-video.vue b/pagesA/yy-video/yy-video.vue new file mode 100644 index 0000000..b91abc1 --- /dev/null +++ b/pagesA/yy-video/yy-video.vue @@ -0,0 +1,63 @@ + + + + + diff --git a/pagesB/editor/editor.vue b/pagesB/custom-editor/custom-editor.vue similarity index 51% rename from pagesB/editor/editor.vue rename to pagesB/custom-editor/custom-editor.vue index 95118c8..4079ac5 100644 --- a/pagesB/editor/editor.vue +++ b/pagesB/custom-editor/custom-editor.vue @@ -1,14 +1,18 @@