合成照相馆小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
photo_uniapp/pages/index/index.vue

482 lines
12 KiB

<template>
<view class="container">
<view class="bannerBox">
<u-swiper
:list="banner"
keyName="adImg"
:showTitle="false"
:autoplay="true"
circular
height="280"
radius="0"
@click="openAd"
></u-swiper>
</view>
<view class="contentBox">
<view class="navBox">
<view class="navItem">
<image src="/static/img/index/zjhc.png" mode="widthFix"></image>
</view>
<view class="navItem">
<image src="/static/img/index/zjgs.png" mode="widthFix"></image>
</view>
<view class="navItem">
<image src="/static/img/index/aixz.png" mode="widthFix"></image>
</view>
<view class="navItem">
<image src="/static/img/index/kthf.png" mode="widthFix"></image>
</view>
</view>
<view class="indexTitle">
<image src="/static/img/index/title_zj.png" mode="widthFix"></image>
</view>
<view class="listBox">
<view class="photoBox">
<view class="photoTop">
<view class="topLeft">
<image src="/static/img/index/zj_icon.png" mode="widthFix"></image>
</view>
<view class="topCenter">
<view class="title">一寸照</view>
<view class="desc">25×35mm | 413×579px</view>
</view>
<view class="topRight">
<view class="distance">
<image src="/static/img/index/right.png" mode="widthFix"></image>
</view>
</view>
</view>
</view>
<view class="photoBox">
<view class="photoTop">
<view class="topLeft">
<image src="/static/img/index/zj_icon.png" mode="widthFix"></image>
</view>
<view class="topCenter">
<view class="title">二寸照</view>
<view class="desc">25×35mm | 413×579px</view>
</view>
<view class="topRight">
<view class="distance">
<image src="/static/img/index/right.png" mode="widthFix"></image>
</view>
</view>
</view>
</view>
<view class="photoBox">
<view class="photoTop">
<view class="topLeft">
<image src="/static/img/index/zj_icon.png" mode="widthFix"></image>
</view>
<view class="topCenter">
<view class="title">大一寸照</view>
<view class="desc">25×35mm | 413×579px</view>
</view>
<view class="topRight">
<view class="distance">
<image src="/static/img/index/right.png" mode="widthFix"></image>
</view>
</view>
</view>
</view>
<view class="photoBox">
<view class="photoTop">
<view class="topLeft">
<image src="/static/img/index/zj_icon.png" mode="widthFix"></image>
</view>
<view class="topCenter">
<view class="title">小一寸照</view>
<view class="desc">25×35mm | 413×579px</view>
</view>
<view class="topRight">
<view class="distance">
<image src="/static/img/index/right.png" mode="widthFix"></image>
</view>
</view>
</view>
</view>
</view>
<view class="indexTitle">
<image src="/static/img/index/title_xz.png" mode="widthFix"></image>
</view>
<view class="picList">
<scroll-view class="scrollBox" scroll-x="true" @scroll="scroll1" scroll-left="0">
<view class="picBox">
<view class="pic">
<image src="/static/img/index/pic.png" mode="widthFix"></image>
</view>
<view class="pic_title">风格名称</view>
</view>
<view class="picBox">
<view class="pic">
<image src="/static/img/index/pic.png" mode="widthFix"></image>
</view>
<view class="pic_title">风格名称</view>
</view>
<view class="picBox">
<view class="pic">
<image src="/static/img/index/pic.png" mode="widthFix"></image>
</view>
<view class="pic_title">风格名称</view>
</view>
<view class="picBox">
<view class="pic">
<image src="/static/img/index/pic.png" mode="widthFix"></image>
</view>
<view class="pic_title">风格名称</view>
</view>
</scroll-view>
</view>
<view class="indexTitle">
<image src="/static/img/index/title_kt.png" mode="widthFix"></image>
</view>
<view class="picList">
<scroll-view class="scrollBox" scroll-x="true" @scroll="scroll2" scroll-left="0">
<view class="picBox">
<view class="pic">
<image src="/static/img/index/pic.png" mode="widthFix"></image>
</view>
<view class="pic_title">风格名称</view>
</view>
<view class="picBox">
<view class="pic">
<image src="/static/img/index/pic.png" mode="widthFix"></image>
</view>
<view class="pic_title">风格名称</view>
</view>
<view class="picBox">
<view class="pic">
<image src="/static/img/index/pic.png" mode="widthFix"></image>
</view>
<view class="pic_title">风格名称</view>
</view>
<view class="picBox">
<view class="pic">
<image src="/static/img/index/pic.png" mode="widthFix"></image>
</view>
<view class="pic_title">风格名称</view>
</view>
</scroll-view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
banner: [
{
adImg:'/static/img/index/banner.png',
}
],
notice:'',
}
},
computed:{
},
onLoad() {
this.getHomeInfo();
},
onShareAppMessage() {
return {
title: '空间充-首页',
path: uni.$u.page(),
}
},
onShareTimeline() {
return {
title: '空间充-首页',
path: uni.$u.page(),
}
},
methods: {
//获取门店信息
getHomeInfo(){
var _this =this;
//post 请求例子
_this.$api.post('ycl/home', {},function(res){
console.log(res);
var d = res;
var banner = d.adList
banner.forEach((item, index) => {
item.title = item.adName;
})
//_this.banner = banner;
//_this.notice = d.notice;
//_this.$user.session('servicePhone',d.servicePhone);
});
},
//滚动监控
scroll1(e) {
console.log(e);
},
scroll2(e) {
console.log(e);
},
//扫码
scanQrcode()
{
var _this =this;
_this.$com.showLoading('识别中...');
uni.scanCode({
onlyFromCamera: false,
success: function (res) {
console.log(res);
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
if (res.scanType == 'QR_CODE')
{
var url = res.result;
var codeTypeArr = ['deviceKey', 'deviceCode', 'qrcode', 'code']; //支持的条码参数
var url_str = '';
codeTypeArr.forEach(function(item) {
if(url.indexOf(item) != -1 )
{
var keyindex = item;
var deviceKey = _this.getParameterByName(url,item);
if(!_this.$com.isNull(deviceKey))
{
if(['qrcode', 'code'].includes(item)) {
keyindex = 'deviceCode';
}
console.log(keyindex+'='+deviceKey);
url_str = `${keyindex}=${deviceKey}`;
return;
}
}
});
if(!_this.$com.isNull(url_str))
{
uni.$u.route({
url: '/pages/order/order?'+url_str,
});
}
else
{
_this.$com.alert('二维码格式有误');
}
}
else
{
_this.$com.alert('暂不支持此种条码类型');
}
},
fail:function(err){
_this.$com.alert('扫码失败,请重试');
},
complete:function(end){
_this.$com.hideLoading();
}
});
},
//获取url中是否有某个参数的值
getParameterByName(url,name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(url);
if (results == null) return "";
else return decodeURIComponent(results[1].replace(/\+/g, " "));
},
openAd(index)
{
var _this =this;
var item = _this.banner[index];
console.log(item);
if(!_this.$com.isNull(item.jumpUrl))
{
console.log(item.jumpUrl);
var url = '';
switch(item.jumpType)
{
case 0:
url=item.jumpUrl;
break;
case 1:
url='/pages/web/index?title='+item.adName+'&url='+encodeURIComponent(item.jumpUrl);
break;
case 2:
url='/pages/web/video?title='+item.adName+'&url='+encodeURIComponent(item.jumpUrl);
break;
default:
url = '';
}
if(!_this.$com.isNull(url))
{
uni.navigateTo({
url:url,
})
}
}
},
}
}
</script>
<style lang="scss">
.container{width: 100%;}
.bannerBox{
width: 100%;
background: #082436;
height: auto;
position: relative;
}
::v-deep .u-swiper{background-color: inherit !important;}
.contentBox{
width:746rpx;
height: 500rpx;
background: linear-gradient( 180deg, #DBD9FF 0%, #F5F6FB 100%);
border-radius: 28rpx 28rpx 0rpx 0rpx;
border: 2rpx solid #FFFFFF;
margin-top: -80rpx;
position: relative;
z-index: 2;
}
.navBox{ width: 100%; height: auto; display: flex;}
.navBox .navItem{ width: 164rpx; height: 140rpx; margin: 40rpx 20rpx 20rpx 20rpx;}
.navBox .navItem image{ width: 100%; height: auto;}
.indexTitle {width: 730rpx; height: auto; margin: 20rpx auto; padding-left: 20rpx; }
.indexTitle image{ width: 226rpx; height: auto;}
.listBox{ width: 100%; height: auto;}
.photoBox{
padding:20rpx 10rpx 10rpx 10rpx;
height: auto;
border-radius: 24rpx 24rpx 24rpx 24rpx;
opacity: 1;
background: #FFFFFF;
width: 670rpx;
margin: 15rpx auto;
}
.photoTop{width: 100%; height: auto; display: flex;
}
.photoTop .topLeft{
width: 100rpx;
height: 88rpx;
}
.topLeft image{ width: 60rpx; height: auto; margin-left: 14rpx;}
.photoTop .topCenter{
width: 400rpx;
height: auto;
padding-left: 18rpx;
}
.topCenter .title{
font-size: 30rpx;
font-weight: 400;
color:#333333;
line-height: 50rpx;
width: 100%;
overflow: hidden; //超出文本隐藏
white-space: nowrap; //不换行,只显示一行
text-overflow: ellipsis; //超出部分省略号显示
}
.topCenter .desc{
font-size: 24rpx;
color:#999999;
line-height: 30rpx;
width: 100%;
overflow: hidden; //超出文本隐藏
white-space: nowrap; //不换行,只显示一行
text-overflow: ellipsis; //超
}
.photoTop .topRight{
width: 160rpx;
height: auto;
text-align: right;
}
.topRight .distance{ color: #90A1AA; font-size: 24rpx; font-family: PingFang SC-Regular; padding-top: 20rpx;}
.topRight .distance image{ width: 32rpx; height: 32rpx; margin-right: 24rpx;}
.picList{ width: 100%; height: 360rpx;}
.scrollBox {
margin-top: 20rpx;
width: 100%;
height: 360rpx;
white-space: nowrap;
}
.picBox {
display: inline-block;
width:260rpx;
height: 360rpx;
text-align: center;
position: relative;
margin-left: 20rpx;
}
.picBox .pic{
position: absolute;
width:100%;
height: 360rpx;
}
.picBox .pic image{
width:260rpx;
height: 360rpx;
border-radius:24rpx;
}
.picBox .pic_title{
position: absolute;
width:240rpx;
height: 72rpx;
bottom: 0;
z-index: 2;
font-size: 24rpx; line-height: 72rpx;
padding-left: 20rpx;
color: #FFFFFF;
text-align: left;
overflow: hidden; //超出文本隐藏
white-space: nowrap; //不换行,只显示一行
text-overflow: ellipsis; //超
}
</style>