[..]
@@ -46,7 +46,15 @@ const userClause = () => {
|
||||
// 邀请好友
|
||||
const userInvite = () => {
|
||||
return request({
|
||||
url: 'articles/invite'
|
||||
url: 'user/invite'
|
||||
})
|
||||
}
|
||||
|
||||
// 我的伙伴
|
||||
const userPartne = (data) => {
|
||||
return request({
|
||||
url: 'user/relations',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -56,5 +64,6 @@ export {
|
||||
userCustomer,
|
||||
userHelp,
|
||||
userClause,
|
||||
userInvite
|
||||
userInvite,
|
||||
userPartne
|
||||
}
|
||||
|
||||
88
pages.json
@@ -34,6 +34,13 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "帮助中心"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/user/partner",
|
||||
"name": "userPartner",
|
||||
"auth": true,
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的伙伴"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/user/clause",
|
||||
"name": "userClause",
|
||||
@@ -42,10 +49,23 @@
|
||||
"navigationBarTitleText": "服务条款"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/instrument/basics",
|
||||
"name": "instrumentBasics",
|
||||
"path": "pages/vip/vip",
|
||||
"name": "vipIndex",
|
||||
"style": {
|
||||
"navigationBarTitleText": "企业基础信息"
|
||||
"navigationBarTitleText": "开通节点"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/vip/agree",
|
||||
"name": "vipAgree",
|
||||
"style": {
|
||||
"navigationBarTitleText": "服务条款"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/setting/setting",
|
||||
"name": "setting",
|
||||
"auth": true,
|
||||
"style": {
|
||||
"navigationBarTitleText": "设置中心"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/goods/management",
|
||||
@@ -170,6 +190,62 @@
|
||||
},
|
||||
"name": "ResetPassword"
|
||||
},{
|
||||
"path": "pages/verification/index",
|
||||
"name": "verificationIndex",
|
||||
"auth": true,
|
||||
"style": {
|
||||
"navigationBarTitleText": "扫码核销"
|
||||
}
|
||||
},{
|
||||
"path": "pages/verification/history",
|
||||
"name": "verificationHistory",
|
||||
"auth": true,
|
||||
"style": {
|
||||
"navigationBarTitleText": "核销记录"
|
||||
}
|
||||
},{
|
||||
"path": "pages/shop/lists",
|
||||
"name": "shopLists",
|
||||
"auth": true,
|
||||
"style": {
|
||||
"navigationBarTitleText": "部门/门店"
|
||||
}
|
||||
},{
|
||||
"path": "pages/shop/create",
|
||||
"name": "shopCreate",
|
||||
"auth": true,
|
||||
"style": {
|
||||
"navigationBarTitleText": "创建部门/门店"
|
||||
}
|
||||
},{
|
||||
"path": "pages/employees/list",
|
||||
"name": "employeesList",
|
||||
"auth": true,
|
||||
"style": {
|
||||
"navigationBarTitleText": "员工管理"
|
||||
}
|
||||
},{
|
||||
"path": "pages/employees/add",
|
||||
"name": "employeesAdd",
|
||||
"auth": true,
|
||||
"style": {
|
||||
"navigationBarTitleText": "添加员工"
|
||||
}
|
||||
},{
|
||||
"path": "pages/instrument/Spread",
|
||||
"name": "instrumentSpread",
|
||||
"auth": true,
|
||||
"style": {
|
||||
"navigationBarTitleText": "营销推广码"
|
||||
}
|
||||
},{
|
||||
"path": "pages/instrument/basics",
|
||||
"name": "instrumentBasics",
|
||||
"auth": true,
|
||||
"style": {
|
||||
"navigationBarTitleText": "基础信息"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/wallet/fragment",
|
||||
"style": {
|
||||
"navigationBarTitleText": "能量碎片记录",
|
||||
@@ -178,7 +254,8 @@
|
||||
"navigationBarTextStyle": "white"
|
||||
},
|
||||
"name": "Fragment"
|
||||
},{
|
||||
},
|
||||
{
|
||||
"path": "pages/wallet/addCard",
|
||||
"style": {
|
||||
"navigationBarTitleText": "添加银行卡",
|
||||
@@ -205,8 +282,7 @@
|
||||
"navigationBarTextStyle": "white"
|
||||
},
|
||||
"name": "withdrawList"
|
||||
}
|
||||
],
|
||||
}],
|
||||
"globalStyle": {
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "#F5F5F5"
|
||||
|
||||
@@ -207,7 +207,7 @@
|
||||
button{
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
background-color: $mian-color-deep;
|
||||
background-color: $mian-color;
|
||||
border-radius: 0;
|
||||
color: white;
|
||||
font-size: $title-size-lg;
|
||||
|
||||
311
pages/employees/add.vue
Normal file
@@ -0,0 +1,311 @@
|
||||
<template>
|
||||
<view class="content" v-if="!loging">
|
||||
<!-- 基础信息 -->
|
||||
<view class="info-card">
|
||||
<view class="cover">
|
||||
<view class="cover-add vertical" @click="updCover">
|
||||
<block v-if="cover.showpath != ''">
|
||||
<image :src="cover.showpath" mode="aspectFill"></image>
|
||||
</block>
|
||||
<block v-else>
|
||||
<image class="cover-default" src="@/static/icons/add-icon.png" mode="widthFix"></image>
|
||||
<view>员工寸照</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-text">
|
||||
<view class="info-inputs">
|
||||
<input type="text" v-model="name" placeholder="姓名"/>
|
||||
</view>
|
||||
<view class="info-inputs">
|
||||
<input type="number" v-model="phone" placeholder="手机号码"/>
|
||||
</view>
|
||||
<view class="info-inputs">
|
||||
<input type="text" v-model="job" placeholder="职业"/>
|
||||
</view>
|
||||
<view class="info-inputs">
|
||||
<picker :range="section" range-key="name" :value="sectionIndex" @change="pickerChange">
|
||||
<view class="picker-text">
|
||||
{{section[sectionIndex].name}}
|
||||
<uni-icons class="icon" type="arrowdown" color="#555"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="jurisdiction switch">
|
||||
<view class="item">
|
||||
<label>
|
||||
<view class="item-title">设为推荐</view>
|
||||
<view class="item-info">设为推荐员工将在企业自媒体中优先展示</view>
|
||||
<switch class="item-switch" :checked="isPosition" color="#e93340" @change="switchChange" />
|
||||
</label>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 权限设置 -->
|
||||
<view class="title">权限设置</view>
|
||||
<view class="jurisdiction">
|
||||
<checkbox-group @change="permissionChange">
|
||||
<view class="item" v-for="(item, index) in permissions" :key="index">
|
||||
<label>
|
||||
<view class="item-title">{{item.title}}</view>
|
||||
<view class="item-info">{{item.description}}</view>
|
||||
<checkbox class="item-checkbox" :checked="item.check" color="#e93340" :value="item.permission_id" />
|
||||
</label>
|
||||
</view>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
<!-- 按钮 -->
|
||||
<view class="add-btns">
|
||||
<button size="default" @click="onAddEmployees">{{type === 'PUT' ? '修改': '添加'}}</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { employeesConfig, addEmployees, employeesInfo, employeesPut } from '@/apis/interfaces/employees'
|
||||
import { uploads } from '@/apis/interfaces/uploading'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
type : '',
|
||||
loging : true,
|
||||
section : [],
|
||||
permissions : [],
|
||||
permissionIds: [],
|
||||
sectionIndex : 0,
|
||||
cover : {
|
||||
showpath : '',
|
||||
path : ''
|
||||
},
|
||||
name : '',
|
||||
phone : '',
|
||||
job : '',
|
||||
isPosition : false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
if(this.$Route.query.type === 'PUT'){
|
||||
this.type = 'PUT'
|
||||
uni.setNavigationBarTitle({
|
||||
title: '编辑员工'
|
||||
})
|
||||
}
|
||||
employeesConfig().then(res => {
|
||||
this.section = res.store
|
||||
if(this.$Route.query.type === 'PUT'){
|
||||
employeesInfo(this.$Route.query.id || 4).then(res => {
|
||||
let permissionIds = []
|
||||
for(let val of res.permission){
|
||||
if(val.check){
|
||||
permissionIds.push(val.permission_id)
|
||||
}
|
||||
}
|
||||
this.permissions = res.permission
|
||||
this.sectionIndex = this.section.findIndex(val => val.store_id == res.store.store_id)
|
||||
this.permissionIds= permissionIds
|
||||
this.name = res.name
|
||||
this.phone = res.mobile
|
||||
this.job = res.job
|
||||
this.cover = res.cover
|
||||
this.isPosition = res.is_position
|
||||
this.loging = false
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}else{
|
||||
this.permissions = res.permissions
|
||||
this.loging = false
|
||||
}
|
||||
})
|
||||
},
|
||||
methods:{
|
||||
// 设为推荐
|
||||
switchChange(e){
|
||||
this.isPosition = e.detail.value
|
||||
},
|
||||
// 选择部门
|
||||
pickerChange(e){
|
||||
this.sectionIndex = e.detail.value
|
||||
},
|
||||
// 权限选择
|
||||
permissionChange(e){
|
||||
this.permissionIds = e.detail.value
|
||||
},
|
||||
// 上传照片
|
||||
updCover(){
|
||||
uni.chooseImage({
|
||||
crop: {width: 229, height: 320},
|
||||
success: path=> {
|
||||
uploads([{
|
||||
uri : path.tempFilePaths[0]
|
||||
}]).then(res => {
|
||||
this.cover = {
|
||||
showpath: res.url[0],
|
||||
path : res.path[0]
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 添加员工
|
||||
onAddEmployees(){
|
||||
let data = {
|
||||
name : this.name,
|
||||
mobileNo : this.phone,
|
||||
job : this.job,
|
||||
cover : this.cover.path,
|
||||
position : this.isPosition ? 1: 0,
|
||||
order : 0,
|
||||
store_id : this.section[this.sectionIndex].store_id,
|
||||
permission : this.permissionIds
|
||||
}
|
||||
let submitAdd = this.type == 'PUT' ? employeesPut(this.$Route.query.id, data) : addEmployees(data)
|
||||
|
||||
submitAdd.then(res => {
|
||||
uni.showModal({
|
||||
title : '提示',
|
||||
content : res,
|
||||
showCancel : false,
|
||||
success : () => {
|
||||
this.$Router.back()
|
||||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content{
|
||||
min-height: 100vh;
|
||||
@extend .ios-bottom;
|
||||
.title{
|
||||
padding: ($padding/2) $padding;
|
||||
color: $text-gray;
|
||||
}
|
||||
.jurisdiction{
|
||||
background: white;
|
||||
&.switch{
|
||||
margin-top: $margin;
|
||||
}
|
||||
.item{
|
||||
position: relative;
|
||||
padding: $padding 150rpx $padding $padding;
|
||||
&::after{
|
||||
position: absolute;
|
||||
left: $padding;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: 1rpx;
|
||||
content: " ";
|
||||
background: $border-color;
|
||||
}
|
||||
&:last-child::after{
|
||||
display: none;
|
||||
}
|
||||
.item-checkbox{
|
||||
position: absolute;
|
||||
right: $padding;
|
||||
top: 50%;
|
||||
height: 40rpx;
|
||||
margin-top: -27rpx;
|
||||
}
|
||||
.item-switch{
|
||||
position: absolute;
|
||||
right: $padding;
|
||||
top: 50%;
|
||||
height: 40rpx;
|
||||
margin-top: -27rpx;
|
||||
}
|
||||
.item-title{
|
||||
font-size: $title-size;
|
||||
padding-bottom: $margin/3;
|
||||
}
|
||||
.item-info{
|
||||
font-size: $title-size-m;
|
||||
color: $text-gray;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 基础信息
|
||||
.info-card{
|
||||
background: white;
|
||||
padding: $padding;
|
||||
position: relative;
|
||||
min-height: 238rpx;
|
||||
.cover{
|
||||
position: absolute;
|
||||
top: $padding;
|
||||
left: $padding;
|
||||
background: #f8f8f8;
|
||||
width: 229rpx;
|
||||
height: 320rpx;
|
||||
.cover-add{
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
image{
|
||||
width: 229rpx;
|
||||
height: 320rpx;
|
||||
}
|
||||
image.cover-default{
|
||||
width: 128rpx;
|
||||
}
|
||||
color: $text-gray-m;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
}
|
||||
.info-text{
|
||||
padding-left: $padding + 229;
|
||||
.info-inputs{
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
border-bottom: solid 1rpx $border-color;
|
||||
input{
|
||||
height: 80rpx;
|
||||
}
|
||||
.picker-text{
|
||||
position: relative;
|
||||
padding-right: 80rpx;
|
||||
.icon{
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 添加按钮
|
||||
.add-btns{
|
||||
padding: $padding;
|
||||
button[size='default']{
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background: $text-price;
|
||||
font-size: $title-size;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
260
pages/employees/list.vue
Normal file
@@ -0,0 +1,260 @@
|
||||
<template>
|
||||
<view class="ios-bottom" v-if="!loding">
|
||||
<view class="header-flex">
|
||||
员工数量 {{total}} 人
|
||||
<view class="add-btn" @click="addEmployees">添加员工</view>
|
||||
</view>
|
||||
<!-- 员工列表 -->
|
||||
<uni-collapse v-if="lists.length > 0">
|
||||
<block v-for="(listItem, listIndex) in lists" :key="listIndex">
|
||||
<uni-collapse-item :show-animation="true" :open="listIndex === 0">
|
||||
<template v-slot:title>
|
||||
<view class="collapse-title">{{listItem.name}}</view>
|
||||
</template>
|
||||
<block v-if="listItem.data.length > 0">
|
||||
<view class="employees-border" v-for="(item, index) in listItem.data" :key="index">
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item :rightOptions="options" @click="onEmployees($event, listIndex, index)">
|
||||
<view class="employees-item">
|
||||
<view class="cover">
|
||||
<block v-if="item.user.avatar === ''">{{item.name.slice(0,1)}}</block>
|
||||
<block v-else>
|
||||
<image class="cover-img" :src="item.user.avatar" mode="aspectFill"></image>
|
||||
</block>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="nickname nowrap">{{item.name}}<text>{{item.job}}</text></view>
|
||||
<view class="job nowrap">
|
||||
<text v-for="(permissionItem, permissionIndex) in item.permission" :key="permissionIndex">{{permissionItem}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-swipe-action-item>
|
||||
</uni-swipe-action>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<view class="employees-null">店铺暂无员工</view>
|
||||
</block>
|
||||
</uni-collapse-item>
|
||||
</block>
|
||||
</uni-collapse>
|
||||
<view v-else class="list-null">
|
||||
<image class="icon" src="@/static/icons/listnull-icon.png" mode="widthFix" />
|
||||
<view class="sub-title">暂未添加员工</view>
|
||||
<view class="sub-btn" @click="$Router.push({name: 'employeesAdd'})">添加员工</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { employees, employeesDelete } from '@/apis/interfaces/employees'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loding : true,
|
||||
lists : [],
|
||||
total : 0,
|
||||
options : [{
|
||||
text : '编辑',
|
||||
type : 'PUT',
|
||||
style : {
|
||||
backgroundColor: '#3688ee'
|
||||
}
|
||||
},{
|
||||
text : '删除',
|
||||
type : 'DELETE',
|
||||
style : {
|
||||
backgroundColor: '#e93340'
|
||||
}
|
||||
}]
|
||||
};
|
||||
},
|
||||
onShow(){
|
||||
employees().then(res => {
|
||||
this.lists = res.data
|
||||
this.total = res.total
|
||||
this.loding = false
|
||||
})
|
||||
},
|
||||
methods:{
|
||||
// 编辑,删除
|
||||
onEmployees(e, upIndex, index){
|
||||
let type = e.content.type,
|
||||
val = this.lists[upIndex].data[index]
|
||||
if(type == 'PUT'){
|
||||
this.$Router.push({name: 'addEmployees', params: {type: 'PUT', id: val.employee_id}})
|
||||
return
|
||||
}
|
||||
uni.showModal({
|
||||
title : '提示',
|
||||
content : '删除后无法恢复,确定删除员工[' + val.name + ']吗?',
|
||||
cancelText : '取消',
|
||||
cancelColor : '#555',
|
||||
confirmText : '确认',
|
||||
confirmColor: '#e93340',
|
||||
success : res => {
|
||||
if(res.confirm) {
|
||||
employeesDelete(val.employee_id).then(res => {
|
||||
uni.showToast({
|
||||
title: res,
|
||||
icon : 'none'
|
||||
})
|
||||
this.lists[upIndex].data.splice(index, 1)
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 添加员工
|
||||
addEmployees(){
|
||||
if(this.lists.length <= 0){
|
||||
uni.showModal({
|
||||
title : '提示',
|
||||
content : '暂未创建门店,无法添加员工',
|
||||
cancelText : '稍后创建',
|
||||
cancelColor : '#555',
|
||||
confirmText : '立即创建',
|
||||
confirmColor: '#e93340',
|
||||
success : res => {
|
||||
if(res.confirm) {
|
||||
this.$Router.push({name: 'shopCreate'})
|
||||
}
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
this.$Router.push({name: 'employeesAdd'})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.collapse-title{
|
||||
padding: 0 $padding;
|
||||
line-height: 90rpx;
|
||||
font-weight: bold;
|
||||
font-size: $title-size-lg;
|
||||
}
|
||||
.employees-item {
|
||||
background: white;
|
||||
padding: ($padding - 10) $padding;
|
||||
position: relative;
|
||||
&::before {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: $padding + 98;
|
||||
right: 0;
|
||||
content: ' ';
|
||||
height: 1rpx;
|
||||
background: $border-color;
|
||||
}
|
||||
.cover {
|
||||
position: absolute;
|
||||
top: $padding - 10;
|
||||
left: $padding;
|
||||
background: $text-price;
|
||||
color: white;
|
||||
height: 88rpx;
|
||||
width: 88rpx;
|
||||
line-height: 88rpx;
|
||||
text-align: center;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
font-size: $title-size-lg;
|
||||
.cover-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
.content {
|
||||
height: 88rpx;
|
||||
padding-left: 108rpx;
|
||||
.nickname{
|
||||
line-height: 40rpx;
|
||||
font-size: $title-size;
|
||||
padding-bottom: 10rpx;
|
||||
text{
|
||||
font-size: $title-size-sm;
|
||||
color: $text-gray-m;
|
||||
padding-left: 10rpx;
|
||||
}
|
||||
}
|
||||
.job{
|
||||
line-height: 38rpx;
|
||||
text{
|
||||
background-color: $border-color-lg;
|
||||
color: $text-gray;
|
||||
padding: 0 10rpx;
|
||||
line-height: 38rpx;
|
||||
margin-left: $margin/2;
|
||||
display: inline-block;
|
||||
&:first-child{
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 空提示
|
||||
.list-null{
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
background: white;
|
||||
padding-bottom: 20vh;
|
||||
@extend .vertical;
|
||||
.sub-title{
|
||||
color: $text-gray;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
.icon{
|
||||
width: 288rpx;
|
||||
}
|
||||
.sub-btn{
|
||||
width: 200rpx;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
text-align: center;
|
||||
background: $mian-color;
|
||||
color: white;
|
||||
display: inline-block;
|
||||
margin-top: $margin*2;
|
||||
}
|
||||
}
|
||||
.employees-null{
|
||||
text-align: center;
|
||||
line-height: 10vh;
|
||||
padding-bottom: $padding;
|
||||
font-size: $title-size-m;
|
||||
color: $text-gray;
|
||||
}
|
||||
|
||||
// 添加员工header
|
||||
.header-flex{
|
||||
background: white;
|
||||
padding: ($padding/2) $padding;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: $margin - 10;
|
||||
line-height: 60rpx;
|
||||
color: $text-gray;
|
||||
.add-btn{
|
||||
background: $mian-color;
|
||||
color: white;
|
||||
width: 150rpx;
|
||||
text-align: center;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,51 +1,60 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<!-- 水晶获得公告 -->
|
||||
<view class="notice" v-if="notice.length >= 1">
|
||||
<swiper class="notice-swiper" :vertical="true" autoplay circular>
|
||||
<swiper-item v-for="(item, index) in notice" :key="index">
|
||||
<view class="notice-item">
|
||||
<image class="notice-cover" :src="item.avatar" mode="aspectFill"></image>
|
||||
<view class="notice-title ellipsis">{{item.nickname}} {{item.title}} {{item.amount}}</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
<!-- 账户余额 -->
|
||||
<view class="info">
|
||||
<view class="info-number">
|
||||
<image class="number-background number-rotate" src="@/static/background/chain-back-01.png" />
|
||||
<view class="info-content webkit-box">
|
||||
<view class="text">{{isAuth ? '持有原石量': '恒量发行原石量'}}<uni-icons class="help-icon" @click="showHelp('occ')" type="help-filled" size="18" color="#fff" /></view>
|
||||
<view class="number">{{occ}}</view>
|
||||
<view class="login" @click="$Router.push({name: 'Login'})" v-if="!isAuth">立即登录</view>
|
||||
<view class="login" @click="openWallet" v-else>我的钱包</view>
|
||||
<view class="total">
|
||||
<view class="item nowrap"><image src="@/static/icons/gemstone-icon.png"/>能量球 99</view>
|
||||
<view class="item nowrap"><image src="@/static/icons/crystal-icon.png"/>能量碎片 11</view>
|
||||
</view>
|
||||
<!-- 矿机 -->
|
||||
<view class="ore">
|
||||
<image class="ore-back" src="@/static/background/chain-back-00.png" mode="widthFix"></image>
|
||||
<view class="ball">
|
||||
<view class="shadow"></view>
|
||||
</view>
|
||||
<view class="ore-lists">
|
||||
<view class="oct-float ore-item" v-for="(item, index) in crystalArr" :key="index" @click="ledCrystal(index)">
|
||||
<block v-if="item.amount !== null">
|
||||
<image src="/static/imgs/crystal-ore-icon.png" mode="widthFix" class="icon" />
|
||||
<view class="text">能量碎片{{ item.amount || '-'}}</view>
|
||||
</block>
|
||||
</view>
|
||||
<navigator url="../index/index" open-type="switchTab" hover-class="none" class="oct-float ore-item-nav">
|
||||
<image src="/static/imgs/gemstone-ore-icon.png" mode="widthFix" class="icon" />
|
||||
<view class="text">购物<uni-icons type="arrowright" color="#FFFFFF" size="14"></uni-icons></view>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 任务分类 -->
|
||||
<scroll-view class="task-block" scroll-x="true">
|
||||
<view class="item" v-for="(item, index) in categoryArr" :key="index" @click="JumpUrl(item.url, item.title)">
|
||||
<view class="text">{{ item.remark }}</view>
|
||||
<view class="icon">
|
||||
<image :src="item.cover" />
|
||||
</view>
|
||||
<!-- 公告信息 -->
|
||||
<!-- <view class="increase">今日消费100元,预计原石单价增长0.1%</view> -->
|
||||
<view class="title">{{ item.title }}</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 平台概况 -->
|
||||
<view class="situation">
|
||||
<view class="header">
|
||||
<view class="header-item">
|
||||
<view class="title">平台原石余量<uni-icons class="help-icon" @click="showHelp('occBalance')" type="help-filled" size="18" color="#009b69" /></view>
|
||||
<view class="title">平台原石余量<uni-icons class="help-icon" @click="showHelp('occBalance')" type="help-filled" size="18" color="rgba(255,255,255,.3)" /></view>
|
||||
<view class="number ellipsis">{{ occBalance }}</view>
|
||||
</view>
|
||||
<view class="header-item">
|
||||
<view class="title">昨日瓜分水晶<uni-icons class="help-icon" @click="showHelp('yesterdayCrystal')" type="help-filled" size="18" color="#009b69" /></view>
|
||||
<view class="title">昨日瓜分水晶<uni-icons class="help-icon" @click="showHelp('yesterdayCrystal')" type="help-filled" size="18" color="rgba(255,255,255,.3)" /></view>
|
||||
<view class="number ellipsis">{{ yesterdayCrystal }}</view>
|
||||
</view>
|
||||
<view class="header-item">
|
||||
<view class="title">区块链高度<uni-icons class="help-icon" @click="showHelp('blockHeight')" type="help-filled" size="18" color="#009b69" /></view>
|
||||
<view class="title">区块链高度<uni-icons class="help-icon" @click="showHelp('blockHeight')" type="help-filled" size="18" color="rgba(255,255,255,.3)" /></view>
|
||||
<view class="number ellipsis">{{ blockHeight }}</view>
|
||||
</view>
|
||||
<view class="header-item">
|
||||
<view class="title">平台累计盈利额<uni-icons class="help-icon" @click="showHelp('gain')" type="help-filled" size="18" color="#009b69" /></view>
|
||||
<view class="title">平台累计盈利额<uni-icons class="help-icon" @click="showHelp('gain')" type="help-filled" size="18" color="rgba(255,255,255,.3)" /></view>
|
||||
<view class="number ellipsis">{{ gain }}</view>
|
||||
</view>
|
||||
<view class="header-item">
|
||||
<view class="title">已开通节点数<uni-icons class="help-icon" @click="showHelp('nodeNumber')" type="help-filled" size="18" color="#009b69" /></view>
|
||||
<view class="title">已开通节点数<uni-icons class="help-icon" @click="showHelp('nodeNumber')" type="help-filled" size="18" color="rgba(255,255,255,.3)" /></view>
|
||||
<view class="number ellipsis">{{ nodeNumber }}</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -93,11 +102,10 @@
|
||||
import F2 from '@/uni_modules/lime-f2/components/lime-f2/f2.min.js'
|
||||
import lF2 from '@/uni_modules/lime-f2/components/lime-f2/'
|
||||
export default {
|
||||
components: {
|
||||
lF2
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
crystalArr : [],
|
||||
categoryArr : [],
|
||||
occs: {},
|
||||
blockHeight: 0,
|
||||
occBalance: 0,
|
||||
@@ -179,6 +187,7 @@
|
||||
// occ信息
|
||||
getOcc(){
|
||||
occ().then(res => {
|
||||
console.log(res)
|
||||
this.occs = res.occs
|
||||
this.yesterdayCrystal = res.yesterday_crystal
|
||||
this.occ = res.occ
|
||||
@@ -190,7 +199,10 @@
|
||||
if(res.help_toast) this.helpToast = res.help_toast
|
||||
this.showCartc(res.movements)
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 绘制图表
|
||||
@@ -264,154 +276,100 @@
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 气泡漂浮 */
|
||||
.number-float{
|
||||
/* 星球旋转 */
|
||||
.ball{
|
||||
position: absolute;
|
||||
height: 480rpx;
|
||||
width: 480rpx;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-top: -240rpx;
|
||||
margin-left: -240rpx;
|
||||
border-radius: 50%;
|
||||
-webkit-transform-style: preserve-3d;
|
||||
background: url(/static/background/chain-back-02.png) repeat-x;
|
||||
background-size: auto 100%;
|
||||
-webkit-animation: move-map 30s infinite linear;
|
||||
-moz-animation: move-map 30s infinite linear;
|
||||
-o-animation: move-map 30s infinite linear;
|
||||
-ms-animation: move-map 30s infinite linear;
|
||||
animation: move-map 30s infinite linear;
|
||||
box-shadow: 0 0 50rpx 50rpx rgba(31,25,34, .2);
|
||||
}
|
||||
.shadow{
|
||||
position: absolute;
|
||||
top: 1%;
|
||||
left: 5%;
|
||||
width: 90%;
|
||||
height: 90%;
|
||||
border-radius: 50%;
|
||||
filter: blur(5px);
|
||||
z-index: 3;
|
||||
background: radial-gradient(circle at 50% 0, rgba(255,255,255, .6) , rgba(255, 255, 255, .0) 58%);
|
||||
}
|
||||
.ball:before,
|
||||
.ball::after{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
content: "";
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
filter: blur(5px);
|
||||
z-index: 2;
|
||||
}
|
||||
.ball:before {
|
||||
background: radial-gradient(circle at 100% 50%, #5881d3 , rgba(255, 255, 255, .0) 45%);
|
||||
}
|
||||
.ball::after {
|
||||
background: radial-gradient(circle at 0 50%, #ca66e0 , rgba(255, 255, 255, .0) 45%);
|
||||
}
|
||||
@-webkit-keyframes move-map {
|
||||
0% {background-position: -1250rpx 0; }
|
||||
100% {background-position: 0 0;}
|
||||
}
|
||||
@-ms-keyframes move-map {
|
||||
0% {background-position: -1250rpx 0; }
|
||||
100% {background-position: 0 0;}
|
||||
}
|
||||
|
||||
@keyframes move-map {
|
||||
0% {background-position: -1250rpx 0; }
|
||||
100% {background-position: 0 0;}
|
||||
}
|
||||
|
||||
/* 水晶漂浮动画 */
|
||||
.oct-float {
|
||||
animation: 4s octfloat infinite;
|
||||
}
|
||||
@keyframes octfloat{
|
||||
0%{
|
||||
@keyframes octfloat {
|
||||
0% {
|
||||
margin-top: 0;
|
||||
}
|
||||
50%{
|
||||
|
||||
50% {
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
100%{
|
||||
|
||||
100% {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
/* 背景旋转 */
|
||||
.number-rotate{
|
||||
animation: 30s octrotate infinite linear;
|
||||
}
|
||||
@keyframes octrotate{
|
||||
from{
|
||||
transform:rotate(0deg);
|
||||
}
|
||||
to{
|
||||
transform:rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
// 背景
|
||||
<style lang="scss" scoped>
|
||||
.content{
|
||||
background: $mian-color-deep;
|
||||
min-height: 100vh;
|
||||
padding-top: var(--status-bar-height);
|
||||
box-sizing: border-box;
|
||||
background-image: url(@/static/background/chain-back-00.png);
|
||||
background-size: 100%;
|
||||
background-position: top center;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
// 求助icon
|
||||
.help-icon{
|
||||
vertical-align: middle;
|
||||
margin-bottom: 4px;
|
||||
margin-left: $margin/2;
|
||||
opacity: .7;
|
||||
}
|
||||
// 原石账户
|
||||
.info{
|
||||
margin-top: calc(#{$margin * 2} + 60rpx);
|
||||
padding: var(--status-bar-height) $padding * 2 $padding * 3;
|
||||
text-align: center;
|
||||
.info-number{
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 568rpx;
|
||||
height: 568rpx;
|
||||
.number-background{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.info-content{
|
||||
position: absolute;
|
||||
top: 12%;
|
||||
left: 12%;
|
||||
width: 76%;
|
||||
height: 76%;
|
||||
background-image: url(@/static/background/chain-back-02.png);
|
||||
background-size: cover;
|
||||
color: white;
|
||||
.text{
|
||||
font-size: $title-size-m;
|
||||
text-shadow: 2rpx 2rpx 0 rgba($color: $mian-color-deep, $alpha: .5);
|
||||
}
|
||||
.number{
|
||||
font-weight: bold;
|
||||
font-size: $title-size + 8;
|
||||
line-height: 70rpx;
|
||||
text-shadow: 2rpx 2rpx 0 rgba($color: $mian-color-deep, $alpha: .5);
|
||||
}
|
||||
.login{
|
||||
margin-top: $margin;
|
||||
background-color: $mian-color;
|
||||
display: inline-block;
|
||||
padding: ( $padding / 2 ) $padding;
|
||||
font-size: $title-size-m;
|
||||
border-radius: 30rpx;
|
||||
border:solid 1rpx $mian-color-deep;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 预计增长
|
||||
.increase{
|
||||
margin: 0 ($margin + $margin / 2) ($margin * 2);
|
||||
background: rgba($color: $mian-color, $alpha: .1);
|
||||
text-align: center;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
font-size: $title-size-m;
|
||||
color: $mian-color;
|
||||
border-radius: $radius-sm;
|
||||
padding: 0 $padding;
|
||||
}
|
||||
// 公告信息
|
||||
.notice{
|
||||
position: fixed;
|
||||
top: $margin * 2;
|
||||
left: $margin + $margin / 2;
|
||||
right: $margin + $margin / 2;
|
||||
padding-top: var(--status-bar-height);
|
||||
z-index: 99;
|
||||
.notice-swiper{
|
||||
height: 60rpx;
|
||||
}
|
||||
.notice-item{
|
||||
position: relative;
|
||||
height: 60rpx;
|
||||
padding-left: 80rpx;
|
||||
padding-right: $padding * 2;
|
||||
display: inline-block;
|
||||
background: rgba($color: $mian-color-deep, $alpha: .3);
|
||||
border-radius: 30rpx;
|
||||
box-sizing: border-box;
|
||||
max-width: 100%;
|
||||
.notice-cover{
|
||||
position: absolute;
|
||||
height: 60rpx;
|
||||
width: 60rpx;
|
||||
left: 0;
|
||||
top: 0;
|
||||
background-color: $mian-color-deep;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.notice-title{
|
||||
line-height: 60rpx;
|
||||
color: white;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
}
|
||||
min-height: calc(100vh - 60px);
|
||||
background: #1f1922;
|
||||
overflow: hidden;
|
||||
}
|
||||
// 平台概况
|
||||
.situation{
|
||||
margin: 0 ($margin + $margin / 2);
|
||||
background-image: linear-gradient(to bottom, rgba($color: $mian-color, $alpha: .1), $mian-color-deep);
|
||||
border-radius: $radius-sm;
|
||||
padding: $padding;
|
||||
margin: 0 $margin;
|
||||
background-image: linear-gradient(to bottom, $block-color, #1f1922);
|
||||
border-radius: $radius;
|
||||
padding: $padding $padding/2 $padding*2;
|
||||
// 平台统计
|
||||
.header{
|
||||
display: flex;
|
||||
@@ -419,23 +377,22 @@
|
||||
margin-bottom: $margin*2;
|
||||
.number{
|
||||
color: white;
|
||||
font-size: $title-size + 4;
|
||||
font-size: $title-size;
|
||||
padding-top: $padding/2;
|
||||
font-weight: bold;
|
||||
line-height: 90rpx;
|
||||
}
|
||||
.title{
|
||||
color: $mian-color;
|
||||
font-weight: bold;
|
||||
color: rgba($color: white, $alpha: .4);
|
||||
font-size: $title-size-sm;
|
||||
}
|
||||
.header-item{
|
||||
width: 50%;
|
||||
padding: $padding $padding / 2;
|
||||
padding: $padding / 2;
|
||||
box-sizing: border-box;
|
||||
&:first-child{
|
||||
width: 100%;
|
||||
.number{
|
||||
font-size: $title-size + 10;
|
||||
font-size: $title-size;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -446,12 +403,12 @@
|
||||
flex-wrap: wrap;
|
||||
margin: 0 -$margin / 2;
|
||||
.node-item{
|
||||
background: rgba($color: $mian-color, $alpha: .2);
|
||||
background: rgba($color: $block-color, $alpha: .8);
|
||||
width: calc(50% - #{$margin});
|
||||
margin: $margin / 2;
|
||||
padding: $padding;
|
||||
box-sizing: border-box;
|
||||
border-radius: $radius-sm;
|
||||
border-radius: $radius/2;
|
||||
}
|
||||
.number{
|
||||
font-size: $title-size + 4;
|
||||
@@ -459,21 +416,20 @@
|
||||
color: white;
|
||||
}
|
||||
.title{
|
||||
font-size: $title-size-m;
|
||||
font-weight: bold;
|
||||
color: rgba($color: white, $alpha: .7);
|
||||
font-size: $title-size-sm;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
// 图表
|
||||
.chart{
|
||||
background: rgba($color: $mian-color, $alpha: .2);
|
||||
background: rgba($color: $block-color, $alpha: .8);
|
||||
padding: $padding;
|
||||
border-radius: $radius-sm;
|
||||
margin-top: $margin*2;
|
||||
border-radius: $radius/2;
|
||||
margin-top: $margin;
|
||||
.title{
|
||||
text-align: center;
|
||||
line-height: 80rpx;
|
||||
color: rgba($color: $mian-color, $alpha: 1.0);
|
||||
color: white;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
.chart-f2{
|
||||
@@ -481,4 +437,137 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
// 数据统计
|
||||
.total {
|
||||
position: relative;
|
||||
margin: $margin;
|
||||
background: #2b2449;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
border-radius: $radius;
|
||||
.item {
|
||||
width: 50%;
|
||||
padding: 0 $padding;
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-size: $title-size-sm;
|
||||
line-height: 76rpx;
|
||||
image{
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
vertical-align: top;
|
||||
margin-top: calc((76rpx - 38rpx) / 2);
|
||||
margin-right: $margin / 2;
|
||||
}
|
||||
}
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
content: "";
|
||||
width: 2rpx;
|
||||
left: 50%;
|
||||
background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, .7), transparent);
|
||||
}
|
||||
}
|
||||
// 求助icon
|
||||
.help-icon{
|
||||
vertical-align: middle;
|
||||
margin-left: $margin/3;
|
||||
opacity: .7;
|
||||
}
|
||||
// 矿石
|
||||
.ore {
|
||||
position: relative;
|
||||
padding-top: 120%;
|
||||
&>image {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
.ore-lists {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
.oct-float-item{
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
.text {
|
||||
margin-top: $margin / 2;
|
||||
color: white;
|
||||
font-size: $title-size-sm;
|
||||
line-height: 40rpx;
|
||||
text-shadow: 0 3rpx 3rpx rgba($color: #000000, $alpha: .2);
|
||||
}
|
||||
.icon {
|
||||
width: 58rpx;
|
||||
vertical-align: top;
|
||||
}
|
||||
}
|
||||
.ore-item-nav{
|
||||
@extend .oct-float-item;
|
||||
right: $margin * 3;
|
||||
top: 12%;
|
||||
}
|
||||
.ore-item {
|
||||
@extend .oct-float-item;
|
||||
&:nth-child(1) { top: 16%; left: 13%; }
|
||||
&:nth-child(2) { top: 50%; right: 10%; }
|
||||
&:nth-child(3) { top: 23%; right: 20%; }
|
||||
&:nth-child(4) { top: 70%; left: 33%;}
|
||||
&:nth-child(5) { top: 40%; left: 20%; }
|
||||
&:nth-child(6) { top: 58%; left: 10%;}
|
||||
&:nth-child(7) { top: 10%; right: 43%;}
|
||||
&:nth-child(8) { top: 46%; right: 29%;}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 任务
|
||||
.task-block {
|
||||
white-space: nowrap;
|
||||
.item {
|
||||
background: rgba($color: $mian-color, $alpha: .2);
|
||||
display: inline-block;
|
||||
margin-left: $margin;
|
||||
width: 210rpx;
|
||||
padding: $padding * 2 $padding;
|
||||
border-radius: $radius;
|
||||
box-sizing: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .06);
|
||||
text-align: center;
|
||||
&:first-child {
|
||||
margin-left: $margin + $margin/2;
|
||||
}
|
||||
&:last-child {
|
||||
margin-right: $margin + $margin/2;
|
||||
}
|
||||
.icon {
|
||||
display: inline-block;
|
||||
margin: $margin 0;
|
||||
width: 98rpx;
|
||||
height: 98rpx;
|
||||
line-height: 98rpx;
|
||||
background: $mian-color-deep;
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
image {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
.text {
|
||||
font-size: $title-size-m;
|
||||
color: $mian-color;
|
||||
}
|
||||
.title {
|
||||
font-size: $title-size;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
249
pages/instrument/Spread.vue
Normal file
@@ -0,0 +1,249 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<view class="codeContent">
|
||||
<image class="codeContent-back" src="../../static/icons/store_codeBack.png" mode="widthFix"></image>
|
||||
<image class="codeContent-cont" src="../../static/icons/store_contBack.png" mode="widthFix"></image>
|
||||
<view class="textContent">
|
||||
<view class="company">
|
||||
<image class="company-logo" :src="companyInfo.cover" mode="aspectFill"></image>
|
||||
<view class="company-cont">
|
||||
<view class="nowrap company-name">{{companyInfo.name}}</view>
|
||||
<view class="company-tips">易货平台</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="code">
|
||||
<image class="code-img" :src="companyInfo.code" mode="aspectFit"></image>
|
||||
<!-- <view class="code-text">简单扫一扫,即可进入平台</view> -->
|
||||
</view>
|
||||
<!-- @click="shareCanvas" -->
|
||||
<view class="codeBnt">
|
||||
扫码推广
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<canvas class="codeImg" canvas-id="qrcodeCard"></canvas>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { companiesCode } from '@/apis/interfaces/store'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
companyInfo : ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
companiesCode().then(res=>{
|
||||
this.companyInfo = res
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 绘制图片
|
||||
shareCanvas(e){
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
})
|
||||
|
||||
// 下载头像
|
||||
let avatarImg = new Promise(success=>{
|
||||
uni.getImageInfo({
|
||||
src : this.companyInfo.cover,
|
||||
success : res => {
|
||||
success(res.path)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// 下载二维码
|
||||
let codeImg = new Promise(success => {
|
||||
uni.getImageInfo({
|
||||
src : this.companyInfo.code,
|
||||
success : res => {
|
||||
success(res.path)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Promise.all([avatarImg, codeImg]).then(res => {
|
||||
// 绘制海报
|
||||
const ctx = uni.createCanvasContext('qrcodeCard')
|
||||
ctx.save()
|
||||
|
||||
// 绘制背景图片
|
||||
ctx.drawImage('../../static/icons/store_downBack', 0, 0, 375, 603)
|
||||
|
||||
// 绘制头像
|
||||
ctx.drawImage(res[0], 0, 0, 60, 60)
|
||||
|
||||
// 绘制二维码
|
||||
ctx.drawImage(res[1], 140, 250, 110, 110)
|
||||
|
||||
// 文字
|
||||
ctx.setFontSize(16)
|
||||
ctx.fillText(this.companyInfo.name, 194, 180 , 270)
|
||||
|
||||
ctx.setFontSize(16)
|
||||
ctx.fillText('邀请你加入易货平台', 194, 180 , 270)
|
||||
|
||||
ctx.save();
|
||||
ctx.beginPath(); //开始绘制
|
||||
ctx.arc(50 / 2 + 170, 50 / 2 + 110, 50 / 2, 0, Math.PI * 2, false);
|
||||
ctx.clip();
|
||||
|
||||
// 保存图片
|
||||
ctx.draw(true, () => {
|
||||
uni.hideLoading()
|
||||
uni.canvasToTempFilePath({
|
||||
canvasId: 'qrcodeCard',
|
||||
x: 0,
|
||||
y: 0,
|
||||
success: res => {
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: res.tempFilePath,
|
||||
success : res=>{
|
||||
if (res.errMsg == "saveImageToPhotosAlbum:ok"){
|
||||
uni.showToast({
|
||||
title: '分享海报已保存至相册',
|
||||
icon : 'none'
|
||||
})
|
||||
}else{
|
||||
uni.hideLoading()
|
||||
}
|
||||
},
|
||||
fail : err=>{
|
||||
if (err.errMsg == "saveImageToPhotosAlbum:fail auth deny"){
|
||||
uni.showModal({
|
||||
title : '提示',
|
||||
content : '暂未授权小程序写入您的相册,无法存储二维码海报',
|
||||
confirmColor: '#d82526',
|
||||
confirmText : '去设置',
|
||||
success : res=>{
|
||||
if (res.confirm){
|
||||
uni.openSetting()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
}).catch(err=>{
|
||||
uni.showToast({
|
||||
title: '海报下载,请检查网络',
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
background-color: #e93340;
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.codeContent {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
.codeContent-back {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
}
|
||||
.codeContent-cont {
|
||||
left: 5%;
|
||||
width: 90%;
|
||||
top: 100px;
|
||||
z-index: 2;
|
||||
position: absolute;
|
||||
}
|
||||
.codeContent-tips {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 20rpx;
|
||||
width: 200rpx;
|
||||
z-index: 2;
|
||||
}
|
||||
.textContent {
|
||||
position: absolute;
|
||||
padding: 20rpx 20rpx 0 40rpx;
|
||||
box-sizing: border-box;
|
||||
width: 70%;
|
||||
z-index: 3;
|
||||
left: 15%;
|
||||
right: 15%;
|
||||
top: 140px;
|
||||
}
|
||||
.company {
|
||||
width: 100%;
|
||||
.company-logo {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.company-cont {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 230rpx;
|
||||
left: 0;
|
||||
top: 0;
|
||||
padding: 20rpx 20rpx 30rpx 210rpx;
|
||||
font-size: $title-size;
|
||||
.company-name {
|
||||
font-weight: 600;
|
||||
margin: 10rpx 0;
|
||||
}
|
||||
.company-tips {
|
||||
font-size: 26rpx;
|
||||
color: #787878;
|
||||
}
|
||||
}
|
||||
}
|
||||
.code {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: $margin;
|
||||
.code-img {
|
||||
width: 90%;
|
||||
}
|
||||
.code-text {
|
||||
color: #787878;
|
||||
margin-top: $margin - 10;
|
||||
font-size: $title-size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.codeBnt {
|
||||
background-color: #e1293f;
|
||||
text-align: center;
|
||||
border-radius: 10rpx;
|
||||
line-height: 90rpx;
|
||||
font-weight: 600;
|
||||
font-size: $title-size;
|
||||
color: #FFFFFF;
|
||||
box-shadow: 4rpx 0 10rpx rgba(155,0,19,.5);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* canvas */
|
||||
.codeImg {
|
||||
position: absolute;
|
||||
left: -1000%;
|
||||
height: 603px;
|
||||
width: 375px;
|
||||
background: white;
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="News-detail" v-if="loaded">
|
||||
<view class="item" v-for="(item,index) in items" v-if="items.length>0"
|
||||
<view class="item" v-for="(item,index) in items" :key="index" v-if="items.length>0"
|
||||
@click="item.read_at === ''?read(index,item):noread(item)">
|
||||
<view class="top">
|
||||
<image src="/static/images/news_2_1.png" mode="widthFix"></image>
|
||||
|
||||
327
pages/shop/create.vue
Normal file
@@ -0,0 +1,327 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="create-form">
|
||||
<view class="header">
|
||||
<view @click="updLogo">
|
||||
<image class="logo" style="border: none;" v-if="cover.showpath" :src="cover.showpath" mode="aspectFill" />
|
||||
<image class="logo" v-else src="@/static/icons/add-icon.png" mode="aspectFill" />
|
||||
</view>
|
||||
<view class="inputs">
|
||||
<input type="text" v-model="name" placeholder="门店/部门名称" />
|
||||
</view>
|
||||
<view class="inputs">
|
||||
<input type="number" v-model="mobile" placeholder="门店联系电话" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="inputs">
|
||||
<label class="inputs-label">开店时间</label>
|
||||
<picker mode="time" @change="pickerTime" :value="startTime" data-key="startTime">
|
||||
<view class="time-text">
|
||||
{{startTime || '选择开店时间'}}
|
||||
<uni-icons class="time-icon" type="arrowdown" size="18" color="#999"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="inputs">
|
||||
<label class="inputs-label">闭店时间</label>
|
||||
<picker mode="time" @change="pickerTime" :value="endTime" data-key="endTime">
|
||||
<view class="time-text">
|
||||
{{endTime || '选择闭店时间'}}
|
||||
<uni-icons class="time-icon" type="arrowdown" size="18" color="#999"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="inputs addrss-input">
|
||||
<label class="inputs-label">门店地址</label>
|
||||
<textarea class="inputs-textarea" v-model="address" placeholder="输入门店地址" auto-height/>
|
||||
<view class="addrss-icon" @click="onLocation">
|
||||
<uni-icons type="location-filled" size="20" color="#c82626"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="inputs">
|
||||
<label class="inputs-label">门店简介</label>
|
||||
<textarea class="inputs-textarea" v-model="description" placeholder="门店简介..." />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="create-btns">
|
||||
<button class="item-btn btn-submit" type="default" @click="createShop">{{type === 'add' ? '创建': '保存'}}</button>
|
||||
<button class="item-btn btn-delete" type="default" @click="onDeleteShop" v-if="type === 'edit'">删除</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { create, putShop, deleteShop, editInfo } from '@/apis/interfaces/shop'
|
||||
import { uploads } from '@/apis/interfaces/uploading'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
type : 'add',
|
||||
id : '',
|
||||
cover : {
|
||||
showpath: '',
|
||||
path : '',
|
||||
},
|
||||
name : '',
|
||||
mobile : '',
|
||||
address : '',
|
||||
startTime : '',
|
||||
endTime : '',
|
||||
description : '',
|
||||
latitude : '',
|
||||
longitude : ''
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
if(this.$Route.query.id){
|
||||
this.type = 'edit'
|
||||
this.getInfo()
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
// 获取编辑信息
|
||||
getInfo(){
|
||||
editInfo(this.$Route.query.id).then(res => {
|
||||
this.id = res.store_id
|
||||
this.cover = res.cover
|
||||
this.name = res.name
|
||||
this.mobile = res.mobile
|
||||
this.address = res.address
|
||||
this.startTime = res.start_time
|
||||
this.endTime = res.end_time
|
||||
this.description= res.description
|
||||
this.latitude = res.latitude
|
||||
this.longitude = res.longitude
|
||||
})
|
||||
},
|
||||
// 获取地址
|
||||
onLocation(){
|
||||
uni.chooseLocation({
|
||||
success: res => {
|
||||
this.address = res.address
|
||||
this.longitude = res.longitude
|
||||
this.latitude = res.latitude
|
||||
},
|
||||
fail: err => {
|
||||
uni.showToast({
|
||||
title: err,
|
||||
icon : 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 选择营业时间
|
||||
pickerTime(e){
|
||||
this[e.target.dataset.key] = e.detail.value
|
||||
},
|
||||
// 编辑创建
|
||||
createShop(){
|
||||
let data = {
|
||||
cover : this.cover.path,
|
||||
name : this.name,
|
||||
mobile : this.mobile,
|
||||
address : this.address,
|
||||
latitude : this.latitude,
|
||||
longitude : this.longitude,
|
||||
description : this.description,
|
||||
start_time : this.startTime,
|
||||
end_time : this.endTime
|
||||
}
|
||||
|
||||
if(this.type === 'edit'){
|
||||
putShop(this.id, {...data}).then(res => {
|
||||
uni.showModal({
|
||||
title : '提示',
|
||||
content : res,
|
||||
showCancel : false,
|
||||
success : modalRes => {
|
||||
this.$Router.back()
|
||||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
return
|
||||
}
|
||||
create({...data}).then(res => {
|
||||
uni.showModal({
|
||||
title : '提示',
|
||||
content : res,
|
||||
showCancel : false,
|
||||
success : modalRes => {
|
||||
this.$Router.back()
|
||||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 删除门店
|
||||
onDeleteShop(){
|
||||
deleteShop(this.id).then(res => {
|
||||
uni.showModal({
|
||||
title : '提示',
|
||||
content : res,
|
||||
showCancel : false,
|
||||
success : modalRes => {
|
||||
this.$Router.back()
|
||||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 上传logo
|
||||
updLogo(){
|
||||
uni.chooseImage({
|
||||
crop: { width: 188, height: 188 },
|
||||
success: path => {
|
||||
uploads([{
|
||||
name: 'logo',
|
||||
uri : path.tempFilePaths[0]
|
||||
}]).then(res => {
|
||||
this.cover = {
|
||||
showpath: res.url[0],
|
||||
path: res.path[0]
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 门店信息
|
||||
.create-form{
|
||||
.header{
|
||||
position: relative;
|
||||
background: white;
|
||||
padding-left: $padding + 150;
|
||||
.logo{
|
||||
width: 108rpx;
|
||||
height: 108rpx;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
left: $padding;
|
||||
top: 26rpx;
|
||||
border: dashed 2rpx $border-color;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.inputs{
|
||||
position: relative;
|
||||
padding-right: $padding;
|
||||
input,
|
||||
.time-text{
|
||||
line-height: 80rpx;
|
||||
height: 80rpx;
|
||||
font-size: $title-size-lg;
|
||||
}
|
||||
&::after{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
content: " ";
|
||||
height: 1rpx;
|
||||
background: $border-color;
|
||||
}
|
||||
&:last-child::after{
|
||||
display: none;
|
||||
}
|
||||
.time-text{
|
||||
padding-right: 80rpx;
|
||||
.time-icon{
|
||||
position: absolute;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: right;
|
||||
width: 80rpx;
|
||||
right: $padding;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.info{
|
||||
@extend .header;
|
||||
margin-top: $margin;
|
||||
padding-left: 0;
|
||||
background: white;
|
||||
.inputs{
|
||||
padding-left: $padding + 150;
|
||||
.inputs-label{
|
||||
position: absolute;
|
||||
left: $padding;
|
||||
top: 0;
|
||||
font-size: $title-size-lg;
|
||||
line-height: 80rpx;
|
||||
height: 80rpx;
|
||||
width: 150rpx;
|
||||
}
|
||||
.inputs-textarea{
|
||||
width: 100%;
|
||||
padding: 20rpx 0;
|
||||
height: 160rpx;
|
||||
font-size: $title-size-lg;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
&.addrss-input{
|
||||
padding-right: $padding + 100;
|
||||
.addrss-icon{
|
||||
position: absolute;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: right;
|
||||
width: 80rpx;
|
||||
right: $padding;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 按钮组
|
||||
.create-btns{
|
||||
padding: $padding;
|
||||
.item-btn{
|
||||
border-radius: 0;
|
||||
background: white;
|
||||
font-size: $title-size;
|
||||
line-height: 90rpx;
|
||||
height: 90rpx;
|
||||
&::after{
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
.btn-submit{
|
||||
background: $text-price;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
margin-bottom: $margin;
|
||||
}
|
||||
.btn-delete{
|
||||
border: solid 1rpx $border-color;
|
||||
color: $text-gray;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
120
pages/shop/lists.vue
Normal file
@@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<view class="lists">
|
||||
<block v-if="lists.length > 0">
|
||||
<view class="lists-item" v-for="(item, index) in lists" :key="index" @click="$Router.push({name: 'shopCreate', params: { id: item.store_id }})">
|
||||
<view class="header">
|
||||
<image class="logo" :src="item.cover" mode="aspectFill"></image>
|
||||
<view class="title">{{item.name}}</view>
|
||||
<view class="time"><text>营业时间{{item.start_time}} 至 {{item.end_time}}</text></view>
|
||||
<view class="icons">
|
||||
<uni-icons type="arrowright" color="#999" size="18"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="address">店铺地址:{{item.address}}</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<view class="list-null">
|
||||
<image class="icon" src="@/static/icons/approve-icon.png" mode="widthFix"></image>
|
||||
<view class="sub-title">暂未创建店铺/部门</view>
|
||||
<view class="sub-btn" @click="$Router.push({name: 'shopCreate'})">创建</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { shops } from '@/apis/interfaces/shop'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
lists: []
|
||||
};
|
||||
},
|
||||
onShow(){
|
||||
shops().then(res => {
|
||||
console.log(res)
|
||||
this.lists = res.data
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
// 空提示
|
||||
.list-null{
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
padding-bottom: 20vh;
|
||||
box-sizing: border-box;
|
||||
background: white;
|
||||
text-align: center;
|
||||
@extend .vertical;
|
||||
.sub-title{
|
||||
color: $text-gray;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
.icon{
|
||||
width: 288rpx;
|
||||
}
|
||||
.sub-btn{
|
||||
width: 200rpx;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
text-align: center;
|
||||
background: $mian-color;
|
||||
color: white;
|
||||
display: inline-block;
|
||||
margin-top: $margin*2;
|
||||
}
|
||||
}
|
||||
// 列表
|
||||
.lists-item{
|
||||
background: white;
|
||||
margin: $margin;
|
||||
border-radius: $radius/2;
|
||||
padding: $padding;
|
||||
.header{
|
||||
position: relative;
|
||||
padding-left: 128rpx;
|
||||
padding-right: 100rpx;
|
||||
min-height: 108rpx;
|
||||
padding-bottom: $padding - 10;
|
||||
.logo{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 108rpx;
|
||||
height: 108rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.title{
|
||||
line-height: 60rpx;
|
||||
font-size: $title-size;
|
||||
font-weight: bold;
|
||||
}
|
||||
.time{
|
||||
line-height: 40rpx;
|
||||
font-size: $title-size-sm;
|
||||
text{
|
||||
background-color: $border-color-lg;
|
||||
color: $text-gray;
|
||||
padding: 0 $padding/2;
|
||||
}
|
||||
}
|
||||
.icons{
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
line-height: 108rpx;
|
||||
}
|
||||
}
|
||||
.address{
|
||||
border-top: solid 1rpx $border-color;
|
||||
padding-top: $padding - 10;
|
||||
font-size: $title-size-m;
|
||||
color: $text-gray;
|
||||
left: 50rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -4,10 +4,10 @@
|
||||
<!-- 邀请码图 -->
|
||||
<view class="codeBack">
|
||||
<image class="codeBack-img" src="/static/user/user-codeIcon.png" mode="widthFix"></image>
|
||||
<view class="codeBack-avatar">
|
||||
<image src="/static/user/call.png" mode="aspectFill"></image>
|
||||
<view class="codeBack-avatar" v-if="inviteData.user_info">
|
||||
<image :src="inviteData.user_info.avatar ? inviteData.user_info.avatar : '/static/user/user-portrait.png'" mode="aspectFill"></image>
|
||||
<view class="">
|
||||
张慢慢
|
||||
{{inviteData.user_info.nickname}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="codeBack-top">
|
||||
@@ -15,7 +15,7 @@
|
||||
您的邀请码
|
||||
</view>
|
||||
<view class="codeBack-number">
|
||||
8012568
|
||||
{{inviteData.invite}}
|
||||
</view>
|
||||
<view class="codeBack-copy" @click="copyCenter(inviteData.invite)">
|
||||
复制
|
||||
@@ -51,6 +51,7 @@
|
||||
// 二维码
|
||||
inviteInfo(){
|
||||
userInvite().then(res => {
|
||||
console.log(res)
|
||||
this.inviteData = res
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
@@ -161,7 +162,7 @@
|
||||
color: #7c52fc
|
||||
}
|
||||
.codeBack-number {
|
||||
font-size: 60rpx;
|
||||
font-size: 40rpx;
|
||||
color: #7c52fc;
|
||||
text-transform:uppercase;
|
||||
font-weight: 700;
|
||||
@@ -196,6 +197,8 @@
|
||||
}
|
||||
.codeBack-avatar {
|
||||
margin-top: $margin * 2;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
image {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
@@ -204,7 +207,7 @@
|
||||
}
|
||||
}
|
||||
.codeBack-yard {
|
||||
padding: $padding $padding * 4 $padding * 2;
|
||||
padding: $padding $padding * 2 $padding * 2;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
font-size: $title-size-lg;
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
<view class="userVip-top-name" v-if="userIdentity.right">
|
||||
开通{{userIdentity.right.name}}。
|
||||
</view>
|
||||
<view class="userVip-top-btn">
|
||||
<view class="userVip-top-btn" v-if="!userIdentity.is_top" @click="$Router.push({name: 'vipIndex'})">
|
||||
去开通<image class="userVip-top-arrow" src="/static/user/userVip_arrow.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
@@ -92,13 +92,18 @@
|
||||
<view class="userVip-rightst-more">全部权益 <image class="userVip-rightst-more-img" src="/static/user/userVip_more_arrow.png"></image></view>
|
||||
</view>
|
||||
<view class="userVip-rightst-list" v-if="userIdentity.right">
|
||||
<block v-for="(item, index) in userIdentity.right.rights" :key="index">
|
||||
<view class="userVip-rightst-label" v-if="index <= 3">
|
||||
<view v-for="(item, index) in userIdentity.right.rights" :key="index" class="userVip-rightst-label">
|
||||
<block v-if="index <= 3">
|
||||
<image class="userVip-rightst-img" :src="item.cover"></image>
|
||||
<view class="userVip-rightst-name">{{item.name}}</view>
|
||||
</view>
|
||||
<view class="nowrap userVip-rightst-name">{{item.name}}</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="userVip-rightst-label">
|
||||
<image class="userVip-rightst-img" src="/static/user/userRightst_icon_more.png"></image>
|
||||
<view class="nowrap userVip-rightst-name">敬请期待</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -149,16 +154,16 @@
|
||||
我的伙伴
|
||||
</view>
|
||||
<view class="partner-list" v-if="userData.relation_count">
|
||||
<view class="partner-label">
|
||||
<view class="partner-label" @click="$Router.push({name: 'userPartner', params:{larer:''}})">
|
||||
<view class="partner-label-name">伙伴总数</view>
|
||||
<view class="partner-label-number">{{userData.relation_count.all || 0}}</view>
|
||||
</view>
|
||||
<view class="partner-label">
|
||||
<view class="partner-label" @click="$Router.push({name: 'userPartner', params:{larer:1}})">
|
||||
<view class="partner-label-name">直接伙伴</view>
|
||||
<view class="partner-label-number">{{userData.relation_count.one || 0}}</view>
|
||||
</view>
|
||||
<view class="partner-label">
|
||||
<view class="partner-label-name">简接伙伴</view>
|
||||
<view class="partner-label" @click="$Router.push({name: 'userPartner', params:{larer:2}})">
|
||||
<view class="partner-label-name">间接伙伴</view>
|
||||
<view class="partner-label-number">{{userData.relation_count.two || 0}}</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -178,7 +183,7 @@
|
||||
<image class="tool-label-img" src="/static/user/userTool-01.png" mode=""></image>
|
||||
<view class="tool-label-name">优惠券管理</view>
|
||||
</view>
|
||||
<view class="tool-label">
|
||||
<view class="tool-label" @click="$Router.push({name: 'instrumentSpread'})">
|
||||
<image class="tool-label-img" src="/static/user/userTool-02.png" mode=""></image>
|
||||
<view class="tool-label-name">营销推广码</view>
|
||||
</view>
|
||||
@@ -186,14 +191,18 @@
|
||||
<image class="tool-label-img" src="/static/user/userTool-03.png" mode=""></image>
|
||||
<view class="tool-label-name">基础信息</view>
|
||||
</view>
|
||||
<view class="tool-label">
|
||||
<view class="tool-label" @click="$Router.push({name: 'shopLists'})">
|
||||
<image class="tool-label-img" src="/static/user/userTool-04.png" mode=""></image>
|
||||
<view class="tool-label-name">部门门店</view>
|
||||
</view>
|
||||
<view class="tool-label" @click="$Router.push({name: 'instrumentBasics'})">
|
||||
<view class="tool-label" @click="$Router.push({name: 'employeesList'})">
|
||||
<image class="tool-label-img" src="/static/user/userTool-05.png" mode=""></image>
|
||||
<view class="tool-label-name">店员管理</view>
|
||||
<view class="tool-label-name">员工管理</view>
|
||||
</view>
|
||||
<!-- <view class="tool-label" @click="$Router.push({name: 'verificationIndex'})">
|
||||
<image class="tool-label-img" src="/static/user/userTool-05.png" mode=""></image>
|
||||
<view class="tool-label-name">扫码核销</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -207,18 +216,18 @@
|
||||
<image class="tool-label-img" src="/static/user/userServe-00.png" mode=""></image>
|
||||
<view class="tool-label-name">专属客服</view>
|
||||
</view>
|
||||
<navigator hover-class="none" class="tool-label" @click="$Router.push({name: 'userCode'})">
|
||||
<view class="tool-label" @click="$Router.push({name: 'userCode'})">
|
||||
<image class="tool-label-img" src="/static/user/userServe-01.png" mode=""></image>
|
||||
<view class="tool-label-name">邀请好友</view>
|
||||
</navigator>
|
||||
<navigator hover-class="none" class="tool-label" @click="$Router.push({name: 'userHelp'})">
|
||||
</view>
|
||||
<view class="tool-label" @click="$Router.push({name: 'userHelp'})">
|
||||
<image class="tool-label-img" src="/static/user/userServe-02.png" mode=""></image>
|
||||
<view class="tool-label-name">帮助中心</view>
|
||||
</navigator>
|
||||
<navigator hover-class="none" class="tool-label" @click="$Router.push({name: 'userClause'})">
|
||||
</view>
|
||||
<view class="tool-label" @click="$Router.push({name: 'userClause'})">
|
||||
<image class="tool-label-img" src="/static/user/userServe-03.png" mode=""></image>
|
||||
<view class="tool-label-name">服务条款</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -229,7 +238,6 @@
|
||||
<view class="item" @click="$Router.push({name: 'couponsManagement'})">优惠券管理</view>
|
||||
<view class="item" @click="$Router.push({name: 'instrumentBasics'})">店员管理</view>
|
||||
<view class="item" @click="$Router.push({name: 'instrumentCustomer'})">成交客户</view>
|
||||
<view class="item" @click="$Router.push({name: 'instrumentBasics'})">店员管理</view>
|
||||
<view class="item" @click="$Router.push({name: 'Personal'})">个人认证</view>
|
||||
<view class="item" @click="$Router.push({name: 'companyApprove'})">企业认证</view>
|
||||
<view class="item" @click="$Router.push({name: 'companyApprove', params: { form_type: 'put' }})">编辑企业认证</view>
|
||||
@@ -247,6 +255,7 @@
|
||||
scroll : 0, // 回弹效果
|
||||
userData : '', // 用户信息
|
||||
userIdentity : '', // 用户身份
|
||||
helpDoc : '', // 资产说明
|
||||
classStyle : false, // 下拉vip时改变样式
|
||||
animatedShow : false, // vip上下跳动效果
|
||||
newList : [],
|
||||
@@ -267,11 +276,11 @@
|
||||
// 获取用户信息
|
||||
this.userInfo();
|
||||
|
||||
// 获取公告列表
|
||||
this.newInfo();
|
||||
|
||||
// 获取专属客服二维码
|
||||
this.customerInfo();
|
||||
|
||||
// 获取公告列表
|
||||
this.newInfo();
|
||||
},
|
||||
onHide() {
|
||||
// 移除vip模块跳动样式
|
||||
@@ -282,8 +291,8 @@
|
||||
userInfo() {
|
||||
// 读取配置信息
|
||||
userIndex().then(res=>{
|
||||
console.log(res)
|
||||
this.userData = res
|
||||
this.helpDoc = res.help_doc
|
||||
this.userIdentity = res.identityShow
|
||||
}).catch(err =>{
|
||||
uni.showToast({
|
||||
@@ -354,10 +363,12 @@
|
||||
|
||||
// 友情提示信息
|
||||
showHelp(type) {
|
||||
let content = '能量球钱包'
|
||||
if(type == 'chip') content = '能量碎片'
|
||||
let title = '能量球',
|
||||
content = this.helpDoc.energy_ball.description
|
||||
if(type == 'chip') title = '能量碎片'
|
||||
if(type == 'chip') content = this.helpDoc.energy_shard.description
|
||||
uni.showModal({
|
||||
title: '友情提示',
|
||||
title: title,
|
||||
content: content,
|
||||
showCancel: false
|
||||
})
|
||||
@@ -585,8 +596,8 @@
|
||||
z-index: 1;
|
||||
.user-tool-icon {
|
||||
padding-left: $padding;
|
||||
width: $uni-img-size-sm + 2;
|
||||
height: $uni-img-size-sm + 2;
|
||||
width: $uni-img-size-sm;
|
||||
height: $uni-img-size-sm;
|
||||
}
|
||||
}
|
||||
.user-back {
|
||||
@@ -612,7 +623,7 @@
|
||||
position: relative;
|
||||
.user-portrait-head {
|
||||
border-radius: $uni-border-radius-circle;
|
||||
border: 4rpx solid #b197ff;
|
||||
border: 4rpx solid #bfaaff;
|
||||
position: absolute;
|
||||
left: 8rpx;
|
||||
top: 14rpx;
|
||||
@@ -662,9 +673,9 @@
|
||||
margin: 30rpx 0 5rpx;
|
||||
font-size: 36rpx;
|
||||
.user-name-identity {
|
||||
width: 92rpx;
|
||||
width: 100rpx;
|
||||
height: 36rpx;
|
||||
margin: 6rpx 0 0 10rpx;
|
||||
margin: 4rpx 0 0 10rpx;
|
||||
}
|
||||
}
|
||||
.user-status {
|
||||
@@ -729,11 +740,13 @@
|
||||
.userVip-rights {
|
||||
margin-top: 40rpx;
|
||||
border-radius: 10rpx;
|
||||
padding: 20rpx;
|
||||
padding: 20rpx 0;
|
||||
box-sizing: border-box;
|
||||
background-image:linear-gradient(to bottom, #dbceff, #bb9fff);
|
||||
color: #5723af;
|
||||
.userVip-rightst-title {
|
||||
padding: 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
font-size: 30rpx;
|
||||
display: flex;
|
||||
.userVip-rightst-title-name {
|
||||
@@ -754,12 +767,12 @@
|
||||
display: flex;
|
||||
.userVip-rightst-label {
|
||||
display: inline-block;
|
||||
flex: 4;
|
||||
width: 25%;
|
||||
text-align: center;
|
||||
font-size: 26rpx;
|
||||
.userVip-rightst-img {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
width: 90rpx;
|
||||
height: 90rpx;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
144
pages/user/partner.vue
Normal file
@@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<!-- 分类 -->
|
||||
<view class="tabs">
|
||||
<view class="item" :class="{'show': larer == ''}" @click="onTabs('')">全部</view>
|
||||
<view class="item" :class="{'show': larer == '1'}" @click="onTabs('1')">直接</view>
|
||||
<view class="item" :class="{'show': larer == '2'}" @click="onTabs('2')">间接</view>
|
||||
</view>
|
||||
|
||||
<view class="partner-list">
|
||||
<view class="partner-label" v-for="(item, index) in lists" :key="index" :larer='larer'>
|
||||
<image class="partner-avatar" :src="item.avatar ? item.avatar : '/static/user/user-portrait.png'" mode="aspectFill"></image>
|
||||
<view class="partner-cont">
|
||||
<view class="partner-name">
|
||||
<view class="partner-nickname">
|
||||
{{item.nickname}}
|
||||
</view>
|
||||
<image v-if="item.identity" class="partner-identity" :src="item.identity.cover" mode="widthFix"></image>
|
||||
</view>
|
||||
<view class="partner-tel">
|
||||
{{item.username}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { userPartne } from '@/apis/interfaces/user'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
larer : '',
|
||||
lists : [],
|
||||
pages : {}
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
this.larer = this.$Route.query.larer
|
||||
// 获取伙伴列表
|
||||
this.getPartner()
|
||||
},
|
||||
methods: {
|
||||
// 伙伴列表
|
||||
getPartner() {
|
||||
userPartne({
|
||||
larer: this.larer
|
||||
}).then(res => {
|
||||
this.lists = res.users
|
||||
})
|
||||
},
|
||||
|
||||
// tabs
|
||||
onTabs(value){
|
||||
if(value == this.larer) return
|
||||
this.lists = []
|
||||
this.larer = value
|
||||
this.getPartner()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content{
|
||||
padding-top: 90rpx;
|
||||
}
|
||||
|
||||
// tabs
|
||||
.tabs{
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 99;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
background: white;
|
||||
padding: 15rpx 0;
|
||||
font-size: $title-size-lg;
|
||||
color: $text-gray;
|
||||
.item{
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
&.show{
|
||||
color: $text-price;
|
||||
border-bottom: solid 4rpx $text-price;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 列表
|
||||
.partner-list{
|
||||
margin: calc(#{$padding} - 10rpx);
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
background-color: #FFFFFF;
|
||||
.partner-label {
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
border-radius: 4rpx;
|
||||
width: 100%;
|
||||
&::after {
|
||||
position: absolute;
|
||||
content: '';
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 1rpx;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
&:last-child::after {
|
||||
display: none;
|
||||
}
|
||||
.partner-avatar {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.partner-cont {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
padding: 22rpx 20rpx 20rpx 150rpx;
|
||||
box-sizing: border-box;
|
||||
.partner-name {
|
||||
display: flex;
|
||||
margin-bottom: 15rpx;
|
||||
.partner-nickname {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.partner-identity {
|
||||
width: 120rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -270,7 +270,7 @@
|
||||
width: calc(100% - 60rpx);
|
||||
height: 360rpx;
|
||||
background-image: linear-gradient(to left, #076cff, #076cff);
|
||||
box-shadow: 0 10rpx 20rpx 0rpx rgba($color: $main-color, $alpha: 0.4);
|
||||
box-shadow: 0 10rpx 20rpx 0rpx rgba($color: $mian-color, $alpha: 0.4);
|
||||
margin: 0 30rpx;
|
||||
border-radius: 20rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
38
pages/vip/agree.vue
Normal file
@@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="contentTitle">
|
||||
<rich-text :nodes="content"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { userAgree } from '@/apis/interfaces/vip'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
content: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
userAgree().then(res => {
|
||||
this.content = res.content
|
||||
}).catch(err =>{
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.contentTitle {
|
||||
padding: $padding;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
541
pages/vip/vip.vue
Normal file
@@ -0,0 +1,541 @@
|
||||
<template>
|
||||
<view class="content" v-if="!loding">
|
||||
<swiper class="vip-container" previous-margin="55rpx" next-margin="55rpx" circular @change="swiperChange">
|
||||
<swiper-item class="swiper-item" v-for="(item, index) in identitie" :key="index">
|
||||
<view class="vip-item" :class="tabsIndex == index ? 'color-item-img' : ''">
|
||||
<image class="vip-back" :src="item.card_cover" mode="scaleToFill"></image>
|
||||
<view class="vip-cont">
|
||||
<view class="vip-name">
|
||||
{{item.name}}<image class="vip-name-img" @click="showRemark(item.name, item.node_definition)" src="../../static/user/vip_privilege_03.png" mode="widthFix"></image>
|
||||
</view>
|
||||
<view class="vip-number" v-if="item.count">
|
||||
{{item.count.stock > 0 ? '剩余名额:' + item.count.residue : '不限名数'}}
|
||||
</view>
|
||||
<view class="vip-tips">
|
||||
<!-- 轻节点 -->
|
||||
<view v-if="item.identity_id == 2" class="vip-tips-text vip-tips-color-00">
|
||||
{{item.title}}
|
||||
</view>
|
||||
|
||||
<!-- 会员 -->
|
||||
<view v-else-if="item.identity_id == 3" class="vip-tips-text vip-tips-color-01">
|
||||
{{item.title}}
|
||||
</view>
|
||||
|
||||
<!-- VIP节点 -->
|
||||
<view v-else-if="item.identity_id == 4" class="vip-tips-text vip-tips-color-02">
|
||||
{{item.title}}
|
||||
</view>
|
||||
|
||||
<!-- 主节点 -->
|
||||
<view v-else-if="item.identity_id == 5" class="vip-tips-text vip-tips-color-03">
|
||||
{{item.title}}
|
||||
</view>
|
||||
|
||||
<!-- 超级节点 -->
|
||||
<view v-else-if="item.identity_id == 6" class="vip-tips-text vip-tips-color-04">
|
||||
{{item.title}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
|
||||
<!-- 会员特权 -->
|
||||
<view class="privilege">
|
||||
<view class="privilege-list">
|
||||
<image class="privilege-img" src="/static/user/vip_privilege_00.png" mode=""></image>
|
||||
<view class="privilege-text">
|
||||
<view class="privilege-name">
|
||||
节点定义
|
||||
</view>
|
||||
{{identitie[tabsIndex].node_definition}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="privilege-list">
|
||||
<image class="privilege-img" src="/static/user/vip_privilege_01.png" mode=""></image>
|
||||
<view class="privilege-text">
|
||||
<view class="privilege-name">
|
||||
升级条件
|
||||
</view>
|
||||
<view class="privilege-label" :class="{'active' : item.finish == true}" v-for="(item, index) in identitie[tabsIndex].get_condition" :key="index">
|
||||
&{{item.message}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="privilege-list">
|
||||
<image class="privilege-img" src="/static/user/vip_privilege_02.png" mode=""></image>
|
||||
<view class="privilege-text">
|
||||
<view class="privilege-name">
|
||||
节点权益
|
||||
</view>
|
||||
<view class="privilege-label privilege-right" v-for="(item, index) in identitie[tabsIndex].rights" :key="index">
|
||||
&{{item.remark}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 用户协议 -->
|
||||
<view class="agree">
|
||||
<view class="agree-tips" @click="$Router.push({name: 'vipAgree'})">
|
||||
请仔细阅读并确认服务协议
|
||||
</view>
|
||||
</view>
|
||||
<view class="agree-btn" @click="agreeChange">
|
||||
<radio :checked="selected" style="transform: scale(.7);" color="#7c52fc"></radio>会员服务协议
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 开通按钮 -->
|
||||
<view class="footer">
|
||||
<block v-if="identitie[tabsIndex].identity_id == 2">
|
||||
<image class="footer-btn" :src="identitie[tabsIndex].button_cover" mode="widthFix" @click="openUrl"></image>
|
||||
</block>
|
||||
<block v-else>
|
||||
<image class="footer-btn" :src="identitie[tabsIndex].button_cover" mode="widthFix" @click="openOrder"></image>
|
||||
</block>
|
||||
<!-- <button class="footer-btn" type="default" >
|
||||
<view class="footer-btn-num">
|
||||
合计:{{total}}
|
||||
</view>
|
||||
<view class="footer-btn-pay">
|
||||
立即支付
|
||||
</view>
|
||||
</button> -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { identities, vipOrder, vipWechatPay, vipCont } from '@/apis/interfaces/vip'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loding : true,
|
||||
tabsIndex : 0,
|
||||
user : {},
|
||||
identitie : [],
|
||||
rights : [],
|
||||
description : '',
|
||||
identityTime: '', // 到期时间
|
||||
sumNumber : 1, // 开通年限
|
||||
total : '', // 开通年限总资金额
|
||||
selected : false, // 用户协议
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// 获取当前用户信息
|
||||
this.idenInfo();
|
||||
},
|
||||
methods: {
|
||||
// 当前用户信息
|
||||
idenInfo(){
|
||||
identities().then(res => {
|
||||
console.log(res.identities)
|
||||
this.loding = false
|
||||
this.identitie = res.identities
|
||||
this.rights = res.identities[this.tabsIndex].rights
|
||||
this.total = res.identities[this.tabsIndex].price
|
||||
}).catch(err =>{
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 切换开通身份
|
||||
swiperChange(e) {
|
||||
this.tabsIndex = e.detail.current
|
||||
// 获取当前用户信息
|
||||
this.idenInfo();
|
||||
},
|
||||
|
||||
// 开通会员
|
||||
openOrder(){
|
||||
if(this.selected == false) {
|
||||
uni.showToast({
|
||||
title: '请勾选用户协议',
|
||||
icon : 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
let identitiesId = this.identitie[this.tabsIndex].identity_id
|
||||
vipOrder(identitiesId,{
|
||||
year: 1
|
||||
}).then(res => {
|
||||
if(!res.test){
|
||||
let verifyForm = res
|
||||
this.wechatPay(res.id)
|
||||
}else{
|
||||
// 测试环境
|
||||
uni.showModal({
|
||||
title : '开通提示',
|
||||
content : '会员开通成功,是否继续完成企业认证',
|
||||
showCancel : true,
|
||||
cancelText : '稍后认证',
|
||||
confirmText : '立即认证',
|
||||
success : modalRes => {
|
||||
if(modalRes.confirm){
|
||||
this.$Router.replace({name: 'Approve'})
|
||||
return
|
||||
}
|
||||
this.$Router.back()
|
||||
},
|
||||
fail(err) {
|
||||
}
|
||||
})
|
||||
}
|
||||
}).catch(err =>{
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 轻节点身份-跳转个人认证
|
||||
openUrl() {
|
||||
this.$Router.push({name: 'Personal'})
|
||||
},
|
||||
|
||||
// 微信支付
|
||||
wechatPay(id){
|
||||
vipWechatPay(id).then(res => {
|
||||
let payConfig = JSON.parse(res.wechat),
|
||||
payIdentity = res.identity
|
||||
uni.requestPayment({
|
||||
provider : "wxpay",
|
||||
orderInfo : payConfig,
|
||||
success : payRes => {
|
||||
console.log(payRes)
|
||||
},
|
||||
fail : payErr => {
|
||||
console.log(payErr)
|
||||
}
|
||||
})
|
||||
}).catch(err =>{
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 勾选协议
|
||||
agreeChange() {
|
||||
this.selected = !this.selected
|
||||
},
|
||||
|
||||
// 会员权益介绍
|
||||
showRemark(title, val){
|
||||
uni.showModal({
|
||||
title : title,
|
||||
content : val,
|
||||
showCancel : false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
.vip-container {
|
||||
width: 750rpx;
|
||||
height: 340rpx;
|
||||
margin-top: $margin;
|
||||
}
|
||||
|
||||
.swiper-item {
|
||||
width: 640rpx;
|
||||
height: 340rpx;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.vip-item {
|
||||
width: 640rpx;
|
||||
height: 340rpx;
|
||||
border-radius: 20rpx;
|
||||
position: relative;
|
||||
.vip-back {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.vip-cont {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 9;
|
||||
padding: 45rpx 70rpx;
|
||||
box-sizing: border-box;
|
||||
.vip-name {
|
||||
display: flex;
|
||||
font-size: 46rpx;
|
||||
color: #ffffff;
|
||||
font-weight: 600;
|
||||
.vip-name-img {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
margin: 12rpx 20rpx;
|
||||
}
|
||||
}
|
||||
.vip-number {
|
||||
margin: 10rpx 0 40rpx;
|
||||
color: #FFFFFF;
|
||||
font-size: 32rpx;
|
||||
opacity: .8;
|
||||
}
|
||||
.vip-tips {
|
||||
font-size: 30rpx;
|
||||
background-color: #e8ebf6;
|
||||
display: inline-block;
|
||||
border-radius: 80rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
padding: 0 30rpx;
|
||||
.vip-tips-text {
|
||||
font-weight: 700;
|
||||
background-clip: text;
|
||||
color: transparent;
|
||||
}
|
||||
.vip-tips-color-00 {
|
||||
background-image: linear-gradient(to bottom,#6189f0,#b6b9c1);
|
||||
}
|
||||
.vip-tips-color-01 {
|
||||
background-image: linear-gradient(to top,#ffd459,#ff6c52);
|
||||
}
|
||||
.vip-tips-color-02 {
|
||||
background-image: linear-gradient(to top,#e0c9fe,#892edb);
|
||||
}
|
||||
.vip-tips-color-03 {
|
||||
background-image: linear-gradient(to top,#f6b237,#f035e3);
|
||||
}
|
||||
.vip-tips-color-04 {
|
||||
background-image: linear-gradient(to top,#c455ec,#5f76e9);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 会员特权
|
||||
.privilege {
|
||||
padding: 20rpx 30rpx 80rpx;
|
||||
box-sizing: border-box;
|
||||
.privilege-list {
|
||||
margin-bottom: 50rpx;
|
||||
display: flex;
|
||||
.privilege-img {
|
||||
width: 74rpx;
|
||||
height: 74rpx;
|
||||
}
|
||||
.privilege-text {
|
||||
width: calc(100% - 74rpx);
|
||||
padding-left: 40rpx;
|
||||
font-size: 32rpx;
|
||||
color: #999999;
|
||||
line-height: 52rpx;
|
||||
.privilege-name {
|
||||
font-size: 40rpx;
|
||||
color: #000000;
|
||||
margin: 10rpx 0 20rpx;
|
||||
}
|
||||
.privilege-label.active {
|
||||
color: #f6b338;
|
||||
}
|
||||
.privilege-right {
|
||||
color: #7877eb;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 用户协议
|
||||
.agree {
|
||||
margin: $margin 0;
|
||||
text-align: center;
|
||||
.agree-tips {
|
||||
background-color: #999999;
|
||||
display: inline-block;
|
||||
padding: 14rpx $padding;
|
||||
color: #FFFFFF;
|
||||
border-radius: 60rpx;
|
||||
}
|
||||
}
|
||||
.agree-btn {
|
||||
display: flex;
|
||||
font-size: $title-size-lg;
|
||||
text-align: left;
|
||||
color: #999999;
|
||||
padding: $padding;
|
||||
}
|
||||
|
||||
// .content{
|
||||
// min-height: 100vh;
|
||||
// background: #fefaef;
|
||||
// }
|
||||
// 开通须知
|
||||
.notice{
|
||||
font-size: $title-size-m;
|
||||
color: $text-gray;
|
||||
padding: $padding $padding*2 $padding*2;
|
||||
.title{
|
||||
padding-bottom: $padding/2;
|
||||
font-weight: bold;
|
||||
}
|
||||
.item{
|
||||
padding-bottom: $padding/2;
|
||||
line-height: 40rpx;
|
||||
text-align: justify;
|
||||
}
|
||||
}
|
||||
// footer
|
||||
.footer{
|
||||
padding: 0 $padding;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
.footer-btn{
|
||||
width: 74%;
|
||||
}
|
||||
}
|
||||
// 会员权限
|
||||
.privilege{
|
||||
padding: $padding;
|
||||
.title{
|
||||
font-weight: bold;
|
||||
color: #322711;
|
||||
font-size: $title-size;
|
||||
text-align: center;
|
||||
line-height: 90rpx;
|
||||
}
|
||||
.privilege-box{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: $padding 0;
|
||||
.item{
|
||||
width: 25%;
|
||||
padding: $padding/2;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
.icon{
|
||||
width: 78rpx;
|
||||
height: 78rpx;
|
||||
background: #bd995d;
|
||||
border-radius: 50%;
|
||||
vertical-align: top;
|
||||
}
|
||||
.text{
|
||||
font-size: $title-size-sm;
|
||||
color: #201212;
|
||||
line-height: 60rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 会员卡
|
||||
.cards{
|
||||
position: relative;
|
||||
background: #1f1b1c;
|
||||
.card{
|
||||
position: relative;
|
||||
margin: 0 $margin;
|
||||
background: linear-gradient(to right, #3b3d4a, #231d1f);
|
||||
padding: 15rpx;
|
||||
border-radius: $radius/2;
|
||||
z-index: 2;
|
||||
.card-content{
|
||||
position: relative;
|
||||
border:solid 1rpx rgba($color: white, $alpha: .4);
|
||||
border-radius: $radius/2;
|
||||
padding: 30rpx 180rpx 60rpx 148rpx;
|
||||
min-height: 98rpx;
|
||||
.cover{
|
||||
position: absolute;
|
||||
left: 30rpx;
|
||||
top: 30rpx;
|
||||
width: 98rpx;
|
||||
height: 98rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.user{
|
||||
color: rgba($color: white, $alpha: .7);
|
||||
line-height: 58rpx;
|
||||
font-size: $title-size-lg;
|
||||
}
|
||||
.sub-time{
|
||||
line-height: 40rpx;
|
||||
color: #e6ce9e;
|
||||
font-size: $title-size-sm;
|
||||
}
|
||||
.btn{
|
||||
position: absolute;
|
||||
color: #261f0f;
|
||||
background: #e6ce9e;
|
||||
width: 160rpx;
|
||||
border-radius: 30rpx;
|
||||
font-size: $title-size-m;
|
||||
right: 30rpx;
|
||||
top: 50rpx;
|
||||
line-height: 58rpx;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
.cards-angle{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
z-index: 3;
|
||||
}
|
||||
&::after{
|
||||
content: " ";
|
||||
height: 70rpx;
|
||||
background: #b29671;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
bottom: 0;
|
||||
border-radius: $radius/2;
|
||||
z-index: 0;
|
||||
}
|
||||
}
|
||||
// tabs
|
||||
.tabs{
|
||||
background: #1f1b1c;
|
||||
color: white;
|
||||
padding: 0 0 $padding 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
font-size: $title-size-lg;
|
||||
.item{
|
||||
margin: 0 $margin;
|
||||
line-height: 70rpx;
|
||||
height: 70rpx;
|
||||
color: rgba($color: white, $alpha: .6);
|
||||
&.show{
|
||||
position: relative;
|
||||
font-weight: bold;
|
||||
font-size: $title-size;
|
||||
color: white;
|
||||
&::after{
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 20%;
|
||||
width: 60%;
|
||||
height: 6rpx;
|
||||
border-radius: 3rpx;
|
||||
content: " ";
|
||||
background: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,12 @@ $text-color: #333;
|
||||
$text-gray: #555;
|
||||
$text-gray-m: #999;
|
||||
$text-price: #8b64fd;
|
||||
$mian-color: #b11eff;
|
||||
$mian-color: #8b64fd;
|
||||
$mian-color-deep: #824f9a;
|
||||
|
||||
// 矿机
|
||||
$block-color: #2b2449;
|
||||
|
||||
// 边框颜色
|
||||
$border-color: #ddd;
|
||||
$border-color-lg: #eff4f2;
|
||||
@@ -76,20 +79,6 @@ $padding: 30rpx;
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
|
||||
.ellipsis-1 {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.ellipsis-2 {
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
|
||||
.ellipsis-3 {
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
|
||||
|
Before Width: | Height: | Size: 482 KiB After Width: | Height: | Size: 202 KiB |
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 469 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 8.2 KiB |
BIN
static/icons/gemstone-ore-icon.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 4.5 KiB |
BIN
static/user/userRightst_icon_more.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
static/user/vip_privilege_00.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
static/user/vip_privilege_01.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
static/user/vip_privilege_02.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
static/user/vip_privilege_03.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
27
uni_modules/uni-collapse/changelog.md
Normal file
@@ -0,0 +1,27 @@
|
||||
## 1.3.3(2021-08-17)
|
||||
- 优化 show-arrow 属性默认为true
|
||||
## 1.3.2(2021-08-17)
|
||||
- 新增 show-arrow 属性,控制是否显示右侧箭头
|
||||
## 1.3.1(2021-07-30)
|
||||
- 优化 vue3下小程序事件警告的问题
|
||||
## 1.3.0(2021-07-30)
|
||||
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
|
||||
## 1.2.2(2021-07-21)
|
||||
- 修复 由1.2.0版本引起的 change 事件返回 undefined 的Bug
|
||||
## 1.2.1(2021-07-21)
|
||||
- 优化 组件示例
|
||||
## 1.2.0(2021-07-21)
|
||||
- 新增 组件折叠动画
|
||||
- 新增 value\v-model 属性 ,动态修改面板折叠状态
|
||||
- 新增 title 插槽 ,可定义面板标题
|
||||
- 新增 border 属性 ,显示隐藏面板内容分隔线
|
||||
- 新增 title-border 属性 ,显示隐藏面板标题分隔线
|
||||
- 修复 resize 方法失效的Bug
|
||||
- 修复 change 事件返回参数不正确的Bug
|
||||
- 优化 H5、App 平台自动更具内容更新高度,无需调用 reszie() 方法
|
||||
## 1.1.7(2021-05-12)
|
||||
- 新增 组件示例地址
|
||||
## 1.1.6(2021-02-05)
|
||||
- 优化 组件引用关系,通过uni_modules引用组件
|
||||
## 1.1.5(2021-02-05)
|
||||
- 调整为uni_modules目录规范
|
||||
@@ -0,0 +1,402 @@
|
||||
<template>
|
||||
<view class="uni-collapse-item">
|
||||
<!-- onClick(!isOpen) -->
|
||||
<view @click="onClick(!isOpen)" class="uni-collapse-item__title"
|
||||
:class="{'is-open':isOpen &&titleBorder === 'auto' ,'uni-collapse-item-border':titleBorder !== 'none'}">
|
||||
<view class="uni-collapse-item__title-wrap">
|
||||
<slot name="title">
|
||||
<view class="uni-collapse-item__title-box" :class="{'is-disabled':disabled}">
|
||||
<image v-if="thumb" :src="thumb" class="uni-collapse-item__title-img" />
|
||||
<text class="uni-collapse-item__title-text">{{ title }}</text>
|
||||
</view>
|
||||
</slot>
|
||||
</view>
|
||||
<view
|
||||
v-if="showArrow"
|
||||
:class="{ 'uni-collapse-item__title-arrow-active': isOpen, 'uni-collapse-item--animation': showAnimation === true }"
|
||||
class="uni-collapse-item__title-arrow">
|
||||
<uni-icons :color="disabled?'#ddd':'#bbb'" size="14" type="arrowdown" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="uni-collapse-item__wrap" :class="{'is--transition':showAnimation}"
|
||||
:style="{height: (isOpen?height:0) +'px'}">
|
||||
<view :id="elId" ref="collapse--hook" class="uni-collapse-item__wrap-content"
|
||||
:class="{open:isheight,'uni-collapse-item--border':border&&isOpen}">
|
||||
<slot></slot>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifdef APP-NVUE
|
||||
const dom = weex.requireModule('dom')
|
||||
// #endif
|
||||
/**
|
||||
* CollapseItem 折叠面板子组件
|
||||
* @description 折叠面板子组件
|
||||
* @property {String} title 标题文字
|
||||
* @property {String} thumb 标题左侧缩略图
|
||||
* @property {String} name 唯一标志符
|
||||
* @property {Boolean} open = [true|false] 是否展开组件
|
||||
* @property {Boolean} titleBorder = [true|false] 是否显示标题分隔线
|
||||
* @property {Boolean} border = [true|false] 是否显示分隔线
|
||||
* @property {Boolean} disabled = [true|false] 是否展开面板
|
||||
* @property {Boolean} showAnimation = [true|false] 开启动画
|
||||
* @property {Boolean} showArrow = [true|false] 是否显示右侧箭头
|
||||
*/
|
||||
export default {
|
||||
name: 'uniCollapseItem',
|
||||
props: {
|
||||
// 列表标题
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
name: {
|
||||
type: [Number, String],
|
||||
default: ''
|
||||
},
|
||||
// 是否禁用
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// #ifdef APP-PLUS
|
||||
// 是否显示动画,app 端默认不开启动画,卡顿严重
|
||||
showAnimation: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
// 是否显示动画
|
||||
showAnimation: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// #endif
|
||||
// 是否展开
|
||||
open: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 缩略图
|
||||
thumb: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 标题分隔线显示类型
|
||||
titleBorder: {
|
||||
type: String,
|
||||
default: 'auto'
|
||||
},
|
||||
border: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
showArrow:{
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
// TODO 随机生生元素ID,解决百度小程序获取同一个元素位置信息的bug
|
||||
const elId = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}`
|
||||
return {
|
||||
isOpen: false,
|
||||
isheight: null,
|
||||
height: 0,
|
||||
elId,
|
||||
nameSync: 0
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
open(val) {
|
||||
this.isOpen = val
|
||||
this.onClick(val,'init')
|
||||
}
|
||||
},
|
||||
updated(e) {
|
||||
this.$nextTick(()=> {
|
||||
this.init(true)
|
||||
})
|
||||
},
|
||||
created(){
|
||||
this.collapse = this.getCollapse()
|
||||
this.oldHeight = 0
|
||||
},
|
||||
// #ifndef VUE3
|
||||
// TODO vue2
|
||||
destroyed() {
|
||||
if (this.__isUnmounted) return
|
||||
this.uninstall()
|
||||
},
|
||||
// #endif
|
||||
// #ifdef VUE3
|
||||
// TODO vue3
|
||||
unmounted() {
|
||||
this.__isUnmounted = true
|
||||
this.uninstall()
|
||||
},
|
||||
// #endif
|
||||
mounted() {
|
||||
if (!this.collapse) return
|
||||
if (this.name !== '') {
|
||||
this.nameSync = this.name
|
||||
} else {
|
||||
this.nameSync = this.collapse.childrens.length + ''
|
||||
}
|
||||
if (this.collapse.names.indexOf(this.nameSync) === -1) {
|
||||
this.collapse.names.push(this.nameSync)
|
||||
} else {
|
||||
console.warn(`name 值 ${this.nameSync} 重复`);
|
||||
}
|
||||
if (this.collapse.childrens.indexOf(this) === -1) {
|
||||
this.collapse.childrens.push(this)
|
||||
}
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
init(type) {
|
||||
// #ifndef APP-NVUE
|
||||
this.getCollapseHeight(type)
|
||||
// #endif
|
||||
// #ifdef APP-NVUE
|
||||
this.getNvueHwight(type)
|
||||
// #endif
|
||||
},
|
||||
uninstall() {
|
||||
if (this.collapse) {
|
||||
this.collapse.childrens.forEach((item, index) => {
|
||||
if (item === this) {
|
||||
this.collapse.childrens.splice(index, 1)
|
||||
}
|
||||
})
|
||||
this.collapse.names.forEach((item, index) => {
|
||||
if (item === this.nameSync) {
|
||||
this.collapse.names.splice(index, 1)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
onClick(isOpen,type) {
|
||||
if (this.disabled) return
|
||||
this.isOpen = isOpen
|
||||
if (this.isOpen && this.collapse) {
|
||||
this.collapse.setAccordion(this)
|
||||
}
|
||||
if(type !== 'init'){
|
||||
this.collapse.onChange(isOpen,this)
|
||||
}
|
||||
},
|
||||
getCollapseHeight(type, index = 0) {
|
||||
const views = uni.createSelectorQuery().in(this)
|
||||
views
|
||||
.select(`#${this.elId}`)
|
||||
.fields({
|
||||
size: true
|
||||
}, data => {
|
||||
// TODO 百度中可能获取不到节点信息 ,需要循环获取
|
||||
if (index >= 10) return
|
||||
if (!data) {
|
||||
index++
|
||||
this.getCollapseHeight(false, index)
|
||||
return
|
||||
}
|
||||
// #ifdef APP-NVUE
|
||||
this.height = data.height + 1
|
||||
// #endif
|
||||
// #ifndef APP-NVUE
|
||||
this.height = data.height
|
||||
// #endif
|
||||
this.isheight = true
|
||||
if (type) return
|
||||
this.onClick(this.open,'init')
|
||||
})
|
||||
.exec()
|
||||
},
|
||||
getNvueHwight(type) {
|
||||
const result = dom.getComponentRect(this.$refs['collapse--hook'], option => {
|
||||
if (option && option.result && option.size) {
|
||||
// #ifdef APP-NVUE
|
||||
this.height = option.size.height + 1
|
||||
// #endif
|
||||
// #ifndef APP-NVUE
|
||||
this.height = option.size.height
|
||||
// #endif
|
||||
this.isheight = true
|
||||
if (type) return
|
||||
this.onClick(this.open,'init')
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取父元素实例
|
||||
*/
|
||||
getCollapse(name = 'uniCollapse') {
|
||||
let parent = this.$parent;
|
||||
let parentName = parent.$options.name;
|
||||
while (parentName !== name) {
|
||||
parent = parent.$parent;
|
||||
if (!parent) return false;
|
||||
parentName = parent.$options.name;
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.uni-collapse-item {
|
||||
/* #ifndef APP-NVUE */
|
||||
box-sizing: border-box;
|
||||
|
||||
/* #endif */
|
||||
&__title {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
transition: border-bottom-color .3s;
|
||||
|
||||
// transition-property: border-bottom-color;
|
||||
// transition-duration: 5s;
|
||||
&-wrap {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
|
||||
}
|
||||
|
||||
&-box {
|
||||
padding: 0 15px;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 48px;
|
||||
line-height: 48px;
|
||||
background-color: #fff;
|
||||
color: #303133;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
/* #ifdef H5 */
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
|
||||
/* #endif */
|
||||
&.is-disabled {
|
||||
.uni-collapse-item__title-text {
|
||||
color: $uni-text-color-disable;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
&.uni-collapse-item-border {
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
}
|
||||
|
||||
&.is-open {
|
||||
border-bottom-color: transparent;
|
||||
}
|
||||
|
||||
&-img {
|
||||
height: $uni-img-size-base;
|
||||
width: $uni-img-size-base;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
&-text {
|
||||
flex: 1;
|
||||
font-size: $uni-font-size-base;
|
||||
/* #ifndef APP-NVUE */
|
||||
white-space: nowrap;
|
||||
color: inherit;
|
||||
/* #endif */
|
||||
/* #ifdef APP-NVUE */
|
||||
lines: 1;
|
||||
/* #endif */
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
&-arrow {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
/* #endif */
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin-right: 10px;
|
||||
transform: rotate(0deg);
|
||||
|
||||
&-active {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
&__wrap {
|
||||
/* #ifndef APP-NVUE */
|
||||
will-change: height;
|
||||
box-sizing: border-box;
|
||||
/* #endif */
|
||||
background-color: #fff;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
height: 0;
|
||||
|
||||
&.is--transition {
|
||||
// transition: all 0.3s;
|
||||
transition-property: height, border-bottom-width;
|
||||
transition-duration: 0.3s;
|
||||
/* #ifndef APP-NVUE */
|
||||
will-change: height;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
|
||||
|
||||
&-content {
|
||||
position: absolute;
|
||||
font-size: 13px;
|
||||
color: #303133;
|
||||
// transition: height 0.3s;
|
||||
border-bottom-color: transparent;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 0;
|
||||
|
||||
&.uni-collapse-item--border {
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-color: red;
|
||||
border-bottom-color: #ebeef5;
|
||||
}
|
||||
|
||||
&.open {
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&--animation {
|
||||
transition-property: transform;
|
||||
transition-duration: 0.3s;
|
||||
transition-timing-function: ease;
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,146 @@
|
||||
<template>
|
||||
<view class="uni-collapse">
|
||||
<slot />
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
/**
|
||||
* Collapse 折叠面板
|
||||
* @description 展示可以折叠 / 展开的内容区域
|
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=23
|
||||
* @property {String|Array} value 当前激活面板改变时触发(如果是手风琴模式,参数类型为string,否则为array)
|
||||
* @property {Boolean} accordion = [true|false] 是否开启手风琴效果是否开启手风琴效果
|
||||
* @event {Function} change 切换面板时触发,如果是手风琴模式,返回类型为string,否则为array
|
||||
*/
|
||||
export default {
|
||||
name: 'uniCollapse',
|
||||
emits:['change','activeItem','input','update:modelValue'],
|
||||
props: {
|
||||
value: {
|
||||
type: [String, Array],
|
||||
default: ''
|
||||
},
|
||||
modelValue: {
|
||||
type: [String, Array],
|
||||
default: ''
|
||||
},
|
||||
accordion: {
|
||||
// 是否开启手风琴效果
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
// TODO 兼容 vue2 和 vue3
|
||||
dataValue() {
|
||||
let value = (typeof this.value === 'string' && this.value === '') ||
|
||||
(Array.isArray(this.value) && this.value.length === 0)
|
||||
let modelValue = (typeof this.modelValue === 'string' && this.modelValue === '') ||
|
||||
(Array.isArray(this.modelValue) && this.modelValue.length === 0)
|
||||
if (value) {
|
||||
return this.modelValue
|
||||
}
|
||||
if (modelValue) {
|
||||
return this.value
|
||||
}
|
||||
|
||||
return this.value
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dataValue(val) {
|
||||
this.setOpen(val)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.childrens = []
|
||||
this.names = []
|
||||
},
|
||||
mounted() {
|
||||
this.setOpen(this.dataValue)
|
||||
},
|
||||
methods: {
|
||||
setOpen(val) {
|
||||
let str = typeof val === 'string'
|
||||
let arr = Array.isArray(val)
|
||||
|
||||
this.childrens.forEach((vm, index) => {
|
||||
if (str) {
|
||||
if (val === vm.nameSync) {
|
||||
if (!this.accordion) {
|
||||
console.warn('accordion 属性为 false ,v-model 类型应该为 array')
|
||||
return
|
||||
}
|
||||
vm.isOpen = true
|
||||
}
|
||||
}
|
||||
if (arr) {
|
||||
val.forEach(v => {
|
||||
if (v === vm.nameSync) {
|
||||
if (this.accordion) {
|
||||
console.warn('accordion 属性为 true ,v-model 类型应该为 string')
|
||||
return
|
||||
}
|
||||
vm.isOpen = true
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
this.emit(val)
|
||||
},
|
||||
setAccordion(self) {
|
||||
if (!this.accordion) return
|
||||
this.childrens.forEach((vm, index) => {
|
||||
if (self !== vm) {
|
||||
vm.isOpen = false
|
||||
}
|
||||
})
|
||||
},
|
||||
resize() {
|
||||
this.childrens.forEach((vm, index) => {
|
||||
// #ifndef APP-NVUE
|
||||
vm.getCollapseHeight()
|
||||
// #endif
|
||||
// #ifdef APP-NVUE
|
||||
vm.getNvueHwight()
|
||||
// #endif
|
||||
})
|
||||
},
|
||||
onChange(isOpen, self) {
|
||||
let activeItem = []
|
||||
|
||||
if (this.accordion) {
|
||||
activeItem = isOpen ? self.nameSync : ''
|
||||
} else {
|
||||
this.childrens.forEach((vm, index) => {
|
||||
if (vm.isOpen) {
|
||||
activeItem.push(vm.nameSync)
|
||||
}
|
||||
})
|
||||
}
|
||||
this.$emit('change', activeItem)
|
||||
this.emit(activeItem)
|
||||
},
|
||||
emit(val){
|
||||
this.$emit('input', val)
|
||||
this.$emit('update:modelValue', val)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.uni-collapse {
|
||||
/* #ifndef APP-NVUE */
|
||||
width: 100%;
|
||||
display: flex;
|
||||
/* #endif */
|
||||
/* #ifdef APP-NVUE */
|
||||
flex: 1;
|
||||
/* #endif */
|
||||
flex-direction: column;
|
||||
background-color: $uni-bg-color;
|
||||
}
|
||||
</style>
|
||||
88
uni_modules/uni-collapse/package.json
Normal file
@@ -0,0 +1,88 @@
|
||||
{
|
||||
"id": "uni-collapse",
|
||||
"displayName": "uni-collapse 折叠面板",
|
||||
"version": "1.3.3",
|
||||
"description": "Collapse 组件,可以折叠 / 展开的内容区域。",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
"折叠",
|
||||
"折叠面板",
|
||||
"手风琴"
|
||||
],
|
||||
"repository": "https://github.com/dcloudio/uni-ui",
|
||||
"engines": {
|
||||
"HBuilderX": ""
|
||||
},
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": "0.00"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": ""
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [
|
||||
"uni-icons"
|
||||
],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
},
|
||||
"client": {
|
||||
"App": {
|
||||
"app-vue": "y",
|
||||
"app-nvue": "y"
|
||||
},
|
||||
"H5-mobile": {
|
||||
"Safari": "y",
|
||||
"Android Browser": "y",
|
||||
"微信浏览器(Android)": "y",
|
||||
"QQ浏览器(Android)": "y"
|
||||
},
|
||||
"H5-pc": {
|
||||
"Chrome": "y",
|
||||
"IE": "y",
|
||||
"Edge": "y",
|
||||
"Firefox": "y",
|
||||
"Safari": "y"
|
||||
},
|
||||
"小程序": {
|
||||
"微信": "y",
|
||||
"阿里": "y",
|
||||
"百度": "y",
|
||||
"字节跳动": "y",
|
||||
"QQ": "y"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "u",
|
||||
"联盟": "u"
|
||||
},
|
||||
"Vue": {
|
||||
"vue2": "y",
|
||||
"vue3": "u"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
276
uni_modules/uni-collapse/readme.md
Normal file
@@ -0,0 +1,276 @@
|
||||
|
||||
|
||||
## Collapse 折叠面板
|
||||
> **组件名:uni-collapse**
|
||||
> 代码块: `uCollapse`
|
||||
> 关联组件:`uni-collapse-item`、`uni-icons`。
|
||||
|
||||
|
||||
折叠面板用来折叠/显示过长的内容或者是列表。通常是在多内容分类项使用,折叠不重要的内容,显示重要内容。点击可以展开折叠部分。
|
||||
|
||||
> **注意事项**
|
||||
> 为了避免错误使用,给大家带来不好的开发体验,请在使用组件前仔细阅读下面的注意事项,可以帮你避免一些错误。
|
||||
> - 组件需要依赖 `sass` 插件 ,请自行手动安装
|
||||
> - `App` 端默认关闭组件动画 ,因为 `height` 动画开销比较大,会导致页面卡顿,请酌情使用动画
|
||||
> - 如在使用组件过程从发现卡顿严重,请尝试停用组件动画,问题原因如上
|
||||
> - 在小程序端组件内容发生变化,需要手动调用 resize() 方法,手动更新几点信息,避免出现内容错位
|
||||
> - 如需自定义组件默认边框颜色等,请使用插槽自定义内容并合理使用 `border ` 和 `title-border` 属性
|
||||
> - 折叠面板仅支持嵌套使用,请勿单独使用
|
||||
> - 组件支持 nvue ,需要在 `manifest.json > app-plus` 节点下配置 `"nvueStyleCompiler" : "uni-app"`
|
||||
> - 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
|
||||
|
||||
|
||||
### 安装方式
|
||||
|
||||
本组件符合[easycom](https://uniapp.dcloud.io/collocation/pages?id=easycom)规范,`HBuilderX 2.5.5`起,只需将本组件导入项目,在页面`template`中即可直接使用,无需在页面中`import`和注册`components`。
|
||||
|
||||
如需通过`npm`方式使用`uni-ui`组件,另见文档:[https://ext.dcloud.net.cn/plugin?id=55](https://ext.dcloud.net.cn/plugin?id=55)
|
||||
|
||||
|
||||
### 基本用法
|
||||
|
||||
使用 `title` 属性指定面板显示内容
|
||||
|
||||
使用 `open` 属性默认打开当前面板
|
||||
|
||||
使用 `disabled` 属性禁用面板
|
||||
|
||||
|
||||
```html
|
||||
<uni-collapse>
|
||||
<uni-collapse-item title="默认开启" :open="true">
|
||||
<text>折叠内容</text>
|
||||
</uni-collapse-item>
|
||||
<uni-collapse-item title="折叠内容">
|
||||
<text>折叠内容</text>
|
||||
</uni-collapse-item>
|
||||
<uni-collapse-item title="禁用状态" disabled>
|
||||
<text>折叠内容</text>
|
||||
</uni-collapse-item>
|
||||
</uni-collapse>
|
||||
```
|
||||
|
||||
### 手风琴效果
|
||||
|
||||
使用 `accordion` 属性,可以仅打开一个面板并关闭其他已经打开的面板,效果类似手风琴
|
||||
|
||||
设置 `accordion` 属性时,`open` 属性则生效在最后一个组件
|
||||
|
||||
```html
|
||||
<uni-collapse accordion>
|
||||
<uni-collapse-item title="手风琴效果">
|
||||
<text>折叠内容</text>
|
||||
</uni-collapse-item>
|
||||
<uni-collapse-item title="手风琴效果">
|
||||
<text>折叠内容</text>
|
||||
</uni-collapse-item>
|
||||
<uni-collapse-item title="禁用状态" disabled>
|
||||
<text>折叠内容</text>
|
||||
</uni-collapse-item>
|
||||
</uni-collapse>
|
||||
```
|
||||
|
||||
### 动态设置折叠面板打开状态
|
||||
|
||||
使用 `v-model` 属性,动态设置面板的显示状态
|
||||
|
||||
使用 `name` 属性设置每个面板的唯一标识,如不设置使用默认索引,从字符串 `"0"` 开始记数
|
||||
|
||||
**注意**
|
||||
|
||||
- 如果 `accordion` 属性为 `true` 则 `v-model` 类型为 `String`
|
||||
- 如果 `accordion` 属性为 `false` 则 `v-model` 类型为 `Array`
|
||||
- 请注意 `v-model` 属性与 `open` 属性请勿一起使用 ,建议只使用 `v-model`
|
||||
|
||||
```html
|
||||
<uni-collapse v-model="value">
|
||||
<uni-collapse-item name="key1" title="默认开启">
|
||||
<text>折叠内容</text>
|
||||
</uni-collapse-item>
|
||||
<uni-collapse-item name="key2" title="默认开启">
|
||||
<text>折叠内容</text>
|
||||
</uni-collapse-item>
|
||||
<uni-collapse-item name="key3" title="默认不开启">
|
||||
<text>折叠内容</text>
|
||||
</uni-collapse-item>
|
||||
</uni-collapse>
|
||||
```
|
||||
|
||||
```javascript
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
value:['key1','key2'],
|
||||
// 如果设置了 accordion 属性,则使用 string 类型
|
||||
// value:'key1'
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 使用动画
|
||||
|
||||
使用 `show-animation` 属性开启或关闭面板折叠动画,默认动画开启
|
||||
|
||||
**注意**
|
||||
|
||||
- `App` 端默认关闭组件动画 ,因为 height 动画开销比较大,会导致页面卡顿,请酌情使用动画,如出现明显卡顿,尝试关闭动画
|
||||
|
||||
|
||||
```html
|
||||
<uni-collapse>
|
||||
<uni-collapse-item :show-animation="true" title="开启动画">
|
||||
<text>折叠内容</text>
|
||||
</uni-collapse-item>
|
||||
<uni-collapse-item :show-animation="true" title="开启动画">
|
||||
<text>折叠内容</text>
|
||||
</uni-collapse-item>
|
||||
<uni-collapse-item :show-animation="false" title="不开启动画">
|
||||
<text>折叠内容</text>
|
||||
</uni-collapse-item>
|
||||
</uni-collapse>
|
||||
```
|
||||
|
||||
### 配置图片
|
||||
|
||||
使用 `thumb` 配置图片地址, 可在面板左侧显示一个图片
|
||||
|
||||
如需显示更多内容,如图标等,请见下方自定义插槽的说明
|
||||
|
||||
```html
|
||||
<uni-collapse>
|
||||
<uni-collapse-item title="标题文字"
|
||||
thumb="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png">
|
||||
<view class="content">
|
||||
<text class="text">折叠内容主体,可自定义内容及样式</text>
|
||||
</view>
|
||||
</uni-collapse-item>
|
||||
</uni-collapse>
|
||||
```
|
||||
|
||||
### 自定义插槽
|
||||
|
||||
如果需要自定义面板显示,可以使用 `title` 插槽达成完全自定义。下面是一个使用 `uni-list` 的列表示例,需要引入 `uni-list` 组件
|
||||
|
||||
```html
|
||||
<uni-collapse>
|
||||
<!-- 因为list默认带一条分隔线,所以使用 titleBorder="none" 取消面板的分隔线 -->
|
||||
<uni-collapse-item title-border="none" :border="false">
|
||||
<template v-slot:title>
|
||||
<uni-list>
|
||||
<uni-list-item title="标题使用自定义标题插槽" :show-extra-icon="true" :extra-icon="extraIcon">
|
||||
</uni-list-item>
|
||||
</uni-list>
|
||||
</template>
|
||||
<view class="content">
|
||||
<text class="text">折叠内容主体,可自定义内容及样式</text>
|
||||
</view>
|
||||
</uni-collapse-item>
|
||||
</uni-collapse>
|
||||
```
|
||||
|
||||
**注意**
|
||||
|
||||
- 在折叠面板组件中使用list时,在 App-Nvue 下请勿单独使用 uni-list-item,会导致组件无法正常显示,其他平台不做限制
|
||||
- 在默认插槽里使用 uni-list 组件与上方示例一样,直接写在默认插槽里即可
|
||||
|
||||
## API
|
||||
|
||||
### Collapse Props
|
||||
|
||||
|属性名|类型|默认值|说明|
|
||||
|:-:|:-:|:-:|:-:|
|
||||
|value/v-model|String/Array|-|当前激活面板改变时触发(如果是手风琴模式,参数类型为string,否则为array)|
|
||||
|accordion|Boolean|false|是否开启手风琴效果 |
|
||||
|
||||
### Collapse Event
|
||||
|
||||
|事件称名|说明|返回值|
|
||||
|:-:|:-:|:-:|
|
||||
|@change|切换面板时触发 |切换面板时触发,如果是手风琴模式,返回类型为string,否则为array|
|
||||
|
||||
### Collapse Methods
|
||||
|
||||
|方法名称|说明|
|
||||
|:-:|:-:|
|
||||
|resize |更新当前列表高度|
|
||||
|
||||
> **提示**
|
||||
> - resize 方法解决动态添加数据,带动画的折叠面板高度不更新的问题
|
||||
> - 需要在数据渲染完毕之后使用 `resize` 方法。推荐在 `this.$nextTick()` 中使用
|
||||
> - 当前只有小程序端需要调用此方法,H5\App 端已经做了处理,不需要手动更新高度
|
||||
> ```html
|
||||
> <view>
|
||||
> <uni-collapse ref="collapse" v-model="value">
|
||||
> <uni-collapse-item title="默认开启" >
|
||||
> <view class="content">
|
||||
> <text class="text">{{content}}</text>
|
||||
> </view>
|
||||
> </uni-collapse-item>
|
||||
> <uni-collapse-item title="折叠内容">
|
||||
> <view class="content">
|
||||
> <text class="text">折叠内容主体,这是一段比较长内容。默认折叠主要内容,只显示当前项标题。点击标题展开,才能看到这段文字。再次点击标题,折叠内容。</text>
|
||||
> </view>
|
||||
> </uni-collapse-item>
|
||||
> </uni-collapse>
|
||||
> <button class="button" type="primary" @click="add">动态修改内容</button>
|
||||
> </view>
|
||||
> ```
|
||||
> ```javascript
|
||||
> export default {
|
||||
> data() {
|
||||
> return {
|
||||
> value:['0'],
|
||||
> content: '折叠内容主体,可自定义内容及样式,点击按钮修改内容使高度发生变化。',
|
||||
> }
|
||||
> },
|
||||
> methods: {
|
||||
> add() {
|
||||
> if (this.content.length > 35) {
|
||||
> this.content = '折叠内容主体,可自定义内容及样式,点击按钮修改内容使高度发生变化。'
|
||||
> } else {
|
||||
> this.content = '折叠内容主体,这是一段比较长内容。通过点击按钮修改后内容后,使组件高度发生变化,在次点击按钮恢复之前的内容和高度。'
|
||||
> }
|
||||
> // TODO 小程序中不支持自动更新 ,需要手动resize 更新组件高度
|
||||
> // #ifdef MP
|
||||
> this.$nextTick(() => {
|
||||
> this.$refs.collapse.resize()
|
||||
> })
|
||||
> // #endif
|
||||
> }
|
||||
> }
|
||||
> }
|
||||
> ```
|
||||
|
||||
|
||||
### CollapseItem Props
|
||||
|
||||
|属性名|类型|默认值|说明|
|
||||
|:-:|:-:|:-:|:-:|
|
||||
|title|String|-|标题文字|
|
||||
|thumb|String|-|标题左侧缩略图|
|
||||
|disabled|Boolean|false|是否禁用|
|
||||
|open|Boolean|false|是否展开面板|
|
||||
|show-animation|Boolean|false|开启动画|
|
||||
|border|Boolean|true|折叠面板内容分隔线|
|
||||
|title-border|String|auto|折叠面板标题分隔线可选值见下方 **TitleBorder Params**|
|
||||
|show-arrow|Boolean|true|是否显示右侧箭头|
|
||||
|
||||
#### TitleBorder Params
|
||||
|
||||
|参数名|说明|
|
||||
|:-:|:-:|
|
||||
|auto|分隔线自动显示|
|
||||
|none|不显示分隔线|
|
||||
|show|一直显示分隔线|
|
||||
|
||||
### Collapse Slots
|
||||
|
||||
|插槽名|说明|
|
||||
|:-:| :-:|
|
||||
|default|默认插槽|
|
||||
|title|面板标题插槽,如使用此插槽禁用样式效果将失效|
|
||||
|
||||
## 组件示例
|
||||
|
||||
点击查看:[https://hellouniapp.dcloud.net.cn/pages/extUI/collapse/collapse](https://hellouniapp.dcloud.net.cn/pages/extUI/collapse/collapse)
|
||||
24
uni_modules/uni-swipe-action/changelog.md
Normal file
@@ -0,0 +1,24 @@
|
||||
## 1.2.4(2021-08-20)
|
||||
- 优化 close-all 方法
|
||||
## 1.2.3(2021-08-20)
|
||||
- 新增 close-all 方法,关闭所有已打开的组件
|
||||
## 1.2.2(2021-08-17)
|
||||
- 新增 resize() 方法,在非微信小程序、h5、app-vue端出现不能滑动的问题的时候,重置组件
|
||||
- 修复 app 端偶尔出现类似 Page[x][-x,xx;-x,xx,x,x-x] 的问题
|
||||
- 优化 微信小程序、h5、app-vue 滑动逻辑,避免出现动态新增组件后不能滑动的问题
|
||||
## 1.2.1(2021-07-30)
|
||||
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
|
||||
- 修复 跨页面修改组件数据 ,导致不能滑动的问题
|
||||
## 1.1.10(2021-06-17)
|
||||
- 修复 按钮点击执行两次的bug
|
||||
## 1.1.9(2021-05-12)
|
||||
- 新增 项目示例地址
|
||||
## 1.1.8(2021-03-26)
|
||||
- 修复 微信小程序 nv_navigator is not defined 报错的bug
|
||||
## 1.1.7(2021-02-05)
|
||||
- 调整为uni_modules目录规范
|
||||
- 新增 左侧滑动
|
||||
- 新增 插槽使用方式
|
||||
- 新增 threshold 属性,可以控制滑动缺省值
|
||||
- 优化 长列表滚动性能
|
||||
- 修复 滚动页面时触发组件滑动的Bug
|
||||
@@ -0,0 +1,300 @@
|
||||
// #ifdef APP-NVUE
|
||||
const BindingX = uni.requireNativePlugin('bindingx');
|
||||
const dom = uni.requireNativePlugin('dom');
|
||||
const animation = uni.requireNativePlugin('animation');
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
|
||||
watch: {
|
||||
show(newVal) {
|
||||
if (this.autoClose) return
|
||||
if (this.stop) return
|
||||
this.stop = true
|
||||
if (newVal) {
|
||||
this.open(newVal)
|
||||
} else {
|
||||
this.close()
|
||||
}
|
||||
},
|
||||
leftOptions() {
|
||||
this.getSelectorQuery()
|
||||
this.init()
|
||||
},
|
||||
rightOptions(newVal) {
|
||||
this.init()
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.swipeaction = this.getSwipeAction()
|
||||
if (this.swipeaction.children !== undefined) {
|
||||
this.swipeaction.children.push(this)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.box = this.getEl(this.$refs['selector-box--hock'])
|
||||
this.selector = this.getEl(this.$refs['selector-content--hock']);
|
||||
this.leftButton = this.getEl(this.$refs['selector-left-button--hock']);
|
||||
this.rightButton = this.getEl(this.$refs['selector-right-button--hock']);
|
||||
this.init()
|
||||
},
|
||||
// beforeDestroy() {
|
||||
// this.swipeaction.children.forEach((item, index) => {
|
||||
// if (item === this) {
|
||||
// this.swipeaction.children.splice(index, 1)
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
methods: {
|
||||
init() {
|
||||
this.$nextTick(() => {
|
||||
this.x = 0
|
||||
this.button = {
|
||||
show: false
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.getSelectorQuery()
|
||||
}, 200)
|
||||
})
|
||||
},
|
||||
onClick(index, item, position) {
|
||||
this.$emit('click', {
|
||||
content: item,
|
||||
index,
|
||||
position
|
||||
})
|
||||
},
|
||||
touchstart(e) {
|
||||
// 每次只触发一次,避免多次监听造成闪烁
|
||||
if (this.stop) return
|
||||
this.stop = true
|
||||
if (this.autoClose) {
|
||||
this.swipeaction.closeOther(this)
|
||||
}
|
||||
|
||||
const leftWidth = this.button.left.width
|
||||
const rightWidth = this.button.right.width
|
||||
let expression = this.range(this.x, -rightWidth, leftWidth)
|
||||
let leftExpression = this.range(this.x - leftWidth, -leftWidth, 0)
|
||||
let rightExpression = this.range(this.x + rightWidth, 0, rightWidth)
|
||||
|
||||
this.eventpan = BindingX.bind({
|
||||
anchor: this.box,
|
||||
eventType: 'pan',
|
||||
props: [{
|
||||
element: this.selector,
|
||||
property: 'transform.translateX',
|
||||
expression
|
||||
}, {
|
||||
element: this.leftButton,
|
||||
property: 'transform.translateX',
|
||||
expression: leftExpression
|
||||
}, {
|
||||
element: this.rightButton,
|
||||
property: 'transform.translateX',
|
||||
expression: rightExpression
|
||||
}, ]
|
||||
}, (e) => {
|
||||
// nope
|
||||
if (e.state === 'end') {
|
||||
this.x = e.deltaX + this.x;
|
||||
this.isclick = true
|
||||
this.bindTiming(e.deltaX)
|
||||
}
|
||||
});
|
||||
},
|
||||
touchend(e) {
|
||||
if (this.isopen !== 'none' && !this.isclick) {
|
||||
this.open('none')
|
||||
}
|
||||
},
|
||||
bindTiming(x) {
|
||||
const left = this.x
|
||||
const leftWidth = this.button.left.width
|
||||
const rightWidth = this.button.right.width
|
||||
const threshold = this.threshold
|
||||
if (!this.isopen || this.isopen === 'none') {
|
||||
if (left > threshold) {
|
||||
this.open('left')
|
||||
} else if (left < -threshold) {
|
||||
this.open('right')
|
||||
} else {
|
||||
this.open('none')
|
||||
}
|
||||
} else {
|
||||
if ((x > -leftWidth && x < 0) || x > rightWidth) {
|
||||
if ((x > -threshold && x < 0) || (x - rightWidth > threshold)) {
|
||||
this.open('left')
|
||||
} else {
|
||||
this.open('none')
|
||||
}
|
||||
} else {
|
||||
if ((x < threshold && x > 0) || (x + leftWidth < -threshold)) {
|
||||
this.open('right')
|
||||
} else {
|
||||
this.open('none')
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 移动范围
|
||||
* @param {Object} num
|
||||
* @param {Object} mix
|
||||
* @param {Object} max
|
||||
*/
|
||||
range(num, mix, max) {
|
||||
return `min(max(x+${num}, ${mix}), ${max})`
|
||||
},
|
||||
|
||||
/**
|
||||
* 开启swipe
|
||||
*/
|
||||
open(type) {
|
||||
this.animation(type)
|
||||
},
|
||||
|
||||
/**
|
||||
* 关闭swipe
|
||||
*/
|
||||
close() {
|
||||
this.animation('none')
|
||||
},
|
||||
|
||||
/**
|
||||
* 开启关闭动画
|
||||
* @param {Object} type
|
||||
*/
|
||||
animation(type) {
|
||||
const time = 300
|
||||
const leftWidth = this.button.left.width
|
||||
const rightWidth = this.button.right.width
|
||||
if (this.eventpan && this.eventpan.token) {
|
||||
BindingX.unbind({
|
||||
token: this.eventpan.token,
|
||||
eventType: 'pan'
|
||||
})
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case 'left':
|
||||
Promise.all([
|
||||
this.move(this.selector, leftWidth),
|
||||
this.move(this.leftButton, 0),
|
||||
this.move(this.rightButton, rightWidth * 2)
|
||||
]).then(() => {
|
||||
this.setEmit(leftWidth, type)
|
||||
})
|
||||
break
|
||||
case 'right':
|
||||
Promise.all([
|
||||
this.move(this.selector, -rightWidth),
|
||||
this.move(this.leftButton, -leftWidth * 2),
|
||||
this.move(this.rightButton, 0)
|
||||
]).then(() => {
|
||||
this.setEmit(-rightWidth, type)
|
||||
})
|
||||
break
|
||||
default:
|
||||
Promise.all([
|
||||
this.move(this.selector, 0),
|
||||
this.move(this.leftButton, -leftWidth),
|
||||
this.move(this.rightButton, rightWidth)
|
||||
]).then(() => {
|
||||
this.setEmit(0, type)
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
setEmit(x, type) {
|
||||
const leftWidth = this.button.left.width
|
||||
const rightWidth = this.button.right.width
|
||||
this.isopen = this.isopen || 'none'
|
||||
this.stop = false
|
||||
this.isclick = false
|
||||
// 只有状态不一致才会返回结果
|
||||
if (this.isopen !== type && this.x !== x) {
|
||||
if (type === 'left' && leftWidth > 0) {
|
||||
this.$emit('change', 'left')
|
||||
}
|
||||
if (type === 'right' && rightWidth > 0) {
|
||||
this.$emit('change', 'right')
|
||||
}
|
||||
if (type === 'none') {
|
||||
this.$emit('change', 'none')
|
||||
}
|
||||
}
|
||||
this.x = x
|
||||
this.isopen = type
|
||||
},
|
||||
move(ref, value) {
|
||||
return new Promise((resolve, reject) => {
|
||||
animation.transition(ref, {
|
||||
styles: {
|
||||
transform: `translateX(${value})`,
|
||||
},
|
||||
duration: 150, //ms
|
||||
timingFunction: 'linear',
|
||||
needLayout: false,
|
||||
delay: 0 //ms
|
||||
}, function(res) {
|
||||
resolve(res)
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取ref
|
||||
* @param {Object} el
|
||||
*/
|
||||
getEl(el) {
|
||||
return el.ref
|
||||
},
|
||||
/**
|
||||
* 获取节点信息
|
||||
*/
|
||||
getSelectorQuery() {
|
||||
Promise.all([
|
||||
this.getDom('left'),
|
||||
this.getDom('right'),
|
||||
]).then((data) => {
|
||||
let show = 'none'
|
||||
if (this.autoClose) {
|
||||
show = 'none'
|
||||
} else {
|
||||
show = this.show
|
||||
}
|
||||
|
||||
if (show === 'none') {
|
||||
// this.close()
|
||||
} else {
|
||||
this.open(show)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
getDom(str) {
|
||||
return new Promise((resolve, reject) => {
|
||||
dom.getComponentRect(this.$refs[`selector-${str}-button--hock`], (data) => {
|
||||
if (data) {
|
||||
this.button[str] = data.size
|
||||
resolve(data)
|
||||
} else {
|
||||
reject()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// #endif
|
||||
|
||||
// #ifndef APP-NVUE
|
||||
export default {}
|
||||
// #endif
|
||||
@@ -0,0 +1,12 @@
|
||||
export function isPC() {
|
||||
var userAgentInfo = navigator.userAgent;
|
||||
var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
|
||||
var flag = true;
|
||||
for (let v = 0; v < Agents.length - 1; v++) {
|
||||
if (userAgentInfo.indexOf(Agents[v]) > 0) {
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
x: 0,
|
||||
transition: false,
|
||||
width: 0,
|
||||
viewWidth: 0,
|
||||
swipeShow: 0
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
show(newVal) {
|
||||
if (this.autoClose) return
|
||||
if (newVal && newVal !== 'none' ) {
|
||||
this.transition = true
|
||||
this.open(newVal)
|
||||
} else {
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.swipeaction = this.getSwipeAction()
|
||||
if (this.swipeaction.children !== undefined) {
|
||||
this.swipeaction.children.push(this)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.isopen = false
|
||||
setTimeout(() => {
|
||||
this.getQuerySelect()
|
||||
}, 50)
|
||||
},
|
||||
methods: {
|
||||
appTouchStart(e) {
|
||||
const {
|
||||
clientX
|
||||
} = e.changedTouches[0]
|
||||
this.clientX = clientX
|
||||
this.timestamp = new Date().getTime()
|
||||
},
|
||||
appTouchEnd(e, index, item, position) {
|
||||
const {
|
||||
clientX
|
||||
} = e.changedTouches[0]
|
||||
// fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题
|
||||
let diff = Math.abs(this.clientX - clientX)
|
||||
let time = (new Date().getTime()) - this.timestamp
|
||||
if (diff < 40 && time < 300) {
|
||||
this.$emit('click', {
|
||||
content: item,
|
||||
index,
|
||||
position
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 移动触发
|
||||
* @param {Object} e
|
||||
*/
|
||||
onChange(e) {
|
||||
this.moveX = e.detail.x
|
||||
this.isclose = false
|
||||
},
|
||||
touchstart(e) {
|
||||
this.transition = false
|
||||
this.isclose = true
|
||||
this.autoClose && this.swipeaction.closeOther(this)
|
||||
},
|
||||
touchmove(e) {},
|
||||
touchend(e) {
|
||||
// 0的位置什么都不执行
|
||||
if (this.isclose && this.isopen === 'none') return
|
||||
if (this.isclose && this.isopen !== 'none') {
|
||||
this.transition = true
|
||||
this.close()
|
||||
} else {
|
||||
this.move(this.moveX + this.leftWidth)
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 移动
|
||||
* @param {Object} moveX
|
||||
*/
|
||||
move(moveX) {
|
||||
// 打开关闭的处理逻辑不太一样
|
||||
this.transition = true
|
||||
// 未打开状态
|
||||
if (!this.isopen || this.isopen === 'none') {
|
||||
if (moveX > this.threshold) {
|
||||
this.open('left')
|
||||
} else if (moveX < -this.threshold) {
|
||||
this.open('right')
|
||||
} else {
|
||||
this.close()
|
||||
}
|
||||
} else {
|
||||
if (moveX < 0 && moveX < this.rightWidth) {
|
||||
const rightX = this.rightWidth + moveX
|
||||
if (rightX < this.threshold) {
|
||||
this.open('right')
|
||||
} else {
|
||||
this.close()
|
||||
}
|
||||
} else if (moveX > 0 && moveX < this.leftWidth) {
|
||||
const leftX = this.leftWidth - moveX
|
||||
if (leftX < this.threshold) {
|
||||
this.open('left')
|
||||
} else {
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 打开
|
||||
*/
|
||||
open(type) {
|
||||
this.x = this.moveX
|
||||
this.animation(type)
|
||||
},
|
||||
|
||||
/**
|
||||
* 关闭
|
||||
*/
|
||||
close() {
|
||||
this.x = this.moveX
|
||||
// TODO 解决 x 值不更新的问题,所以会多触发一次 nextTick ,待优化
|
||||
this.$nextTick(() => {
|
||||
this.x = -this.leftWidth
|
||||
if(this.isopen!=='none'){
|
||||
this.$emit('change', 'none')
|
||||
}
|
||||
this.isopen = 'none'
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 执行结束动画
|
||||
* @param {Object} type
|
||||
*/
|
||||
animation(type) {
|
||||
this.$nextTick(() => {
|
||||
if (type === 'left') {
|
||||
this.x = 0
|
||||
} else {
|
||||
this.x = -this.rightWidth - this.leftWidth
|
||||
}
|
||||
|
||||
if(this.isopen!==type){
|
||||
this.$emit('change', type)
|
||||
}
|
||||
this.isopen = type
|
||||
})
|
||||
|
||||
},
|
||||
getSlide(x) {},
|
||||
getQuerySelect() {
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query.selectAll('.movable-view--hock').boundingClientRect(data => {
|
||||
this.leftWidth = data[1].width
|
||||
this.rightWidth = data[2].width
|
||||
this.width = data[0].width
|
||||
this.viewWidth = this.width + this.rightWidth + this.leftWidth
|
||||
if (this.leftWidth === 0) {
|
||||
// TODO 疑似bug ,初始化的时候如果x 是0,会导致移动位置错误,所以让元素超出一点
|
||||
this.x = -0.1
|
||||
} else {
|
||||
this.x = -this.leftWidth
|
||||
}
|
||||
this.moveX = this.x
|
||||
this.$nextTick(() => {
|
||||
this.swipeShow = 1
|
||||
})
|
||||
|
||||
if (!this.buttonWidth) {
|
||||
this.disabledView = true
|
||||
}
|
||||
|
||||
if (this.autoClose) return
|
||||
if (this.show !== 'none') {
|
||||
this.transition = true
|
||||
this.open(this.shows)
|
||||
}
|
||||
}).exec();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
// #ifndef APP-PLUS|| MP-WEIXIN || H5
|
||||
|
||||
const MIN_DISTANCE = 10;
|
||||
export default {
|
||||
data() {
|
||||
// TODO 随机生生元素ID,解决百度小程序获取同一个元素位置信息的bug
|
||||
const elClass = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}`
|
||||
return {
|
||||
uniShow: false,
|
||||
left: 0,
|
||||
buttonShow: 'none',
|
||||
ani: false,
|
||||
moveLeft:'',
|
||||
elClass
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
show(newVal) {
|
||||
if (this.autoClose) return
|
||||
this.openState(newVal)
|
||||
},
|
||||
left(){
|
||||
this.moveLeft = `translateX(${this.left}px)`
|
||||
},
|
||||
buttonShow(newVal){
|
||||
if (this.autoClose) return
|
||||
this.openState(newVal)
|
||||
},
|
||||
leftOptions() {
|
||||
this.init()
|
||||
},
|
||||
rightOptions() {
|
||||
this.init()
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.swipeaction = this.getSwipeAction()
|
||||
if (this.swipeaction.children !== undefined) {
|
||||
this.swipeaction.children.push(this)
|
||||
}
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
init(){
|
||||
clearTimeout(this.timer)
|
||||
this.timer = setTimeout(() => {
|
||||
this.getSelectorQuery()
|
||||
}, 100)
|
||||
// 移动距离
|
||||
this.left = 0
|
||||
this.x = 0
|
||||
},
|
||||
|
||||
closeSwipe(e) {
|
||||
if (!this.autoClose) return
|
||||
this.swipeaction.closeOther(this)
|
||||
},
|
||||
appTouchStart(e) {
|
||||
const {
|
||||
clientX
|
||||
} = e.changedTouches[0]
|
||||
this.clientX = clientX
|
||||
this.timestamp = new Date().getTime()
|
||||
},
|
||||
appTouchEnd(e, index, item, position) {
|
||||
const {
|
||||
clientX
|
||||
} = e.changedTouches[0]
|
||||
// fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题
|
||||
let diff = Math.abs(this.clientX - clientX)
|
||||
let time = (new Date().getTime()) - this.timestamp
|
||||
if (diff < 40 && time < 300) {
|
||||
this.$emit('click', {
|
||||
content: item,
|
||||
index,
|
||||
position
|
||||
})
|
||||
}
|
||||
},
|
||||
touchstart(e) {
|
||||
if (this.disabled) return
|
||||
this.ani = false
|
||||
this.x = this.left || 0
|
||||
this.stopTouchStart(e)
|
||||
this.autoClose && this.closeSwipe()
|
||||
},
|
||||
touchmove(e) {
|
||||
if (this.disabled) return
|
||||
// 是否可以滑动页面
|
||||
this.stopTouchMove(e);
|
||||
if (this.direction !== 'horizontal') {
|
||||
return;
|
||||
}
|
||||
this.move(this.x + this.deltaX)
|
||||
return false
|
||||
},
|
||||
touchend() {
|
||||
if (this.disabled) return
|
||||
this.moveDirection(this.left)
|
||||
},
|
||||
/**
|
||||
* 设置移动距离
|
||||
* @param {Object} value
|
||||
*/
|
||||
move(value) {
|
||||
value = value || 0
|
||||
const leftWidth = this.leftWidth
|
||||
const rightWidth = this.rightWidth
|
||||
// 获取可滑动范围
|
||||
this.left = this.range(value, -rightWidth, leftWidth);
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取范围
|
||||
* @param {Object} num
|
||||
* @param {Object} min
|
||||
* @param {Object} max
|
||||
*/
|
||||
range(num, min, max) {
|
||||
return Math.min(Math.max(num, min), max);
|
||||
},
|
||||
/**
|
||||
* 移动方向判断
|
||||
* @param {Object} left
|
||||
* @param {Object} value
|
||||
*/
|
||||
moveDirection(left) {
|
||||
const threshold = this.threshold
|
||||
const isopen = this.isopen || 'none'
|
||||
const leftWidth = this.leftWidth
|
||||
const rightWidth = this.rightWidth
|
||||
if (this.deltaX === 0) {
|
||||
this.openState('none')
|
||||
return
|
||||
}
|
||||
if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 && rightWidth +
|
||||
left < threshold)) {
|
||||
// right
|
||||
this.openState('right')
|
||||
} else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 &&
|
||||
leftWidth - left < threshold)) {
|
||||
// left
|
||||
this.openState('left')
|
||||
} else {
|
||||
// default
|
||||
this.openState('none')
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 开启状态
|
||||
* @param {Boolean} type
|
||||
*/
|
||||
openState(type) {
|
||||
const leftWidth = this.leftWidth
|
||||
const rightWidth = this.rightWidth
|
||||
let left = ''
|
||||
this.isopen = this.isopen ? this.isopen : 'none'
|
||||
switch (type) {
|
||||
case "left":
|
||||
left = leftWidth
|
||||
break
|
||||
case "right":
|
||||
left = -rightWidth
|
||||
break
|
||||
default:
|
||||
left = 0
|
||||
}
|
||||
|
||||
|
||||
if (this.isopen !== type) {
|
||||
this.throttle = true
|
||||
this.$emit('change', type)
|
||||
}
|
||||
|
||||
this.isopen = type
|
||||
// 添加动画类
|
||||
this.ani = true
|
||||
this.$nextTick(() => {
|
||||
this.move(left)
|
||||
})
|
||||
// 设置最终移动位置,理论上只要进入到这个函数,肯定是要打开的
|
||||
},
|
||||
close() {
|
||||
this.openState('none')
|
||||
},
|
||||
getDirection(x, y) {
|
||||
if (x > y && x > MIN_DISTANCE) {
|
||||
return 'horizontal';
|
||||
}
|
||||
if (y > x && y > MIN_DISTANCE) {
|
||||
return 'vertical';
|
||||
}
|
||||
return '';
|
||||
},
|
||||
|
||||
/**
|
||||
* 重置滑动状态
|
||||
* @param {Object} event
|
||||
*/
|
||||
resetTouchStatus() {
|
||||
this.direction = '';
|
||||
this.deltaX = 0;
|
||||
this.deltaY = 0;
|
||||
this.offsetX = 0;
|
||||
this.offsetY = 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* 设置滑动开始位置
|
||||
* @param {Object} event
|
||||
*/
|
||||
stopTouchStart(event) {
|
||||
this.resetTouchStatus();
|
||||
const touch = event.touches[0];
|
||||
this.startX = touch.clientX;
|
||||
this.startY = touch.clientY;
|
||||
},
|
||||
|
||||
/**
|
||||
* 滑动中,是否禁止打开
|
||||
* @param {Object} event
|
||||
*/
|
||||
stopTouchMove(event) {
|
||||
const touch = event.touches[0];
|
||||
this.deltaX = touch.clientX - this.startX;
|
||||
this.deltaY = touch.clientY - this.startY;
|
||||
this.offsetX = Math.abs(this.deltaX);
|
||||
this.offsetY = Math.abs(this.deltaY);
|
||||
this.direction = this.direction || this.getDirection(this.offsetX, this.offsetY);
|
||||
},
|
||||
|
||||
getSelectorQuery() {
|
||||
const views = uni.createSelectorQuery().in(this)
|
||||
views
|
||||
.selectAll('.'+this.elClass)
|
||||
.boundingClientRect(data => {
|
||||
if(data.length === 0) return
|
||||
let show = 'none'
|
||||
if (this.autoClose) {
|
||||
show = 'none'
|
||||
} else {
|
||||
show = this.show
|
||||
}
|
||||
this.leftWidth = data[0].width || 0
|
||||
this.rightWidth = data[1].width || 0
|
||||
this.buttonShow = show
|
||||
})
|
||||
.exec()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// #endif
|
||||
|
||||
// #ifdef APP-PLUS|| MP-WEIXIN || H5
|
||||
export default { }
|
||||
// #endif
|
||||
@@ -0,0 +1,81 @@
|
||||
// #ifdef APP-VUE|| MP-WEIXIN || H5
|
||||
import { isPC } from "./isPC"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
is_show:'none'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
show(newVal){
|
||||
this.is_show = this.show
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.swipeaction = this.getSwipeAction()
|
||||
if (this.swipeaction.children !== undefined) {
|
||||
this.swipeaction.children.push(this)
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
this.is_show = this.show
|
||||
},
|
||||
methods: {
|
||||
// wxs 中调用
|
||||
closeSwipe(e) {
|
||||
if (!this.autoClose) return
|
||||
this.swipeaction.closeOther(this)
|
||||
},
|
||||
|
||||
change(e) {
|
||||
this.$emit('change', e.open)
|
||||
if (this.is_show !== e.open) {
|
||||
this.is_show = e.open
|
||||
}
|
||||
},
|
||||
|
||||
appTouchStart(e) {
|
||||
// #ifdef H5
|
||||
if(isPC()) return
|
||||
// #endif
|
||||
const {
|
||||
clientX
|
||||
} = e.changedTouches[0]
|
||||
this.clientX = clientX
|
||||
this.timestamp = new Date().getTime()
|
||||
},
|
||||
appTouchEnd(e, index, item, position) {
|
||||
// #ifdef H5
|
||||
if(isPC()) return
|
||||
// #endif
|
||||
const {
|
||||
clientX
|
||||
} = e.changedTouches[0]
|
||||
// fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题
|
||||
let diff = Math.abs(this.clientX - clientX)
|
||||
let time = (new Date().getTime()) - this.timestamp
|
||||
if (diff < 40 && time < 300) {
|
||||
this.$emit('click', {
|
||||
content: item,
|
||||
index,
|
||||
position
|
||||
})
|
||||
}
|
||||
},
|
||||
onClickForPC(index, item, position) {
|
||||
// #ifdef H5
|
||||
if(!isPC()) return
|
||||
this.$emit('click', {
|
||||
content: item,
|
||||
index,
|
||||
position
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// #endif
|
||||
// #ifndef APP-VUE|| MP-WEIXIN || H5
|
||||
export default {}
|
||||
// #endif
|
||||
@@ -0,0 +1,265 @@
|
||||
const MIN_DISTANCE = 10;
|
||||
export default {
|
||||
showWatch(newVal, oldVal, ownerInstance, instance,self) {
|
||||
let state = self.state
|
||||
this.getDom(instance, ownerInstance,self)
|
||||
if (newVal && newVal !== 'none') {
|
||||
this.openState(newVal, instance, ownerInstance,self)
|
||||
return
|
||||
}
|
||||
|
||||
if (state.left) {
|
||||
this.openState('none', instance, ownerInstance,self)
|
||||
}
|
||||
this.resetTouchStatus(instance,self)
|
||||
},
|
||||
|
||||
/**
|
||||
* 开始触摸操作
|
||||
* @param {Object} e
|
||||
* @param {Object} ins
|
||||
*/
|
||||
touchstart(e, ownerInstance, self) {
|
||||
let instance = e.instance;
|
||||
let disabled = instance.getDataset().disabled
|
||||
let state = self.state;
|
||||
this.getDom(instance, ownerInstance, self)
|
||||
// fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
|
||||
disabled = this.getDisabledType(disabled)
|
||||
if (disabled) return
|
||||
// 开始触摸时移除动画类
|
||||
instance.requestAnimationFrame(function() {
|
||||
instance.removeClass('ani');
|
||||
ownerInstance.callMethod('closeSwipe');
|
||||
})
|
||||
|
||||
// 记录上次的位置
|
||||
state.x = state.left || 0
|
||||
// 计算滑动开始位置
|
||||
this.stopTouchStart(e, ownerInstance, self)
|
||||
},
|
||||
|
||||
/**
|
||||
* 开始滑动操作
|
||||
* @param {Object} e
|
||||
* @param {Object} ownerInstance
|
||||
*/
|
||||
touchmove(e, ownerInstance, self) {
|
||||
let instance = e.instance;
|
||||
let disabled = instance.getDataset().disabled
|
||||
let state = self.state
|
||||
// fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
|
||||
disabled = this.getDisabledType(disabled)
|
||||
if (disabled) return
|
||||
// 是否可以滑动页面
|
||||
this.stopTouchMove(e, self);
|
||||
if (state.direction !== 'horizontal') {
|
||||
return;
|
||||
}
|
||||
if (e.preventDefault) {
|
||||
// 阻止页面滚动
|
||||
e.preventDefault()
|
||||
}
|
||||
let x = state.x + state.deltaX
|
||||
this.move(x, instance, ownerInstance, self)
|
||||
},
|
||||
|
||||
/**
|
||||
* 结束触摸操作
|
||||
* @param {Object} e
|
||||
* @param {Object} ownerInstance
|
||||
*/
|
||||
touchend(e, ownerInstance, self) {
|
||||
let instance = e.instance;
|
||||
let disabled = instance.getDataset().disabled
|
||||
let state = self.state
|
||||
// fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
|
||||
disabled = this.getDisabledType(disabled)
|
||||
|
||||
if (disabled) return
|
||||
// 滑动过程中触摸结束,通过阙值判断是开启还是关闭
|
||||
// fixed by mehaotian 定时器解决点击按钮,touchend 触发比 click 事件时机早的问题 ,主要是 ios13
|
||||
this.moveDirection(state.left, instance, ownerInstance, self)
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 设置移动距离
|
||||
* @param {Object} value
|
||||
* @param {Object} instance
|
||||
* @param {Object} ownerInstance
|
||||
*/
|
||||
move(value, instance, ownerInstance, self) {
|
||||
value = value || 0
|
||||
let state = self.state
|
||||
let leftWidth = state.leftWidth
|
||||
let rightWidth = state.rightWidth
|
||||
// 获取可滑动范围
|
||||
state.left = this.range(value, -rightWidth, leftWidth);
|
||||
instance.requestAnimationFrame(function() {
|
||||
instance.setStyle({
|
||||
transform: 'translateX(' + state.left + 'px)',
|
||||
'-webkit-transform': 'translateX(' + state.left + 'px)'
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取元素信息
|
||||
* @param {Object} instance
|
||||
* @param {Object} ownerInstance
|
||||
*/
|
||||
getDom(instance, ownerInstance, self) {
|
||||
let state = self.state
|
||||
var leftDom = ownerInstance.$el.querySelector('.button-group--left')
|
||||
var rightDom = ownerInstance.$el.querySelector('.button-group--right')
|
||||
|
||||
state.leftWidth = leftDom.offsetWidth || 0
|
||||
state.rightWidth = rightDom.offsetWidth || 0
|
||||
state.threshold = instance.getDataset().threshold
|
||||
},
|
||||
|
||||
getDisabledType(value) {
|
||||
return (typeof(value) === 'string' ? JSON.parse(value) : value) || false;
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取范围
|
||||
* @param {Object} num
|
||||
* @param {Object} min
|
||||
* @param {Object} max
|
||||
*/
|
||||
range(num, min, max) {
|
||||
return Math.min(Math.max(num, min), max);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 移动方向判断
|
||||
* @param {Object} left
|
||||
* @param {Object} value
|
||||
* @param {Object} ownerInstance
|
||||
* @param {Object} ins
|
||||
*/
|
||||
moveDirection(left, ins, ownerInstance, self) {
|
||||
var state = self.state
|
||||
var threshold = state.threshold
|
||||
var position = state.position
|
||||
var isopen = state.isopen || 'none'
|
||||
var leftWidth = state.leftWidth
|
||||
var rightWidth = state.rightWidth
|
||||
if (state.deltaX === 0) {
|
||||
this.openState('none', ins, ownerInstance, self)
|
||||
return
|
||||
}
|
||||
if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 &&
|
||||
rightWidth +
|
||||
left < threshold)) {
|
||||
// right
|
||||
this.openState('right', ins, ownerInstance, self)
|
||||
} else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 &&
|
||||
leftWidth - left < threshold)) {
|
||||
// left
|
||||
this.openState('left', ins, ownerInstance, self)
|
||||
} else {
|
||||
// default
|
||||
this.openState('none', ins, ownerInstance, self)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 开启状态
|
||||
* @param {Boolean} type
|
||||
* @param {Object} ins
|
||||
* @param {Object} ownerInstance
|
||||
*/
|
||||
openState(type, ins, ownerInstance, self) {
|
||||
let state = self.state
|
||||
let leftWidth = state.leftWidth
|
||||
let rightWidth = state.rightWidth
|
||||
let left = ''
|
||||
state.isopen = state.isopen ? state.isopen : 'none'
|
||||
switch (type) {
|
||||
case "left":
|
||||
left = leftWidth
|
||||
break
|
||||
case "right":
|
||||
left = -rightWidth
|
||||
break
|
||||
default:
|
||||
left = 0
|
||||
}
|
||||
|
||||
// && !state.throttle
|
||||
|
||||
if (state.isopen !== type) {
|
||||
state.throttle = true
|
||||
ownerInstance.callMethod('change', {
|
||||
open: type
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
state.isopen = type
|
||||
// 添加动画类
|
||||
ins.requestAnimationFrame(()=> {
|
||||
ins.addClass('ani');
|
||||
this.move(left, ins, ownerInstance, self)
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
getDirection(x, y) {
|
||||
if (x > y && x > MIN_DISTANCE) {
|
||||
return 'horizontal';
|
||||
}
|
||||
if (y > x && y > MIN_DISTANCE) {
|
||||
return 'vertical';
|
||||
}
|
||||
return '';
|
||||
},
|
||||
|
||||
/**
|
||||
* 重置滑动状态
|
||||
* @param {Object} event
|
||||
*/
|
||||
resetTouchStatus(instance, self) {
|
||||
let state = self.state;
|
||||
state.direction = '';
|
||||
state.deltaX = 0;
|
||||
state.deltaY = 0;
|
||||
state.offsetX = 0;
|
||||
state.offsetY = 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* 设置滑动开始位置
|
||||
* @param {Object} event
|
||||
*/
|
||||
stopTouchStart(event, ownerInstance, self) {
|
||||
let instance = event.instance;
|
||||
let state = self.state
|
||||
this.resetTouchStatus(instance, self);
|
||||
var touch = event.touches[0];
|
||||
state.startX = touch.clientX;
|
||||
state.startY = touch.clientY;
|
||||
},
|
||||
|
||||
/**
|
||||
* 滑动中,是否禁止打开
|
||||
* @param {Object} event
|
||||
*/
|
||||
stopTouchMove(event, self) {
|
||||
let instance = event.instance;
|
||||
let state = self.state;
|
||||
let touch = event.touches[0];
|
||||
|
||||
state.deltaX = touch.clientX - state.startX;
|
||||
state.deltaY = touch.clientY - state.startY;
|
||||
state.offsetY = Math.abs(state.deltaY);
|
||||
state.offsetX = Math.abs(state.deltaX);
|
||||
state.direction = state.direction || this.getDirection(state.offsetX, state.offsetY);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,348 @@
|
||||
<template>
|
||||
<!-- 在微信小程序 app vue端 h5 使用wxs 实现-->
|
||||
<!-- #ifdef APP-VUE || MP-WEIXIN || H5 -->
|
||||
<view class="uni-swipe">
|
||||
<!-- #ifdef MP-WEIXIN || VUE3 -->
|
||||
<view class="uni-swipe_box" :change:prop="wxsswipe.showWatch"
|
||||
:prop="is_show" :data-threshold="threshold" :data-disabled="disabled" @touchstart="wxsswipe.touchstart" @touchmove="wxsswipe.touchmove" @touchend="wxsswipe.touchend">
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef MP-WEIXIN || VUE3 -->
|
||||
<view class="uni-swipe_box" :change:prop="renderswipe.showWatch"
|
||||
:prop="is_show" :data-threshold="threshold" :data-disabled="disabled+''" @touchstart="renderswipe.touchstart" @touchmove="renderswipe.touchmove" @touchend="renderswipe.touchend">
|
||||
<!-- #endif -->
|
||||
<!-- 在微信小程序 app vue端 h5 使用wxs 实现-->
|
||||
<view class="uni-swipe_button-group button-group--left">
|
||||
<slot name="left">
|
||||
<view v-for="(item,index) in leftOptions" :key="index" :style="{
|
||||
backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD',
|
||||
fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'
|
||||
}" class="uni-swipe_button button-hock" @touchstart="appTouchStart"
|
||||
@touchend="appTouchEnd($event,index,item,'left')" @click.stop="onClickForPC(index,item,'left')">
|
||||
<text class="uni-swipe_button-text"
|
||||
:style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',}">{{ item.text }}</text>
|
||||
</view>
|
||||
</slot>
|
||||
</view>
|
||||
<view class="uni-swipe_text--center">
|
||||
<slot></slot>
|
||||
</view>
|
||||
<view class="uni-swipe_button-group button-group--right">
|
||||
<slot name="right">
|
||||
<view v-for="(item,index) in rightOptions" :key="index" :style="{
|
||||
backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD',
|
||||
fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'
|
||||
}" class="uni-swipe_button button-hock" @touchstart="appTouchStart"
|
||||
@touchend="appTouchEnd($event,index,item,'right')"
|
||||
@click.stop="onClickForPC(index,item,'right')"><text class="uni-swipe_button-text"
|
||||
:style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',}">{{ item.text }}</text>
|
||||
</view>
|
||||
</slot>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<!-- app nvue端 使用 bindingx -->
|
||||
<!-- #ifdef APP-NVUE -->
|
||||
<view ref="selector-box--hock" class="uni-swipe" @horizontalpan="touchstart" @touchend="touchend">
|
||||
<view ref='selector-left-button--hock' class="uni-swipe_button-group button-group--left">
|
||||
<slot name="left">
|
||||
<view v-for="(item,index) in leftOptions" :data-button="btn" :key="index" :style="{
|
||||
backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD',
|
||||
fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'
|
||||
}" class="uni-swipe_button button-hock" @click.stop="onClick(index,item,'left')"><text
|
||||
class="uni-swipe_button-text"
|
||||
:style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',}">{{ item.text }}</text>
|
||||
</view>
|
||||
</slot>
|
||||
</view>
|
||||
<view ref='selector-right-button--hock' class="uni-swipe_button-group button-group--right">
|
||||
<slot name="right">
|
||||
<view v-for="(item,index) in rightOptions" :data-button="btn" :key="index" :style="{
|
||||
backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD',
|
||||
fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'
|
||||
}" class="uni-swipe_button button-hock" @click.stop="onClick(index,item,'right')"><text
|
||||
class="uni-swipe_button-text"
|
||||
:style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',}">{{ item.text }}</text>
|
||||
</view>
|
||||
</slot>
|
||||
</view>
|
||||
<view ref='selector-content--hock' class="uni-swipe_box">
|
||||
<slot></slot>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<!-- 其他平台使用 js ,长列表性能可能会有影响-->
|
||||
<!-- #ifdef MP-ALIPAY || MP-BAIDU || MP-TOUTIAO || MP-QQ -->
|
||||
<view class="uni-swipe">
|
||||
<view class="uni-swipe_box" @touchstart="touchstart" @touchmove="touchmove" @touchend="touchend"
|
||||
:style="{transform:moveLeft}" :class="{ani:ani}">
|
||||
<view class="uni-swipe_button-group button-group--left" :class="[elClass]">
|
||||
<slot name="left">
|
||||
<view v-for="(item,index) in leftOptions" :data-button="btn" :key="index" :style="{
|
||||
backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD',
|
||||
fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'
|
||||
}" class="uni-swipe_button button-hock" @touchstart="appTouchStart"
|
||||
@touchend="appTouchEnd($event,index,item,'left')"><text class="uni-swipe_button-text"
|
||||
:style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',}">{{ item.text }}</text>
|
||||
</view>
|
||||
</slot>
|
||||
</view>
|
||||
<slot></slot>
|
||||
<view class="uni-swipe_button-group button-group--right" :class="[elClass]">
|
||||
<slot name="right">
|
||||
<view v-for="(item,index) in rightOptions" :data-button="btn" :key="index" :style="{
|
||||
backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD',
|
||||
fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'
|
||||
}" @touchstart="appTouchStart" @touchend="appTouchEnd($event,index,item,'right')"
|
||||
class="uni-swipe_button button-hock"><text class="uni-swipe_button-text"
|
||||
:style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',}">{{ item.text }}</text>
|
||||
</view>
|
||||
</slot>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
|
||||
</template>
|
||||
<script src="./wx.wxs" module="wxsswipe" lang="wxs"></script>
|
||||
|
||||
<script module="renderswipe" lang="renderjs">
|
||||
import render from './render.js'
|
||||
export default {
|
||||
mounted(e,ins,owner) {
|
||||
this.state = {}
|
||||
},
|
||||
methods:{
|
||||
showWatch(newVal, oldVal, ownerInstance, instance){
|
||||
render.showWatch(newVal, oldVal, ownerInstance, instance,this)
|
||||
},
|
||||
touchstart(e,ownerInstance){
|
||||
render.touchstart(e,ownerInstance,this)
|
||||
},
|
||||
touchmove(e, ownerInstance){
|
||||
render.touchmove(e,ownerInstance,this)
|
||||
},
|
||||
touchend(e,ownerInstance){
|
||||
render.touchend(e,ownerInstance,this)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
import mpwxs from './mpwxs'
|
||||
import bindingx from './bindingx.js'
|
||||
import mpother from './mpother'
|
||||
|
||||
/**
|
||||
* SwipeActionItem 滑动操作子组件
|
||||
* @description 通过滑动触发选项的容器
|
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=181
|
||||
* @property {Boolean} show = [left|right|none] 开启关闭组件,auto-close = false 时生效
|
||||
* @property {Boolean} disabled = [true|false] 是否禁止滑动
|
||||
* @property {Boolean} autoClose = [true|false] 滑动打开当前组件,是否关闭其他组件
|
||||
* @property {Number} threshold 滑动缺省值
|
||||
* @property {Array} leftOptions 左侧选项内容及样式
|
||||
* @property {Array} rgihtOptions 右侧选项内容及样式
|
||||
* @event {Function} click 点击选项按钮时触发事件,e = {content,index} ,content(点击内容)、index(下标)
|
||||
* @event {Function} change 组件打开或关闭时触发,left\right\none
|
||||
*/
|
||||
|
||||
export default {
|
||||
mixins: [mpwxs,bindingx,mpother],
|
||||
emits:['click','change'],
|
||||
props: {
|
||||
// 控制开关
|
||||
show: {
|
||||
type: String,
|
||||
default: 'none'
|
||||
},
|
||||
|
||||
// 禁用
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
|
||||
// 是否自动关闭
|
||||
autoClose: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
|
||||
// 滑动缺省距离
|
||||
threshold: {
|
||||
type: Number,
|
||||
default: 20
|
||||
},
|
||||
|
||||
// 左侧按钮内容
|
||||
leftOptions: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
|
||||
// 右侧按钮内容
|
||||
rightOptions: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
// #ifndef VUE3
|
||||
// TODO vue2
|
||||
destroyed() {
|
||||
if (this.__isUnmounted) return
|
||||
this.uninstall()
|
||||
},
|
||||
// #endif
|
||||
// #ifdef VUE3
|
||||
// TODO vue3
|
||||
unmounted() {
|
||||
this.__isUnmounted = true
|
||||
this.uninstall()
|
||||
},
|
||||
// #endif
|
||||
|
||||
methods: {
|
||||
uninstall() {
|
||||
if (this.swipeaction) {
|
||||
this.swipeaction.children.forEach((item, index) => {
|
||||
if (item === this) {
|
||||
this.swipeaction.children.splice(index, 1)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 获取父元素实例
|
||||
*/
|
||||
getSwipeAction(name = 'uniSwipeAction') {
|
||||
let parent = this.$parent;
|
||||
let parentName = parent.$options.name;
|
||||
while (parentName !== name) {
|
||||
parent = parent.$parent;
|
||||
if (!parent) return false;
|
||||
parentName = parent.$options.name;
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.uni-swipe {
|
||||
position: relative;
|
||||
/* #ifndef APP-NVUE */
|
||||
overflow: hidden;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.uni-swipe_box {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
// touch-action: none;
|
||||
/* #endif */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.uni-swipe_content {
|
||||
// border: 1px red solid;
|
||||
}
|
||||
|
||||
.uni-swipe_text--center {
|
||||
width: 100%;
|
||||
/* #ifndef APP-NVUE */
|
||||
cursor: grab;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.uni-swipe_button-group {
|
||||
/* #ifndef APP-NVUE */
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
/* #ifdef H5 */
|
||||
cursor: pointer;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.button-group--left {
|
||||
left: 0;
|
||||
transform: translateX(-100%)
|
||||
}
|
||||
|
||||
.button-group--right {
|
||||
right: 0;
|
||||
transform: translateX(100%)
|
||||
}
|
||||
|
||||
.uni-swipe_button {
|
||||
/* #ifdef APP-NVUE */
|
||||
flex: 1;
|
||||
/* #endif */
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.uni-swipe_button-text {
|
||||
/* #ifndef APP-NVUE */
|
||||
flex-shrink: 0;
|
||||
/* #endif */
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.ani {
|
||||
transition-property: transform;
|
||||
transition-duration: 0.3s;
|
||||
transition-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1);
|
||||
}
|
||||
|
||||
/* #ifdef MP-ALIPAY */
|
||||
.movable-area {
|
||||
/* width: 100%; */
|
||||
height: 45px;
|
||||
}
|
||||
|
||||
.movable-view {
|
||||
display: flex;
|
||||
/* justify-content: center; */
|
||||
position: relative;
|
||||
flex: 1;
|
||||
height: 45px;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.movable-view-button {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
flex-direction: row;
|
||||
height: 100%;
|
||||
background: #C0C0C0;
|
||||
}
|
||||
|
||||
/* .transition {
|
||||
transition: all 0.3s;
|
||||
} */
|
||||
|
||||
.movable-view-box {
|
||||
flex-shrink: 0;
|
||||
height: 100%;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
</style>
|
||||
@@ -0,0 +1,341 @@
|
||||
var MIN_DISTANCE = 10;
|
||||
|
||||
/**
|
||||
* 判断当前是否为H5、app-vue
|
||||
*/
|
||||
var IS_HTML5 = false
|
||||
if (typeof window === 'object') IS_HTML5 = true
|
||||
|
||||
/**
|
||||
* 监听页面内值的变化,主要用于动态开关swipe-action
|
||||
* @param {Object} newValue
|
||||
* @param {Object} oldValue
|
||||
* @param {Object} ownerInstance
|
||||
* @param {Object} instance
|
||||
*/
|
||||
function showWatch(newVal, oldVal, ownerInstance, instance) {
|
||||
var state = instance.getState()
|
||||
getDom(instance, ownerInstance)
|
||||
if (newVal && newVal !== 'none') {
|
||||
openState(newVal, instance, ownerInstance)
|
||||
return
|
||||
}
|
||||
|
||||
if (state.left) {
|
||||
openState('none', instance, ownerInstance)
|
||||
}
|
||||
resetTouchStatus(instance)
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始触摸操作
|
||||
* @param {Object} e
|
||||
* @param {Object} ins
|
||||
*/
|
||||
function touchstart(e, ownerInstance) {
|
||||
var instance = e.instance;
|
||||
var disabled = instance.getDataset().disabled
|
||||
var state = instance.getState();
|
||||
getDom(instance, ownerInstance)
|
||||
// fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
|
||||
disabled = (typeof(disabled) === 'string' ? JSON.parse(disabled) : disabled) || false;
|
||||
if (disabled) return
|
||||
// 开始触摸时移除动画类
|
||||
instance.requestAnimationFrame(function() {
|
||||
instance.removeClass('ani');
|
||||
ownerInstance.callMethod('closeSwipe');
|
||||
})
|
||||
|
||||
// 记录上次的位置
|
||||
state.x = state.left || 0
|
||||
// 计算滑动开始位置
|
||||
stopTouchStart(e, ownerInstance)
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始滑动操作
|
||||
* @param {Object} e
|
||||
* @param {Object} ownerInstance
|
||||
*/
|
||||
function touchmove(e, ownerInstance) {
|
||||
var instance = e.instance;
|
||||
var disabled = instance.getDataset().disabled
|
||||
var state = instance.getState()
|
||||
// fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
|
||||
disabled = (typeof(disabled) === 'string' ? JSON.parse(disabled) : disabled) || false;
|
||||
if (disabled) return
|
||||
// 是否可以滑动页面
|
||||
stopTouchMove(e);
|
||||
if (state.direction !== 'horizontal') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.preventDefault) {
|
||||
// 阻止页面滚动
|
||||
e.preventDefault()
|
||||
}
|
||||
|
||||
move(state.x + state.deltaX, instance, ownerInstance)
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束触摸操作
|
||||
* @param {Object} e
|
||||
* @param {Object} ownerInstance
|
||||
*/
|
||||
function touchend(e, ownerInstance) {
|
||||
var instance = e.instance;
|
||||
var disabled = instance.getDataset().disabled
|
||||
var state = instance.getState()
|
||||
// fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
|
||||
disabled = (typeof(disabled) === 'string' ? JSON.parse(disabled) : disabled) || false;
|
||||
|
||||
if (disabled) return
|
||||
// 滑动过程中触摸结束,通过阙值判断是开启还是关闭
|
||||
// fixed by mehaotian 定时器解决点击按钮,touchend 触发比 click 事件时机早的问题 ,主要是 ios13
|
||||
moveDirection(state.left, instance, ownerInstance)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置移动距离
|
||||
* @param {Object} value
|
||||
* @param {Object} instance
|
||||
* @param {Object} ownerInstance
|
||||
*/
|
||||
function move(value, instance, ownerInstance) {
|
||||
value = value || 0
|
||||
var state = instance.getState()
|
||||
var leftWidth = state.leftWidth
|
||||
var rightWidth = state.rightWidth
|
||||
// 获取可滑动范围
|
||||
state.left = range(value, -rightWidth, leftWidth);
|
||||
instance.requestAnimationFrame(function() {
|
||||
instance.setStyle({
|
||||
transform: 'translateX(' + state.left + 'px)',
|
||||
'-webkit-transform': 'translateX(' + state.left + 'px)'
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取元素信息
|
||||
* @param {Object} instance
|
||||
* @param {Object} ownerInstance
|
||||
*/
|
||||
function getDom(instance, ownerInstance) {
|
||||
var state = instance.getState()
|
||||
var leftDom = ownerInstance.selectComponent('.button-group--left')
|
||||
var rightDom = ownerInstance.selectComponent('.button-group--right')
|
||||
var leftStyles = {
|
||||
width: 0
|
||||
}
|
||||
var rightStyles = {
|
||||
width: 0
|
||||
}
|
||||
leftStyles = leftDom.getBoundingClientRect()
|
||||
rightStyles = rightDom.getBoundingClientRect()
|
||||
|
||||
state.leftWidth = leftStyles.width || 0
|
||||
state.rightWidth = rightStyles.width || 0
|
||||
state.threshold = instance.getDataset().threshold
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取范围
|
||||
* @param {Object} num
|
||||
* @param {Object} min
|
||||
* @param {Object} max
|
||||
*/
|
||||
function range(num, min, max) {
|
||||
return Math.min(Math.max(num, min), max);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 移动方向判断
|
||||
* @param {Object} left
|
||||
* @param {Object} value
|
||||
* @param {Object} ownerInstance
|
||||
* @param {Object} ins
|
||||
*/
|
||||
function moveDirection(left, ins, ownerInstance) {
|
||||
var state = ins.getState()
|
||||
var threshold = state.threshold
|
||||
var position = state.position
|
||||
var isopen = state.isopen || 'none'
|
||||
var leftWidth = state.leftWidth
|
||||
var rightWidth = state.rightWidth
|
||||
if (state.deltaX === 0) {
|
||||
openState('none', ins, ownerInstance)
|
||||
return
|
||||
}
|
||||
if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 &&
|
||||
rightWidth +
|
||||
left < threshold)) {
|
||||
// right
|
||||
openState('right', ins, ownerInstance)
|
||||
} else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 &&
|
||||
leftWidth - left < threshold)) {
|
||||
// left
|
||||
openState('left', ins, ownerInstance)
|
||||
} else {
|
||||
// default
|
||||
openState('none', ins, ownerInstance)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 开启状态
|
||||
* @param {Boolean} type
|
||||
* @param {Object} ins
|
||||
* @param {Object} ownerInstance
|
||||
*/
|
||||
function openState(type, ins, ownerInstance) {
|
||||
var state = ins.getState()
|
||||
var leftWidth = state.leftWidth
|
||||
var rightWidth = state.rightWidth
|
||||
var left = ''
|
||||
state.isopen = state.isopen ? state.isopen : 'none'
|
||||
switch (type) {
|
||||
case "left":
|
||||
left = leftWidth
|
||||
break
|
||||
case "right":
|
||||
left = -rightWidth
|
||||
break
|
||||
default:
|
||||
left = 0
|
||||
}
|
||||
|
||||
// && !state.throttle
|
||||
|
||||
if (state.isopen !== type) {
|
||||
state.throttle = true
|
||||
ownerInstance.callMethod('change', {
|
||||
open: type
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
state.isopen = type
|
||||
// 添加动画类
|
||||
ins.requestAnimationFrame(function() {
|
||||
ins.addClass('ani');
|
||||
move(left, ins, ownerInstance)
|
||||
})
|
||||
// 设置最终移动位置,理论上只要进入到这个函数,肯定是要打开的
|
||||
}
|
||||
|
||||
|
||||
function getDirection(x, y) {
|
||||
if (x > y && x > MIN_DISTANCE) {
|
||||
return 'horizontal';
|
||||
}
|
||||
if (y > x && y > MIN_DISTANCE) {
|
||||
return 'vertical';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置滑动状态
|
||||
* @param {Object} event
|
||||
*/
|
||||
function resetTouchStatus(instance) {
|
||||
var state = instance.getState();
|
||||
state.direction = '';
|
||||
state.deltaX = 0;
|
||||
state.deltaY = 0;
|
||||
state.offsetX = 0;
|
||||
state.offsetY = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置滑动开始位置
|
||||
* @param {Object} event
|
||||
*/
|
||||
function stopTouchStart(event) {
|
||||
var instance = event.instance;
|
||||
var state = instance.getState();
|
||||
resetTouchStatus(instance);
|
||||
var touch = event.touches[0];
|
||||
if (IS_HTML5 && isPC()) {
|
||||
touch = event;
|
||||
}
|
||||
state.startX = touch.clientX;
|
||||
state.startY = touch.clientY;
|
||||
}
|
||||
|
||||
/**
|
||||
* 滑动中,是否禁止打开
|
||||
* @param {Object} event
|
||||
*/
|
||||
function stopTouchMove(event) {
|
||||
var instance = event.instance;
|
||||
var state = instance.getState();
|
||||
var touch = event.touches[0];
|
||||
if (IS_HTML5 && isPC()) {
|
||||
touch = event;
|
||||
}
|
||||
state.deltaX = touch.clientX - state.startX;
|
||||
state.deltaY = touch.clientY - state.startY;
|
||||
state.offsetY = Math.abs(state.deltaY);
|
||||
state.offsetX = Math.abs(state.deltaX);
|
||||
state.direction = state.direction || getDirection(state.offsetX, state.offsetY);
|
||||
}
|
||||
|
||||
function isPC() {
|
||||
var userAgentInfo = navigator.userAgent;
|
||||
var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
|
||||
var flag = true;
|
||||
for (var v = 0; v < Agents.length - 1; v++) {
|
||||
if (userAgentInfo.indexOf(Agents[v]) > 0) {
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
var movable = false
|
||||
|
||||
function mousedown(e, ins) {
|
||||
if (!IS_HTML5) return
|
||||
if (!isPC()) return
|
||||
touchstart(e, ins)
|
||||
movable = true
|
||||
}
|
||||
|
||||
function mousemove(e, ins) {
|
||||
if (!IS_HTML5) return
|
||||
if (!isPC()) return
|
||||
if (!movable) return
|
||||
touchmove(e, ins)
|
||||
}
|
||||
|
||||
function mouseup(e, ins) {
|
||||
if (!IS_HTML5) return
|
||||
if (!isPC()) return
|
||||
touchend(e, ins)
|
||||
movable = false
|
||||
}
|
||||
|
||||
function mouseleave(e, ins) {
|
||||
if (!IS_HTML5) return
|
||||
if (!isPC()) return
|
||||
movable = false
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
showWatch: showWatch,
|
||||
touchstart: touchstart,
|
||||
touchmove: touchmove,
|
||||
touchend: touchend,
|
||||
mousedown: mousedown,
|
||||
mousemove: mousemove,
|
||||
mouseup: mouseup,
|
||||
mouseleave: mouseleave
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<template>
|
||||
<view>
|
||||
<slot></slot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* SwipeAction 滑动操作
|
||||
* @description 通过滑动触发选项的容器
|
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=181
|
||||
*/
|
||||
export default {
|
||||
name:"uniSwipeAction",
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
created() {
|
||||
this.children = [];
|
||||
},
|
||||
methods: {
|
||||
// 公开给用户使用,重制组件样式
|
||||
resize(){
|
||||
// wxs 会自己计算组件大小,所以无需执行下面代码
|
||||
// #ifndef APP-VUE || H5 || MP-WEIXIN
|
||||
this.children.forEach(vm=>{
|
||||
vm.init()
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
// 公开给用户使用,关闭全部 已经打开的组件
|
||||
closeAll(){
|
||||
this.children.forEach(vm=>{
|
||||
// #ifdef APP-VUE || H5 || MP-WEIXIN
|
||||
vm.is_show = 'none'
|
||||
// #endif
|
||||
|
||||
// #ifndef APP-VUE || H5 || MP-WEIXIN
|
||||
vm.close()
|
||||
// #endif
|
||||
})
|
||||
},
|
||||
closeOther(vm) {
|
||||
if (this.openItem && this.openItem !== vm) {
|
||||
// #ifdef APP-VUE || H5 || MP-WEIXIN
|
||||
this.openItem.is_show = 'none'
|
||||
// #endif
|
||||
|
||||
// #ifndef APP-VUE || H5 || MP-WEIXIN
|
||||
this.openItem.close()
|
||||
// #endif
|
||||
}
|
||||
// 记录上一个打开的 swipe-action-item ,用于 auto-close
|
||||
this.openItem = vm
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
87
uni_modules/uni-swipe-action/package.json
Normal file
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"id": "uni-swipe-action",
|
||||
"displayName": "uni-swipe-action 滑动操作",
|
||||
"version": "1.2.4",
|
||||
"description": "SwipeAction 滑动操作操作组件",
|
||||
"keywords": [
|
||||
"",
|
||||
"uni-ui",
|
||||
"uniui",
|
||||
"滑动删除",
|
||||
"侧滑删除"
|
||||
],
|
||||
"repository": "https://github.com/dcloudio/uni-ui",
|
||||
"engines": {
|
||||
"HBuilderX": ""
|
||||
},
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": "0.00"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": ""
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
},
|
||||
"client": {
|
||||
"App": {
|
||||
"app-vue": "y",
|
||||
"app-nvue": "y"
|
||||
},
|
||||
"H5-mobile": {
|
||||
"Safari": "y",
|
||||
"Android Browser": "y",
|
||||
"微信浏览器(Android)": "y",
|
||||
"QQ浏览器(Android)": "y"
|
||||
},
|
||||
"H5-pc": {
|
||||
"Chrome": "y",
|
||||
"IE": "y",
|
||||
"Edge": "y",
|
||||
"Firefox": "y",
|
||||
"Safari": "y"
|
||||
},
|
||||
"小程序": {
|
||||
"微信": "y",
|
||||
"阿里": "y",
|
||||
"百度": "y",
|
||||
"字节跳动": "y",
|
||||
"QQ": "y"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "y",
|
||||
"联盟": "u"
|
||||
},
|
||||
"Vue": {
|
||||
"vue2": "y",
|
||||
"vue3": "u"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
193
uni_modules/uni-swipe-action/readme.md
Normal file
@@ -0,0 +1,193 @@
|
||||
|
||||
|
||||
## SwipeAction 滑动操作
|
||||
> **组件名:uni-swipe-action**
|
||||
> 代码块: `uSwipeAction`、`uSwipeActionItem`
|
||||
|
||||
|
||||
通过滑动触发选项的容器
|
||||
|
||||
> **注意事项**
|
||||
> 为了避免错误使用,给大家带来不好的开发体验,请在使用组件前仔细阅读下面的注意事项,可以帮你避免一些错误。
|
||||
> - swipeAction的跟手联动是非常考验性能的。为了提高交互体验,本组件在 app 端 vue 页面、h5、微信小程序使用了wxs 技术,nvue 页面使用 bindingx 技术,可以达到流畅的体验。在其他小程序平台由于底层不支持优化技术,只能使用使用普通 js ,此时性能一般。
|
||||
> - `uni-swipe-action` 和 `uni-swipe-action-item` 需要同时使用
|
||||
> - `uni-swipe-action` 不能嵌套在 `swiper` 中使用
|
||||
> - 长列表不建议使用 autoClose属性,会影响组件性能,造成卡顿,原因是打开之后要通知其他已经打开的组件关闭,会导致多个组件重新渲染
|
||||
> - 事件中传入 `$event` 获取额外参数
|
||||
> - 向下兼容,需要将 `options` 属性替换成 `right-options`
|
||||
> - 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
|
||||
|
||||
|
||||
### 安装方式
|
||||
|
||||
本组件符合[easycom](https://uniapp.dcloud.io/collocation/pages?id=easycom)规范,`HBuilderX 2.5.5`起,只需将本组件导入项目,在页面`template`中即可直接使用,无需在页面中`import`和注册`components`。
|
||||
|
||||
如需通过`npm`方式使用`uni-ui`组件,另见文档:[https://ext.dcloud.net.cn/plugin?id=55](https://ext.dcloud.net.cn/plugin?id=55)
|
||||
|
||||
|
||||
## 基本用法
|
||||
|
||||
在 ``template`` 中的使用
|
||||
|
||||
```html
|
||||
<uni-swipe-action>
|
||||
<!-- 基础用法 -->
|
||||
<uni-swipe-action-item :right-options="options" :left-options="options" @click="onClick" @change="change">
|
||||
<view>SwipeAction 基础使用场景</view>
|
||||
</uni-swipe-action-item>
|
||||
<!-- 使用插槽 (请自行给定插槽内容宽度)-->
|
||||
<uni-swipe-action-item>
|
||||
<template v-slot:left>
|
||||
<view><text>置顶</text></view>
|
||||
</template>
|
||||
<view>
|
||||
<text >使用插槽</text>
|
||||
</view>
|
||||
<template v-slot:right>
|
||||
<view><text>删除</text></view>
|
||||
</template>
|
||||
</uni-swipe-action-item>
|
||||
<!-- 混合用法 -->
|
||||
<uni-swipe-action-item :right-options="options">
|
||||
<template v-slot:left>
|
||||
<view><text>置顶</text></view>
|
||||
</template>
|
||||
<view><text>混合使用</text></view>
|
||||
</uni-swipe-action-item>
|
||||
</uni-swipe-action>
|
||||
|
||||
<!-- 禁止滑动 -->
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item :disabled="true" :right-options="options">
|
||||
<view>SwipeAction 基础使用场景</view>
|
||||
</uni-swipe-action-item>
|
||||
</uni-swipe-action>
|
||||
|
||||
<!-- 按组使用 -->
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item :right-options="options" @click="bindClick" @change="swipeChange($event, index)">
|
||||
<view >item1</view>
|
||||
</uni-swipe-action-item>
|
||||
<uni-swipe-action-item :right-options="options" @click="bindClick" @change="swipeChange($event, index)">
|
||||
<view>item2</view>
|
||||
</uni-swipe-action-item>
|
||||
<uni-swipe-action-item :right-options="options" @click="bindClick" @change="swipeChange($event, index)">
|
||||
<view>item3</view>
|
||||
</uni-swipe-action-item>
|
||||
</uni-swipe-action>
|
||||
|
||||
```
|
||||
|
||||
|
||||
```javascript
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
options:[
|
||||
{
|
||||
text: '取消',
|
||||
style: {
|
||||
backgroundColor: '#007aff'
|
||||
}
|
||||
}, {
|
||||
text: '确认',
|
||||
style: {
|
||||
backgroundColor: '#dd524d'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
onClick(e){
|
||||
console.log('点击了'+(e.position === 'left' ? '左侧' : '右侧') + e.content.text + '按钮')
|
||||
},
|
||||
swipeChange(e,index){
|
||||
console.log('当前状态:'+ e +',下标:' + index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### SwipeAciton Props
|
||||
|
||||
|属性名|类型|可选值|默认值|是否必填|说明|
|
||||
|:-:|:-:|:-:|:-:|:-:|:-:|
|
||||
|show|String|left/right/none|none |否|开启关闭组件,auto-close = false 时生效|
|
||||
|threshold|Number|-|20|否|滑动阙值|
|
||||
|disabled|Boolean|-|false|否|是否禁止滑动|
|
||||
|autoClose|Boolean|-|true|否|其他组件开启的时候,当前组件是否自动关闭,**注意:长列表使用会有性能问题**|
|
||||
|left-options|Array/Object |-|-|否|左侧选项内容及样式|
|
||||
|right-options|Array/Object |-|-|否|右侧选项内容及样式|
|
||||
|
||||
#### LeftOptions & RightOptions Options
|
||||
|
||||
|参数|类型|是否必填 |说明|
|
||||
|:-:|:-:|:-:|:-:|
|
||||
|text|String|是|按钮的文字 |
|
||||
|style|Object|否|按钮样式{backgroundColor,color,fontSize},backgroundColor默认为:#C7C6CD,color默认为:#FFFFFF,fontSize默认为:14px |
|
||||
|
||||
|
||||
|
||||
### SwipeAction Events
|
||||
|
||||
|事件称名 |说明|返回值|
|
||||
|:-:|:-:|:-:|
|
||||
|@click|点击选项按钮时触发事件|e = {content,index} ,content(点击内容)、index(下标)、position (位置信息) |
|
||||
|@change|组件打开或关闭时触发|left:左侧 ,right:右侧,none:关闭|
|
||||
|
||||
### SwipeAction Methods
|
||||
|
||||
方法通过 ref 调用
|
||||
|
||||
|方法称名 |说明|
|
||||
|:-:|:-:|
|
||||
|resize()|动态添加数据后,如不能正常滑动,需要主动调用此方法,微信小程序、h5、app-vue 不生效|
|
||||
|close-all()|关闭所有已经打开的组件|
|
||||
### SwipeAction Slots
|
||||
|
||||
|名称|说明|
|
||||
|:-:|:-:|
|
||||
|-|默认插槽自定义显示内容|
|
||||
|default|默认内容插槽|
|
||||
|left|左侧滑动内容 ,会覆盖 leftOptions 内容|
|
||||
|right|右侧滑动内容 ,会覆盖 rightOptions 内容|
|
||||
|
||||
> **提示**
|
||||
> - iOS 端由于存在bounce效果,滑动体验略差,建议禁止bounce效果,禁止方式如下:
|
||||
> ```javascript
|
||||
> {
|
||||
> "path": "swipe-action/swipe-action",
|
||||
> "style": {
|
||||
> "navigationBarTitleText": "SwipeAction 滑动操作",
|
||||
> "disableScroll":true,
|
||||
> "app-plus":{
|
||||
> "bounce":"none"
|
||||
> }
|
||||
> }
|
||||
> }
|
||||
> ```
|
||||
|
||||
|
||||
### Q&A
|
||||
1. Q:动态加载数据,组件滑动失效是怎么回事
|
||||
- A:是因为组件会在加载的时候获取相应的节点信息数据 ,获取需要滑动的距离,所以有时候动态加载数据之后,可能是时机的问题,导致节点信息获取失败 ,那么组件就不能正常滑动。
|
||||
- A:如果是在其他页面通过 vuex 或者uni.$emit 等手段来更新其他页面 uni-swipe-action 数据 ,同样会发生不能滑动的现象,原因是页面隐藏后是不能获取到页面信息的,所以回到 uni-swipe-action 页面后,新增的组件节点信息获取肯定是错误的,所以不能滑动。
|
||||
- A:值的高兴的是在 1.2.2 版本中重构了组件滑动逻辑 ,在微信小程序、h5、app-vue 中使用了 wxs 优化滑动性能,并且不需要担心动态新增组件导致组件无法滑动的问题,节点信息在滑动时实时获取。
|
||||
- A:因为其他平台无法使用 wxs ,所以还是会出现无法滑动的问题怎么处理?1.2.2 版本提供了 resize() 方法,无法滑动时调用 resize() 方法重新渲染组件即可,调用方法时要保证节点已经渲染完毕。
|
||||
|
||||
2. Q:运行到 nvue 下没有样式
|
||||
- A:因为 nvue 下样式默认不能使用复杂的css选择器,所以需要在 manifest.json 中配置 "nvueStyleCompiler" 属性
|
||||
```json
|
||||
// manifest.json
|
||||
{
|
||||
"nvueStyleCompiler" : "uni-app",
|
||||
}
|
||||
```
|
||||
|
||||
## 组件示例
|
||||
|
||||
点击查看:[https://hellouniapp.dcloud.net.cn/pages/extUI/swipe-action/swipe-action](https://hellouniapp.dcloud.net.cn/pages/extUI/swipe-action/swipe-action)
|
||||
0
unpackage/dist/dev/.automator/app-plus/.automator.json
vendored
Normal file
1
unpackage/dist/dev/app-plus/__uniappchooselocation.js
vendored
Normal file
1
unpackage/dist/dev/app-plus/__uniappes6.js
vendored
Normal file
1
unpackage/dist/dev/app-plus/__uniappopenlocation.js
vendored
Normal file
1
unpackage/dist/dev/app-plus/__uniapppicker.js
vendored
Normal file
8
unpackage/dist/dev/app-plus/__uniappquill.js
vendored
Normal file
1
unpackage/dist/dev/app-plus/__uniappquillimageresize.js
vendored
Normal file
1
unpackage/dist/dev/app-plus/__uniappscan.js
vendored
Normal file
BIN
unpackage/dist/dev/app-plus/__uniappsuccess.png
vendored
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
25
unpackage/dist/dev/app-plus/__uniappview.html
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script>
|
||||
var __UniViewStartTime__ = Date.now();
|
||||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
|
||||
CSS.supports('top: constant(a)'))
|
||||
document.write(
|
||||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
|
||||
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||
</script>
|
||||
<title>View</title>
|
||||
<link rel="stylesheet" href="view.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="__uniappes6.js"></script>
|
||||
<script src="view.umd.min.js"></script>
|
||||
<script src="app-view.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
8
unpackage/dist/dev/app-plus/app-config-service.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
var isReady=false;var onReadyCallbacks=[];
|
||||
var isServiceReady=false;var onServiceReadyCallbacks=[];
|
||||
var __uniConfig = {"pages":["pages/index/index","pages/found/index","pages/user/index","pages/user/code","pages/user/help","pages/user/partner","pages/user/clause","pages/vip/vip","pages/vip/agree","pages/setting/setting","pages/goods/management","pages/goods/addClassify","pages/goods/add","pages/goods/goodsAuth","pages/coupons/management","pages/coupons/add","pages/coupons/magDetails","pages/coupons/selectGoods","pages/login/login","pages/certification/personal","pages/setting/setting","pages/setting/aboutUs","pages/company/approve"],"window":{"navigationStyle":"custom","backgroundColor":"#F5F5F5"},"tabBar":{"borderStyle":"white","backgroundColor":"#FFFFFF","selectedColor":"#774ffd","iconWidth":"26px","spacing":"0","height":"60px","list":[{"text":"发现能量","iconPath":"static/tabBar/tabBar_icon_00.png","selectedIconPath":"static/tabBar/tabBar_show_00.png","pagePath":"pages/index/index"},{"text":"发现更多","iconPath":"static/tabBar/tabBar_icon_01.png","selectedIconPath":"static/tabBar/tabBar_show_01.png","pagePath":"pages/found/index"},{"text":"节点中心","iconPath":"static/tabBar/tabBar_icon_02.png","selectedIconPath":"static/tabBar/tabBar_show_02.png","pagePath":"pages/user/index"}]},"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"BlockChainH5","compilerVersion":"3.1.18","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
|
||||
var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"发现能量"}},{"path":"/pages/found/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"发现更多"}},{"path":"/pages/user/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"节点中心"}},{"path":"/pages/user/code","meta":{},"window":{"navigationBarTitleText":"邀请好友"}},{"path":"/pages/user/help","meta":{},"window":{"navigationBarTitleText":"帮助中心"}},{"path":"/pages/user/partner","meta":{},"window":{"navigationBarTitleText":"我的伙伴"}},{"path":"/pages/user/clause","meta":{},"window":{"navigationBarTitleText":"服务条款"}},{"path":"/pages/vip/vip","meta":{},"window":{"navigationBarTitleText":"开通节点"}},{"path":"/pages/vip/agree","meta":{},"window":{"navigationBarTitleText":"服务条款"}},{"path":"/pages/setting/setting","meta":{},"window":{"navigationBarTitleText":"设置中心"}},{"path":"/pages/goods/management","meta":{},"window":{"navigationBarTitleText":"商品权证管理"}},{"path":"/pages/goods/addClassify","meta":{},"window":{"navigationBarTitleText":"发布商品类目"}},{"path":"/pages/goods/add","meta":{},"window":{"navigationBarTitleText":"商品权证创建"}},{"path":"/pages/goods/goodsAuth","meta":{},"window":{"navigationBarTitleText":"商品权证认证"}},{"path":"/pages/coupons/management","meta":{},"window":{"navigationBarTitleText":"创建优惠券"}},{"path":"/pages/coupons/add","meta":{},"window":{"navigationBarTitleText":"创建优惠券"}},{"path":"/pages/coupons/magDetails","meta":{},"window":{"navigationBarTitleText":"优惠券详情"}},{"path":"/pages/coupons/selectGoods","meta":{},"window":{"navigationBarTitleText":"关联产品"}},{"path":"/pages/login/login","meta":{},"window":{"navigationBarTitleText":"登录"}},{"path":"/pages/certification/personal","meta":{},"window":{"navigationBarTitleText":"个人认证"}},{"path":"/pages/setting/aboutUs","meta":{},"window":{"navigationBarTitleText":"关于我们"}},{"path":"/pages/company/approve","meta":{},"window":{"navigationBarTitleText":"企业认证"}}];
|
||||
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});
|
||||
154
unpackage/dist/dev/app-plus/app-config.js
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // install a JSONP callback for chunk loading
|
||||
/******/ function webpackJsonpCallback(data) {
|
||||
/******/ var chunkIds = data[0];
|
||||
/******/ var moreModules = data[1];
|
||||
/******/ var executeModules = data[2];
|
||||
/******/
|
||||
/******/ // add "moreModules" to the modules object,
|
||||
/******/ // then flag all "chunkIds" as loaded and fire callback
|
||||
/******/ var moduleId, chunkId, i = 0, resolves = [];
|
||||
/******/ for(;i < chunkIds.length; i++) {
|
||||
/******/ chunkId = chunkIds[i];
|
||||
/******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {
|
||||
/******/ resolves.push(installedChunks[chunkId][0]);
|
||||
/******/ }
|
||||
/******/ installedChunks[chunkId] = 0;
|
||||
/******/ }
|
||||
/******/ for(moduleId in moreModules) {
|
||||
/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
|
||||
/******/ modules[moduleId] = moreModules[moduleId];
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ if(parentJsonpFunction) parentJsonpFunction(data);
|
||||
/******/
|
||||
/******/ while(resolves.length) {
|
||||
/******/ resolves.shift()();
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ // add entry modules from loaded chunk to deferred list
|
||||
/******/ deferredModules.push.apply(deferredModules, executeModules || []);
|
||||
/******/
|
||||
/******/ // run deferred modules when all chunks ready
|
||||
/******/ return checkDeferredModules();
|
||||
/******/ };
|
||||
/******/ function checkDeferredModules() {
|
||||
/******/ var result;
|
||||
/******/ for(var i = 0; i < deferredModules.length; i++) {
|
||||
/******/ var deferredModule = deferredModules[i];
|
||||
/******/ var fulfilled = true;
|
||||
/******/ for(var j = 1; j < deferredModule.length; j++) {
|
||||
/******/ var depId = deferredModule[j];
|
||||
/******/ if(installedChunks[depId] !== 0) fulfilled = false;
|
||||
/******/ }
|
||||
/******/ if(fulfilled) {
|
||||
/******/ deferredModules.splice(i--, 1);
|
||||
/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ return result;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // object to store loaded and loading chunks
|
||||
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
||||
/******/ // Promise = chunk loading, 0 = chunk loaded
|
||||
/******/ var installedChunks = {
|
||||
/******/ "app-config": 0
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ var deferredModules = [];
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "/";
|
||||
/******/
|
||||
/******/ var jsonpArray = this["webpackJsonp"] = this["webpackJsonp"] || [];
|
||||
/******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray);
|
||||
/******/ jsonpArray.push = webpackJsonpCallback;
|
||||
/******/ jsonpArray = jsonpArray.slice();
|
||||
/******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);
|
||||
/******/ var parentJsonpFunction = oldJsonpFunction;
|
||||
/******/
|
||||
/******/
|
||||
/******/ // run deferred modules from other chunks
|
||||
/******/ checkDeferredModules();
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([]);
|
||||
18232
unpackage/dist/dev/app-plus/app-service.js
vendored
Normal file
14334
unpackage/dist/dev/app-plus/app-view.js
vendored
Normal file
1
unpackage/dist/dev/app-plus/manifest.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__1F65101","name":"BlockChainH5","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"light","background":"#000000"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"]},"apple":{},"plugins":{"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"allowsInlineMediaPlayback":true,"safearea":{"background":"#FFFFFF","bottom":{"offset":"auto"}},"uni-app":{"compilerVersion":"3.1.18","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"tabBar":{"borderStyle":"rgba(255,255,255,0.4)","backgroundColor":"#FFFFFF","selectedColor":"#774ffd","iconWidth":"26px","spacing":"0","height":"60px","list":[{"text":"发现能量","iconPath":"static/tabBar/tabBar_icon_00.png","selectedIconPath":"static/tabBar/tabBar_show_00.png","pagePath":"pages/index/index"},{"text":"发现更多","iconPath":"static/tabBar/tabBar_icon_01.png","selectedIconPath":"static/tabBar/tabBar_show_01.png","pagePath":"pages/found/index"},{"text":"节点中心","iconPath":"static/tabBar/tabBar_icon_02.png","selectedIconPath":"static/tabBar/tabBar_show_02.png","pagePath":"pages/user/index"}],"child":["lauchwebview"],"selected":0},"launch_path":"__uniappview.html"}}
|
||||
BIN
unpackage/dist/dev/app-plus/static/background/chain-back-00.png
vendored
Normal file
|
After Width: | Height: | Size: 482 KiB |
BIN
unpackage/dist/dev/app-plus/static/background/chain-back-01.png
vendored
Normal file
|
After Width: | Height: | Size: 166 KiB |
BIN
unpackage/dist/dev/app-plus/static/background/chain-back-02.png
vendored
Normal file
|
After Width: | Height: | Size: 115 KiB |
BIN
unpackage/dist/dev/app-plus/static/background/crystal-background.png
vendored
Normal file
|
After Width: | Height: | Size: 255 KiB |
BIN
unpackage/dist/dev/app-plus/static/background/idcard-positive.png
vendored
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
unpackage/dist/dev/app-plus/static/background/idcard-reverse.png
vendored
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
unpackage/dist/dev/app-plus/static/background/wallet-back.png
vendored
Normal file
|
After Width: | Height: | Size: 261 KiB |
BIN
unpackage/dist/dev/app-plus/static/background/wallet-code-background.png
vendored
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/add-icon.png
vendored
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/approve-icon.png
vendored
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/audit-icon.png
vendored
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/checked-icon.png
vendored
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/crystal-icon.png
vendored
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/e-logo-white.png
vendored
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/e-logo.png
vendored
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/equity_arrow_icon.png
vendored
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/equity_arrow_right.png
vendored
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/equity_arrow_up.png
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/equity_coupons_01.png
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/equity_coupons_02.png
vendored
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/equity_coupons_03.png
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/equity_nav.png
vendored
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/fire.png
vendored
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/gemstone-icon.png
vendored
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/goods_buy.png
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/goods_close.png
vendored
Normal file
|
After Width: | Height: | Size: 558 B |
BIN
unpackage/dist/dev/app-plus/static/icons/goods_row.png
vendored
Normal file
|
After Width: | Height: | Size: 686 B |
BIN
unpackage/dist/dev/app-plus/static/icons/goods_spot.png
vendored
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/listnull-icon.png
vendored
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/login-icon.png
vendored
Normal file
|
After Width: | Height: | Size: 8.7 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/market_icon_high.png
vendored
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/market_icon_low.png
vendored
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/order-null.png
vendored
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/order_icon_00.png
vendored
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/order_icon_01.png
vendored
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/order_icon_02.png
vendored
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
unpackage/dist/dev/app-plus/static/icons/order_icon_03.png
vendored
Normal file
|
After Width: | Height: | Size: 2.1 KiB |