master
271556543@qq.com 3 years ago
parent e90d722920
commit 0f33f25daf

@ -0,0 +1,130 @@
<template>
<view>
<u-mask :show="isShow" :isBack="false">
<cpn-navbar title="拍照上传"></cpn-navbar>
<view class="content">
<view class="content__img">
<u-upload ref="uUpload" :custom-btn="true" :action="action" :auto-upload="false"
:source-type="['camera']">
<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
<u-icon name="camera" size="60" color="#c0c4cc" label="点击拍摄" label-pos="bottom"></u-icon>
</view>
</u-upload>
</view>
<view class="content__btn">
<u-button :custom-style="btnStyle1" shape="circle" type="error"
@click="$emit('update:isShow',false),clearList()">取消</u-button>
<u-button :custom-style="btnStyle2" shape="circle" type="primary" @click.stop="submit">确认</u-button>
</view>
</view>
</u-mask>
</view>
</template>
<script>
export default {
props: {
isShow: {
type: Boolean,
default: false
},
type: Number
},
data() {
return {
btnStyle1: {
letterSpacing: "4rpx",
fontWeight: "600",
width: '330rpx',
background: "linear-gradient(133deg,#ff832a 36%, #FA3534)",
filter: "drop-shadow(0 0 6rpx #FA3534) drop-shadow(0 0 10rpx #ff832a)"
},
btnStyle2: {
letterSpacing: "4rpx",
fontWeight: "600",
width: '330rpx',
background: "linear-gradient(133deg,#03d5ff 36%, #108cff)",
filter: "drop-shadow(0 0 6rpx #108cff) drop-shadow(0 0 10rpx #03d5ff)"
}
}
},
methods: {
clearList() {
this.$refs.uUpload.clear()
},
submit() {
if (!this.$refs.uUpload.lists || this.$refs.uUpload.lists.length === 0) {
uni.showToast({
icon: 'none',
title: '请选择拍摄照片'
})
return
}
let fileList = this.$refs.uUpload.lists.map(item => {
return item.url
})
this.$emit('confirm', fileList, this.type)
},
},
computed: {
},
}
</script>
<style scoped lang="scss">
.content {
height: 1410rpx;
padding: 20rpx;
position: relative;
&::before {
content: '';
width: 1800rpx;
height: 1800rpx;
border-radius: 100%;
background: rgb(250, 250, 250);
box-shadow: 0 6rpx 40rpx 6rpx #1479FF;
position: absolute;
top: -800rpx;
left: calc(375rpx - 900rpx);
}
&__btn {
display: flex;
justify-content: space-between;
position: absolute;
left: 30rpx;
right: 30rpx;
bottom: 60rpx;
}
}
.slot-btn {
width: 200rpx;
height: 200rpx;
display: flex;
justify-content: center;
align-items: center;
background: rgb(244, 245, 246);
border: 2rpx #108cff solid;
border-radius: 10rpx;
box-sizing: content-box;
filter: drop-shadow(0 0 4rpx #0fc7ff) drop-shadow(0 0 6rpx #00eaff);
animation: flame 2s ease-in-out infinite alternate;
}
.slot-btn__hover {
background-color: rgb(235, 236, 238);
}
@keyframes flame {
to {
filter: drop-shadow(0 0 2rpx #1063cf) drop-shadow(0 0 5rpx #1479FF) drop-shadow(0 0 7rpx #0fc7ff) drop-shadow(0 0 10rpx #08ffef);
}
}
</style>

@ -84,7 +84,7 @@
<!-- 打卡 -->
<view class="clock">
<view class="btn" v-if="detail.status === 1 && detail.logs_count < 3"
<view class="btn" v-if="detail.status === 1 && detail.logs_count < detail.product.process_total"
@click="$u.throttle(clockIn,1000)">
<view class="text1">过程打卡</view>
<view class="text2">{{detail.logs_count + 1}}</view>
@ -111,6 +111,8 @@
定位时间{{$u.timeFormat(location.time,'hh:MM:ss')}} {{location.address}}
</view>
</view>
<imgUpload ref="imgUpload" :isShow.sync="isShowImg" :type="type" @confirm="clock"></imgUpload>
</view>
</template>
@ -120,9 +122,15 @@
} from '@/common/config.js'
import QQMapWX from '@/libs/qqmap-wx-jssdk.js'
import imgUpload from './components/imgUpload.vue'
export default {
components: {
imgUpload
},
data() {
return {
type: 0, //,1 2 3退
isShowImg: false,
id: '',
flag: false, //()
qqmapsdk: null,
@ -233,41 +241,61 @@
},
//
async uploadImgs() {
let res = await uni.chooseImage({
sourceType: ['camera']
})
if (res[1]) {
let promiseAll = res[1].tempFilePaths.map(item => {
console.log(`${ROOTPATH}/api/nurse/upload-file`);
return new Promise((resolve, reject) => {
uni.uploadFile({
url: `${ROOTPATH}/api/nurse/upload-file`,
header: {
Authorization: `Bearer ${this.vuex_token}`
},
filePath: item,
name: 'file',
success: (res1) => {
resolve(res1)
},
fail: (err) => {
reject(err)
}
})
uploadImgs(files) {
let promiseAll = files.map(item => {
return new Promise((resolve, reject) => {
uni.uploadFile({
url: `${ROOTPATH}/api/nurse/upload-file`,
header: {
Authorization: `Bearer ${this.vuex_token}`
},
filePath: item,
name: 'file',
success: (res1) => {
resolve(res1)
},
fail: (err) => {
reject(err)
}
})
})
})
return Promise.all(promiseAll)
} else {
return Promise.reject(res[0].errMsg)
}
return Promise.all(promiseAll)
// let res = await uni.chooseImage({
// sourceType: ['camera']
// })
// if (res[1]) {
// let promiseAll = res[1].tempFilePaths.map(item => {
// console.log(`${ROOTPATH}/api/nurse/upload-file`);
// return new Promise((resolve, reject) => {
// uni.uploadFile({
// url: `${ROOTPATH}/api/nurse/upload-file`,
// header: {
// Authorization: `Bearer ${this.vuex_token}`
// },
// filePath: item,
// name: 'file',
// success: (res1) => {
// resolve(res1)
// },
// fail: (err) => {
// reject(err)
// }
// })
// })
// })
// return Promise.all(promiseAll)
// } else {
// return Promise.reject(res[0].errMsg)
// }
},
//
clock(type) {
clock(files, type) {
let title;
switch (type) {
case 1:
@ -282,19 +310,20 @@
default:
title = '操作成功'
}
this.uploadImgs().then(res => {
this.uploadImgs(files).then(res => {
this.form.upload_list = res.map(item => {
return {
upload_id: JSON.parse(item.data).id
}
})
this.form.type = type
console.log(this.form);
this.$u.api.processSave(this.form).then(res => {
uni.showToast({
icon: 'success',
title
})
this.$refs['imgUpload'].clearList()
this.isShowImg = false
this.getDeatil(this.id)
}).catch(err => {
uni.showToast({
@ -333,7 +362,9 @@
//
sign() {
this.clock(1)
this.type = 1
this.isShowImg = true
//this.clock(1)
},
//
@ -353,7 +384,8 @@
return
}
this.saveSku().then(res => {
this.clock(2)
this.type = 2
this.isShowImg = true
}).catch(err => {
console.log(err);
uni.showToast({
@ -365,10 +397,10 @@
//退
signOut() {
if (this.detail.logs_count < 3) {
if (this.detail.logs_count < this.detail.product.process_total) {
uni.showToast({
icon: 'none',
title: `请先完成3次打卡,再签退。当前完成打卡次数${this.detail.logs_count}`
title: `请先完成${this.detail.product.process_total}次打卡,再签退。当前完成打卡次数${this.detail.logs_count}`
})
return
}
@ -405,7 +437,8 @@
}
this.saveSku().then(() => {
this.clock(3)
this.type = 3
this.isShowImg = true
}).catch(err => {
console.log(err);
uni.showToast({
@ -444,7 +477,7 @@
},
mounted() {
this.load()
//this.getLoaction()
this.getLoaction()
}
}
</script>

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save