Commit 19990dc6 authored by Facius's avatar Facius

大图预览

parent 41b4fb7c
...@@ -153,9 +153,9 @@ ...@@ -153,9 +153,9 @@
{ {
"path": "pages/photo/detail", "path": "pages/photo/detail",
"style": { "style": {
"navigationBarTitleText": "图片展示", "navigationBarTitleText": "图片展示",
"navigationBarBackgroundColor": "#333333", "navigationBarBackgroundColor":"#FFFFFF",
"navigationBarTextStyle": "#FFFFFF", "backgroundColor":"#F4F5F7",
"disableScroll": true "disableScroll": true
} }
}, },
......
<template> <template>
<view class="backView"> <view class="backView">
<view class="topView"> <!-- <view class="topView">
<!--text class="topTitle">示范照片 ({{currentNumber}}/{{totalNumber}})</text--> text class="topTitle">示范照片 ({{currentNumber}}/{{totalNumber}})</text
</view> </view> -->
<view class="wrap"> <view class="wrap">
<u-swiper <u-swiper
@click="imageClick" @click="imageClick"
@change="changeSwipter" @change="changeSwipter"
img-mode="aspectFit" img-mode="aspectFit"
bg-color="#333333" bg-color="#000000"
:height="600" :list="swiperList" height="100%"
:list="swiperList"
:autoplay="false" :autoplay="false"
:circular='false' :circular='false'
mode="dot" mode="dot"
:current="done_count" :current="done_count"
></u-swiper> ></u-swiper>
</view> </view>
<view class="bottomView"> <!-- <view class="bottomView">
<image class="takeView" :src="icon_gotake" mode="" @click="takeClick"></image> <image class="takeView" :src="icon_gotake" mode="" @click="takeClick"></image>
<image class="backIcon" :src="icon_arrow_down" mode="" @click="backClick"></image> <image class="backIcon" :src="icon_arrow_down" mode="" @click="backClick"></image>
</view> </view> -->
</view> </view>
</template> </template>
...@@ -43,12 +44,12 @@ ...@@ -43,12 +44,12 @@
current_image:'', current_image:'',
done_count:0, done_count:0,
images:[], images:[],
icon_gotake:'https://qn-static.banshouhui.com/gotake.png', // icon_gotake:'https://qn-static.banshouhui.com/gotake.png',
icon_arrow_down:'https://qn-static.banshouhui.com/arrow_down.png', // icon_arrow_down:'https://qn-static.banshouhui.com/arrow_down.png',
ifFirst:true, // ifFirst:true,
last_done_count:0, // last_done_count:0,
swiperList:[], swiperList:[],
windowHeight:0, // windowHeight:0,
title:'' title:''
} }
}, },
...@@ -79,14 +80,14 @@ ...@@ -79,14 +80,14 @@
this.initData(e) this.initData(e)
}, },
onShow(){ // onShow(){
if(this.isFirst == false){ // if(this.isFirst == false){
this.checkDoneCount() // this.checkDoneCount()
} // }
}, // },
methods: { methods: {
initData: function (e) { initData: function (e) {
...@@ -114,16 +115,14 @@ ...@@ -114,16 +115,14 @@
if(e && e.title){ if(e && e.title){
this.title = e.title this.title = e.title
if(this.title.length>6){ if(this.title.length>5){
this.title = this.title.substr(0,6) + '...' this.title = this.title.substr(0,5) + '...'
} }
} }
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: this.title + ' (' + this.current_count + '/'+ this.image_count + ')' title: this.title + '(' + this.current_count + '/'+ this.image_count + ')'
}) })
uni.setNavigationBarColor({ uni.setNavigationBarColor({
...@@ -132,75 +131,75 @@ ...@@ -132,75 +131,75 @@
}) })
}, },
//检查已拍照数量 // //检查已拍照数量
checkDoneCount: function (){ // checkDoneCount: function (){
let pages = getCurrentPages(); // let pages = getCurrentPages();
let currPage = pages[pages.length-1]; // let currPage = pages[pages.length-1];
this.done_count = currPage.data.done_count // this.done_count = currPage.data.done_count
console.log('是否清除:') // console.log('是否清除:')
//console.log(currPage.data.isClean) // //console.log(currPage.data.isClean)
if (currPage.data.done_count == this.image_count){ // if (currPage.data.done_count == this.image_count){
console.log('已拍完 所有数量照片') // console.log('已拍完 所有数量照片')
uni.showToast({ // uni.showToast({
icon:'none', // icon:'none',
title:'已拍完此项照片' // title:'已拍完此项照片'
}) // })
setTimeout(function() { // setTimeout(function() {
uni.navigateBack({ // uni.navigateBack({
}) // })
}, 2000); // }, 2000);
}else{ // }else{
if(this.done_count != this.last_done_count ){ // if(this.done_count != this.last_done_count ){
console.log('没有拍完 所有数量照片') // console.log('没有拍完 所有数量照片')
this.last_done_count = this.done_count // this.last_done_count = this.done_count
this.current_count = currPage.data.done_count + 1 // this.current_count = currPage.data.done_count + 1
this.current_image = this.images[currPage.data.done_count] // this.current_image = this.images[currPage.data.done_count]
console.log('没有拍完 所有数量照片 current_count:'+this.current_count) // console.log('没有拍完 所有数量照片 current_count:'+this.current_count)
console.log('没有拍完 所有数量照片 current_image:'+this.current_image) // console.log('没有拍完 所有数量照片 current_image:'+this.current_image)
uni.setNavigationBarTitle({ // uni.setNavigationBarTitle({
title: this.title + ' (' + this.current_count + '/'+ this.image_count + ')' // title: this.title + '(' + this.current_count + '/'+ this.image_count + ')'
}) // })
} // }
} // }
}, // },
//照片预览 //照片预览
imageClick: function (index) { imageClick: function (index) {
let currentImg = this.images[index] let currentImg = this.images[index]
uni.previewImage({ uni.previewImage({
urls: [currentImg], urls: this.images,
current:index current:index
}) })
}, },
changeSwipter(index){ changeSwipter(index){
let txt = '走线照片 (' + (index + 1) + '/'+ this.image_count + ')' let txt = this.title + '(' + (index + 1) + '/'+ this.image_count + ')'
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: txt title: txt
}) })
}, },
//拍照 点击 // //拍照 点击
takeClick: function () { // takeClick: function () {
this.isFirst = false // this.isFirst = false
uni.navigateTo({ // uni.navigateTo({
url:'/pages/photo/try' // url:'/pages/photo/try'
}) // })
}, // },
//返回 点击 // //返回 点击
backClick: function () { // backClick: function () {
uni.navigateBack({ // uni.navigateBack({
}) // })
}, // },
} }
...@@ -210,12 +209,13 @@ ...@@ -210,12 +209,13 @@
<style> <style>
.wrap { .wrap {
width:100%; width:100%;
height:calc(100vh - 600rpx); /* height:calc(100vh - 600rpx); */
background-color:#333; height: 100%;
background-color:#000000;
/* padding:0 40rpx; */ /* padding:0 40rpx; */
} }
.backView{ .backView{
background-color: #FAFAFA; background-color: #F4F5F7;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
...@@ -226,7 +226,11 @@ ...@@ -226,7 +226,11 @@
align-items: center; align-items: center;
} }
.topView{ .u-swiper-wrap {
height: 100%;
}
/*.topView{
background-color: #333333; background-color: #333333;
width: 100%; width: 100%;
height: 12%; height: 12%;
...@@ -291,5 +295,5 @@ ...@@ -291,5 +295,5 @@
left: 60rpx; left: 60rpx;
bottom: 50rpx; bottom: 50rpx;
} }
*/
</style> </style>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<view class="right-view-title">拍照项有:</view> <view class="right-view-title">拍照项有:</view>
<template v-for="(item,ikey) in rightList"> <template v-for="(item,ikey) in rightList">
<view class="rightItemView" @click="rightItemClick(item,ikey)" :key="ikey"> <view class="rightItemView" @click="rightItemClick(item,ikey)" :key="ikey">
<view class="['rightContentView', item.images.length > 0 ? 'gray666Color' : 'rightTitle']"> <view :class="['rightContentView', item.images.length > 0 ? 'gray666Color' : 'rightTitle']">
<text class="ph-lst-item-index">{{ ikey + 1 }}</text> <text class="ph-lst-item-index">{{ ikey + 1 }}</text>
<text class="">{{item.name}} ({{item.image_count}}张)</text> <text class="">{{item.name}} ({{item.image_count}}张)</text>
<image class="ph-list-item-arrow" src="/static/photo/arrow.png"></image> <image class="ph-list-item-arrow" src="/static/photo/arrow.png"></image>
...@@ -100,19 +100,19 @@ ...@@ -100,19 +100,19 @@
this.dataList = res.result this.dataList = res.result
this.dataList.forEach(item => { // this.dataList.forEach(item => {
item.list.forEach(subItem => { // item.list.forEach(subItem => {
subItem.isClicked = false // subItem.isClicked = false
}) // })
}) // })
console.log('添加 新字段 后的数组:') console.log('添加 新字段 后的数组:')
console.log(this.dataList) console.log(this.dataList)
var item = res.result[0] var item = res.result[0]
this.rightList = item.list this.rightList = item.list
}, },
//顶部点击 //顶部点击
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
uni.navigateTo({ uni.navigateTo({
url: '/pages/photo/detail' + url: '/pages/photo/detail' +
'?current_image=' + image + '?current_image=' + image +
'&image_count=' + item.image_count + '&image_count=' + item.images.length +
'&current_count=' + (index + 1) + '&current_count=' + (index + 1) +
'&images=' + JSON.stringify(item.images) + '&images=' + JSON.stringify(item.images) +
'&title=' + item.name, '&title=' + item.name,
...@@ -139,25 +139,24 @@ ...@@ -139,25 +139,24 @@
//右侧点击 //右侧点击
rightItemClick: function(item, ikey) { rightItemClick: function(item, ikey) {
// for (let i = 0; i < this.rightList.length; i++) {
// // for (let i = 0; i < this.rightList.length; i++) { // var subItem = this.rightList[i]
// // var subItem = this.rightList[i] // if(i == ikey){
// // if(i == ikey){ // subItem.isClicked = true
// // subItem.isClicked = true // }
// // } // }
// // } // item.clickable = true
// // item.clickable = true
// this.$set(this.rightList[ikey],'clickable',true) // this.$set(this.rightList[ikey],'clickable',true)
// var current_image = item.images[0] // var current_image = item.images[0]
// var current_count = 1 // var current_count = 1
// uni.navigateTo({ uni.navigateTo({
// url:'/pages/photo/detail' url:'/pages/photo/standard'
// +'?current_image=' + current_image // +'?current_image=' + current_image
// +'&image_count=' + item.image_count // +'&image_count=' + item.image_count
// +'&current_count=' + current_count // +'&current_count=' + current_count
// +'&images=' + JSON.stringify(item.images) // +'&images=' + JSON.stringify(item.images)
// +'&title=' + item.name, // +'&title=' + item.name,
// }) })
}, },
...@@ -174,7 +173,8 @@ ...@@ -174,7 +173,8 @@
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
height: 100%;
} }
.centerBackView { .centerBackView {
...@@ -209,8 +209,8 @@ ...@@ -209,8 +209,8 @@
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-top: 100rpx; padding-top: 100rpx;
margin-bottom: 50rpx; padding-bottom: 50rpx;
} }
.right-view-title { .right-view-title {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<swiper :current="elCurrent" @change="change" @animationfinish="animationfinish" :interval="interval" :circular="circular" :duration="duration" :autoplay="autoplay" <swiper :current="elCurrent" @change="change" @animationfinish="animationfinish" :interval="interval" :circular="circular" :duration="duration" :autoplay="autoplay"
:previous-margin="effect3d ? effect3dPreviousMargin + 'rpx' : '0'" :next-margin="effect3d ? effect3dPreviousMargin + 'rpx' : '0'" :previous-margin="effect3d ? effect3dPreviousMargin + 'rpx' : '0'" :next-margin="effect3d ? effect3dPreviousMargin + 'rpx' : '0'"
:style="{ :style="{
height: height + 'rpx' height: heightString
}"> }">
<swiper-item class="u-swiper-item" v-for="(item, index) in list" :key="index"> <swiper-item class="u-swiper-item" v-for="(item, index) in list" :key="index">
<view class="u-list-image-wrap" @tap.stop.prevent="listClick(index)" :class="[uCurrent != index ? 'u-list-scale' : '']" :style="{ <view class="u-list-image-wrap" @tap.stop.prevent="listClick(index)" :class="[uCurrent != index ? 'u-list-scale' : '']" :style="{
...@@ -207,6 +207,9 @@ ...@@ -207,6 +207,9 @@
// 因为uni的swiper组件的current参数只接受Number类型,这里做一个转换 // 因为uni的swiper组件的current参数只接受Number类型,这里做一个转换
elCurrent() { elCurrent() {
return Number(this.current); return Number(this.current);
},
heightString() {
return typeof this.height === 'number' && this.height !== 0 ? (this.height + 'rpx') : this.height
} }
}, },
methods: { methods: {
......
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