Compare commits

..

2 Commits

@ -1,3 +1,3 @@
{
"eggHelper.serverPort": 35684
"eggHelper.serverPort": 38737
}

@ -9,8 +9,8 @@ const formRef = ref<UniHelper.UniFormsInstance>()
const form = ref({
username: 'majoys000',
password: '123qwe',
// username: 'biz000',
// password: '123456',
// username: 'majoys000',
// password: '123qwe',
})
//
const rules: UniHelper.UniFormsRules = {

@ -230,8 +230,10 @@ const handleCancl = () => {
const handleSubmit = async () => {
await formRef.value?.validate?.()
const params = {
...valiFormData.value
...valiFormData.value,
mediaList: mediaList.value
}
console.log(233, params)
const data = await postAddAPI(params)
valiFormData.value.type = ''
valiFormData.value.projectId = ''
@ -241,6 +243,8 @@ const handleSubmit = async () => {
valiFormData.value.amount = ''
valiFormData.value.owner = ''
valiFormData.value.remark = ''
//
mediaList.value = []
emit('close', true)
}
//
@ -259,6 +263,58 @@ const selectOne = (val: string)=>{
const selectConfirm = (val: string)=>{
valiFormData.value.owner = val
}
const handleMediaAdd = () => {
uni.chooseImage({
count: 5,
mediaType: ['image','video'],
sourceType: ['album', 'camera'],
maxDuration: 30,
camera: 'back',
success: (res)=> {
console.log('chooseImage', res)
const tempFilePath = res.tempFilePaths[0]
handleUploadFile(tempFilePath)
}
});
}
// 线
const handleUploadFile = (e) => {
const _this = this
const tempFilePath = e.tempFilePaths[0]
const businessId = e.tempFiles[0].uuid
uni.uploadFile({
url: '/infra/file/uploadWatch', //
filePath: tempFilePath,//
name: 'files',
formData: {
businessType: 'errorOrderPhoto',
businessId: businessId,
businessFileType: 'errorOrderPhoto',
},
success: (res) => {
const url = JSON.parse(res.data).data
const obj = {
k: businessId,
v: url
}
mediaList.value.push(obj)
}
});
}
const mediaValue = ref([])
const mediaList = ref([])
//
const select = (e: any) => {
handleUploadFile(e)
console.log('选择文件:', e)
}
//
const deleteImage = (e: any) => {
const idx = mediaList.value.findIndex(q => q.k = e.tempFile.uuid)
mediaList.value.splice(idx,1)
console.log('删除图片', mediaList.value, e.tempFile.uuid)
}
</script>
<template>
<view class="data-detail">
@ -301,6 +357,10 @@ const selectConfirm = (val: string)=>{
<uni-forms-item label="情况描述" required name="remark">
<uni-easyinput type="textarea" v-model="valiFormData.remark" placeholder="请输入情况描述" />
</uni-forms-item>
<uni-forms-item class="media-item" label="照片(最多可上传5张)" name="mediaValue">
<uni-file-picker limit="5" v-model="mediaValue" fileMediatype="image" mode="grid" :auto-upload="false"
@select="select" @delete="deleteImage" />
</uni-forms-item>
</uni-forms>
<view class="action">
<button class="cancle" @click="handleCancl()"></button>
@ -334,6 +394,10 @@ const selectConfirm = (val: string)=>{
display: flex!important;
align-items: center!important;
}
.media-add {
width: 140rpx;
height: 140rpx;
}
.action {
display: flex;
justify-content: space-between;

@ -2,10 +2,10 @@
* @Author:
* @Date: 2024-01-04 12:54:56
* @LastEditors: jevononlie 728254585@qq.com
* @LastEditTime: 2024-05-14 16:18:48
* @LastEditTime: 2024-05-28 14:15:11
* @FilePath: /hl-app/src/services/constants.ts
* @Description: ,`customMade`, koroFileHeader : https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
// export const serviceDomain = 'https://nxhs.cjyx.cc'
export const serviceDomain = 'http://222.71.165.187:9031'
export const serviceDomain = 'http://222.71.165.187:9021'

Loading…
Cancel
Save