增加图片上传

This commit is contained in:
小朱 2025-04-29 16:25:56 +08:00
parent 9f4fbf0a73
commit b6b8b8eb2f
2 changed files with 36 additions and 7 deletions

View File

@ -135,7 +135,8 @@
// //
const regindata = ref([]) const regindata = ref([])
onShow(() => { onShow(() => {
loadMoreData(1, 5) loadMoreData(1, 5);
selectedItems.value=[]
}) })
// //
@ -256,10 +257,10 @@
if (statusZT.value == 0) { // if (statusZT.value == 0) { //
handleLeaveWarehouse(); handleLeaveWarehouse();
} else { // } else { //
// handleLaunch(); handleLaunch();
uni.navigateTo({ // uni.navigateTo({
url: `/pages/warehouse/vehicledispatch/vehicledispatch?orderId=274372153543897088` // url: `/pages/warehouse/vehicledispatch/vehicledispatch?orderId=274372153543897088`
}); // });
} }
}).catch(err => { }).catch(err => {
console.log('err', err); console.log('err', err);

View File

@ -8,6 +8,14 @@
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
</view> </view>
<view class="">
<uni-section title="上传图片" type="line">
<view class="example-body">
<uni-file-picker limit="9" @select="selectImg" @delete="delChangeImg"
:value="fileLists"></uni-file-picker>
</view>
</uni-section>
</view>
<view class="button-container"> <view class="button-container">
<view class="button-group flex justify-between padding"> <view class="button-group flex justify-between padding">
<button class="cu-btn bg-blue margin-tb-sm lg" @click="unlockHandler">开锁</button> <button class="cu-btn bg-blue margin-tb-sm lg" @click="unlockHandler">开锁</button>
@ -62,6 +70,7 @@
} from '@/utils/tools.js'; } from '@/utils/tools.js';
const orderId = ref(""); const orderId = ref("");
const fileLists = ref([]);
const newbikeCode = ref(""); const newbikeCode = ref("");
@ -90,7 +99,25 @@
} }
}) })
} }
const delChangeImg = (res) => {
const fileUniqueKey = fileLists.value[res.index].fileUniqueKey;
fileLists.value.splice(res.index, 1);
api.callEbikeInfo("deletedFile?fileUniqueKey=" + fileUniqueKey, {}, "get");
};
const selectImg = (data) => {
const file = data.tempFiles[0];
api.fileUpload(file).then(res => {
if (res.code == 200) {
fileLists.value.push(res.data)
} else {
if (fileLists.value.length > 0) {
fileLists.value.pop();
} else {
fileLists.value = [];
}
}
});
};
const deleteDispatchRecord = (recordId, index) => { const deleteDispatchRecord = (recordId, index) => {
if (dispatchRecords.value.length == 1) { if (dispatchRecords.value.length == 1) {
uni.showModal({ uni.showModal({
@ -175,7 +202,8 @@
if (index == 0) // if (index == 0) //
{ {
const params = { const params = {
"orderId": orderId.value "orderId": orderId.value,
"fileLists":fileLists.value
} }
api.callEbikeInfo("completeDeployment", params).then(res => { api.callEbikeInfo("completeDeployment", params).then(res => {
if (res.code == 200) { if (res.code == 200) {