Commit 9f13ffbc authored by Mac's avatar Mac

相亲一小模块

parent a3ae462b
...@@ -547,6 +547,13 @@ ...@@ -547,6 +547,13 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}] }]
},
//相亲分包
{
"root": "pages/blindDate",
"pages": [{
"path": "basicdata"//基础资料的填写
}]
} }
], ],
"globalStyle": { "globalStyle": {
......
This diff is collapsed.
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="scroll-choose-all" :style="{'box-shadow':'0 3px 8px 0px '+mainColor}">
<view class="middleLine" :style="{'background':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: 375rpx;
margin-left: -2px;
z-index: 1;
}
.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
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