Commit 10fd684c authored by 罗超's avatar 罗超

Merge branch 'master' of http://gitlab.oytour.com/zk123/jz_travel

parents 9bf70ab9 82424c68
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<image class="img-1" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :src="item.imglist[1]" /> <image class="img-1" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :src="item.imglist[1]" />
<image class="img-2" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :src="item.imglist[0]" /> <image class="img-2" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :src="item.imglist[0]" />
</template> </template>
<template v-if="item.imglist&&item.imglist.length>3"> <template v-if="item.imglist&&item.imglist.length>=3">
<image class="img-0" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :src="item.imglist[0]" /> <image class="img-0" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :src="item.imglist[0]" />
<image class="img-1" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :src="item.imglist[1]" /> <image class="img-1" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :src="item.imglist[1]" />
<image class="img-2" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :src="item.imglist[2]" /> <image class="img-2" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :src="item.imglist[2]" />
......
...@@ -546,69 +546,7 @@ ...@@ -546,69 +546,7 @@
"path":"paysuccess"//支付成功页面 "path":"paysuccess"//支付成功页面
}] }]
}, },
//相亲分包
{
"root": "pages/blindDate",
"pages": [{
"path": "basicdata"//基础资料的填写
},{
"path":"personal/fanlist"//粉丝列表
},{
"path":"personal/followlist"//关注列表
},{
"path":"personal/peoplescreen"//人物筛选
},{
"path":"oldpersondetails",//之前的人物详情
"style": {
"navigationStyle": "custom"
}
},{
"path":"persondetails"//人物详情
},{
"path":"personal/editmaterial"//资料编辑
},{
"path":"postbar"//贴吧列表
},{
"path":"postPublishing"//贴吧发布
},{
"path":"postDetails"//招募贴详情
},{
"path":"sendimg"//评论图片发布
},{
"path":"stickSignUp"//招募贴报名
},{
"path":"personal/mysignupList"//我的报名列表
},{
"path":"baomingList"//招募贴查看报名列表
},{
"path":"personal/myrecruitstick"//我的招募贴
},{
"path":"richText"//富文本编辑页面
},{
"path":"message"//消息
},{
"path":"visitor"//访客
},{
"path":"systemMsg"//系统消息
},{
"path":"personal/mydate"//我的约会
},{
"path":"circleNews"//圈子消息
},{
"path":"personal/buyvip",//会员购买
"style": {
"navigationStyle": "custom"
}
},{
"path":"userList"//用户列表
},{
"path":"editData"//编辑资料
},{
"path":"xqposter"//相亲分享海报
},{
"path":"personal/IDidentification"//身份证验证
}]
},
//韩国馆项目 { "root": "pages/kotra", "pages": [{ "path": "contanctus" },{ "path": "contanctDetail" },{ "path": "compInformation" },{ //韩国馆项目 { "root": "pages/kotra", "pages": [{ "path": "contanctus" },{ "path": "contanctDetail" },{ "path": "compInformation" },{
"path": "activeInner" "path": "activeInner"
},{ },{
......
<template>
<view class="baomingList" :style="{ height: contentHeight }">
<u-empty v-if="g.length == 0" text="暂无报名记录" mode="list"></u-empty>
<view
v-if="g.length > 0"
style="
height: calc(100vh);
width: calc(100vw);
overflow: hidden;
"
>
<scroll-view
:scroll-y="true"
:enable-back-to-top="true"
:enable-flex="true"
@scrolltolower="lower"
:style="{ height: '100%' }"
>
<view class="ftBox" v-if="type==0">
<view class="interDList" v-for="(x, i) in g" :key="i">
<view style="position: relative;" @click="goUserinfo(x)">
<u-avatar :src="x.Photo" size="80"></u-avatar>
<image v-if="x.Sex==1" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/basic-nan2.png" style="width: 32rpx;height: 32rpx;position: absolute;right: 0;bottom: 0;"></image>
<image v-if="x.Sex==2" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/basic-nv2.png" style="width: 32rpx;height: 32rpx;position: absolute;right: 0;bottom: 0;"></image>
</view>
<view :style="{'width':(windowWidth-30-45-20-30)+'px','margin-left':'10px'}">
<view class="teinfo">{{x.UserName}}</view>
<view class="teinfo2" >
</view>
</view>
<view class="gzbtn" @click.stop="setFollowTeacher(x,i)" v-if="UserId != x.UserId">
<view class="iconstyle" :style="{background:mainColor,border:'none'}" v-if="x.IsFocus==0">
<u-icon name="plus" color="#FFF" size="32"></u-icon>
</view>
<view class="iconstyle" :style="{background:mainColor}" v-if="x.IsFocus==1">
<u-icon name="success" color="#FFF" size="32"></u-icon>
</view>
<image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/basic-hu.png" style="width: 50rpx;height: 50rpx;" v-if="x.IsFocus==2"></image>
</view>
</view>
</view>
<view v-if="type==1" class="ftBox">
<view v-for="(x, i) in g" :key="i">
<view class="interDList" style="border-bottom: none;">
<view style="position: relative;" @click="goUserinfo(x)">
<u-avatar :src="x.Photo" size="80"></u-avatar>
<image v-if="x.Sex==1" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/basic-nan2.png" style="width: 32rpx;height: 32rpx;position: absolute;right: 0;bottom: 0;"></image>
<image v-if="x.Sex==2" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/basic-nv2.png" style="width: 32rpx;height: 32rpx;position: absolute;right: 0;bottom: 0;"></image>
</view>
<view class="interDList-r" :style="{'width':(windowWidth-30-45-20-30)+'px','margin-left':'10px'}">
<view class="teinfo">{{x.UserName}}</view>
<view class="teinfo2" style="font-size: 11px">
<u-icon name="contact" :size="24" color="#999999" style='margin-right: 5px;' ></u-icon>
<view style="max-width: 200rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis">{{x.Name}}</view>
<u-icon name="friends-o" :size="24" color="#999999" style='margin-right: 5px;margin-left: 10px;' ></u-icon>
<view>{{x.PeopleNum}}</view>
<u-icon name="phone-o" :size="24" color="#999999" style='margin-right: 5px;margin-left: 10px;' ></u-icon>
<view>{{x.Mobile}}</view>
</view>
</view>
<view class="gzbtn" @click.stop="setFollowTeacher(x,i)" v-if="UserId != x.UserId">
<view class="iconstyle" :style="{background:mainColor,border:'none'}" v-if="x.IsFocus==0">
<u-icon name="plus" color="#FFF" size="32"></u-icon>
</view>
<view class="iconstyle" :style="{background:mainColor}" v-if="x.IsFocus==1">
<u-icon name="success" color="#FFF" size="32"></u-icon>
</view>
<image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/basic-hu.png" style="width: 50rpx;height: 50rpx;" v-if="x.IsFocus==2"></image>
</view>
</view>
<view class="box-Remark" v-if="x.Remark!=''">
{{x.Remark}}
</view>
</view>
</view>
<u-loadmore
:status="status"
:load-text="loadText"
:font-size="24"
:margin-top="20"
:margin-bottom="20"
bg-color="#FFF"
/>
</scroll-view>
</view>
<!-- 加载中 -->
<view class="loading" v-if="loading">
<u-loading mode="flower" size="48">></u-loading>
<Text style="color: #fff; margin-top: 10rpx;">加载中...</Text>
</view>
<!-- 取消提示 -->
</view>
</template>
<script>
export default {
data() {
return {
pageTitle: "报名列表",
showAuth:false,
msg:{
pageIndex: 1,
pageSize:10,
ActivityId:0,
},
type:0,
mainColor: "",
secondary:'',
pricecolor:'',
contentHeight: 0,
page: 1,
page_count: 1,
g: [],
loading: false,
status: "loadmore",
count:0,
loadText: {
loadmore: "轻轻上拉,加载更多",
loading: "努力加载中",
nomore: "没有更多了",
},
windowWidth:0,
UserId:0,
};
},
created() {
this.contentHeight = this.$utils.calcContentHeight(-40) + "px";
this.mainColor = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary;
this.pricecolor = this.$uiConfig.pricecolor;
this.windowWidth = this.$utils.SystemInfo().windowWidth;
this.UserId = uni.getStorageSync('mall_UserInfo')?uni.getStorageSync('mall_UserInfo').UserId : 0;
},
mounted() {
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title
: [];
pages.forEach((x) => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
onLoad(options){
console.log(options)
if(options){
this.type= options.type;
this.msg.ActivityId= options.ActivityId;
}
this.u = uni.getStorageSync("mall_UserInfo");
if (!this.u) {
this.u = {
nickName: "未登录",
avatarUrl: ""
};
this.showAuth = true;
} else{
this.init();
}
},
methods: {
init() {
this.loading = true;
this.request2(
{
url: '/api/AppletMiai/GetActivityEnrollPageList',
data: this.msg
},
res => {
if(res.resultCode==1){
this.loading = false;
this.count = res.data.count;
this.g = this.g.concat(res.data.pageData);
this.page_count = res.data.pageCount;
if (this.page_count == 1) {
this.status = "nomore";
}
}
}
);
},
setFollowTeacher(x,i){
let ID=0
if(x.IsFocus!=0){
ID = x.MyFollowId
}
this.request2({
url: '/api/AppletMiai/GetFollowMember',
data: {
ID:ID,
UserId:x.UserId,
}
},
res => {
uni.showToast({
title:res.message,
icon:'none'
})
this.request2(
{
url: '/api/AppletMiai/GetActivityEnrollPageList',
data: {
pageIndex: 1,
pageSize:10,
ActivityId:this.msg.ActivityId,
Id:x.Id
},
},
res => {
if(res.resultCode==1){
this.g[i] = res.data.pageData[0]
this.$forceUpdate()
}
}
);
}
);
},
lower(e) {
if (this.msg.pageIndex < this.page_count) {
this.msg.pageIndex++;
this.status = "loading";
this.init();
} else {
this.status = "nomore";
}
},
reloadUserinfo() {
this.u = uni.getStorageSync("mall_UserInfo");
// this.showAuth=false;
this.init();
},
//关闭登录窗口
gbAuth(){
uni.navigateBack()
},
goUserinfo(x){//用户信息
uni.navigateTo({
url: '/pages/blindDate/persondetails?UserId='+ x.UserId
});
}
},
};
</script>
<style>
.baomingList {
width: 100%;
height: 100vh;
background: #FFF;
}
.baomingList .loading {
width: 200rpx;
height: 200rpx;
background: #000000;
opacity: 0.7;
border-radius: 10rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: fixed;
left: 50%;
top: 30%;
margin-left: -100rpx;
z-index: 999;
}
.baomingList .interDList{
width:calc(100vw - 30px) ;
display: flex;
flex-direction: row;
align-items: center;
padding: 15px 0;
border-bottom: 1px solid #f5f5f5;
}
.baomingList .followTeacher-top{
width: 100%;
height: 35px;
padding: 0 15px;
display: flex;
flex-direction: row;
align-items: center;
font-size: 11px;
color: #999999;
background: #FAF8F9;
}
.baomingList .ftBox{
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.baomingList .teinfo{
width: 100%;
overflow: hidden;white-space: nowrap;text-overflow: ellipsis;
font-size: 15px;
}
.baomingList .gzbtn{
width: 69px;
height: 26px;
border-radius: 4px;
margin-left: 8px;
color: #111111;
display: flex;
align-items: center;
justify-content: flex-end;
font-size: 13px;
}
.iconstyle{
width: 50rpx;
height: 50rpx;
border-radius: 25rpx;
display: flex;
align-items: center;
justify-content: center;
}
.interDList-r{
height: 40px;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.teinfo2{
display: flex;
align-items: center;
}
.box-Remark{
width: calc(100vw - 30px - 80rpx - 20rpx);
padding: 14px 10px;
background: #EDEDED;
font-size: 11px;
color: #777777;
margin-left: 100rpx;
border-radius: 6px;
}
</style>
This diff is collapsed.
This diff is collapsed.
<template>
<view class="container" :style="{
paddingBottom: showMoreTool ? '220rpx' : '120rpx'
}">
<editor
class="ql-container"
:placeholder="placeholder"
:show-img-size="true"
:show-img-toolbar="true"
:show-img-resize="true"
@ready="onEditorReady"
id="editor"
@statuschange="statuschange"
@focus="editFocus"
@blur="editBlur"
ref="editot"
></editor>
<!-- 操作工具 -->
<view class="tool-view" >
<view class="tool">
<jinIcon class="single" type="&#xe6f3;" font-size="44rpx" title="插入图片" @click="insertImage"></jinIcon>
<jinIcon class="single" type="&#xe6f9;" font-size="44rpx" title="修改文字样式" @click="showMore" :color="showMoreTool ? activeColor : '#666666'"></jinIcon>
<jinIcon class="single" type="&#xe6eb;" font-size="44rpx" title="分割线" @click="insertDivider"></jinIcon>
<jinIcon class="single" type="&#xe6e8;" font-size="44rpx" title="撤销" @click="undo"></jinIcon>
<jinIcon class="single" type="&#xe705;" font-size="44rpx" title="重做" @click="redo"></jinIcon>
<jinIcon class="single" type="&#xeb8a;" font-size="44rpx" title="设置" @click="release"></jinIcon>
</view>
<!-- 文字相关操作 -->
<view class="font-more" :style="{ height: showMoreTool ? '100rpx' : 0 }">
<jinIcon class="single" type="&#xe6e7;" font-size="44rpx" title="加粗" @click="setBold" :color="showBold ? activeColor : '#666666'"></jinIcon>
<jinIcon class="single" type="&#xe6fe;" font-size="44rpx" title="斜体" @click="setItalic" :color="showItalic ? activeColor : '#666666'"></jinIcon>
<jinIcon class="single" type="&#xe6f8;" font-size="44rpx" title="分割线" @click="setIns" :color="showIns ? activeColor : '#666666'"></jinIcon>
<jinIcon class="single" type="&#xe6e3;" font-size="44rpx" title="标题" @click="setHeader" :color="showHeader ? activeColor : '#666666'"></jinIcon>
<jinIcon class="single" type="&#xe6f1;" font-size="44rpx" title="居中" @click="setCenter" :color="showCenter ? activeColor : '#666666'"></jinIcon>
<jinIcon class="single" type="&#xe6ed;" font-size="44rpx" title="居右" @click="setRight" :color="showRight ? activeColor : '#666666'"></jinIcon>
</view>
<view class="setting-layer-mask" v-if="showSettingLayer" @click="showSetting"></view>
<view class="setting-layer" v-if="showSettingLayer">
<view class="single" @click="release(true)">
<jinIcon class="icon" type="&#xe639;" ></jinIcon>
<view>公开发布</view>
</view>
<view class="single" @click="release(false)">
<jinIcon class="icon" type="&#xe655;" ></jinIcon>
<view>私密保存</view>
</view>
</view>
</view>
</view>
</template>
<script>
import jinIcon from './jin-icons.vue';
export default {
props: {
// 点击图片时显示图片大小控件
showImgSize: {
type: Boolean,
default: false
},
// 点击图片时显示工具栏控件
showImgToolbar: {
type: Boolean,
default: false
},
// 点击图片时显示修改尺寸控件
showImgResize: {
type: Boolean,
default: false
},
// 占位符
placeholder: {
type: String,
default: '开始输入...'
},
// 图片上传的地址
uploadFileUrl: {
type: String,
default: '#'
},
// 上传文件时的name
fileKeyName: {
type: String,
default: 'file'
},
// 上传图片时,http请求的header
header: {
type: Object
},
// 初始化html
html: {
type: String
},
},
computed:{
},
data() {
return {
showMoreTool: true,
showBold: false,
showItalic: false,
showIns: false,
showHeader: false,
showCenter: false,
showRight: false,
showSettingLayer: false,
activeColor: '#F56C6C'
};
},
components: {
jinIcon
},
created() {
},
methods: {
onEditorReady(e) {
this.html = decodeURIComponent(this.html)//解密
uni.createSelectorQuery()
.in(this)
.select('.ql-container')
.fields({
size: true,
context: true
},res => {
this.editorCtx = res.context;
this.editorCtx.setContents({
html: this.html
})
})
.exec();
},
undo() {
this.editorCtx.undo();
},
// 插入图片
insertImage() {
uni.chooseImage({
count: 9, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], //从相册选择
success: async(res) => {
var tempFilePaths = res.tempFilePaths;
uni.showLoading({
title: '正在上传中...'
})
for (let temp of tempFilePaths) {
// 图片上传服务器
await uni.uploadFile({
url: this.uploadFileUrl,
filePath: temp,
name: this.fileKeyName,
header: this.header,
success: res => {
let data = JSON.parse(res.data)
// 上传完成后处理
this.editorCtx.insertImage({
src: data.data, // 此处需要将图片地址切换成服务器返回的真实图片地址
success: function(e) {
}
});
uni.hideLoading()
},
});
}
}
});
},
insertDivider() {
this.editorCtx.insertDivider();
},
redo() {
this.editorCtx.redo();
},
showMore() {
this.showMoreTool = !this.showMoreTool;
this.editorCtx.setContents()
},
setBold() {
this.showBold = !this.showBold;
this.editorCtx.format('bold');
},
setItalic() {
this.showItalic = !this.showItalic;
this.editorCtx.format('italic');
},
checkStatus(name, detail, obj) {
if (detail.hasOwnProperty(name)) {
this[obj] = true;
} else {
this[obj] = false;
}
},
statuschange(e) {
var detail = e.detail;
this.checkStatus('bold', detail, 'showBold');
this.checkStatus('italic', detail, 'showItalic');
this.checkStatus('ins', detail, 'showIns');
this.checkStatus('header', detail, 'showHeader');
if (detail.hasOwnProperty('align')) {
if (detail.align == 'center') {
this.showCenter = true;
this.showRight = false;
} else if (detail.align == 'right') {
this.showCenter = false;
this.showRight = true;
} else {
this.showCenter = false;
this.showRight = false;
}
} else {
this.showCenter = false;
this.showRight = false;
}
},
setIns() {
this.showIns = !this.showIns;
this.editorCtx.format('ins');
},
setHeader() {
this.showHeader = !this.showHeader;
this.editorCtx.format('header', this.showHeader ? 'H2' : false);
},
setCenter() {
this.showCenter = !this.showCenter;
this.editorCtx.format('align', this.showCenter ? 'center' : false);
},
setRight() {
this.showRight = !this.showRight;
this.editorCtx.format('align', this.showRight ? 'right' : false);
},
showSetting() {
this.showSettingLayer = !this.showSettingLayer;
},
async editFocus() {
},
editBlur() {
},
release(isPublic) {
this.showSettingLayer = false;
this.editorCtx.getContents({
success: res => {
Object.assign(res, {
isPublic: isPublic
})
this.$emit('editOk', res);
}
})
},
}
};
</script>
<style scoped>
.container {
padding: 30rpx 0;
box-sizing: border-box;
padding-bottom: 120rpx;
}
.ql-container {
line-height: 160%;
font-size: 34rpx;
width: calc(100% - 60rpx);
height: auto;
margin: 0 auto;
}
.tool-view{
width: 100vw;
position: fixed;
bottom: 0;
left: 0;
}
.tool {
height: 100rpx;
display: flex;
align-items: center;
justify-content: space-around;
width: 100%;
background: #eee;
}
.font-more {
position: absolute;
left: 0;
bottom: 100rpx;
display: flex;
align-items: center;
justify-content: space-around;
width: 100%;
background: rgb(235, 235, 235);
overflow: hidden;
transition: all 0.15s;
}
.setting-layer {
position: absolute;
bottom: 100rpx;
background: #fff;
width: 250rpx;
right: 20rpx;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
border-radius: 8rpx;
}
.setting-layer .single {
height: 80rpx;
font-size: 32rpx;
padding: 0 30rpx;
display: flex;
align-items: center;
line-height: 80rpx;
flex-direction: row;
color: #666;
}
.setting-layer .single .icon {
margin-right: 20rpx;
}
.setting-layer-mask{
position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
background: transparent;
}
</style>
<template>
<view class="content">
<view class="icon" :style="{color: color, fontSize: fontSize}" v-html="type" @click="toclick"></view>
</view>
</template>
<script>
export default {
props: {
type: {
type: String,
default: '&#xe644;'
},
color: {
type: String,
default: '#666666'
},
fontSize: {
type: String,
default: '34rpx'
}
},
methods: {
toclick() {
this.$emit('click');
}
}
}
</script>
<style scoped>
.content{
display: flex;
align-items: center;
justify-content: center;
}
@font-face {
font-family: 'jin';
/** 阿里巴巴矢量图标库的字体库地址,可以替换自己的字体库地址 **/
src: url('https://at.alicdn.com/t/font_1491431_6m7ltjo8wi.ttf') format('truetype');
}
.icon {
font-family: jin !important;
font-size: 34rpx;
}
</style>
This diff is collapsed.
function OcrIdCard(access_token){
return new Promise(function(resolve,reject){
var that = this;
//识别身份证
wx.chooseImage({
count: 1,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: function (res) {
console.log(res.tempFilePaths)
//核心代码
wx.getFileSystemManager().readFile({
filePath: res.tempFilePaths[0],
encoding: 'base64', //编码格式
success(ans) {
// console.log(ans.data)
wx.showLoading({ title: '识别中' })
wx.request({
url: 'https://aip.baidubce.com/rest/2.0/ocr/v1/idcard?access_token=' + access_token,
method: 'POST',
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data: {
image: ans.data,
id_card_side: 'front'
},
success(_res) {
wx.hideLoading();
resolve(_res)
}, fail(_res) {
wx.hideLoading();
wx.showToast({
title: '请求出错',
})
reject(_res)
}
})
}
})
}
})
})
}
module.exports = {
OcrIdCard: OcrIdCard
}
\ No newline at end of file
<template>
<view class="range-slider" :style="'width:' + width + 'rpx;height:' + height + 'rpx'">
<view class="range-bar" :style="'width:100%;height:' + barHeight + 'rpx'">
<view class="range-bar-bg" :style="'background-color:' + backgroundColor + ''"></view>
<view class="range-bar-progress" :style="'margin-left:' + progressBarLeft + 'rpx;width:' + progressBarWidth + 'rpx;background-color:' + activeColor + ''"></view>
</view>
<view
class="block"
:class="{ active: isMinActive }"
:style="'width:' + blockSize + 'rpx;height:' + blockSize + 'rpx;margin-left:' + minBlockLeft + 'rpx;'"
@touchstart="_onBlockTouchStart"
@touchmove.stop="_onBlockTouchMove"
@touchend="_onBlockTouchEnd"
:data-left="minBlockLeft"
data-tag="minBlock"
>
<slot name="minBlock"></slot>
</view>
<view
class="block"
:class="{ active: isMaxActive }"
:style="'width:' + blockSize + 'rpx;height:' + blockSize + 'rpx;margin-left:' + maxBlockLeft + 'rpx;'"
@touchstart="_onBlockTouchStart"
@touchmove.stop="_onBlockTouchMove"
@touchend="_onBlockTouchEnd"
:data-left="maxBlockLeft"
data-tag="maxBlock"
>
<slot name="maxBlock"></slot>
</view>
</view>
</template>
<script>
/**
* range-slider v1.0.6
*/
const _windowWidth = uni.getSystemInfoSync().windowWidth;
export default {
data() {
return {
isMinActive: false,
isMaxActive: false,
//#ifdef H5
MAX_LENGTH: 294,
maxBlockLeft: 300,
//#endif
// #ifndef H5
MAX_LENGTH: 700,
maxBlockLeft: 350,
// #endif
minBlockLeft: 0,
progressBarLeft: 0,
progressBarWidth: 350,
originalMinValue: 0,
originalMaxValue: 0
};
},
components: {},
props: {
//组件宽度
width: {
type: Number,
default: 750
},
//组件高度
height: {
type: Number,
default: 100
},
//滑块大小
blockSize: {
type: Number,
default: 50
},
//区间进度条高度
barHeight: {
type: Number,
default: 5
},
//背景条颜色
backgroundColor: {
type: String,
default: '#e9e9e9'
},
//已选择的颜色
activeColor: {
type: String,
default: '#1aad19'
},
//最小值
min: {
type: Number,
default: 0
},
//最大值
max: {
type: Number,
default: 100
},
//设置初始值
values: {
type: Array,
default: function() {
return [0, 100];
}
},
//步长值
step: {
type: Number,
default: 1
},
//live模式,是否动态更新
liveMode: {
type: Boolean,
default: true
}
},
created: function() {
//使用自定义组件编译模式时,支持生命周期为:created
this._refresh();
},
onLoad: function(option) {
//不使用自定义组件编译模式时,支持生命周期为:onload
this._refresh();
},
onUnload: function() {},
watch: {
//组件宽度
width: function(newVal, oldVal, changedPath) {
var that = this;
if (newVal != that.width) {
this._refresh();
}
},
//滑块大小
blockSize: function(newVal, oldVal, changedPath) {
var that = this;
if (newVal != that.blockSize) {
this._refresh();
}
},
//最小值
min: function(newVal, oldVal, changedPath) {
var that = this;
if (newVal != that.min) {
that._refresh();
}
},
//最大值
max: function(newVal, oldVal, changedPath) {
var that = this;
if (newVal != that.max) {
that._refresh();
}
},
//设置初始值
values: function(newVal, oldVal, changedPath) {
var that = this;
var values = that.values;
console.log('refresh', newVal, oldVal);
if (that._isValuesValid(newVal) && that._isValuesValid(values)) {
if (values[0] != oldVal[0] || values[1] != oldVal[1]) that._refresh();
}
}
},
methods: {
//补0
_pad: function(num, n) {
return Array(n - ('' + num).length + 1).join(0) + num;
},
_pxToRpx: function(px) {
return (750 * px) / _windowWidth;
},
_onBlockTouchStart: function(e) {
let tag = e.target.dataset.tag;
if (tag == 'minBlock' || tag == 'maxBlock') {
this.isMinActive = tag == 'minBlock';
this.isMaxActive = tag == 'maxBlock';
//兼容h5平台及某版本微信
if (e.hasOwnProperty('changedTouches')) {
this._blockDownX = e.changedTouches[0].pageX;
} else {
this._blockDownX = e.pageX;
}
//#ifdef H5
this._blockLeft = parseFloat(e.target.dataset.left);
//#endif
// #ifndef H5
this._blockLeft = e.target.dataset.left;
// #endif
this._curBlock = e.target.dataset.tag;
}
},
_onBlockTouchMove: function(e) {
let tag = e.target.dataset.tag;
if (tag == 'minBlock' || tag == 'maxBlock') {
var that = this;
var values = that._calculateValues(e);
that._refreshProgressBar(values[2], values[3]);
that._refreshBlock(values[2], values[3]);
//拖动时也触发事件
var eventDetail = {
minValue: this.formatNumber(values[0], this.step),
maxValue: this.formatNumber(values[1], this.step),
fromUser: true,
originalValue: {
minValue: values[0],
maxValue: values[1]
}
};
this.originalMinValue = values[0];
this.originalMaxValue = values[1];
var eventOption = {};
//
if (this.liveMode) that.$emit('rangechange', eventDetail, eventOption);
}
},
_onBlockTouchEnd: function(e) {
let tag = e.target.dataset.tag;
this.isMinActive = false;
this.isMaxActive = false;
if (tag == 'minBlock' || tag == 'maxBlock') {
var that = this;
var values = that._calculateValues(e.mp.changedTouches[0]);
that._refreshProgressBar(values[2], values[3]);
that._refreshBlock(values[2], values[3]);
var eventDetail = {
minValue: this.formatNumber(values[0], this.step),
maxValue: this.formatNumber(values[1], this.step),
fromUser: true,
originalValue: {
minValue: values[0],
maxValue: values[1]
}
};
this.originalMinValue = values[0];
this.originalMaxValue = values[1];
var eventOption = {};
that.$emit('rangechange', eventDetail, eventOption);
}
},
_isValuesValid: function(values) {
return values != null && values != undefined && values.length == 2;
},
/**
* 根据手势计算相关数据
*/
_calculateValues: function(e) {
var pageX = e.pageX;
//兼容h5平台
if (e.hasOwnProperty('changedTouches')) {
pageX = e.changedTouches[0].pageX;
}
var that = this;
var moveLength = pageX - that._blockDownX;
var left = that._blockLeft + that._pxToRpx(moveLength);
left = Math.max(0, left);
left = Math.min(left, that.MAX_LENGTH);
var minBlockLeft = that.minBlockLeft;
var maxBlockLeft = that.maxBlockLeft;
if (that._curBlock == 'minBlock') {
minBlockLeft = left;
} else {
maxBlockLeft = left;
}
var range = that.max - that.min;
var minLeft = Math.min(minBlockLeft, maxBlockLeft);
var maxLeft = Math.max(minBlockLeft, maxBlockLeft);
var minValue = (minLeft / that.MAX_LENGTH) * range + that.min;
var maxValue = (maxLeft / that.MAX_LENGTH) * range + that.min;
return [minValue, maxValue, minLeft, maxLeft];
},
/**
* 计算滑块坐标
*/
_calculateBlockLeft: function(minValue, maxValue) {
var that = this;
var blockSize = that.blockSize;
var range = that.max - that.min;
var minLeft = ((minValue - that.min) / range) * that.MAX_LENGTH;
var maxLeft = ((maxValue - that.min) / range) * that.MAX_LENGTH;
return [minLeft, maxLeft];
},
/**
* 刷新进度条视图
*/
_refreshProgressBar: function(minBlockLeft, maxBlockLeft) {
var that = this;
var blockSize = that.blockSize;
that.progressBarLeft = minBlockLeft + blockSize / 2;
that.progressBarWidth = Math.abs(maxBlockLeft - minBlockLeft);
},
/**
* 刷新滑块视图
*/
_refreshBlock: function(minBlockLeft, maxBlockLeft) {
var that = this;
that.minBlockLeft = minBlockLeft;
that.maxBlockLeft = maxBlockLeft;
},
/**
* 刷新整个视图
*/
_refresh: function() {
var that = this;
var MAX_LENGTH = that.width - that.blockSize;
that.MAX_LENGTH = MAX_LENGTH;
that.maxBlockLeft = MAX_LENGTH;
that.progressBarWidth = MAX_LENGTH;
var values = that.values;
if (this.originalMinValue && this.originalMinValue) {
values = [this.originalMinValue || values[0], this.originalMaxValue || values[1]];
}
if (that._isValuesValid(values)) {
values[0] = Math.max(that.min, values[0]);
values[0] = Math.min(values[0], that.max);
values[1] = Math.max(that.min, values[1]);
values[1] = Math.min(values[1], that.max);
var leftValues = that._calculateBlockLeft(values[0], values[1]);
that._refreshProgressBar(leftValues[0], leftValues[1]);
that._refreshBlock(leftValues[0], leftValues[1]);
}
},
formatNumber(num, step) {
//格式化数字,保留几位小数
let stepStr = '' + step;
let index = stepStr.indexOf('.');
let len = index > -1 ? stepStr.length - index - 1 : 0;
let offestNum = parseInt(1 + Array(('' + len).length + 1).join(0)) * 0.1;
let tmpNum = num * offestNum;
return ((parseInt(tmpNum / step + (step > 1 ? 1 : step) * 0.5) * step) / offestNum).toFixed(len);
}
}
};
</script>
<style>
.range-slider {
position: relative;
}
.range-bar {
position: absolute;
}
.range-bar {
position: absolute;
top: 50%;
transform: translate(0, -50%);
border-radius: 10000rpx;
}
.range-bar-bg {
position: absolute;
width: 100%;
height: 100%;
border-radius: 10000rpx;
}
.range-bar-progress {
position: absolute;
width: 100%;
height: 100%;
background-color: blueviolet;
}
.block {
position: absolute;
top: 50%;
transform: translate(0, -50%);
background: #fff;
border-radius: 50%;
box-shadow: 0rpx 0rpx 6rpx #ccc;
}
.block.active {
transform: translate(0, -50%) scale(1.5);
}
</style>
<template>
<view class="scroll-choose-all" :style="{'box-shadow':'0 3px 8px 0px '+mainColor}">
<view class="middleLine" :style="{'border-top': '10px solid ' +mainColor,}"></view>
<scroll-view class="scroll-choose" scroll-x="true" upper-threshold="5" lower-threshold="5"
:scroll-left="scrollLeftInit" show-scrollbar="false" @scroll="scroll" @scrolltoupper="upper"
@scrolltolower="lower" scroll-with-animation="true">
<view class="scroll-con" :style="{width: scrollWid}">
<view class="topLine">
<view class="allLine" :style="{'marginRight': maginL + 'px'}" :class="item.type" v-for="(item,index) in scrollList" :key="index"></view>
</view>
<view class="bottomNum" :style="{'paddingLeft': allNumLeft,}">
<text class="allNum" :style="{width: (maginL + 2) * 10 + 'px',left: -((maginL + 2) * 5) + 'px','color':value==item?mainColor:'#AEAEB0',}" v-for="(item,index) in scrollNumList" :key="index">
{{item}}
</text>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
export default {
name: 'ScrollChoose',
props: {
//起始值和终止值差距不要过大,否则会影响页面性能(暂不支持设置小数)
/**
* 初始值(注意:初始值应在起始值和终止值之间)
*/
scrollLeft: {
type: Number,
default: 0
},
/**
* 滚动区域起始值(注意:起始值不能大于终止值)
*/
scrollStart: {
type: Number,
default: 0
},
/**
* 滚动区域终止值
*/
scrollEnd: {
type: Number,
default: 100
},
/**
* 线间距
*/
maginL: {
type: Number,
default: 5
},
},
data() {
return {
scrollList:[],
scrollNumList:[],
scrollWid: '100vw',
scrollLeftInit: 0,
allNumLeft: '',
mainColor: '',
secondary: '',
value:0,
}
},
mounted() {
this.mainColor = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary;
this.init();
},
created() {
this.value = this.scrollLeft
},
computed:{
},
methods: {
init(){
for(let i = this.scrollStart; i < (this.scrollEnd + 1); i++){
let _line = {};
if(i%5 == 0){
if(i%10 == 0){
this.scrollNumList.push(i);
_line.type = 'LLine'
}else{
_line.type = 'MLine'
}
}else{
_line.type = 'SLine'
}
this.scrollList.push(_line);
}
this.scrollWid = uni.upx2px(750) + (this.scrollEnd - this.scrollStart) * (this.maginL + 2) + 'px';
if(this.scrollStart % 10 != 0){
if(this.scrollStart > 0){
this.allNumLeft = (10 - this.scrollStart % 10) * (this.maginL + 2) + uni.upx2px(372) + 'px';
}else{
this.allNumLeft = Math.abs(this.scrollStart % 10) * (this.maginL + 2) + uni.upx2px(372) + 'px';
}
}
setTimeout(()=>{
this.setNowLeft();
},100)
},
setNowLeft(){
this.scrollLeftInit = (this.scrollLeft - this.scrollStart) * (this.maginL + 2);
},
upper: function(e) {
setTimeout(()=>{
this.$emit('scroll',this.scrollStart);
},50)
},
lower: function(e) {
setTimeout(()=>{
this.$emit('scroll',this.scrollEnd);
},50)
},
scroll: function(e) {
this.value = Math.round(e.detail.scrollLeft/(this.maginL + 2)) + this.scrollStart
this.$emit('scroll',Math.round(e.detail.scrollLeft/(this.maginL + 2)) + this.scrollStart);
}
}
}
</script>
<style lang="scss">
@charset "UTF-8";
.scroll-choose-all{
width: 650rpx;
height: 70px;
background: #f8f8f8;
margin: 20px 0;
border-bottom: 1px solid #ccc;
border-top: 1px solid #ccc;
position: relative;
border-radius: 10px;
overflow: hidden;
}
.middleLine{
position: absolute;
// width: 4px;
// height: 25px;
// background: #00C6C1;
left: 369rpx;
margin-left: -2px;
z-index: 1;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
// border-top: 10px solid red;
}
.scroll-choose{
width: 650rpx;
height: 70px;
.scroll-con{
height: 70px;
overflow: hidden;
.topLine{
height: 30px;
padding: 0 372rpx;
}
.bottomNum{
height: 30px;
padding: 0 0 0 372rpx;
width: 100%;
// display: flex;
// flex-wrap: nowrap;
.allNum{
display: inline-block;
position: relative;
// width: 70px;
// left: -35px;
text-align: center;
}
}
.allLine{
display: inline-block;
// margin-right: 5px;
width: 2px;
background: #E7E6E9;
position: relative;
}
.allLine:last-child{
margin-right: 0px !important;
}
.LLine{
height: 30px;
}
.MLine{
height: 20px;
top: -10px;
}
.SLine{
height: 15px;
top: -15px;
}
}
}
</style>
\ No newline at end of file
This diff is collapsed.
<template>
<u-popup :maskCloseAble="maskCloseAble" mode="bottom" :popup="false" v-model="value" length="auto"
:safeAreaInsetBottom="safeAreaInsetBottom" @close="close" z-index="999">
<view class="u-picker-header" @touchmove.stop.prevent="stop" catchtouchmove="stop">
<view class="u-btn-picker u-btn-picker--tips" hover-class="u-opacity"
:hover-stay-time="150" @tap="getResult('cancel')">取消</view>
<view class="u-btn-picker u-btn-picker--primary" hover-class="u-opacity"
:hover-stay-time="150" @touchmove.stop="" @tap.stop="getResult('confirm')">确定</view>
</view>
<view class="u-picker-body">
<picker-view :value="pickVal" @change="bindChange" class="u-picker-view">
<picker-view-column>
<view class="u-column-item" v-for="(item,index) in districtsObj.provinces" :key="index">
<view class="u-line-1">
{{item.Name}}
</view>
</view>
</picker-view-column>
<picker-view-column>
<view class="u-column-item" v-for="(item,index) in districtsObj.cities" :key="index">
<view class="u-line-1">
{{item.Name}}
</view>
</view>
</picker-view-column>
<picker-view-column>
<view class="u-column-item" v-for="(item,index) in districtsObj.areas" :key="index">
<view class="u-line-1">
{{item.Name}}
</view>
</view>
</picker-view-column>
</picker-view>
</view>
</u-popup>
</template>
<script>
import uPopup from './u-popup'
export default {
props: {
safeAreaInsetBottom: {
type: Boolean,
default: false
},
// 是否允许通过点击遮罩关闭Picker
maskCloseAble: {
type: Boolean,
default: true
},
// 通过双向绑定控制组件的弹出与收起
value: {
type: Boolean,
default: false
},
},
data() {
return {
pickVal:[0, 0, 0],
districtsObj: {
provinces: [],
cities: [],
areas: [],
},
province: 0,
city: 0,
area: 0
}
},
watch: {
// 如果地区发生变化,为了让picker联动起来,必须重置this.citys和this.areas
province(val) {
this.loadCities(this.districtsObj.provinces[this.province].ID);
},
city(val) {
this.loadAreas(this.districtsObj.cities[this.city].ID);
}
},
mounted() {
console.log(this.value)
this.loadDistrict()
},
methods: {
close() {
this.$emit('input', false);
},
async loadDistrict() {
this.loadProvinces()
},
loadProvinces() { // 加载省份
this.request2(
{
url: '/api/Destination/GetChildList',
data: {Id:1}
},
res => {
let data = res.data
this.districtsObj.provinces = data
this.loadCities(data[0].ID)
},
);
},
loadCities(Id) {
this.request2(
{
url: '/api/Destination/GetChildList',
data: {Id:Id}
},
res => {
let data = res.data
this.districtsObj.cities = data
this.loadAreas(data[0].ID)
},
);
},
loadAreas(Id) {
this.request2(
{
url: '/api/Destination/GetChildList',
data: {Id:Id}
},
res => {
let data = res.data
this.districtsObj.areas = data
},
);
},
bindChange(event) {
this.pickVal = event.detail.value;
let i = 0;
this.province = this.pickVal[i++];
this.city = this.pickVal[i++];
this.area = this.pickVal[i++];
},
getResult(event = null) {
let result = {
province: this.districtsObj.provinces[this.province],
city: this.districtsObj.cities[this.city],
area: this.districtsObj.areas[this.area],
}
if (event) this.$emit(event, result);
this.close();
}
},
components:{
uPopup
}
}
</script>
<style lang="scss" scoped>
.u-datetime-picker {
position: relative;
z-index: 999;
}
.u-picker-view {
height: 100%;
box-sizing: border-box;
}
.u-picker-header {
width: 100%;
height: 90rpx;
padding: 0 40rpx;
display: flex;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
font-size: 32rpx;
background: #ddd;
position: relative;
}
.u-picker-header::after {
content: '';
position: absolute;
border-bottom: 1rpx solid #eaeef1;
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
bottom: 0;
right: 0;
left: 0;
}
.u-picker-body {
width: 100%;
height: 500rpx;
overflow: hidden;
background-color: #fff;
}
.u-column-item {
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
padding: 0 8rpx;
}
.u-text {
font-size: 24rpx;
padding-left: 8rpx;
}
.u-btn-picker {
padding: 16rpx;
box-sizing: border-box;
text-align: center;
text-decoration: none;
}
.u-opacity {
opacity: 0.5;
}
.u-btn-picker--primary {
}
.u-btn-picker--tips {
}
</style>
<template>
<view class="u-mask" :style="[maskStyle]" :class="[show ? 'u-mask-show' : '']" @tap="click" @touchmove.stop.prevent>
<slot />
</view>
</template>
<script>
/**
* mask 遮罩
* @description 创建一个遮罩层,用于强调特定的页面元素,并阻止用户对遮罩下层的内容进行操作,一般用于弹窗场景
* @tutorial https://www.uviewui.com/components/mask.html
* @property {Boolean} show 是否显示遮罩(默认false)
* @property {String Number} z-index z-index 层级(默认1070)
* @property {Object} custom-style 自定义样式对象,见上方说明
* @property {String Number} duration 动画时长,单位毫秒(默认300)
* @property {Boolean} zoom 是否使用scale对这招进行缩放(默认true)
* @property {Boolean} mask-click-able 遮罩是否可点击,为false时点击不会发送click事件(默认true)
* @event {Function} click mask-click-able为true时,点击遮罩发送此事件
* @example <u-mask :show="show" @click="show = false"></u-mask>
*/
export default {
name: "u-mask",
props: {
// 是否显示遮罩
show: {
type: Boolean,
default: false
},
// 层级z-index
zIndex: {
type: [Number, String],
default: '1'
},
// 用户自定义样式
customStyle: {
type: Object,
default () {
return {}
}
},
// 遮罩的动画样式, 是否使用使用zoom进行scale进行缩放
zoom: {
type: Boolean,
default: true
},
// 遮罩的过渡时间,单位为ms
duration: {
type: [Number, String],
default: 300
},
// 是否可以通过点击遮罩进行关闭
maskClickAble: {
type: Boolean,
default: true
}
},
computed: {
maskStyle() {
let style = {};
style.backgroundColor = "rgba(0, 0, 0, 0.6)";
style.zIndex = this.zIndex ? this.zIndex : this.$u.zIndex.mask;
style.transition = `all ${this.duration / 1000}s ease-in-out`;
// 缩放
if (this.zoom == true) style.transform = 'scale(1.2, 1.2)';
// 判断用户传递的对象是否为空
if (Object.keys(this.customStyle).length) style = { ...style,
...this.customStyle
};
// 合并自定义的样式
//Object.assign(style, customStyle);
return style;
}
},
methods: {
click() {
if (!this.maskClickAble) return;
this.$emit('click');
}
}
}
</script>
<style lang="scss" scoped>
.u-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
opacity: 0;
visibility: hidden;
}
.u-mask-show {
opacity: 1;
visibility: visible;
transform: scale(1);
}
</style>
<template>
<view v-if="visibleSync" :style="[customStyle]" :class="{ 'u-drawer-visible': showDrawer }" class="u-drawer">
<u-mask :maskClickAble="maskCloseAble" :show="showDrawer && mask" @click="maskClick"></u-mask>
<view class="u-drawer-content" @tap="modeCenterClose(mode)" :class="[
safeAreaInsetBottom ? 'safe-area-inset-bottom' : '',
'u-drawer-' + mode,
showDrawer ? 'u-drawer-content-visible' : '',
zoom && mode == 'center' ? 'u-animation-zoom' : ''
]"
@touchmove.stop.prevent @tap.stop.prevent :style="[style]">
<view class="u-mode-center-box" @tap.stop.prevent @touchmove.stop.prevent v-if="mode == 'center'" :style="[centerStyle]">
<slot />
</view>
<block v-else>
<slot />
</block>
</view>
</view>
</template>
<script>
/**
* popup 弹窗
* @description 弹出层容器,用于展示弹窗、信息提示等内容,支持上、下、左、右和中部弹出。组件只提供容器,内部内容由用户自定义
* @tutorial https://www.uviewui.com/components/popup.html
* @property {String} mode 弹出方向(默认left)
* @property {Boolean} mask 是否显示遮罩(默认true)
* @property {String Number} length mode=left | 见官网说明(默认auto)
* @property {Boolean} zoom 是否开启缩放动画,只在mode为center时有效(默认true)
* @property {Boolean} safe-area-inset-bottom 是否开启底部安全区适配(默认false)
* @property {Boolean} mask-close-able 点击遮罩是否可以关闭弹出层(默认true)
* @property {Object} custom-style 用户自定义样式
* @property {Number String} border-radius 弹窗圆角值(默认0)
* @property {Number String} z-index 弹出内容的z-index值(默认1075)
* @event {Function} open 弹出层打开
* @event {Function} close 弹出层收起
* @example <u-popup v-model="show"><view>出淤泥而不染,濯清涟而不妖</view></u-popup>
*/
import uMask from './u-mask'
export default {
name: 'u-popup',
props: {
/**
* 显示状态
*/
show: {
type: Boolean,
default: false
},
/**
* 弹出方向,left|right|top|bottom|center
*/
mode: {
type: String,
default: 'left'
},
/**
* 是否显示遮罩
*/
mask: {
type: Boolean,
default: true
},
// 抽屉的宽度(mode=left|right),或者高度(mode=top|bottom),单位rpx,或者"auto"
// 或者百分比"50%",表示由内容撑开高度或者宽度
length: {
type: [Number, String],
default: 'auto'
},
// 是否开启缩放动画,只在mode=center时有效
zoom: {
type: Boolean,
default: true
},
// 是否开启底部安全区适配,开启的话,会在iPhoneX机型底部添加一定的内边距
safeAreaInsetBottom: {
type: Boolean,
default: false
},
// 是否可以通过点击遮罩进行关闭
maskCloseAble: {
type: Boolean,
default: true
},
// 用户自定义样式
customStyle: {
type: Object,
default () {
return {};
}
},
value: {
type: Boolean,
default: false
},
// 此为内部参数,不在文档对外使用,为了解决Picker和keyboard等融合了弹窗的组件
// 对v-model双向绑定多层调用造成报错不能修改props值的问题
popup: {
type: Boolean,
default: true
},
// 显示显示弹窗的圆角,单位rpx
borderRadius: {
type: [Number, String],
default: 0
},
zIndex: {
type: [Number, String],
default: '100'
}
},
data() {
return {
visibleSync: false,
showDrawer: false,
timer: null,
style1: {}
};
},
computed: {
// 根据mode的位置,设定其弹窗的宽度(mode = left|right),或者高度(mode = top|bottom)
style() {
let style = {};
let translate = '100%';
// 判断是否是否百分比或者auto值,是的话,直接使用该值,否则默认为rpx单位的数值
let length = (/%$/.test(this.length) || this.length == 'auto') ? this.length : uni.upx2px(this.length) + 'px';
// 如果是左边或者上边弹出时,需要给translate设置为负值,用于隐藏
if (this.mode == 'left' || this.mode == 'top') translate = length == 'auto' ? '-100%' : '-' + length;
if (this.mode == 'left' || this.mode == 'right') {
style = {
width: length,
height: '100%',
transform: `translate3D(${translate},0px,0px)`
};
} else if (this.mode == 'top' || this.mode == 'bottom') {
style = {
width: '100%',
height: length,
transform: `translate3D(0px,${translate},0px)`
};
}
style.zIndex = this.zIndex ? this.zIndex : this.$u.zIndex.popup;
// 如果用户设置了borderRadius值,添加弹窗的圆角
if (this.borderRadius) {
switch (this.mode) {
case 'left':
style.borderRadius = `0 ${this.borderRadius}rpx ${this.borderRadius}rpx 0`;
break;
case 'top':
style.borderRadius = `0 0 ${this.borderRadius}rpx ${this.borderRadius}rpx`;
break;
case 'right':
style.borderRadius = `${this.borderRadius}rpx 0 0 ${this.borderRadius}rpx`;
break;
case 'bottom':
style.borderRadius = `${this.borderRadius}rpx ${this.borderRadius}rpx 0 0`;
break;
default:
;
}
// 不加可能圆角无效
style.overflow = 'hidden';
}
return style;
},
// 中部弹窗的特有样式
centerStyle() {
let style = {};
let length = (/%$/.test(this.length) || this.length == 'auto') ? this.length : uni.upx2px(this.length) + 'px';
style.width = length;
style.zIndex = this.zIndex ? this.zIndex : this.$u.zIndex.popup;
if (this.borderRadius) {
style.borderRadius = `${this.borderRadius}rpx`;
// 不加可能圆角无效
style.overflow = 'hidden';
}
return style;
}
},
watch: {
value(val) {
if (val) {
this.open();
} else {
this.close();
}
}
},
created() {
// 先让弹窗组件渲染,再改变遮罩和抽屉元素的样式,让其动画其起作用(必须要有延时,才会有效果)
this.visibleSync = this.value;
setTimeout(() => {
this.showDrawer = this.value;
}, 30);
},
methods: {
// 遮罩被点击
maskClick() {
this.close();
},
close() {
this.change('showDrawer', 'visibleSync', false);
},
// 中部弹出时,需要.u-drawer-content将居中内容,此元素会铺满屏幕,点击需要关闭弹窗
// 让其只在mode=center时起作用
modeCenterClose(mode) {
if (mode != 'center' || !this.maskCloseAble) return;
this.close();
},
open() {
this.change('visibleSync', 'showDrawer', true);
},
// 此处的原理是,关闭时先通过动画隐藏弹窗和遮罩,再移除整个组件
// 打开时,先渲染组件,延时一定时间再让遮罩和弹窗的动画起作用
change(param1, param2, status) {
// 如果this.popup为false,以为着为picker,actionsheet等组件调用了popup组件
if (this.popup == true) this.$emit('input', status);
this[param1] = status;
if (this.timer) {
clearTimeout(this.timer);
}
this.timer = setTimeout(
() => {
this[param2] = status;
this.$emit(status ? 'open' : 'close');
},
status ? 30 : 300
);
}
},
components:{
uMask
}
};
</script>
<style scoped lang="scss">
.u-drawer {
/* #ifndef APP-NVUE */
display: block;
/* #endif */
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: hidden;
z-index: 999;
background-color: rgba(0, 0, 0, 0.4);
}
.u-drawer-content {
/* #ifndef APP-NVUE */
display: block;
/* #endif */
position: absolute;
z-index: 1003;
transition: all 0.25s linear;
}
.u-drawer-left {
top: 0;
bottom: 0;
left: 0;
background-color: #ffffff;
}
.u-drawer-right {
right: 0;
top: 0;
bottom: 0;
background-color: #ffffff;
}
.u-drawer-top {
top: 0;
left: 0;
right: 0;
background-color: #ffffff;
}
.u-drawer-bottom {
bottom: 0;
left: 0;
right: 0;
background-color: #ffffff;
}
.u-drawer-center {
/* #ifndef APP-NVUE */
display: flex;
flex-direction: column;
/* #endif */
bottom: 0;
left: 0;
right: 0;
top: 0;
justify-content: center;
align-items: center;
opacity: 0;
z-index: 99999;
}
.u-mode-center-box {
min-width: 100rpx;
min-height: 100rpx;
/* #ifndef APP-NVUE */
display: block;
/* #endif */
position: relative;
background-color: #ffffff;
}
.u-drawer-content-visible.u-drawer-center {
transform: scale(1);
opacity: 1;
}
.u-animation-zoom {
transform: scale(1.15);
}
.u-drawer-content-visible {
transform: translate3D(0px, 0px, 0px) !important;
}
.u-drawer-mask {
/* #ifndef APP-NVUE */
display: block;
/* #endif */
opacity: 0;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.4);
transition: opacity 0.25s;
}
.u-drawer-mask-visible {
/* #ifndef APP-NVUE */
display: block;
/* #endif */
opacity: 1;
}
</style>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -178,7 +178,7 @@ ...@@ -178,7 +178,7 @@
info: {}, info: {},
contentHeight: 0, contentHeight: 0,
navs:[{Name:'司导专车'},{Name:'景区专车'}], navs:[{Name:'司导专车'},{Name:'景区专车'}],
active:0, active:1,
mainColor: '', mainColor: '',
scrollTop: 0, scrollTop: 0,
headStyle: {}, headStyle: {},
......
...@@ -285,6 +285,7 @@ ...@@ -285,6 +285,7 @@
this.Up = uni.getStorageSync("mall_UserInfo")?uni.getStorageSync("mall_UserInfo").UserPageType:0; this.Up = uni.getStorageSync("mall_UserInfo")?uni.getStorageSync("mall_UserInfo").UserPageType:0;
}, },
onLoad(options) { onLoad(options) {
console.log(options)
this.id = options.id; this.id = options.id;
this.roomMsg.HotelId = options.id; this.roomMsg.HotelId = options.id;
let that = this let that = this
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment