Browse Source

隐藏未开发的功能,支持上传图片/视频

fenbao
wangyx 1 month ago
parent
commit
80e1ef1357
  1. 34
      pages/tabBar/work/index.vue
  2. 28
      pagesA/checkout/detail/detail.vue
  3. 19
      pagesA/force/index/index.vue
  4. 20
      pagesA/release/detail/detail.vue
  5. 23
      pagesA/xjPage/xj.vue

34
pages/tabBar/work/index.vue

@ -22,7 +22,7 @@
</view>
</view>
<view class="conItem">
<view class="conItem" style="display: none;">
<view class="conItem-title">水电</view>
<view class="conItem-cont">
<view class="conItem-cont-item" v-for="(item, index) in sdList" :key="index" @click="handelSdClick(item)">
@ -32,7 +32,7 @@
</view>
</view>
<view class="conItem">
<view class="conItem" style="display: none;">
<view class="conItem-title">报修</view>
<view class="conItem-cont">
<view class="conItem-cont-item" v-for="(item, index) in bxList" :key="index">
@ -42,7 +42,7 @@
</view>
</view>
<view class="conItem">
<view class="conItem" style="display: none;">
<view class="conItem-title">报事</view>
<view class="conItem-cont">
<view class="conItem-cont-item" v-for="(item, index) in bsList" :key="index" @click="handleBsClick(item)">
@ -60,28 +60,28 @@ export default {
data () {
return {
fyList: [
{ image: '/static/img/看房.png', text: '看房确认' },
// { image: '/static/img/.png', text: '' },
{ image: '/static/img/退房检查.png', text: '退房检查' },
{ image: '/static/img/释放.png', text: '释放房源检查' },
{ image: '/static/img/预约.png', text: '预约看房' },
// { image: '/static/img/.png', text: '' },
{ image: '/static/img/强制清退.png', text: '强制清退' },
],
xjList: [
{ image: '/static/img/巡查.png', text: '巡检上报' },
{ image: '/static/img/记录.png', text: '巡检记录' },
],
sdList: [
{ image: '/static/img/水费.png', text: '水量上报' },
{ image: '/static/img/电费.png', text: '电量上报' },
],
bxList: [
{ image: '/static/img/上报.png', text: '上报' },
{ image: '/static/img/处理.png', text: '处理' },
],
bsList: [
{ image: '/static/img/上报.png', text: '上报' },
{ image: '/static/img/处理.png', text: '处理' },
],
// sdList: [
// { image: '/static/img/.png', text: '' },
// { image: '/static/img/.png', text: '' },
// ],
// bxList: [
// { image: '/static/img/.png', text: '' },
// { image: '/static/img/.png', text: '' },
// ],
// bsList: [
// { image: '/static/img/.png', text: '' },
// { image: '/static/img/.png', text: '' },
// ],
}
},

28
pagesA/checkout/detail/detail.vue

@ -105,7 +105,7 @@
@delete="onDelete"
:disabled="true"
>
<view class="custom-upload-btn" @click.stop="chooseImage">
<view class="custom-upload-btn" @click.stop="chooseMedia">
<view class="icon-box">
<image
class="camera-icon"
@ -192,27 +192,36 @@ export default {
onDeviceChange(idx, val) {
this.deviceList[idx].status = val;
},
chooseImage() {
uni.chooseImage({
chooseMedia() {
uni.chooseMedia({
count: 10 - this.fileList.length,
sizeType: ["original", "compressed"],
mediaType: ["image", "video"],
sourceType: ["album", "camera"],
maxDuration: 60,
camera: "back",
success: async (res) => {
uni.showLoading({ title: "上传中...", mask: true });
try {
const files =
res.tempFiles || res.tempFilePaths.map((path) => ({ path }));
const files = res.tempFiles;
for (let i = 0; i < files.length; i++) {
const filePath = files[i].path;
const file = files[i];
const filePath = file.tempFilePath;
const type = file.fileType || (filePath.match(/\.(mp4|mov|avi|wmv|flv|mkv)$/i) ? "video" : "image");
//
const uploadRes = await uploadImage(filePath);
this.fileList.push({
url: uploadRes.data?.url || uploadRes.url || uploadRes.path,
name: uploadRes.data?.name || uploadRes.name || "",
type: uploadRes.data?.type || uploadRes.type || "image",
type: type,
status: "success",
});
}
this.img1 = this.fileList.map((v) => v.url);
// facilitiesCheckImages
this.facilitiesCheckImages = this.fileList.map((v) => ({
name: v.name || "",
format: v.type,
url: v.url,
}));
} catch (e) {
uni.showToast({ title: "上传失败", icon: "none" });
} finally {
@ -229,7 +238,6 @@ export default {
this.$u.toast("请传10MB以内大小的图片/视频!");
return false;
},
//
onDelete(event) {
this[`fileList${event.name}`].splice(event.index, 1);
var arry = [];

19
pagesA/force/index/index.vue

@ -110,7 +110,7 @@
@delete="onDelete"
:disabled="true"
>
<view class="custom-upload-btn" @click.stop="chooseImage">
<view class="custom-upload-btn" @click.stop="chooseMedia">
<view class="icon-box">
<image
class="camera-icon"
@ -230,23 +230,26 @@ export default {
(this.baseInfo.unitName = ""),
(this.baseInfo.roomTypeName = "");
},
chooseImage() {
uni.chooseImage({
chooseMedia() {
uni.chooseMedia({
count: 10 - this.fileList.length,
sizeType: ["original", "compressed"],
mediaType: ["image", "video"],
sourceType: ["album", "camera"],
maxDuration: 60,
camera: "back",
success: async (res) => {
uni.showLoading({ title: "上传中...", mask: true });
try {
const files =
res.tempFiles || res.tempFilePaths.map((path) => ({ path }));
const files = res.tempFiles;
for (let i = 0; i < files.length; i++) {
const filePath = files[i].path;
const file = files[i];
const filePath = file.tempFilePath;
const type = file.fileType || (filePath.match(/\.(mp4|mov|avi|wmv|flv|mkv)$/i) ? "video" : "image");
const uploadRes = await uploadImage(filePath);
this.fileList.push({
url: uploadRes.data?.url || uploadRes.url || uploadRes.path,
name: uploadRes.data?.name || uploadRes.name || "",
type: uploadRes.data?.type || uploadRes.type || "image",
type: type,
status: "success",
});
}

20
pagesA/release/detail/detail.vue

@ -86,7 +86,7 @@
@delete="onDelete"
:disabled="true"
>
<view class="custom-upload-btn" @click.stop="chooseImage">
<view class="custom-upload-btn" @click.stop="chooseMedia">
<view class="icon-box">
<image
class="camera-icon"
@ -168,23 +168,27 @@ export default {
}
},
methods: {
chooseImage() {
uni.chooseImage({
chooseMedia() {
uni.chooseMedia({
count: 10 - this.fileList.length,
sizeType: ["original", "compressed"],
mediaType: ["image", "video"],
sourceType: ["album", "camera"],
maxDuration: 60,
camera: "back",
success: async (res) => {
uni.showLoading({ title: "上传中...", mask: true });
try {
const files =
res.tempFiles || res.tempFilePaths.map((path) => ({ path }));
const files = res.tempFiles;
for (let i = 0; i < files.length; i++) {
const filePath = files[i].path;
const file = files[i];
const filePath = file.tempFilePath;
const type = file.fileType || (filePath.match(/\.(mp4|mov|avi|wmv|flv|mkv)$/i) ? "video" : "image");
//
const uploadRes = await uploadImage(filePath);
this.fileList.push({
url: uploadRes.data?.url || uploadRes.url || uploadRes.path,
name: uploadRes.data?.name || uploadRes.name || "",
type: uploadRes.data?.type || uploadRes.type || "image",
type: type,
status: "success",
});
}

23
pagesA/xjPage/xj.vue

@ -92,7 +92,7 @@
@delete="onDelete"
:disabled="true"
>
<view class="custom-upload-btn" @click.stop="chooseImage">
<view class="custom-upload-btn" @click.stop="chooseMedia">
<view class="icon-box">
<image
class="camera-icon"
@ -190,26 +190,27 @@ export default {
this.getDictType();
},
methods: {
chooseImage() {
uni.chooseImage({
chooseMedia() {
uni.chooseMedia({
count: 10 - this.fileList.length,
sizeType: ["original", "compressed"],
mediaType: ["image", "video"],
sourceType: ["album", "camera"],
maxDuration: 60,
camera: "back",
success: async (res) => {
uni.showLoading({ title: "上传中...", mask: true });
try {
// H5
const files =
res.tempFiles || res.tempFilePaths.map((path) => ({ path }));
const files = res.tempFiles;
for (let i = 0; i < files.length; i++) {
const filePath = files[i].path;
const file = files[i];
const filePath = file.tempFilePath;
const type = file.fileType || (filePath.match(/\.(mp4|mov|avi|wmv|flv|mkv)$/i) ? "video" : "image");
//
const uploadRes = await uploadImage(filePath);
//
this.fileList.push({
url: uploadRes.data?.url || uploadRes.url || uploadRes.path, //
url: uploadRes.data?.url || uploadRes.url || uploadRes.path,
name: uploadRes.data?.name || uploadRes.name || "",
type: uploadRes.data?.type || uploadRes.type || "image",
type: type,
status: "success",
});
}

Loading…
Cancel
Save