Commit 91ac0bb6 authored by 刘用法's avatar 刘用法
parents 1437644d 5cfa8f92
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
src="/static/photo/icon-switch.png"></cover-image> src="/static/photo/icon-switch.png"></cover-image>
<cover-image @click="setCameraInfo('flash')" class="icon" mode="aspectFit" <cover-image @click="setCameraInfo('flash')" class="icon" mode="aspectFit"
:src="'/static/photo/icon-light-' + cameraInfo.flash +'.png'"></cover-image> :src="'/static/photo/icon-light-' + cameraInfo.flash +'.png'"></cover-image>
<cover-image @click="changeType(3)" class="icon" mode="aspectFit" <cover-image v-if="currentItem.system_id" @click="changeType(3)" class="icon" mode="aspectFit"
src="/static/photo/icon-setting.png"></cover-image> src="/static/photo/icon-setting.png"></cover-image>
</cover-view> </cover-view>
</cover-view> </cover-view>
...@@ -58,18 +58,13 @@ ...@@ -58,18 +58,13 @@
export default { export default {
props: { props: {
currentItem: { // 对应的规范item currentItem: { // 对应的规范item
type: Object,
default () { default () {
return { return {
_id: '', // 规格ID _id: '', // 规格ID
system_id: '', // 系统ID system_id: '', // 系统ID
brand_id: '', // 品牌ID brand_id: '', // 品牌ID
classify_id: '', // 分类ID classify_id: '', // 分类ID
images: [ // 拍照要求示意图 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'
],
main_point: [] // 要点 main_point: [] // 要点
} }
} }
...@@ -115,7 +110,8 @@ ...@@ -115,7 +110,8 @@
}, },
created(e) { created(e) {
const photo = getApp().globalData.photo const photo = getApp().globalData.photo
getApp().trackPage('拍照页') getApp().trackPage('拍照页')
photo.allImages = []
// this.ctx = uni.createCameraContext(); // this.ctx = uni.createCameraContext();
this.updateTime() this.updateTime()
this.getLocation() this.getLocation()
......
## 相机组件使用说明
```
该组件仅用于拍照后返回图片,与业务不关联,目前最多一次可以拍10张图片
```
### 因为相机组件需要全屏展示,所以加载该组件需要在当前页面隐藏顶部导航栏和底部的TabBar
```
uni.hideTabBar()
```
### 然后加上自定义导航栏,通过切换状态takeStatus来显示和隐藏
```
<u-navbar v-if="!takeStatus" :is-back="false" :title-size="26" title-color="#000" title="我的"></u-navbar>
```
## API
### Props
| 属性名 | 类型 | 默认值 | 可选值 | 说明 |
| :-: | :-: | :-: | :-: | :-: |
| currentItem | Object | - | - | 对应的规范数据,用于获取示意图和水印,以及保存图片所需的ID **格式见下文** |
### currentItem 格式
```json
{
_id: '', // 保存图片时需要
system_id: '', // 获取水印列表需要
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'
],
main_point: [] // 拍照要求
... // 列表其他字段也可传进来,可能会用到
}
```
### Events
|事件称名 |说明 | 返回值 |
|:-: |:-: | :-: |
|@close | 关闭相机或完成拍照的时候触发 | 已拍照完成的图片数组|
## 组件用法
### 基础用法
```html
<u-navbar v-if="!takeStatus" :is-back="false" :title-size="26" title-color="#000" title="我的"></u-navbar>
<view @click="take">打开相机</view>
<take-photo v-if="takeStatus" :currentItem="testData" @close="closeTake"></take-photo>
```
```javascript
import takePhoto from '@/components/take/index.vue'
export default {
components: {
'take-photo': takePhoto
},
data() {
return {
takeStatus: false,
testData: {}
}
},
methods:{
// 打开相机
take() {
uni.hideTabBar() // 打开时隐藏TabBar
this.takeStatus = true
},
// 拍照完成或关闭相机
closeTake(images) {
console.log(images)
this.takeStatus = false
}
}
}
```
\ No newline at end of file
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</u-cell-group> </u-cell-group>
</view> </view>
</view> </view>
<take-photo type="test" v-if="takeStatus" :currentItem="testData" @close="closeTake"></take-photo> <take-photo v-if="takeStatus" :currentItem="testData" @close="closeTake"></take-photo>
</view> </view>
</template> </template>
......
...@@ -103,20 +103,25 @@ ...@@ -103,20 +103,25 @@
</view> </view>
<!-- 异常预约 ,现场拍照 这里是调用拍照的两个组件--> <!-- 异常预约 ,现场拍照 这里是调用拍照的两个组件-->
<view class="right"> <view class="right">
<view v-show="allowRight" @click="allowRightClick" class="button"></view> <view v-if="errorSignIn" @click="take" class="button">
<text>异常签到</text>
</view>
<view v-if="scenePhoto" @click="scenePhotoClick" class="button">
<text>现场拍照</text>
</view>
</view> </view>
</view> </view>
<take-photo type="test" v-if="takeStatus" @close="closeTake"></take-photo>
</view> </view>
</template> </template>
<script> <script>
import appointTime from '@/components/appoint/appoint-time.vue' import appointTime from '@/components/appoint/appoint-time.vue'
import { import takePhoto from '@/components/take/index.vue'
getQueryString
} from '@/common/util.js'
export default { export default {
components: { components: {
appointTime appointTime,
'take-photo': takePhoto
}, },
data() { data() {
return { return {
...@@ -141,7 +146,10 @@ ...@@ -141,7 +146,10 @@
showTimeSelect: false, showTimeSelect: false,
submitType: '', submitType: '',
nextUrl:'', nextUrl:'',
btnClass:'appoint-btn' btnClass:'appoint-btn',
takeStatus:false,
errorSignIn:false,
scenePhoto: false
} }
}, },
onLoad(option) { onLoad(option) {
...@@ -155,9 +163,6 @@ ...@@ -155,9 +163,6 @@
this.loadOrderDetail() this.loadOrderDetail()
this.loadOrderRecord() this.loadOrderRecord()
this.getLocation() this.getLocation()
},
created() {
}, },
computed: { computed: {
phoneIcon() { phoneIcon() {
...@@ -172,6 +177,21 @@ ...@@ -172,6 +177,21 @@
} }
}, },
methods: { methods: {
scenePhotoClick() { // 跳转拍照小程序
uni.navigateTo({
url: 'pages/photo/list?orderId='+this.order.orderId+'&brandId='+this.order.lianbaoBrandId+'&brand='+this.order.brandName
+'&systemId='+this.order.partnerCompanyId+'&classifyId='+this.order.categoryId
})
},
take() {
uni.hideTabBar()
this.takeStatus = true
},
closeTake() {
this.takeStatus = false
// 获取返回的图片 ,如果返回的图片存在则直接异常签约,成功后跳转到去完工页面,
},
loadOrderDetail() { // 获取工单详情 loadOrderDetail() { // 获取工单详情
let self = this let self = this
let timestamp = new Date().getTime(); let timestamp = new Date().getTime();
...@@ -265,12 +285,14 @@ ...@@ -265,12 +285,14 @@
this.allowFeedback = true this.allowFeedback = true
this.showCenterBtn = true this.showCenterBtn = true
this.submitType = "maintainWorkerCheckin" this.submitType = "maintainWorkerCheckin"
this.errorSignIn = true
} else if (orderStatus > 31 && orderStatus < 80) { } else if (orderStatus > 31 && orderStatus < 80) {
// 完工 // 完工
this.centerButton = "filish" this.centerButton = "filish"
this.centerButtonText = "去完工" this.centerButtonText = "去完工"
this.allowFeedback = true this.allowFeedback = true
this.showCenterBtn = true this.showCenterBtn = true
this.scenePhoto = true
} else {} } else {}
}, },
handleBtn() { handleBtn() {
......
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