Commit 6cc13f41 by LJM

修复api

parent cf08ab1b
......@@ -90,11 +90,11 @@
</template>
<script>
import { API } from '@/util/api.js';
import { titleCase } from '@/util/util.js';
import w_md5 from '../../js_sdk/zww-md5/w_md5.js';
import { API } from '@/util/api.js';
import { titleCase } from '@/util/util.js';
import w_md5 from '../../js_sdk/zww-md5/w_md5.js';
export default {
export default {
data() {
return {
logistics_company_arr: ['FedEx', 'DHL', 'UPS', '顺丰', 'Air'], //物流公司
......@@ -191,14 +191,16 @@ export default {
chooseImageChange() {
var self = this;
var time = parseInt(new Date().getTime() / 1000);
uni.chooseImage({
uni.chooseMedia({
count: 4,
mediaType: ['image'],
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: chooseImageRes => {
uni.showLoading({
title: '上传中...'
});
const tempFilePaths = chooseImageRes.tempFilePaths;
const tempFilePaths = chooseImageRes.tempFiles;
let maxNum = tempFilePaths.length * 1 + self.form.info_pic.length * 1;
if (maxNum > 4) {
uni.hideLoading();
......@@ -211,7 +213,7 @@ export default {
console.log(tempFilePaths[i]);
uni.uploadFile({
url: API.upload,
filePath: tempFilePaths[i],
filePath: tempFilePaths[i].tempFilePath,
name: 'upload',
formData: {
source: '1',
......@@ -266,8 +268,7 @@ export default {
content: '请上传收货图片',
showCancel: false,
success: res => {
if (res.confirm) {
} else if (res.cancel) {
if (res.confirm) {} else if (res.cancel) {
console.log('用户点击取消');
}
}
......@@ -312,9 +313,9 @@ export default {
});
}
}
};
};
</script>
<style scoped lang="scss">
@import '../../assets/css/goods/addExectionReceiving.scss';
@import '../../assets/css/goods/addExectionReceiving.scss';
</style>
\ No newline at end of file
......@@ -178,14 +178,16 @@
this.noexebshowFalg = false; //不允许再次触发onshow这个生命周期
var self = this;
var time = parseInt(new Date().getTime() / 1000);
uni.chooseImage({
uni.chooseMedia({
count: 4,
mediaType: ['image'],
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: chooseImageRes => {
uni.showLoading({
title: '上传中...'
});
const tempFilePaths = chooseImageRes.tempFilePaths;
const tempFilePaths = chooseImageRes.tempFiles;
let maxNum = tempFilePaths.length * 1 + self.form.check_in_pic.length * 1;
if (maxNum > 4) {
uni.hideLoading();
......@@ -195,10 +197,9 @@
return false;
}
for (let i = 0; i < tempFilePaths.length; i++) {
console.log(tempFilePaths[i]);
uni.uploadFile({
url: API.upload,
filePath: tempFilePaths[i],
filePath: tempFilePaths[i].tempFilePath,
name: 'upload',
formData: {
source: '1',
......@@ -208,7 +209,6 @@
success: uploadFileRes => {
uni.hideLoading();
var data = JSON.parse(uploadFileRes.data);
console.log(data);
if (data.code === 200) {
self.form.check_in_pic.push(data.data[0]);
} else {
......@@ -220,7 +220,6 @@
},
fail: error => {
uni.hideLoading();
console.log(error);
}
});
}
......
......@@ -34,11 +34,13 @@
<view class="pic-list column">
<text class="title">问题图片</text>
<view class="list row verCenter">
<view class="box" @click="clickImg(operation_img, index)" v-for="(item, index) in operation_img" :key="index"><image :src="item" mode="aspectFill"></image></view>
<view class="box" @click="clickImg(operation_img, index)" v-for="(item, index) in operation_img" :key="index">
<image :src="item" mode="aspectFill"></image>
</view>
</view>
</view>
<view class="work-information">
</view>
<view class="work-information" v-if="warehouseOperationDetail.detail">
<view class="top row bothSide verCenter">
<view class="title row verCenter">
<text class="arrow row rowCenter verCenter"></text>
......@@ -72,7 +74,7 @@
</view>
</view>
<view class="camera disable row rowCenter verCenter" v-if="item.operation_img">已上传</view>
<view class="camera row rowCenter verCenter" @click="chooseImageChange()" v-else="item.operation_img">拍照</view>
<view class="camera row rowCenter verCenter" @click="chooseImageChange()" v-else-if="item.operation_img">拍照</view>
</view>
</view>
</view>
......@@ -81,10 +83,10 @@
</template>
<script>
import { API } from '@/util/api.js';
import w_md5 from '../../js_sdk/zww-md5/w_md5.js';
import { API } from '@/util/api.js';
import w_md5 from '../../js_sdk/zww-md5/w_md5.js';
export default {
export default {
data() {
return {
warehouseOperationDetail: {},
......@@ -112,19 +114,23 @@ export default {
});
},
chooseImageChange() {
uni.chooseImage({
uni.chooseMedia({
count: 1,
mediaType: ['image'],
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: chooseImageRes => {
uni.showLoading({
title: '上传中...'
});
const tempFilePaths = chooseImageRes.tempFilePaths;
const tempFilePaths = chooseImageRes.tempFiles;
const time = parseInt(new Date().getTime() / 1000);
console.log(tempFilePaths);
uni.uploadFile({
url: API.upload,
filePath: tempFilePaths[0],
filePath: tempFilePaths[0].tempFilePath,
name: 'upload',
formData: {
source: '1',
......@@ -136,6 +142,7 @@ export default {
uni.hideLoading();
var data = JSON.parse(uploadFileRes.data);
if (data.code === 200) {
this.operation_img.push(data.data[0]);
} else {
......@@ -156,8 +163,7 @@ export default {
submit() {
this.request(
API.execWarehouseOperation,
'POST',
{
'POST', {
weonlt_id: this.weonlt_id,
'weondl_id[]': this.weondl_ids.join(','),
operation_img: this.operation_img.join(','),
......@@ -208,9 +214,9 @@ export default {
});
}
}
};
};
</script>
<style scoped lang="scss">
@import '../../assets/css/goods/warehouseOperationConfirm.scss';
@import '../../assets/css/goods/warehouseOperationConfirm.scss';
</style>
\ No newline at end of file
......@@ -171,20 +171,20 @@
chooseImageChange() {
this.noexebshowFalg = false;
// 使用 chooseImage选择图片
uni.chooseImage({
uni.chooseMedia({
count: this.maxNum,
mediaType: ['image'],
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: chooseImageRes => {
console.log('选择图片成功:', chooseImageRes);
// 显示loading
uni.showLoading({
title: '上传中...'
});
// 获取选择的图片路径数组
const imagePaths = chooseImageRes.tempFilePaths;
const imagePaths = chooseImageRes.tempFiles;
// 判断选择的图片数量是否超过最大限制数量
let maxNum = Number(imagePaths.length) + Number(this.image_list.length); //当前上传的+已经上传的
......@@ -201,7 +201,7 @@
imagePaths.forEach(imagePath => {
// 使用compressImage 压缩图片
uni.compressImage({
src: imagePath,
src: imagePath.tempFilePath,
quality: 50, //压缩质量,范围0~100,数值越小,质量越低,压缩率越高
success: compressedRes => {
console.log('压缩图片成功:', compressedRes);
......
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 sign in to comment