Commit 251c3de0 authored by Morson's avatar Morson

Merge branch 'dev-photo-v2' of https://git.banshouhui.com/heyinchen/take_order into dev-photo-v2

# Conflicts:
#	take-order/pages.json
parents ba0a4552 d15d7909
<template> <template>
<view class="standard-box" v-if="currentItem"> <view class="standard-box">
简单了解的了解到了家里的经历的阶段了
<swiper class="swiper-box" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish"> <swiper class="swiper-box" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
<swiper-item class="swiper-item" key="swiper1"> <swiper-item class="swiper-item" key="swiper1">
<view class="title"> <view class="title">
...@@ -151,6 +152,7 @@ ...@@ -151,6 +152,7 @@
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
color:#fff;
} }
.swiper-box{ .swiper-box{
width: 690rpx; width: 690rpx;
......
...@@ -6,19 +6,13 @@ ...@@ -6,19 +6,13 @@
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{ {
"path": "pages/photo/product", "path": "pages/photo/index",
"style": { "style": {
"navigationBarTitleText": "拍照小工具", "navigationBarTitleText": "拍照小工具",
"navigationBarBackgroundColor":"#FFFFFF", "navigationBarBackgroundColor":"#FFFFFF",
"backgroundColor":"#F4F5F7" "backgroundColor":"#F4F5F7"
} }
}, },
{
"path": "pages/photo/index",
"style": {
"navigationBarTitleText": "拍照小工具首页"
}
},
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
...@@ -141,16 +135,6 @@ ...@@ -141,16 +135,6 @@
"disableScroll": true "disableScroll": true
} }
}, },
{
"path": "pages/photo/detail",
"style": {
"navigationBarTitleText": "图片展示",
"navigationBarBackgroundColor": "#333333",
"navigationBarTextStyle": "#FFFFFF",
"disableScroll": true
}
},
{ {
"path": "pages/photo/preview", "path": "pages/photo/preview",
"style": { "style": {
...@@ -169,17 +153,6 @@ ...@@ -169,17 +153,6 @@
} }
}, },
{
"path": "pages/photo/brand",
"style": {
"navigationBarTitleText": "扳手会工单规范"
}
},
{ {
"path": "pages/index/success", "path": "pages/index/success",
"style": { "style": {
...@@ -280,8 +253,8 @@ ...@@ -280,8 +253,8 @@
"path": "pages/settle/index", //启动页面,必选 "path": "pages/settle/index", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到 "query": "" //启动参数,在页面的onLoad函数里面得到
},{ },{
"name": "拍照-规范", //模式名称 "name": "拍照-首页", //模式名称
"path": "pages/photo/product", //启动页面,必选 "path": "pages/photo/index", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到 "query": "" //启动参数,在页面的onLoad函数里面得到
},{ },{
"name": "基本信息", //模式名称 "name": "基本信息", //模式名称
......
<template>
<view class="backView">
<text class="topTitle"> {{product}} > 选择品牌</text>
<view class="u-p-b-48">
<view class="itemView u-m-t-48" @click="itemClick(item)" v-for="(item,ikey) in brandList":key="ikey">
<text class="itemTitle">{{item.name}}</text>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
product_code:'',
brandList:[],
brand_code:'',
product:'',
brand:'',
}
},
onLoad(e) {
getApp().trackPage('选择品牌页')
if(e && e.product_code){
this.product_code = e.product_code
}
if(e && e.product){
this.product = e.product
}
this.getBrandList()
},
methods: {
getBrandList: function () {
let that = this
this.$u.cloudApi.getBrand({product_code:this.product_code}).then(res =>{
console.log('获取品牌数据:')
console.log(res)
if(res.result.data){
that.brandList = res.result.data
}
}
)
},
//选择 点击
itemClick: function (item) {
if(item.product_code){
this.brand_code = item.code
}
if(item.name){
this.brand = item.name
}
uni.navigateTo({
url:'/pages/photo/list'
+ '?brand_code=' + this.brand_code
+ '&brand=' + this.brand
+ '&product_code=' + this.product_code
+ '&product=' + this.product,
})
},
}
}
</script>
<style>
.backView{
background-color: #FAFAFA;
position: absolute;
top: 0;
left: 0;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.topTitle{
margin-top: 192rpx;
font-size: 32rpx;
}
.itemView{
background-color: #FFFFFF;
width: 548rpx;
height: 96rpx;
display: flex;
align-items: center;
justify-content: center;
border-style: solid;
box-shadow:0px 2px 7px 0px rgba(0, 0, 0, 0.05);
border-width: 0rpx;
}
.itemTitle{
font-size: 32rpx;
font-weight:bold;
}
</style>
<template>
<view class="backView">
<view class="topView">
<!--text class="topTitle">示范照片 ({{currentNumber}}/{{totalNumber}})</text-->
</view>
<view class="wrap">
<u-swiper
@click="imageClick"
@change="changeSwipter"
img-mode="aspectFit"
bg-color="#333333"
:height="600" :list="swiperList"
:autoplay="false"
:circular='false'
mode="dot"
:current="done_count"
></u-swiper>
</view>
<view class="bottomView">
<image class="takeView" :src="icon_gotake" mode="" @click="takeClick"></image>
<image class="backIcon" :src="icon_arrow_down" mode="" @click="backClick"></image>
</view>
</view>
</template>
<script>
import uSwiper from '@/uview-ui/components/u-swiper/u-swiper'
export default {
components:{
uSwiper
},
data() {
return {
// background: ['color1', 'color2', 'color3'],
// indicatorDots: true,
// autoplay: true,
// interval: 2000,
// duration: 500,
image_count:1,
current_count:1,
current_image:'',
done_count:0,
images:[],
icon_gotake:'https://qn-static.banshouhui.com/gotake.png',
icon_arrow_down:'https://qn-static.banshouhui.com/arrow_down.png',
ifFirst:true,
last_done_count:0,
swiperList:[],
windowHeight:0,
title:''
}
},
watch:{
images(val){
let list = val.map(img=>{
return {
image:img
}
})
this.swiperList = list
// console.log(this.swiperList,'this.swiperList')
}
},
computed:{
// swiperList(){
// console.log(this.images,'this.images')
// let list = this.images.map(img=>{
// return {
// image:img
// }
// })
// return list
// }
},
onLoad(e) {
getApp().trackPage('照片规范详情页')
this.initData(e)
},
onShow(){
if(this.isFirst == false){
this.checkDoneCount()
}
},
methods: {
initData: function (e) {
if(e && e.current_image){
this.current_image = e.current_image
}
if(e && e.image_count){
this.image_count = e.image_count
}
if(e && e.current_count){
this.done_count = e.current_count
}
if(e && e.current_count){
this.current_count = Math.max(e.current_count - 1, 0)
}
if(e && e.images){
this.images = [].concat(JSON.parse(e.images))
}
if(e && e.title){
this.title = e.title
if(this.title.length>6){
this.title = this.title.substr(0,6) + '...'
}
}
uni.setNavigationBarTitle({
title: this.title + ' (' + this.current_count + '/'+ this.image_count + ')'
})
uni.setNavigationBarColor({
frontColor:'#FFFFFF',
backgroundColor:'#333333',
})
},
//检查已拍照数量
checkDoneCount: function (){
let pages = getCurrentPages();
let currPage = pages[pages.length-1];
this.done_count = currPage.data.done_count
console.log('是否清除:')
//console.log(currPage.data.isClean)
if (currPage.data.done_count == this.image_count){
console.log('已拍完 所有数量照片')
uni.showToast({
icon:'none',
title:'已拍完此项照片'
})
setTimeout(function() {
uni.navigateBack({
})
}, 2000);
}else{
if(this.done_count != this.last_done_count ){
console.log('没有拍完 所有数量照片')
this.last_done_count = this.done_count
this.current_count = currPage.data.done_count + 1
this.current_image = this.images[currPage.data.done_count]
console.log('没有拍完 所有数量照片 current_count:'+this.current_count)
console.log('没有拍完 所有数量照片 current_image:'+this.current_image)
uni.setNavigationBarTitle({
title: this.title + ' (' + this.current_count + '/'+ this.image_count + ')'
})
}
}
},
//照片预览
imageClick: function (index) {
let currentImg = this.images[index]
uni.previewImage({
urls: [currentImg],
current:index
})
},
changeSwipter(index){
let txt = '走线照片 (' + (index + 1) + '/'+ this.image_count + ')'
uni.setNavigationBarTitle({
title: txt
})
},
//拍照 点击
takeClick: function () {
this.isFirst = false
uni.navigateTo({
url:'/pages/photo/try'
})
},
//返回 点击
backClick: function () {
uni.navigateBack({
})
},
}
}
</script>
<style>
.wrap {
width:100%;
height:calc(100vh - 600rpx);
background-color:#333;
/* padding:0 40rpx; */
}
.backView{
background-color: #FAFAFA;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.topView{
background-color: #333333;
width: 100%;
height: 12%;
display: flex;
align-items: center;
justify-content: center;
}
.topTitle{
font-size: 28rpx;
color: #FFFFFF;
}
.centerBackView{
background-color: #333333;
height: 47.3%;
display: flex;
flex-direction: row;
}
.photoImage{
background-color: #333333;
width: 750rpx;
height: 568rpx;
}
.bottomView{
background-color: #333333;
width: 100%;
height: 40.7%;
position: fixed;
bottom: 0;
display: flex;
flex-direction: column-reverse;
align-items: center;
}
.takeView{
background-color: #FFFFFF;
width: 146rpx;
height: 102rpx;
border-radius: 16rpx;
margin-bottom: 50rpx;
display: flex;
align-items: center;
justify-content: center;
}
.takeText{
font-size: 28rpx;
text-align: center;
}
.backIcon{
background-color: #FFFFFF;
width: 54rpx;
height: 54rpx;
border-radius: 27rpx;
position: fixed;
left: 60rpx;
bottom: 50rpx;
}
</style>
This diff is collapsed.
<template>
<view class="backView">
<view class="ph-pr-arr" v-for="(dataItem, index) in list" :key="index">
<template v-if="dataItem.data.length > 0">
<view class="topTitle"><text>{{ dataItem.title }}</text></view>
<view class="ph-pr-content">
<view v-for="(item,ikey) in dataItem.data"
:class="param[dataItem.type] === item._id ? 'select-item-view' : 'item-view'"
@click="itemClick(dataItem.type, item)" :key="item._id">
<text class="itemTitle">{{item.name}}</text>
</view>
</view>
</template>
</view>
<button class="ph-pr-button" type="primary" @click="handleClick" :disabled="!selectedAll"
:style="buttonStyle">下一步</button>
</view>
</template>
<script>
export default {
data() {
return {
classifyList: [],
systemList: [],
brandList: [],
param: {
classifyId: '',
systemId: '',
brandId: '',
},
brandName: '',
selectedAll: false,
}
},
computed: {
list() {
return [{
title: '请选择类别',
type: 'classifyId',
data: this.classifyList
},
{
title: '请选择系统',
type: 'systemId',
data: this.systemList
},
{
title: '请选择品牌',
type: 'brandId',
data: this.brandList
}
]
},
buttonStyle() {
return this.selectedAll ? 'color: #FFFFFF;background-color: #2272FF;' :
'color: #FFFFFF;background-color: #D1D4D4;'
}
},
onLoad(e) {
getApp().trackPage('选择产品页')
this.getclassifyList()
},
onShareAppMessage(res) {
let shareObj = {
title: '',
path: '/pages/photo/product',
imageUrl: '',
success() {},
fail() {}
}
return shareObj
},
methods: {
getclassifyList: function() {
let that = this
this.$u.cloudApi.getClassifyDictionary().then(res => {
console.log('获取产品数据:')
console.log(res)
if (res.result && res.result.data) {
that.classifyList = res.result.data
that.param.classifyId = that.classifyList[0]._id
that.$u.cloudApi.getRelationDictionary({
"classify_id": that.param.classifyId,
"field": "system_id"
}).then(res1 => {
that.systemList = res1.result
})
}
})
},
//选择 点击
itemClick: function(type, item) {
switch (type) {
case 'classifyId':
this.param = {
classifyId: item._id,
systemId: '',
brandId: ''
}
this.selectedAll = false
this.systemList = []
this.brandList = []
this.$u.cloudApi.getRelationDictionary({
"classify_id": this.param.classifyId,
"field": "system_id"
}).then(res => {
this.systemList = res.result
})
break
case 'systemId':
this.param = {
classifyId: this.param.classifyId,
systemId: item._id,
brandId: ''
}
this.selectedAll = false
this.brandList = []
this.$u.cloudApi.getRelationDictionary({
"classify_id": this.param.classifyId,
"system_id": this.param.systemId,
"field": "brand_id"
}).then(res => {
console.log('获取品牌数据:', res)
this.brandList = res.result
})
break
case 'brandId':
this.param.brandId = item._id
this.selectedAll = true
this.brandName = item.name
break
default:
break
}
},
// 点击下一步
handleClick() {
// 点击下一步设置全局拍照品牌品类
const globalData = getApp().globalData
let keys = ['brandId', 'brandName', 'classifyId', 'systemId']
keys.map(key => {
globalData.photo.product[key] = this[key] || this.param[key]
})
uni.navigateTo({
url: '/pages/photo/list' +
'?brandId=' + this.param.brandId +
'&brand=' + this.brandName +
'&classifyId=' + this.param.systemId +
'&systemId=' + this.param.systemId,
})
}
}
}
</script>
<style>
.backView {
background-color: #FAFAFA;
position: absolute;
top: 0;
left: 0;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
height: 100%;
}
.topTitle {
margin-top: 50rpx;
padding-left: 30rpx;
font-size: 36rpx;
font-weight: bold;
color: #333333;
}
.ph-pr-content {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
width: 100%;
padding: 22rpx 22rpx;
}
.ph-pr-arr {
width: 100%;
}
.item-view {
background-color: #FFFFFF;
/* width: 548rpx; */
margin: 0rpx 8rpx 24rpx 8rpx;
/* flex: 1 1 0%;
max-width: 33%; */
width: 222rpx;
height: 76rpx;
display: flex;
align-items: center;
justify-content: center;
border-style: solid;
box-shadow: 0px 2px 7px 0px rgba(0, 0, 0, 0.05);
border-width: 0rpx;
border-radius: 12rpx;
font-size: 26rpx;
color: #666666;
}
.select-item-view {
background-color: #2272FF;
margin: 0rpx 8rpx 24rpx 8rpx;
/* flex: 1 1 0%;
max-width: 33%; */
width: 222rpx;
height: 76rpx;
display: flex;
align-items: center;
justify-content: center;
border-style: solid;
box-shadow: 0px 2px 7px 0px rgba(0, 0, 0, 0.05);
border-width: 0rpx;
border-radius: 12rpx;
font-size: 26rpx;
color: #FFFFFF;
}
.ph-pr-button {
position: absolute;
bottom: 76rpx;
border-radius: 52rpx;
height: 104rpx;
font-size: 32rpx;
width: 600rpx;
line-height: 104rpx;
}
</style>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<cover-image @click="goPage('/pages/photo/markSetting')" class="icon" mode="aspectFit" src="/static/photo/icon-setting.png"></cover-image> <cover-image @click="goPage('/pages/photo/markSetting')" class="icon" mode="aspectFit" src="/static/photo/icon-setting.png"></cover-image>
</cover-view> </cover-view>
</cover-view> </cover-view>
<camera class="camera-box" v-if="cameraChange" :device-position="cameraInfo.devicePosition" :flash="cameraInfo.flash" :style="{'height':cameraHeight + 'rpx'}" <camera class="camera-box" v-if="cameraChange&&!standardShow" :device-position="cameraInfo.devicePosition" :flash="cameraInfo.flash" :style="{'height':cameraHeight + 'rpx'}"
@error="cameraError"> @error="cameraError">
<cover-view class="mark-box"> <cover-view class="mark-box">
<cover-view class="txt u-m-l-20 u-m-t-30">经度:{{waterInfo.longitude || '正在获取中...'}}</cover-view> <cover-view class="txt u-m-l-20 u-m-t-30">经度:{{waterInfo.longitude || '正在获取中...'}}</cover-view>
...@@ -18,18 +18,18 @@ ...@@ -18,18 +18,18 @@
</cover-view> </cover-view>
<cover-image class="mark-water" mode="aspectFit" :src="waterInfo.markImage"></cover-image> <cover-image class="mark-water" mode="aspectFit" :src="waterInfo.markImage"></cover-image>
</camera> </camera>
<cover-view class="bottom-box" v-show="!standardShow"> <cover-view class="bottom-box" v-if="!standardShow">
<cover-image class="icon" src='/static/photo/icon-back.png' mode="" @click="goBack"></cover-image> <cover-image class="icon" src='/static/photo/icon-back.png' mode="" @click="goBack"></cover-image>
<cover-image class='icon-take icon' src='/static/photo/icon-take.png' @click="takePhoto"> </cover-image> <cover-image class='icon-take icon' src='/static/photo/icon-take.png' @click="takePhoto"> </cover-image>
<cover-image class='icon' src='/static/photo/icon-standard.png' @click="standardShow = true"> </cover-image> <cover-image class='icon' src='/static/photo/icon-standard.png' @click="standardShow = true"> </cover-image>
</cover-view> </cover-view>
<canvas canvas-id="canvas" id="photoCanvas" class="canvas" :style="{'width':750 + 'rpx','height': cameraHeight + 'rpx'}"></canvas> <canvas canvas-id="canvas" id="photoCanvas" class="canvas" :style="{'width':750 + 'rpx','height': cameraHeight + 'rpx'}"></canvas>
<cover-view class="page-mask" v-if="standardShow"> <view v-show="standardShow" class="page-mask" :z-index="10000">
<photo-standard :currentItem="currentItem" /> <photo-standard :currentItem="currentItem" />
<cover-view class="btn-close" @click="standardShow = false"> <view class="btn-close" @click="standardShow = false">
<cover-image class="icon icon-close" mode="aspectFit" src="/static/photo/icon-close.png"></cover-image> <image class="icon icon-close" mode="aspectFit" src="/static/photo/icon-close.png"></cover-image>
</cover-view> </view>
</cover-view> </view>
</view> </view>
</template> </template>
...@@ -50,10 +50,10 @@ ...@@ -50,10 +50,10 @@
name:'111', name:'111',
images:['https://qn-static.banshouhui.com/live_mark.png','https://qn-static.banshouhui.com/live_mark.png','https://qn-static.banshouhui.com/live_mark.png'], images:['https://qn-static.banshouhui.com/live_mark.png','https://qn-static.banshouhui.com/live_mark.png','https://qn-static.banshouhui.com/live_mark.png'],
}, },
standardShow:false, standardShow:true,
cameraInfo:{ cameraInfo:{
devicePosition:'front', devicePosition:'front',
flash:'off' flash:'auto'
}, },
waterInfo: { waterInfo: {
longitude: '', // 经度 longitude: '', // 经度
...@@ -494,7 +494,7 @@ ...@@ -494,7 +494,7 @@
.page-mask{ .page-mask{
position: fixed; position: fixed;
bottom:0; bottom:0;
z-index: 100; z-index: 1000;
width:750rpx; width:750rpx;
height:100vh; height:100vh;
padding:0 30rpx; padding:0 30rpx;
......
This diff is collapsed.
...@@ -26,6 +26,15 @@ exports.main = async (event, context) => { ...@@ -26,6 +26,15 @@ exports.main = async (event, context) => {
.done(), .done(),
as: 'imageList' as: 'imageList'
}).end() }).end()
const watermarkC = uniCloud.database().collection("user_watermark").field({'_id': false})
let userWatermark = await watermarkC.where({
user_id: user_id,
system_id: event.system_id
}).get()
if (!userWatermark.data || userWatermark.data.length <= 0) { // 用户没有 获取模板
userWatermark = await watermarkC.where({system_id: event.system_id}).get()
}
let userWatermarkData = userWatermark.data[0]
let data = res.data let data = res.data
const map = new Map() const map = new Map()
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
...@@ -38,6 +47,7 @@ exports.main = async (event, context) => { ...@@ -38,6 +47,7 @@ exports.main = async (event, context) => {
data[i].images = data[i].images.split(",") data[i].images = data[i].images.split(",")
map.set(key, { map.set(key, {
type: key, type: key,
userWatermark: userWatermarkData,
list: [data[i]] list: [data[i]]
}) })
} }
......
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