新增ios、android权限检测、修改购物车滑动删除
parent
5352140914
commit
f492b90972
|
@ -383,6 +383,34 @@ scroll-view ::-webkit-scrollbar {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* 圆圈中间一个原点 start */
|
||||||
|
.mo-item {
|
||||||
|
width: 30rpx;
|
||||||
|
height: 30rpx;
|
||||||
|
border-radius: 100%;
|
||||||
|
border: 2rpx solid #000000;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.active-item{
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
border: 2rpx solid #FF0000;
|
||||||
|
}
|
||||||
|
.active-item::before{
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%,-50%);
|
||||||
|
width: 20rpx;
|
||||||
|
height: 20rpx;
|
||||||
|
border-radius: 100%;
|
||||||
|
background-color: #FF0000;
|
||||||
|
}
|
||||||
|
/* 圆圈中间一个原点 end */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
#参数说明
|
参数说明
|
||||||
|
|
||||||
current:当前选中项,默认0表示第一项
|
current:当前选中项,默认0表示第一项
|
||||||
isIcon:哪个图标突出,默认2表示从索引0开始数,第二个图标突出
|
isIcon:哪个图标突出,默认2表示从索引0开始数,第二个图标突出
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view class="disac shopping-cart-item animated " :class="item.ifExit ? 'fadeInUp' : 'fadeOutDown'" :style="{display: item.ifAnimation ? 'flex' : 'none'}" v-for="(item,index) in dataList" :key="index">
|
<view class="disac shopping-cart-item animated " :class="item.ifExit ? 'fadeInUp' : 'fadeOutDown'" :style="{display: item.ifShow ? 'flex' : 'none'}" v-for="(item,index) in dataList" :key="index">
|
||||||
<!-- 选择 -->
|
<!-- 选择 -->
|
||||||
<view class="flexs mo-item" :class="item.ifcheck ? 'active-item' : ''" @tap="chooseEv(index)"></view>
|
<view class="flexs mo-item" :class="item.ifcheck ? 'active-item' : ''" @tap="chooseEv(index)"></view>
|
||||||
<!-- 商品图片 -->
|
<!-- 商品图片 -->
|
||||||
<view class="shopp-img mar-zy20 flexs" @tap="chooseEv(index)">
|
<view class="shopp-img imgH mar-zy20 flexs" @tap="chooseEv(index)">
|
||||||
<image class="shopp-img imgH" :src="item.imgsrc" mode="aspectFill" lazy-load></image>
|
<image class="shopp-img imgH width100 " :src="item.imgsrc" mode="aspectFill" lazy-load></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="disjb fc imgH width100">
|
<view class="disjb fc imgH width100">
|
||||||
<view @tap="goDetail(item.id)">
|
<view @tap="goDetail(item.id)">
|
||||||
<!-- 商品标题 -->
|
<!-- 商品标题 -->
|
||||||
<view class="fon28 bold clips1">{{item.title}}</view>
|
<view class="fon28 bold clips1">{{item.title}}{{dataList.length}}</view>
|
||||||
<!-- 商品描述 -->
|
<!-- 商品描述 -->
|
||||||
<view class="fon24 clips2">{{item.content}}</view>
|
<view class="fon24 clips2">{{item.content}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -20,27 +20,28 @@
|
||||||
<!-- 商品数量 -->
|
<!-- 商品数量 -->
|
||||||
<view class="disac">
|
<view class="disac">
|
||||||
<!-- 减数量 -->
|
<!-- 减数量 -->
|
||||||
<i class="icon icon-cut countBtn disjcac" @tap="addCutEv(index,0)" :style="{backgroundColor: item.num==1 ? '#cccccc' : '#000000'}"></i>
|
<i class="icon icon-cut countBtn disjcac" @tap="addCutEv(index,0)" :style="{backgroundColor: item.num==minNum || !ifManage ? '#cccccc' : '#000000'}"></i>
|
||||||
<!-- 实际数量 -->
|
<!-- 实际数量 -->
|
||||||
<input type="digit" class="fon24 tcenter countInput" v-model="item.num">
|
<input type="digit" @blur="blurEv(index,$event)" @focus="focusEv(item.num)" class="fon24 tcenter countInput" :disabled="!ifManage" v-model="item.num">
|
||||||
<!-- 加数量 -->
|
<!-- 加数量 -->
|
||||||
<i class="icon icon-add countBtn disjcac" @tap="addCutEv(index,1)" :style="{backgroundColor: item.num==10 ? '#cccccc' : '#000000'}"></i>
|
<i class="icon icon-add countBtn disjcac" @tap="addCutEv(index,1)" :style="{backgroundColor: item.num==maxNum || !ifManage ? '#cccccc' : '#000000'}"></i>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 管理 -->
|
<!-- 管理 -->
|
||||||
<view class="shopping-manage" :style="{backgroundColor: ifManage ? 'rgba(0,0,0,.6)' : 'rgba(255,0,0,1)'}" @tap="manageEv">{{ifManage ? '管理' : '取消'}}</view>
|
<view v-if="dataList.length" class="shopping-manage" :style="{backgroundColor: ifManage ? 'rgba(0,0,0,.6)' : 'rgba(255,0,0,1)'}" @tap="manageEv">{{ifManage ? '管理' : '取消'}}</view>
|
||||||
<!-- 底部导航 -->
|
<!-- 底部导航 -->
|
||||||
<view class="disjbac cart-foot-box fon24">
|
<view class="disjbac cart-foot-box fon24">
|
||||||
<view class="" v-if="ifManage">合计:<span class="fon38 colf8 bold">{{allPrice}}</span></view>
|
<view class="" v-if="ifManage">合计:<span class="fon38 colf8 bold">{{allPrice}}</span></view>
|
||||||
<view class="disac mar-z10" v-else @tap="chooseAllEv">
|
<view class="disac" v-else @tap="chooseAllEv">
|
||||||
<view class="flexs mo-item mar-y10" :class="ifSelectAll ? 'active-item' : ''" @tap="chooseEv(index)"></view>
|
<view class="flexs mo-item mar-y10" :class="ifSelectAll ? 'active-item' : ''" @tap="chooseEv(index)"></view>
|
||||||
<span>全选</span>
|
<span>全选</span>
|
||||||
</view>
|
</view>
|
||||||
<view class="fon38 cart-submit-btn"
|
<view class="fon38 cart-submit-btn"
|
||||||
:style="{backgroundColor: allPrice=='0.00' ? '#cccccc' : '#FF0000'}" @tap="submitEv">{{ifManage ? `${allPrice=='0.00' ? '去购物' : '去结算'}` : `删除 (${delNum})`}}</view>
|
:style="{backgroundColor: !ifManage && !delNum ? '#cccccc' : '#FF0000'}" @tap="submitEv">{{ifManage ? `${allPrice=='0.00' ? '去购物' : '去结算'}` : `删除 (${delNum})`}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
<nothing-page v-if="!ifLoading && !dataList.length" content="你的购物车:这也空空,那也空空(*^▽^*)"></nothing-page>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -52,14 +53,17 @@
|
||||||
type:Array,
|
type:Array,
|
||||||
default:()=>{
|
default:()=>{
|
||||||
return [
|
return [
|
||||||
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题商品标题商品标题商品标题商品标题商品标题',content:'商品描述商品描述',price:199.13,num:1,ifcheck:true},
|
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题',content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',price:199,num:1,ifcheck:false,ifExit:true,ifShow:true},
|
||||||
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题',content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',price:199,num:1,ifcheck:false},
|
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题',content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',price:199,num:1,ifcheck:false,ifExit:true,ifShow:true},
|
||||||
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题',content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',price:199,num:1,ifcheck:false},
|
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题',content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',price:199,num:1,ifcheck:false,ifExit:true,ifShow:true},
|
||||||
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题',content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',price:199,num:1,ifcheck:false},
|
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题',content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',price:199,num:1,ifcheck:false,ifExit:true,ifShow:true},
|
||||||
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题',content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',price:199,num:1,ifcheck:false},
|
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题',content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',price:199,num:1,ifcheck:false,ifExit:true,ifShow:true},
|
||||||
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题',content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',price:199,num:1,ifcheck:false},
|
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题',content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',price:199,num:1,ifcheck:false,ifExit:true,ifShow:true},
|
||||||
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题',content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',price:199,num:1,ifcheck:false},
|
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题',content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',price:199,num:1,ifcheck:false,ifExit:true,ifShow:true},
|
||||||
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题',content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',price:199,num:1,ifcheck:false},
|
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题',content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',price:199,num:1,ifcheck:false,ifExit:true,ifShow:true},
|
||||||
|
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题',content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',price:199,num:1,ifcheck:false,ifExit:true,ifShow:true},
|
||||||
|
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题',content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',price:199,num:1,ifcheck:false,ifExit:true,ifShow:true},
|
||||||
|
{id:1,imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'商品标题',content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',price:199,num:1,ifcheck:false,ifExit:true,ifShow:true},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +72,11 @@
|
||||||
return {
|
return {
|
||||||
dataList:[],
|
dataList:[],
|
||||||
ifManage:true,//是否显示管理按钮
|
ifManage:true,//是否显示管理按钮
|
||||||
ifSelectAll:false//是否全选
|
ifSelectAll:false,//是否全选
|
||||||
|
originalNum:0,//当前输入框原值
|
||||||
|
maxNum:20,//最大可输入数量
|
||||||
|
minNum:1,//最小可输入数量
|
||||||
|
ifLoading:true
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed:{
|
computed:{
|
||||||
|
@ -102,12 +110,14 @@
|
||||||
title:'商品标题'+index,
|
title:'商品标题'+index,
|
||||||
content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',
|
content:'商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述',
|
||||||
price:199,
|
price:199,
|
||||||
num:1,
|
num:index+++1,
|
||||||
ifcheck:false,
|
ifcheck:false,//是否被选中
|
||||||
ifExit:true,
|
ifExit:true,//是否存在
|
||||||
ifAnimation:true
|
ifShow:true//是否隐藏
|
||||||
}
|
}
|
||||||
this.dataList.push(obj);
|
this.dataList.push(obj);
|
||||||
|
// this.dataList = [];
|
||||||
|
this.ifLoading = false;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
@ -116,20 +126,35 @@
|
||||||
if(this.ifManage) {
|
if(this.ifManage) {
|
||||||
if(this.allPrice=='0.00') {
|
if(this.allPrice=='0.00') {
|
||||||
// 去购物
|
// 去购物
|
||||||
|
console.log('去购物');
|
||||||
} else {
|
} else {
|
||||||
// 去结算
|
// 去结算
|
||||||
|
console.log('去结算');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 进入删除
|
// 进入删除
|
||||||
this.dataList.forEach((item,index)=>{
|
this.dataList.forEach((item,index)=>{
|
||||||
|
// 判断商品是否被选中
|
||||||
if(item.ifcheck) {
|
if(item.ifcheck) {
|
||||||
|
// 该商品被选中
|
||||||
|
// 修改为不存在的商品
|
||||||
this.dataList[index].ifExit = false;
|
this.dataList[index].ifExit = false;
|
||||||
|
// 修改该商品不被选中
|
||||||
this.dataList[index].ifcheck = false;
|
this.dataList[index].ifcheck = false;
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
this.dataList[index].ifAnimation = false;
|
// 隐藏该商品
|
||||||
|
this.dataList[index].ifShow = false;
|
||||||
},1000)
|
},1000)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
setTimeout(()=>{
|
||||||
|
// 重构数组列表,去除不存在的商品
|
||||||
|
this.dataList = this.dataList.filter(item=>item.ifExit==true);
|
||||||
|
if(!this.dataList.length) {
|
||||||
|
// 如果购物车为空按钮变为去购物,全选变为合计:0.00
|
||||||
|
this.ifManage = true;
|
||||||
|
}
|
||||||
|
},1000)
|
||||||
this.judgeSelectAllEv();
|
this.judgeSelectAllEv();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -160,23 +185,42 @@
|
||||||
},
|
},
|
||||||
// 数量加减事件
|
// 数量加减事件
|
||||||
addCutEv(index,num) {
|
addCutEv(index,num) {
|
||||||
if(num) {
|
// 不在管理状态下:可进行加减
|
||||||
// 加
|
if(this.ifManage) {
|
||||||
if(this.dataList[index].num!=10) {
|
if(num) {
|
||||||
this.dataList[index].num++;
|
// 加 ,如果当前商品数量不等于最大值
|
||||||
}
|
if(this.dataList[index].num != this.maxNum) {
|
||||||
} else {
|
this.dataList[index].num++;
|
||||||
// 减
|
}
|
||||||
if(this.dataList[index].num>1) {
|
} else {
|
||||||
this.dataList[index].num--;
|
// 减 ,如果当前商品数量大于最小值
|
||||||
|
if(this.dataList[index].num > this.minNum) {
|
||||||
|
this.dataList[index].num--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
console.log(this.allPrice,'总价');
|
||||||
}
|
}
|
||||||
console.log(this.allPrice,'总价');
|
|
||||||
},
|
},
|
||||||
// 管理点击事件
|
// 管理点击事件
|
||||||
manageEv(){
|
manageEv(){
|
||||||
this.dataList.forEach(item=>item.ifcheck=false)
|
// 重置所有商品不被选中
|
||||||
|
this.dataList.forEach(item=>item.ifcheck=false);
|
||||||
|
// 管理状态的切换 管理/取消
|
||||||
this.ifManage = !this.ifManage;
|
this.ifManage = !this.ifManage;
|
||||||
|
// 设置底部全选框不被选中
|
||||||
|
this.ifSelectAll = false;
|
||||||
|
},
|
||||||
|
// 输入框获取焦点事件
|
||||||
|
focusEv(num) {
|
||||||
|
// 储存当前商品的原始数值
|
||||||
|
this.originalNum = num;
|
||||||
|
},
|
||||||
|
// 输入框失去焦点事件
|
||||||
|
blurEv(index,e) {
|
||||||
|
// 失去焦点时,获取当前输入框里的数值
|
||||||
|
let currentNum = e.detail.value*1;
|
||||||
|
// 如果当前输入框的值不等于0或空,并且当前输入框的值大于最大值,当前商品的数量 = 最大值, 否则为当前输入框输入的值
|
||||||
|
this.dataList[index].num = currentNum ? currentNum > this.maxNum ? this.maxNum : currentNum : this.originalNum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,6 +244,10 @@
|
||||||
.active-item::before{
|
.active-item::before{
|
||||||
content: '';
|
content: '';
|
||||||
display: block;
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%,-50%);
|
||||||
width: 20rpx;
|
width: 20rpx;
|
||||||
height: 20rpx;
|
height: 20rpx;
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
|
@ -211,7 +259,7 @@
|
||||||
.countBtn{font-size: 36rpx;width: 40rpx;height: 40rpx;background-color: #000000;color: #FFFFFF; border-radius: 10rpx;}
|
.countBtn{font-size: 36rpx;width: 40rpx;height: 40rpx;background-color: #000000;color: #FFFFFF; border-radius: 10rpx;}
|
||||||
.countInput{background-color: #F5F5F5;width: 80rpx;border-radius: 10rpx;padding: 10rpx 0;margin: 0 10rpx;}
|
.countInput{background-color: #F5F5F5;width: 80rpx;border-radius: 10rpx;padding: 10rpx 0;margin: 0 10rpx;}
|
||||||
|
|
||||||
.cart-foot-box{position: fixed;bottom: 0;right: 0;left: 0;background-color: #FFFFFF;padding: 20rpx 30rpx;box-shadow: -6rpx 0rpx 10rpx rgba(0, 0, 0, .3);}
|
.cart-foot-box{position: fixed;bottom: 0;right: 0;left: 0;background-color: #FFFFFF; padding: 20rpx 40rpx;box-shadow: -6rpx 0rpx 10rpx rgba(0, 0, 0, .3);}
|
||||||
.cart-submit-btn{color: #FFFFFF;background-color: #cccccc;padding: 10rpx 40rpx;border-radius: 40rpx;}
|
.cart-submit-btn{color: #FFFFFF;background-color: #cccccc;padding: 10rpx 40rpx;border-radius: 40rpx;}
|
||||||
|
|
||||||
.shopping-manage{position: fixed;right: 20rpx;bottom: 340rpx;width: 80rpx;height: 80rpx; border-radius: 100%;background-color: rgba(0, 0, 0, .6);color: #FFFFFF;font-size: 24rpx;display: flex;justify-content: center;align-items: center;}
|
.shopping-manage{position: fixed;right: 20rpx;bottom: 340rpx;width: 80rpx;height: 80rpx; border-radius: 100%;background-color: rgba(0, 0, 0, .6);color: #FFFFFF;font-size: 24rpx;display: flex;justify-content: center;align-items: center;}
|
||||||
|
|
|
@ -0,0 +1,267 @@
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view>
|
||||||
|
<view class="slide-box" v-for="(item, index) in listData" :key="index">
|
||||||
|
<view class="slide-list"
|
||||||
|
@touchstart="touchStart($event, index)"
|
||||||
|
@touchend="touchEnd($event, index)"
|
||||||
|
@touchmove="touchMove($event, index)"
|
||||||
|
@tap="recover(index)"
|
||||||
|
:style="{ transform: 'translate3d(' + item.slide_x + 'px, 0, 0)' }">
|
||||||
|
<view class="now-message-info" :style="{ width: windowWidth + 'px' }" @click="clickItemMethod(item)">
|
||||||
|
<view class="mo-item flexs"></view>
|
||||||
|
<view class="shopp-img imgH mar-zy20">
|
||||||
|
<image class="shopp-img imgH width100" :src="item.image" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
<view class="imgH disjb fc fon24 pad-y20">
|
||||||
|
<view class="">
|
||||||
|
<view class="fon36 colb">标题</view>
|
||||||
|
<view class="clips2">描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述</view>
|
||||||
|
</view>
|
||||||
|
<view class="col3">{{ item.rightDetail }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="group-btn">
|
||||||
|
<view class="btn-div" v-for="(value, key) in button" :key="key"
|
||||||
|
@click="clickMethod(item, value, index)" :style="{background: value.background}">
|
||||||
|
{{value.title}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view style="clear:both"></view>
|
||||||
|
</view>
|
||||||
|
<view class="list-item-border" v-if="border"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* m-slide-list 滑动操作列表
|
||||||
|
* @description 滑动操作列表组件
|
||||||
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=209
|
||||||
|
* @property {Array} list 数据源,格式为:[{title: 'xxx', image:'xxx', surname: 'xxx',detail:'xxx', rightDetail: 'xxx', slide_x: 0},{title: 'xxx', image:'xxx', surname: 'xxx',detail:'xxx', rightDetail: 'xxx', slide_x: 0}]
|
||||||
|
* @property {Array} button 按钮数据源,格式为:[{title: 'xxx', background:'xxx'},{title: 'xxx', background:'xxx'}]
|
||||||
|
* @property {Boolean} border 边框
|
||||||
|
*/
|
||||||
|
export default {
|
||||||
|
name: 'mark-slide-list',
|
||||||
|
props: {
|
||||||
|
list: { //数据list
|
||||||
|
type: Array,
|
||||||
|
default () {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
button: { //按钮数据list
|
||||||
|
type: Array,
|
||||||
|
default () {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
border: { //边框
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
windowWidth() {
|
||||||
|
return uni.getSystemInfoSync().windowWidth;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
listData: [],
|
||||||
|
start_slide_x: 0,
|
||||||
|
btnWidth: 0,
|
||||||
|
startX: 0,
|
||||||
|
LastX: 0,
|
||||||
|
startTime: 0,
|
||||||
|
itemIndex: 0
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.listData = this.clone(this.list)
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
list: {
|
||||||
|
handler: function(val, oldval) {
|
||||||
|
this.listData = this.clone(this.list)
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
clone(data) {
|
||||||
|
const type = typeof data
|
||||||
|
let obj;
|
||||||
|
if (type === 'array') {
|
||||||
|
obj = [];
|
||||||
|
} else if (type === 'object') {
|
||||||
|
obj = {};
|
||||||
|
} else {
|
||||||
|
// 不再具有下一层次
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
if (type === 'array') {
|
||||||
|
for (let i = 0, len = data.length; i < len; i++) {
|
||||||
|
obj.push(this.clone(data[i]));
|
||||||
|
}
|
||||||
|
} else if (type === 'object') {
|
||||||
|
// 对原型上的方法也拷贝了....
|
||||||
|
for (const key in data) {
|
||||||
|
obj[key] = this.clone(data[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 滑动开始
|
||||||
|
touchStart(e, index) {
|
||||||
|
if (this.itemIndex == index) {
|
||||||
|
this.itemIndex = index
|
||||||
|
}
|
||||||
|
//记录手指放上去的时间
|
||||||
|
this.startTime = e.timeStamp;
|
||||||
|
//记录滑块的初始位置
|
||||||
|
this.start_slide_x = this.listData[index].slide_x;
|
||||||
|
// 按钮宽度
|
||||||
|
//#ifdef MP-WEIXIN
|
||||||
|
uni.createSelectorQuery().in(this).selectAll('.group-btn').boundingClientRect(res => {
|
||||||
|
if (res != null) {
|
||||||
|
this.btnWidth = res[index].width * -1;
|
||||||
|
}
|
||||||
|
}).exec();
|
||||||
|
//#endif
|
||||||
|
//#ifdef H5 || APP-PLUS
|
||||||
|
uni.createSelectorQuery()
|
||||||
|
.selectAll('.group-btn')
|
||||||
|
.boundingClientRect()
|
||||||
|
.exec(res => {
|
||||||
|
if (res[0] != null) {
|
||||||
|
this.btnWidth = res[0][index].width * -1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//#endif
|
||||||
|
// 记录上一次开始时手指所处位置
|
||||||
|
this.startX = e.touches[0].pageX;
|
||||||
|
// 记录上一次手指位置
|
||||||
|
this.lastX = this.startX;
|
||||||
|
//初始化非当前滑动消息列的位置
|
||||||
|
for (var i in this.listData) {
|
||||||
|
if (index != i) {
|
||||||
|
this.listData[i].slide_x = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 滑动中
|
||||||
|
touchMove(e, index) {
|
||||||
|
const endX = e.touches[0].pageX;
|
||||||
|
const distance = endX - this.lastX;
|
||||||
|
// 预测滑块所处位置
|
||||||
|
const duang = this.listData[index].slide_x + distance;
|
||||||
|
// 如果在可行区域内
|
||||||
|
if (duang <= 0 && duang >= this.btnWidth) {
|
||||||
|
this.listData[index].slide_x = duang;
|
||||||
|
}
|
||||||
|
// 此处手指所处位置将成为下次手指移动时的上一次位置
|
||||||
|
this.lastX = endX;
|
||||||
|
},
|
||||||
|
// 滑动结束
|
||||||
|
touchEnd(e, index) {
|
||||||
|
let distance = 10;
|
||||||
|
const endTime = e.timeStamp;
|
||||||
|
const x_end_distance = this.startX - this.lastX;
|
||||||
|
if (Math.abs(endTime - this.startTime) > 200) {
|
||||||
|
distance = this.btnWidth / -2;
|
||||||
|
}
|
||||||
|
// 判断手指最终位置与手指开始位置的位置差距
|
||||||
|
if (x_end_distance > distance) {
|
||||||
|
this.listData[index].slide_x = this.btnWidth;
|
||||||
|
} else if (x_end_distance < distance * -1) {
|
||||||
|
this.listData[index].slide_x = 0;
|
||||||
|
} else {
|
||||||
|
this.listData[index].slide_x = this.start_slide_x;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 点击回复原状
|
||||||
|
recover(index) {
|
||||||
|
this.listData[index].slide_x = 0;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 点击按钮触发事件
|
||||||
|
* @param {Object} item 列表数据
|
||||||
|
* @param {Object} buttonItem 按钮数据
|
||||||
|
* @param {Object} index 列表数据key
|
||||||
|
*/
|
||||||
|
clickMethod(item, buttonItem, index) {
|
||||||
|
this.$emit("change", item, buttonItem, index)
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 点击按钮触发事件
|
||||||
|
* @param {Object} item 列表数据
|
||||||
|
*/
|
||||||
|
clickItemMethod(item) {
|
||||||
|
this.$emit("click", item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.slide-box {
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-item-border {
|
||||||
|
width: 100%;
|
||||||
|
border-bottom: 1px solid #f2f2f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slide-list {
|
||||||
|
transition: all 100ms;
|
||||||
|
transition-timing-function: ease-out;
|
||||||
|
min-width: 200%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.now-message-info {
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
clear: both;
|
||||||
|
padding: 20rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.imgH{height: 180rpx;}
|
||||||
|
.shopp-img{width: 180rpx;border-radius: 10rpx;}
|
||||||
|
|
||||||
|
.group-btn {
|
||||||
|
float: left;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
height: 220rpx;
|
||||||
|
min-width: 100rpx;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-div {
|
||||||
|
height: 220rpx;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
padding: 0 50rpx;
|
||||||
|
font-size: 34rpx;
|
||||||
|
line-height: 220rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top {
|
||||||
|
background-color: #c4c7cd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.removeM {
|
||||||
|
background-color: #ff3b32;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -1,9 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view class="posi-sticky">
|
<view class="posi-sticky" :style="{top: newTop +'px'}">
|
||||||
<scrollTextSlide @changeEv="tabTap" :list="tagList" :activeIndex="activeIndex"></scrollTextSlide>
|
<scrollTextSlide @changeEv="tabTap" :list="tagList" :activeIndex="activeIndex"></scrollTextSlide>
|
||||||
</view>
|
</view>
|
||||||
<swiper :style="{height: swiperHeight-100 + 'px'}" class=" fon30" :current="activeIndex" @change="swiperChange">
|
<swiper :style="{height: swiperHeight - 200 + 'px'}" class=" fon30" :current="activeIndex" @change="swiperChange">
|
||||||
<swiper-item v-for="(item,index) in list.length" :key="index">
|
<swiper-item v-for="(item,index) in list.length" :key="index">
|
||||||
<scroll-view scroll-y @scrolltolower="scrollBottomEv" style="height: 100%;">
|
<scroll-view scroll-y @scrolltolower="scrollBottomEv" style="height: 100%;">
|
||||||
<!-- 列表数据 -->
|
<!-- 列表数据 -->
|
||||||
|
@ -52,10 +52,10 @@
|
||||||
[
|
[
|
||||||
{title:'标题',content:'描述描述描述描述描述描述描述描述描述描述描述描述',price:199,xiaol:99},
|
{title:'标题',content:'描述描述描述描述描述描述描述描述描述描述描述描述',price:199,xiaol:99},
|
||||||
{title:'标题',content:'描述描述描述描述描述描述描述描述描述描述描述描述',price:199,xiaol:99},
|
{title:'标题',content:'描述描述描述描述描述描述描述描述描述描述描述描述',price:199,xiaol:99},
|
||||||
{title:'标题',content:'描述描述描述描述描述描述描述描述描述描述描述描述',price:199,xiaol:99},
|
// {title:'标题',content:'描述描述描述描述描述描述描述描述描述描述描述描述',price:199,xiaol:99},
|
||||||
{title:'标题',content:'描述描述描述描述描述描述描述描述描述描述描述描述',price:199,xiaol:99},
|
// {title:'标题',content:'描述描述描述描述描述描述描述描述描述描述描述描述',price:199,xiaol:99},
|
||||||
{title:'标题',content:'描述描述描述描述描述描述描述描述描述描述描述描述',price:199,xiaol:99},
|
// {title:'标题',content:'描述描述描述描述描述描述描述描述描述描述描述描述',price:199,xiaol:99},
|
||||||
{title:'标题',content:'描述描述描述描述描述描述描述描述描述描述描述描述',price:199,xiaol:99},
|
// {title:'标题',content:'描述描述描述描述描述描述描述描述描述描述描述描述',price:199,xiaol:99},
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{title:'标题',content:'描述描述描述描述描述描述描述描述描述描述描述描述',price:199,xiaol:99},
|
{title:'标题',content:'描述描述描述描述描述描述描述描述描述描述描述描述',price:199,xiaol:99},
|
||||||
|
@ -87,6 +87,7 @@
|
||||||
return {
|
return {
|
||||||
activeIndex:0,
|
activeIndex:0,
|
||||||
swiperHeight:uni.getSystemInfoSync().windowHeight,
|
swiperHeight:uni.getSystemInfoSync().windowHeight,
|
||||||
|
newTop:uni.getSystemInfoSync().statusBarHeight + 50
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -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()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,15 @@
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"path" : "shopping-cart-slide/shopping-cart-slide",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<status-container :ifReturn="false" titlet="列表">
|
<status-container :ifReturn="false" titlet="列表">
|
||||||
<view slot="content">
|
<view slot="content" style="margin: -20rpx -20rpx 0 -20rpx;">
|
||||||
<swiperTabSlide @scrollBottom="scrollBottomEv" :list="dataList" :ifloading="ifloading"></swiperTabSlide>
|
<swiperTabSlide @scrollBottom="scrollBottomEv" :list="dataList" :ifloading="ifloading"></swiperTabSlide>
|
||||||
</view>
|
</view>
|
||||||
</status-container>
|
</status-container>
|
||||||
<!-- 底部tab -->
|
<!-- 底部tab -->
|
||||||
<foot-tab :current="3"></foot-tab>
|
<foot-tab current="3"></foot-tab>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="pad-x180">
|
<view class="pad-x180">
|
||||||
<!-- 底部tab -->
|
<!-- 底部tab -->
|
||||||
<foot-tab :current='4'></foot-tab>
|
<foot-tab current='4'></foot-tab>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
return {
|
return {
|
||||||
funList:[
|
funList:[
|
||||||
{url:'/pagesA/shopping-cart/shopping-cart',title:'购物车',iconsrc:'',iconWidth:60,iconHeight:60,content:'',contentColor:'#999999',ifNext:true},
|
{url:'/pagesA/shopping-cart/shopping-cart',title:'购物车',iconsrc:'',iconWidth:60,iconHeight:60,content:'',contentColor:'#999999',ifNext:true},
|
||||||
|
{url:'/pagesA/shopping-cart-slide/shopping-cart-slide',title:'购物车-滑动删除',iconsrc:'',iconWidth:60,iconHeight:60,content:'',contentColor:'#999999',ifNext:true},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -64,8 +64,6 @@
|
||||||
import addressTwo from '@/components/choose-address/address-two/address-two.vue';
|
import addressTwo from '@/components/choose-address/address-two/address-two.vue';
|
||||||
import addressThree from '@/components/choose-address/address-three/address-three.vue';
|
import addressThree from '@/components/choose-address/address-three/address-three.vue';
|
||||||
import addressFour from '@/components/choose-address/address-four/address-four.vue';
|
import addressFour from '@/components/choose-address/address-four/address-four.vue';
|
||||||
import yayaMap from '@/jsFile/map/yaya-map.js';
|
|
||||||
import yayaTime from '@/jsFile/time/yaya-time.js';
|
|
||||||
import statusContainer from '@/components/containers/status-container.vue';
|
import statusContainer from '@/components/containers/status-container.vue';
|
||||||
export default {
|
export default {
|
||||||
components:{
|
components:{
|
||||||
|
@ -100,8 +98,6 @@
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getDistrict();
|
this.getDistrict();
|
||||||
yayaMap.getAddressH5();
|
|
||||||
yayaTime.weekDate();
|
|
||||||
},
|
},
|
||||||
computed:{
|
computed:{
|
||||||
regionName(){
|
regionName(){
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<status-container titlet="购物车">
|
||||||
|
<view slot="content">
|
||||||
|
<cart-slide :list="list" :button="buttonList" :border="true" @click="clickMethod" @change="changeMethod"></cart-slide>
|
||||||
|
</view>
|
||||||
|
</status-container>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import cartSlide from '@/components/shopping-carts/cart-slide';
|
||||||
|
export default {
|
||||||
|
components:{
|
||||||
|
cartSlide
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list : [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
image: 'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',
|
||||||
|
title: '张三',
|
||||||
|
rightDetail: '2019-03-18',
|
||||||
|
detail: 'XXXXXXXXXXXXXXXXXXX公司',
|
||||||
|
slide_x: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
surname: '李',
|
||||||
|
title: '李二',
|
||||||
|
rightDetail: '2019-03-17',
|
||||||
|
detail: 'XXXXXXXXXXXXXXXXXXX公司',
|
||||||
|
slide_x: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
title: '王五',
|
||||||
|
rightDetail: '2019-03-18',
|
||||||
|
slide_x: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
surname: '李',
|
||||||
|
detail: 'XXXXXXXXXXXXXXXXXXX公司',
|
||||||
|
slide_x: 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
buttonList: [
|
||||||
|
{
|
||||||
|
title: '分享',
|
||||||
|
background: '#c4c7cd'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '删除',
|
||||||
|
background: '#ff3b32'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
changeMethod(data, button, index){
|
||||||
|
console.log('滑动按钮回调', data)
|
||||||
|
console.log('滑动按钮回调', button)
|
||||||
|
},
|
||||||
|
clickMethod(data){
|
||||||
|
console.log('点击行回调', data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
Loading…
Reference in New Issue