|
@ -4,8 +4,14 @@ |
|
|
<!-- 插件名称输入和提交 --> |
|
|
<!-- 插件名称输入和提交 --> |
|
|
<view class="flex item-center justify-between py-2"> |
|
|
<view class="flex item-center justify-between py-2"> |
|
|
<view class="flex-1"> |
|
|
<view class="flex-1"> |
|
|
<text v-if="deliver.deliverName"> |
|
|
<text v-if="deliver.deliverName" class="relative"> |
|
|
{{ deliver.deliverName }} |
|
|
{{ deliver.deliverName }} |
|
|
|
|
|
<u-badge |
|
|
|
|
|
size="mini" |
|
|
|
|
|
:is-dot="true" |
|
|
|
|
|
style="transform: translate3d(2em, -1em, 0)" |
|
|
|
|
|
v-show="!deliver.details || !deliver.details.length" |
|
|
|
|
|
></u-badge> |
|
|
</text> |
|
|
</text> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
@ -79,7 +85,7 @@ import { UPLOAD_EXTENSION } from '@/config/deliver'; |
|
|
const deliver = inject('deliver'); |
|
|
const deliver = inject('deliver'); |
|
|
const task = inject('task'); |
|
|
const task = inject('task'); |
|
|
const store = useStore(); |
|
|
const store = useStore(); |
|
|
const emits = defineEmits(['upload-success']); |
|
|
const emits = defineEmits(['upload-success', 'edit-success']); |
|
|
|
|
|
|
|
|
const reviewerRef = ref(null); |
|
|
const reviewerRef = ref(null); |
|
|
const submitBtnLoading = ref(false); |
|
|
const submitBtnLoading = ref(false); |
|
@ -165,6 +171,11 @@ function paste() { |
|
|
|
|
|
|
|
|
// 文件上传 |
|
|
// 文件上传 |
|
|
async function uploadFile() { |
|
|
async function uploadFile() { |
|
|
|
|
|
// #ifdef APP-PLUS |
|
|
|
|
|
uni.$ui.showToast('APP暂不支持上传文件') |
|
|
|
|
|
// #endif |
|
|
|
|
|
|
|
|
|
|
|
// #ifdef H5 |
|
|
try { |
|
|
try { |
|
|
const data = await uni.$upload.chooseAndUpload(UPLOAD_URL, {}, UPLOAD_EXTENSION, 'files'); |
|
|
const data = await uni.$upload.chooseAndUpload(UPLOAD_URL, {}, UPLOAD_EXTENSION, 'files'); |
|
|
// console.log(data[0]); |
|
|
// console.log(data[0]); |
|
@ -172,34 +183,52 @@ async function uploadFile() { |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error('error: ', error); |
|
|
console.error('error: ', error); |
|
|
} |
|
|
} |
|
|
} |
|
|
// #endif |
|
|
|
|
|
|
|
|
// TODO: 拍照上传 |
|
|
|
|
|
async function uploadPhoto() { |
|
|
|
|
|
try { |
|
|
|
|
|
const data = await uni.$upload.chooseAndUpload(UPLOAD_URL, {}, UPLOAD_EXTENSION, 'files'); |
|
|
|
|
|
// console.log(data[0]) |
|
|
|
|
|
linkValue.value = data[0].visitUrl; |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.error('error: ', error); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 拍照上传 |
|
|
// 拍照上传 |
|
|
// function photos (){ |
|
|
function uploadPhoto (){ |
|
|
// uni.chooseImage({ |
|
|
uni.$ui.hideLoading(); |
|
|
// count: 1, //默认9 |
|
|
let timer = null; |
|
|
// sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 |
|
|
clearTimeout(timer); |
|
|
// sourceType: ['album','camera'], //从相册选择 |
|
|
uni.chooseImage({ |
|
|
// success: function (res) { |
|
|
count: 1, //默认9 |
|
|
// linkValue.value = JSON.stringify(res.tempFilePaths) |
|
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 |
|
|
// } |
|
|
sourceType: ['album','camera'], //从相册选择 |
|
|
// }); |
|
|
success: (res) => { |
|
|
// } |
|
|
if (!timer) { |
|
|
|
|
|
timer = setTimeout(() => { |
|
|
|
|
|
uni.$ui.showLoading('正在上传...'); |
|
|
|
|
|
timer = null; |
|
|
|
|
|
}, 800); |
|
|
|
|
|
} |
|
|
|
|
|
const tempFilePaths = res.tempFilePaths; |
|
|
|
|
|
uni.uploadFile({ |
|
|
|
|
|
url: UPLOAD_URL, //仅为示例,非真实的接口地址 |
|
|
|
|
|
filePath: tempFilePaths[0], |
|
|
|
|
|
name: 'files', |
|
|
|
|
|
formData: {}, |
|
|
|
|
|
success: (res) => { |
|
|
|
|
|
clearTimeout(timer); |
|
|
|
|
|
uni.$ui.hideLoading(); |
|
|
|
|
|
const data = JSON.parse(res.data) |
|
|
|
|
|
if(data.code === 200){ |
|
|
|
|
|
linkValue.value = data.data[0].visitUrl; |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
fail: error => { |
|
|
|
|
|
clearTimeout(timer); |
|
|
|
|
|
uni.$ui.hideLoading(); |
|
|
|
|
|
console.error('error',error) |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 确定修改交付物名称 |
|
|
// 确定修改交付物名称 |
|
|
async function confirmEditDeliverName() { |
|
|
async function confirmEditDeliverName() { |
|
|
// TODO: 发请求 请求成功后更新task里的交付物信息 |
|
|
|
|
|
if (!newInputRef.value) { |
|
|
if (!newInputRef.value) { |
|
|
uni.$ui.showToast('输入不能为空'); |
|
|
uni.$ui.showToast('输入不能为空'); |
|
|
} |
|
|
} |
|
@ -211,6 +240,7 @@ async function confirmEditDeliverName() { |
|
|
}; |
|
|
}; |
|
|
await uni.$u.api.editDeliverName(param); |
|
|
await uni.$u.api.editDeliverName(param); |
|
|
// uni.$ui.showToast('修改交付物名称成功'); |
|
|
// uni.$ui.showToast('修改交付物名称成功'); |
|
|
|
|
|
emits('edit-success'); |
|
|
// 请求成功 才会清空 请求失败保留 |
|
|
// 请求成功 才会清空 请求失败保留 |
|
|
showEditModal.value = false; |
|
|
showEditModal.value = false; |
|
|
showMask.value = false; |
|
|
showMask.value = false; |
|
|