Commit 3462a90b authored by 刘用法's avatar 刘用法
parents e26e8a21 05fe970c
<template> <template>
<view> <view>
<view class="topView" :style="{'height':navHeight/2 + 'px'}"></view>
<view class="contentView"> <view class="contentView">
<!-- <u-image class="pic" :src="files[0]" bg-color="transparent" @click="showPreviewFn"></u-image> --> <!-- <u-image class="pic" :src="files[0]" bg-color="transparent" @click="showPreviewFn"></u-image> -->
<image class="pic" :src="files[0]" v-lazy mode="aspectFit" @click="showPreviewFn"></image> <image class="pic" :src="files[0]" v-lazy mode="aspectFit" @click="showPreviewFn"></image>
...@@ -29,12 +30,13 @@ ...@@ -29,12 +30,13 @@
keys: [], keys: [],
token: '', token: '',
product: '', product: '',
allImages: [] allImages: [],
navHeight: 130
} }
}, },
created(e) { created(e) {
// 获取照片选项对象 // 获取照片选项对象
console.log(getApp().globalData.photo.currentItem) this.navHeight = getApp().globalData.navHeight
const product = app.globalData.photo.product const product = app.globalData.photo.product
this.product = `?brandId=${product.brandId}&brand=${product.brandName}&classifyId=${product.classifyId}&systemId=${product.systemId}` this.product = `?brandId=${product.brandId}&brand=${product.brandName}&classifyId=${product.classifyId}&systemId=${product.systemId}`
if(app.globalData.photo.currentItem) { if(app.globalData.photo.currentItem) {
...@@ -146,6 +148,12 @@ ...@@ -146,6 +148,12 @@
</script> </script>
<style lang="scss"> <style lang="scss">
.topView {
background: #000;
width: 100%;
position: fixed;
top: 0;
}
.contentView { .contentView {
background-color: #333333; background-color: #333333;
/* padding-top: 120rpx; */ /* padding-top: 120rpx; */
...@@ -155,7 +163,7 @@ ...@@ -155,7 +163,7 @@
flex-direction: column; flex-direction: column;
} }
/deep/ .u-image{ /deep/ .u-image{
height:100vh !important; height:100% !important;
} }
/deep/ .u-image__loading{ /deep/ .u-image__loading{
background-color: transparent!important; background-color: transparent!important;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<complete-check :show="completeCheckStatus" :list-data="completeCheckResult" :pass="pass" @close="closeCheckResult" @handle="handerProgrom" @change="confirm"></complete-check> <complete-check :show="completeCheckStatus" :list-data="completeCheckResult" :pass="pass" @close="closeCheckResult" @handle="handerProgrom" @change="confirm"></complete-check>
<view class="u-wrap"> <view class="u-wrap">
<u-navbar :background="{background: '#2272FF'}" back-icon-color="#fff" :title-size="32" title-color="#fff" :border-bottom="false" title="完工信息"></u-navbar> <u-navbar :background="{background: '#2272FF'}" back-icon-color="#fff" :title-size="32" title-color="#fff" :border-bottom="false" title="完工信息"></u-navbar>
<u-tabs-swiper class="order-tabs" ref="tabs" :current="tabIndex" name="panelName" :list="list" @change="tabsChange" :is-scroll="false" bg-color="#2272FF" inactive-color="#a6c6ff" active-color="#fff" height="80" font-size="32"></u-tabs-swiper> <u-tabs class="order-tabs" ref="tabs" :current="tabIndex" name="panelName" :list="list" @change="tabsChange" :is-scroll="false" bg-color="#2272FF" inactive-color="#a6c6ff" active-color="#fff" height="80" font-size="32"></u-tabs>
<view class="u-menu-wrap"> <view class="u-menu-wrap">
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="scrollTop" :scroll-into-view="itemId" v-if="list[tabIndex].items.length > 1"> <scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="scrollTop" :scroll-into-view="itemId" v-if="list[tabIndex].items.length > 1">
<view v-for="(item,index) in list[tabIndex].items" :key="index" class="u-tab-item" <view v-for="(item,index) in list[tabIndex].items" :key="index" class="u-tab-item"
......
<template> <template>
<view> <view>
<view class="contentView"> <view class="contentView">
<u-image class="pic" :src="files[0]" bg-color="transparent" @click="showPreviewFn"></u-image> <u-image class="pic" :src="files[0]" bg-color="transparent" @click="showPreviewFn"></u-image>
<!-- <image class="pic" :src="files[0]" v-lazy mode="aspectFit"></image> --> <!-- <image class="pic" :src="files[0]" v-lazy mode="aspectFit"></image> -->
</view> </view>
<view class="bottomView"> <view class="bottomView">
<image class="btn" :src="btn_remake" @click="$u.throttle(remakePhoto, 3000)"></image> <image class="btn" :src="btn_remake" @click="$u.throttle(remakePhoto, 3000)"></image>
<image class="btn" :src="btn_continue" @click="$u.throttle(continuePhoto, 3000)"></image> <image class="btn" :src="btn_continue" @click="$u.throttle(continuePhoto, 3000)"></image>
</view> </view>
<image class="btn finish" src="/static/photo/finish.png" @click="$u.throttle(finishPhoto, 3000)"></image> <image class="btn finish" src="/static/photo/finish.png" @click="$u.throttle(finishPhoto, 3000)"></image>
</view> </view>
</template> </template>
<script> <script>
import qiniup from '@/components/upload/qiniup'; import qiniup from '@/components/upload/qiniup';
const app = getApp() const app = getApp()
export default { export default {
mixins: [qiniup], mixins: [qiniup],
data() { data() {
return { return {
protocolContent: '', protocolContent: '',
btn_remake: 'https://qn-static.banshouhui.com/take_order/photo/remake.png', btn_remake: 'https://qn-static.banshouhui.com/take_order/photo/remake.png',
btn_continue: '/static/photo/continue.png', btn_continue: '/static/photo/continue.png',
standardId: '', standardId: '',
images: [], images: [],
files: [], files: [],
fileMaps: [], fileMaps: [],
keys: [], keys: [],
token: '', token: '',
product: '', product: '',
} }
}, },
onLoad(e) { onLoad(e) {
// 获取照片选项对象 // 获取照片选项对象
const product = app.globalData.photo.product const product = app.globalData.photo.product
this.product = `?brandId=${product.brandId}&brand=${product.brandName}&classifyId=${product.classifyId}&systemId=${product.systemId}` this.product = `?brandId=${product.brandId}&brand=${product.brandName}&classifyId=${product.classifyId}&systemId=${product.systemId}`
if(app.globalData.photo.currentItem) { if(app.globalData.photo.currentItem) {
// 获取规格Id // 获取规格Id
this.standardId = app.globalData.photo.currentItem._id this.standardId = app.globalData.photo.currentItem._id
} }
getApp().trackPage('照片预览页') getApp().trackPage('照片预览页')
const globalTempPath = getApp().globalData.photo.tempPath const globalTempPath = getApp().globalData.photo.tempPath
if(globalTempPath && globalTempPath.mixWater){ if(globalTempPath && globalTempPath.mixWater){
this.files = [globalTempPath.mixWater] this.files = [globalTempPath.mixWater]
} }
if(e.standardId) { if(e.standardId) {
this.standardId = e.standardId this.standardId = e.standardId
} }
this.token = this.vuex_token this.token = this.vuex_token
}, },
methods: { methods: {
// 保存照片到本地 // 保存照片到本地
async saveTempToLocal(tempImagePath) { async saveTempToLocal(tempImagePath) {
//has_origin //是否保存原图 //has_origin //是否保存原图
let that = this let that = this
const photo = getApp().globalData.photo const photo = getApp().globalData.photo
if(!photo.tempPath){ if(!photo.tempPath){
return return
} }
let path = '' let path = ''
if(photo.tempPath.origin && photo.waterSetting && photo.waterSetting.has_origin){ if(photo.tempPath.origin && photo.waterSetting && photo.waterSetting.has_origin){
// 保存原图到本地 // 保存原图到本地
path = photo.tempPath.origin path = photo.tempPath.origin
let result = await this.saveLocal(path) let result = await this.saveLocal(path)
if(result){ if(result){
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '已将照片原图保存到本地相册' title: '已将照片原图保存到本地相册'
}) })
} }
} }
if(photo.currentItem){ if(photo.currentItem){
photo.currentItem.imageList.unshift(photo.tempPath.mixWater) photo.currentItem.imageList.unshift(photo.tempPath.mixWater)
} }
// if(photo.productList && photo.productList[photo.topIndex]){ // if(photo.productList && photo.productList[photo.topIndex]){
// const topArr = photo.productList[photo.topIndex] // const topArr = photo.productList[photo.topIndex]
// if(topArr[photo.itemIndex]){ // if(topArr[photo.itemIndex]){
// topArr[photo.itemIndex].imageList.push(photo.tempPath.mixWater) // topArr[photo.itemIndex].imageList.push(photo.tempPath.mixWater)
// } // }
// } // }
// photo. // photo.
if(photo.tempPath.mixWater){ if(photo.tempPath.mixWater){
// 保存水印处理图片到本地 // 保存水印处理图片到本地
path = photo.tempPath.mixWater path = photo.tempPath.mixWater
let result1 = await this.saveLocal(path) let result1 = await this.saveLocal(path)
if(result1){ if(result1){
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '已将水印图片保存到本地相册' title: '已将水印图片保存到本地相册'
}) })
} }
} }
}, },
saveLocal(path){ saveLocal(path){
return new Promise((resolve,reject)=>{ return new Promise((resolve,reject)=>{
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath: path, filePath: path,
success() { success() {
resolve(true) resolve(true)
}, },
fail() { fail() {
reject('保存失败') reject('保存失败')
} }
}) })
}) })
}, },
showPreviewFn(img) { showPreviewFn(img) {
uni.previewImage({ uni.previewImage({
current: 0, current: 0,
urls: this.files urls: this.files
}); });
}, },
// 重拍图片 // 重拍图片
remakePhoto() { remakePhoto() {
uni.navigateBack({ uni.navigateBack({
delta:1 delta:1
}) })
}, },
finishPhoto(){ finishPhoto(){
const photo = getApp().globalData.photo const photo = getApp().globalData.photo
photo.currentItemLength = 10 photo.currentItemLength = 10
this.continuePhoto() this.continuePhoto()
// 完成本项 // 完成本项
// uni.navigateBack({ // uni.navigateBack({
// delta:2 // delta:2
// }) // })
}, },
// 确认图片 // 确认图片
continuePhoto() { continuePhoto() {
let self = this let self = this
uni.showLoading({ uni.showLoading({
title:'图片保存中…' title:'图片保存中…'
}) })
self.saveTempToLocal() self.saveTempToLocal()
self.confirmUpload(true) self.confirmUpload(true)
}, },
submitFile() { submitFile() {
let self = this let self = this
if(self.keys.length) { if(self.keys.length) {
for (let s of self.keys) { for (let s of self.keys) {
self.$u.cloudApi.saveImage({ self.$u.cloudApi.saveImage({
"token": self.token, "token": self.token,
"standardId": self.standardId, "standardId": self.standardId,
"url": s, "url": s,
}).then(async res =>{ }).then(async res =>{
console.log(res, "云服务保存图片"); console.log(res, "云服务保存图片");
if(res.result.code) { if(res.result.code) {
// TODO 参数是否要来回传递 // TODO 参数是否要来回传递
const photo = getApp().globalData.photo const photo = getApp().globalData.photo
photo.currentItemLength = photo.currentItemLength + 1 photo.currentItemLength = photo.currentItemLength + 1
uni.hideLoading() uni.hideLoading()
// 当前项的图片显示 // 当前项的图片显示
// 拍照项张数目增加 等于10张 // 拍照项张数目增加 等于10张
if(photo.currentItemLength<10){ if(photo.currentItemLength<10){
uni.navigateBack({ uni.navigateBack({
delta:1 delta:1
}) })
}else{ }else{
uni.navigateBack({ uni.navigateBack({
delta:2 delta:2
}) })
} }
// let timer = setTimeout(()=>{ // let timer = setTimeout(()=>{
// if(photo.currentItemLength<10){ // if(photo.currentItemLength<10){
// uni.navigateBack({ // uni.navigateBack({
// delta:1 // delta:1
// }) // })
// }else{ // }else{
// uni.navigateBack({ // uni.navigateBack({
// delta:2 // delta:2
// }) // })
// } // }
// },2000) // },2000)
} else { } else {
uni.showToast({ uni.showToast({
title:'图片上传失败 '+ res.result.msg title:'图片上传失败 '+ res.result.msg
}) })
} }
}) })
} }
} }
}, },
downloadImages() { downloadImages() {
let self = this; let self = this;
for (let url of this.images) { for (let url of this.images) {
uni.downloadFile({ uni.downloadFile({
url: url, //仅为示例,并非真实的资源 url: url, //仅为示例,并非真实的资源
success(res) { success(res) {
// 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容 // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
if (res.statusCode === 200) { if (res.statusCode === 200) {
self.files.push(res.tempFilePath) self.files.push(res.tempFilePath)
} }
}, },
fail(e) { fail(e) {
} }
}) })
} }
}, },
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.contentView { .contentView {
background-color: #333333; background-color: #333333;
/* padding-top: 120rpx; */ /* padding-top: 120rpx; */
padding-bottom:228rpx; padding-bottom:228rpx;
height: 100vh; height: 100vh;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
/deep/ .u-image{ /deep/ .u-image{
height:100vh !important; height:100vh !important;
} }
/deep/ .u-image__loading{ /deep/ .u-image__loading{
background-color: transparent!important; background-color: transparent!important;
} }
/deep/ .u-image__error{ /deep/ .u-image__error{
background-color: transparent!important; background-color: transparent!important;
} }
.pic { .pic {
flex:1; flex:1;
width: 100%; width: 100%;
/* height:auto */ /* height:auto */
/* height: 760rpx; */ /* height: 760rpx; */
} }
.bottomView { .bottomView {
box-shadow: 0 0 1rpx 6rpx rgba(255,255,255,0.05); box-shadow: 0 0 1rpx 6rpx rgba(255,255,255,0.05);
background-color: #333333; background-color: #333333;
width: 100%; width: 100%;
padding:70rpx 0; padding:70rpx 0;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
align-items: center; align-items: center;
.btn{ .btn{
display: block; display: block;
width: 200rpx; width: 200rpx;
height: 88rpx; height: 88rpx;
} }
} }
.btn{ .btn{
display: block; display: block;
width: 232rpx; width: 232rpx;
height: 80rpx; height: 80rpx;
&.finish{ &.finish{
position: fixed; position: fixed;
top:30rpx; top:30rpx;
right:30rpx; right:30rpx;
} }
} }
</style> </style>
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