diff --git a/components/containers/readme.md b/components/containers/readme.md
new file mode 100644
index 0000000..c2b37f6
--- /dev/null
+++ b/components/containers/readme.md
@@ -0,0 +1,37 @@
+第一步:引入组件
+
+ import statusContainer from '@/components/containers/status-container.vue';
+
+第二步:注册组件
+
+ export default {
+ components:{
+ statusContainer
+ }
+ }
+
+第三步:使用组件
+
+
+
+
+
+
+
+参数说明
+
+ ifTitle:是否显示标题,默认true
+ titlet:标题文字,默认标题
+ ifTitleCenter:标题是否居中,默认居中
+ titlec:标题颜色,默认#000000
+ ifReturn:是否显示返回键,默认显示
+ returnc:返回键颜色,默认#333333
+ backgroundc:导航栏背景色,默认#FFFFFF
\ No newline at end of file
diff --git a/components/custom-preview/img-video-preview.vue b/components/custom-preview/img-video-preview.vue
new file mode 100644
index 0000000..e2800fa
--- /dev/null
+++ b/components/custom-preview/img-video-preview.vue
@@ -0,0 +1,155 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{list[currentNum].title}}
+
+ {{currentNum+1}}/{{list.length}}
+
+
+ {{list[currentNum].content}}
+
+
+ 关闭
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/foot-tabs/readme.md b/components/foot-tabs/readme.md
new file mode 100644
index 0000000..a21cbf8
--- /dev/null
+++ b/components/foot-tabs/readme.md
@@ -0,0 +1,37 @@
+第一步:引入组件
+
+ import footTab from '@/components/foot-tabs/foot-tab.vue';
+
+第二步:注册组件
+
+ export default {
+ components:{
+ footTab
+ }
+ }
+
+第三步:使用组件
+
+
+
+
+
+
+
+参数说明
+
+ current:当前选中项,默认0表示第一项
+ isIcon:哪个图标突出,默认2表示从索引0开始数,第二个图标突出
+ backgroundImage:底部导航背景图片,默认空值
+ backgroundColor:背景颜色,默认#FFFFFF
+ isGradualChange:是否开启背景颜色渐变,默认开启
+ direction:渐变方向,默认right top
+ colorOne:第一种颜色,默认#FFFFFF
+ colorTwo:第二种颜色,默认#FFFFFF
+ colorThree:第三种颜色,默认#FFFFFF
+ colorFour:第四种颜色,默认#FFFFFF
+ boxShadowNum:阴影大小0~1之间 0表示没有阴影,默认0.1
\ No newline at end of file
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 @@
+
+
+
+
+
+
+ {{item.title}}
+
+
+ {{item.content}}
+
+
+
+
+
+
+
+
+
+
\ 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 @@
+
+
+
+
+
+
+
+ {{item.title}}
+
+
+
+
+
+
+
\ 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 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.title}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/nothing/readme.md b/components/nothing/readme.md
new file mode 100644
index 0000000..b3ab5cd
--- /dev/null
+++ b/components/nothing/readme.md
@@ -0,0 +1,19 @@
+
+
diff --git a/components/scroll-views/scroll-text-slide readme.md b/components/scroll-views/scroll-text-slide readme.md
new file mode 100644
index 0000000..6a36ca9
--- /dev/null
+++ b/components/scroll-views/scroll-text-slide readme.md
@@ -0,0 +1,30 @@
+第一步:引入组件
+
+ import scrollTextSlide from '@/components/scroll-views/scroll-text-slide.vue';
+
+第二步:注册组件
+
+ export default {
+ components:{
+ scrollTextSlide
+ }
+ }
+
+第三步:使用组件
+
+
+
+
+
+
+
+参数说明
+
+ list:数据列表,默认['全部', '测试', '测试宽度', '测试宽度三号', '测试宽度四号小星星', '测试宽度五号']
+ activeIndex:选中索引,默认0
+ config:未选中、选中、下划线的样式,默认为以下对象:
+ {
+ color: '#999999',//默认时字体颜色
+ activeColor: '#000000',//选中时字体颜色
+ underLineColor: '#000000',//下滑线颜色
+ }
\ No newline at end of file
diff --git a/components/shopping-carts/cart-one.vue b/components/shopping-carts/cart-one.vue
new file mode 100644
index 0000000..49f020d
--- /dev/null
+++ b/components/shopping-carts/cart-one.vue
@@ -0,0 +1,267 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.title}}{{dataList.length}}
+
+ {{item.content}}
+
+
+
+ ¥:{{$toolAll.tools.addXiaoShu(item.price)}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ifManage ? '管理' : '取消'}}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/shopping-carts/cart-slide.vue b/components/shopping-carts/cart-slide.vue
new file mode 100644
index 0000000..13e514b
--- /dev/null
+++ b/components/shopping-carts/cart-slide.vue
@@ -0,0 +1,362 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{item.title}}
+ {{item.content}}
+
+
+
+ ¥:{{$toolAll.tools.addXiaoShu(item.price)}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{value.title}}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/status-navs/readme.md b/components/status-navs/readme.md
new file mode 100644
index 0000000..6af41cc
--- /dev/null
+++ b/components/status-navs/readme.md
@@ -0,0 +1,43 @@
+第一步:引入组件
+
+ import statusNav from '@/components/status-navs/status-nav.vue';
+
+第二步:注册组件
+
+ export default {
+ components:{
+ statusNav
+ }
+ }
+
+第三步:使用组件
+
+
+
+
+
+
+
+参数说明
+
+ ifTitle:是否显示标题,默认true
+ navBarTitle:导航栏标题,默认空值
+ ifCenter:标题是否居中,默认居中
+ titleColor:标题颜色,默认#000000
+ ifReturn:是否显示返回键,默认显示
+ returnc:返回键颜色,默认#333333
+ backgroudColor:状态栏、导航栏背景颜色,默认#FFFFFF
+ navBarHeight:导航栏高度,默认40px
+ clipNumber:标题最多几行显示,默认1
+ marginBottom:底部距离内容多高,默认20rpx
\ No newline at end of file
diff --git a/components/status-navs/status-nav.vue b/components/status-navs/status-nav.vue
index c0f0af6..0ef683a 100644
--- a/components/status-navs/status-nav.vue
+++ b/components/status-navs/status-nav.vue
@@ -88,11 +88,6 @@
type:Boolean,
default: true
},
- // 来自哪里
- fromWhere: {
- type:Number,
- default:0
- },
// 底部距离内容多高
marginBottom: {
type:String,
@@ -137,25 +132,14 @@
},
//返回事件
backEv(){
- if(uni.getStorageSync('outside')*1==2){
- this.fromWhere = uni.getStorageSync('outside')*1;
- }
- switch (this.fromWhere){
- case 1:
- case 2:
- uni.navigateTo({
- url:'/pages/tabbar/pagehome/pagehome'
- })
- uni.setStorageSync('outside',0)
- break;
- case 0:
- uni.navigateBack({
- delta:1
- })
- break;
- default:
- break;
- }
+ uni.navigateBack({
+ delta:1,
+ success: (res) => {},fail: (err) => {
+ uni.reLaunch({
+ url:'/pages/tabbar/pagehome/pagehome'
+ })
+ }
+ })
}
}
}
diff --git a/components/swiper/readme.md b/components/swiper/readme.md
new file mode 100644
index 0000000..33d4513
--- /dev/null
+++ b/components/swiper/readme.md
@@ -0,0 +1,34 @@
+第一步:引入组件
+
+ import swiperPu from '@/components/swipers/swiper-pu.vue';
+
+第二步:注册组件
+
+ export default {
+ components:{
+ 'custom-swiper':swiperPu
+ }
+ }
+
+第三步:使用组件
+
+
+
+
+
+
+
+参数说明
+
+ isplay:是否自动轮播,默认不轮播
+ isDot:是否显示指示点,默认显示
+ bannerList:默认轮播图片,默认值为以下数组:
+ [
+ {imgSrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',url:'',isVideo:false,poster:''},
+ {imgSrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',url:'',isVideo:false,poster:''},
+ {imgSrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',url:'',isVideo:false,poster:''},
+ ]
+ newHeight:swiper的高,默认200px
+ newBottom:指示点距离底部位置,默认18px
+ newRadius:图片圆角,默认0px
+ browseP:是否可预览,默认不能预览
\ No newline at end of file
diff --git a/jsFile/array/array.js b/jsFile/array/array.js
index 25d93bb..ee588c5 100644
--- a/jsFile/array/array.js
+++ b/jsFile/array/array.js
@@ -1,5 +1,10 @@
const arrTool = {
- oneArrToTwo(arr, size) { // arr是一维数组 size是二维数组包含几条数据
+ /**
+ * @description 一维数组变二维数组
+ * @param {Array} arr
+ * @param {Number} size
+ */
+ oneArrToTwo(arr, size) {
var arrTwo = []
for (var i = 0; i < arr.length; i = i + size) {
arrTwo.push(arr.slice(i, i + size))
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/permission/permission.js b/jsFile/permission/permission.js
new file mode 100644
index 0000000..9981504
--- /dev/null
+++ b/jsFile/permission/permission.js
@@ -0,0 +1,272 @@
+/**
+ * 本模块封装了Android、iOS的应用权限判断、打开应用权限设置界面、以及位置系统服务是否开启
+ */
+
+var isIos
+// #ifdef APP-PLUS
+isIos = (plus.os.name == "iOS")
+// #endif
+
+// 判断推送权限是否开启
+function judgeIosPermissionPush() {
+ var result = false;
+ var UIApplication = plus.ios.import("UIApplication");
+ var app = UIApplication.sharedApplication();
+ var enabledTypes = 0;
+ if (app.currentUserNotificationSettings) {
+ var settings = app.currentUserNotificationSettings();
+ enabledTypes = settings.plusGetAttribute("types");
+ console.log("enabledTypes1:" + enabledTypes);
+ if (enabledTypes == 0) {
+ console.log("推送权限没有开启");
+ } else {
+ result = true;
+ console.log("已经开启推送功能!")
+ }
+ plus.ios.deleteObject(settings);
+ } else {
+ enabledTypes = app.enabledRemoteNotificationTypes();
+ if (enabledTypes == 0) {
+ console.log("推送权限没有开启!");
+ } else {
+ result = true;
+ console.log("已经开启推送功能!")
+ }
+ console.log("enabledTypes2:" + enabledTypes);
+ }
+ plus.ios.deleteObject(app);
+ plus.ios.deleteObject(UIApplication);
+ return result;
+}
+
+// 判断定位权限是否开启
+function judgeIosPermissionLocation() {
+ var result = false;
+ var cllocationManger = plus.ios.import("CLLocationManager");
+ var status = cllocationManger.authorizationStatus();
+ result = (status != 2)
+ console.log("定位权限开启:" + result);
+ // 以下代码判断了手机设备的定位是否关闭,推荐另行使用方法 checkSystemEnableLocation
+ /* var enable = cllocationManger.locationServicesEnabled();
+ var status = cllocationManger.authorizationStatus();
+ console.log("enable:" + enable);
+ console.log("status:" + status);
+ if (enable && status != 2) {
+ result = true;
+ console.log("手机定位服务已开启且已授予定位权限");
+ } else {
+ console.log("手机系统的定位没有打开或未给予定位权限");
+ } */
+ plus.ios.deleteObject(cllocationManger);
+ return result;
+}
+
+// 判断麦克风权限是否开启
+function judgeIosPermissionRecord() {
+ var result = false;
+ var avaudiosession = plus.ios.import("AVAudioSession");
+ var avaudio = avaudiosession.sharedInstance();
+ var permissionStatus = avaudio.recordPermission();
+ console.log("permissionStatus:" + permissionStatus);
+ if (permissionStatus == 1684369017 || permissionStatus == 1970168948) {
+ console.log("麦克风权限没有开启");
+ } else {
+ result = true;
+ console.log("麦克风权限已经开启");
+ }
+ plus.ios.deleteObject(avaudiosession);
+ return result;
+}
+
+// 判断相机权限是否开启
+function judgeIosPermissionCamera() {
+ var result = false;
+ var AVCaptureDevice = plus.ios.import("AVCaptureDevice");
+ var authStatus = AVCaptureDevice.authorizationStatusForMediaType('vide');
+ console.log("authStatus:" + authStatus);
+ if (authStatus == 3) {
+ result = true;
+ console.log("相机权限已经开启");
+ } else {
+ console.log("相机权限没有开启");
+ }
+ plus.ios.deleteObject(AVCaptureDevice);
+ return result;
+}
+
+// 判断相册权限是否开启
+function judgeIosPermissionPhotoLibrary() {
+ var result = false;
+ var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary");
+ var authStatus = PHPhotoLibrary.authorizationStatus();
+ console.log("authStatus:" + authStatus);
+ if (authStatus == 3) {
+ result = true;
+ console.log("相册权限已经开启");
+ } else {
+ console.log("相册权限没有开启");
+ }
+ plus.ios.deleteObject(PHPhotoLibrary);
+ return result;
+}
+
+// 判断通讯录权限是否开启
+function judgeIosPermissionContact() {
+ var result = false;
+ var CNContactStore = plus.ios.import("CNContactStore");
+ var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0);
+ if (cnAuthStatus == 3) {
+ result = true;
+ console.log("通讯录权限已经开启");
+ } else {
+ console.log("通讯录权限没有开启");
+ }
+ plus.ios.deleteObject(CNContactStore);
+ return result;
+}
+
+// 判断日历权限是否开启
+function judgeIosPermissionCalendar() {
+ var result = false;
+ var EKEventStore = plus.ios.import("EKEventStore");
+ var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0);
+ if (ekAuthStatus == 3) {
+ result = true;
+ console.log("日历权限已经开启");
+ } else {
+ console.log("日历权限没有开启");
+ }
+ plus.ios.deleteObject(EKEventStore);
+ return result;
+}
+
+// 判断备忘录权限是否开启
+function judgeIosPermissionMemo() {
+ var result = false;
+ var EKEventStore = plus.ios.import("EKEventStore");
+ var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1);
+ if (ekAuthStatus == 3) {
+ result = true;
+ console.log("备忘录权限已经开启");
+ } else {
+ console.log("备忘录权限没有开启");
+ }
+ plus.ios.deleteObject(EKEventStore);
+ return result;
+}
+
+// Android权限查询
+function requestAndroidPermission(permissionID) {
+ return new Promise((resolve, reject) => {
+ plus.android.requestPermissions(
+ [permissionID], // 理论上支持多个权限同时查询,但实际上本函数封装只处理了一个权限的情况。有需要的可自行扩展封装
+ function(resultObj) {
+ var result = 0;
+ for (var i = 0; i < resultObj.granted.length; i++) {
+ var grantedPermission = resultObj.granted[i];
+ console.log('已获取的权限:' + grantedPermission);
+ result = 1
+ }
+ for (var i = 0; i < resultObj.deniedPresent.length; i++) {
+ var deniedPresentPermission = resultObj.deniedPresent[i];
+ console.log('拒绝本次申请的权限:' + deniedPresentPermission);
+ result = 0
+ }
+ for (var i = 0; i < resultObj.deniedAlways.length; i++) {
+ var deniedAlwaysPermission = resultObj.deniedAlways[i];
+ console.log('永久拒绝申请的权限:' + deniedAlwaysPermission);
+ result = -1
+ }
+ resolve(result);
+ // 若所需权限被拒绝,则打开APP设置界面,可以在APP设置界面打开相应权限
+ // if (result != 1) {
+ // gotoAppPermissionSetting()
+ // }
+ },
+ function(error) {
+ console.log('申请权限错误:' + error.code + " = " + error.message);
+ resolve({
+ code: error.code,
+ message: error.message
+ });
+ }
+ );
+ });
+}
+
+// 使用一个方法,根据参数判断权限
+function judgeIosPermission(permissionID) {
+ if (permissionID == "location") {
+ return judgeIosPermissionLocation()
+ } else if (permissionID == "camera") {
+ return judgeIosPermissionCamera()
+ } else if (permissionID == "photoLibrary") {
+ return judgeIosPermissionPhotoLibrary()
+ } else if (permissionID == "record") {
+ return judgeIosPermissionRecord()
+ } else if (permissionID == "push") {
+ return judgeIosPermissionPush()
+ } else if (permissionID == "contact") {
+ return judgeIosPermissionContact()
+ } else if (permissionID == "calendar") {
+ return judgeIosPermissionCalendar()
+ } else if (permissionID == "memo") {
+ return judgeIosPermissionMemo()
+ }
+ return false;
+}
+
+// 跳转到**应用**的权限页面
+function gotoAppPermissionSetting() {
+ if (isIos) {
+ var UIApplication = plus.ios.import("UIApplication");
+ var application2 = UIApplication.sharedApplication();
+ var NSURL2 = plus.ios.import("NSURL");
+ // var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
+ var setting2 = NSURL2.URLWithString("app-settings:");
+ application2.openURL(setting2);
+
+ plus.ios.deleteObject(setting2);
+ plus.ios.deleteObject(NSURL2);
+ plus.ios.deleteObject(application2);
+ } else {
+ // console.log(plus.device.vendor);
+ var Intent = plus.android.importClass("android.content.Intent");
+ var Settings = plus.android.importClass("android.provider.Settings");
+ var Uri = plus.android.importClass("android.net.Uri");
+ var mainActivity = plus.android.runtimeMainActivity();
+ var intent = new Intent();
+ intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
+ var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
+ intent.setData(uri);
+ mainActivity.startActivity(intent);
+ }
+}
+
+// 检查系统的设备服务是否开启
+// var checkSystemEnableLocation = async function () {
+function checkSystemEnableLocation() {
+ if (isIos) {
+ var result = false;
+ var cllocationManger = plus.ios.import("CLLocationManager");
+ var result = cllocationManger.locationServicesEnabled();
+ console.log("系统定位开启:" + result);
+ plus.ios.deleteObject(cllocationManger);
+ return result;
+ } else {
+ var context = plus.android.importClass("android.content.Context");
+ var locationManager = plus.android.importClass("android.location.LocationManager");
+ var main = plus.android.runtimeMainActivity();
+ var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
+ var result = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER);
+ console.log("系统定位开启:" + result);
+ return result
+ }
+}
+
+module.exports = {
+ judgeIosPermission: judgeIosPermission,
+ requestAndroidPermission: requestAndroidPermission,
+ checkSystemEnableLocation: checkSystemEnableLocation,
+ gotoAppPermissionSetting: gotoAppPermissionSetting
+}
diff --git a/jsFile/permission/readme.md b/jsFile/permission/readme.md
new file mode 100644
index 0000000..06589f7
--- /dev/null
+++ b/jsFile/permission/readme.md
@@ -0,0 +1,51 @@
+第一步:引入js
+
+ import permision from "@/jsFile/permission/permission.js";
+
+第二步:使用js里的方法
+
+ let permisionID = '';
+
+ ios系统:
+
+ permisionID:可取以下值
+ location:位置权限
+ camera:摄像头权限
+ photoLibrary:相册权限
+ record:麦克风权限
+ push:推送权限
+ contact:通讯录权限
+ calendar:日历权限
+ memo:备忘录权限
+
+ Android系统:
+
+ permisionID:可取以下值
+ android.permission.ACCESS_FINE_LOCATION:位置权限
+ android.permission.ACCESS_COARSE_LOCATION:模糊位置权限(蓝牙\ble依赖)
+ android.permission.CAMERA:摄像头权限
+ android.permission.READ_EXTERNAL_STORAGE:外部存储(含相册)读取权限
+ android.permission.WRITE_EXTERNAL_STORAGE:外部存储(含相册)写入权限
+ android.permission.RECORD_AUDIO:麦克风权限
+ android.permission.READ_CONTACTS:通讯录读取权限
+ android.permission.WRITE_CONTACTS:通讯录写入权限
+ android.permission.READ_CALENDAR:日历读取权限
+ android.permission.WRITE_CALENDAR:日历写入权限
+ android.permission.READ_SMS:短信读取权限
+ android.permission.SEND_SMS:短信发送权限
+ android.permission.RECEIVE_SMS:接收新短信权限
+ android.permission.READ_PHONE_STATE:获取手机识别码等信息的权限
+ android.permission.CALL_PHONE:拨打电话权限
+ android.permission.READ_CALL_LOG:获取通话记录权限
+
+
+ let result = permision.judgeIosPermission(permisionID);
+ if(!result) {
+ //未开启权限,并前往应用设置
+ permision.gotoAppPermissionSetting()
+ }
+
+
+
+
+
\ No newline at end of file
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 e6d094d..ba59743 100644
--- a/pages.json
+++ b/pages.json
@@ -88,6 +88,42 @@
"enablePullDownRefresh": false
}
}
+ ,{
+ "path" : "yy-video/yy-video",
+ "style" :
+ {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+
+ }
+ ,{
+ "path" : "yy-img/yy-img",
+ "style" :
+ {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+
+ }
+ ,{
+ "path" : "shopping-cart/shopping-cart",
+ "style" :
+ {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+
+ }
+ ,{
+ "path" : "shopping-cart-slide/shopping-cart-slide",
+ "style" :
+ {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+
+ }
]
},
{ //B包
diff --git a/pagesA/shopping-cart-slide/shopping-cart-slide.vue b/pagesA/shopping-cart-slide/shopping-cart-slide.vue
new file mode 100644
index 0000000..8f49fc2
--- /dev/null
+++ b/pagesA/shopping-cart-slide/shopping-cart-slide.vue
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pagesA/shopping-cart/shopping-cart.vue b/pagesA/shopping-cart/shopping-cart.vue
new file mode 100644
index 0000000..eb24eef
--- /dev/null
+++ b/pagesA/shopping-cart/shopping-cart.vue
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
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 @@
+
+
+
+
+
+
+
+
+
+
+
+
+