|
@@ -1,4 +1,4 @@
|
|
|
-import { getOrderInfo, getOrderLogs, uploadFile, clockIn, getAnomalyList } from '@/api/fulfiller'
|
|
|
|
|
|
|
+import { getOrderInfo, getOrderLogs, uploadFile, clockIn, getAnomalyList, submitNursingSummary } from '@/api/fulfiller'
|
|
|
import { getServiceList, getServiceDetail } from '@/api/service'
|
|
import { getServiceList, getServiceDetail } from '@/api/service'
|
|
|
import { getDictDataByType } from '@/api/system/dict/index'
|
|
import { getDictDataByType } from '@/api/system/dict/index'
|
|
|
import { getPetDetail } from '@/api/archieves/pet/index'
|
|
import { getPetDetail } from '@/api/archieves/pet/index'
|
|
@@ -11,6 +11,7 @@ export default {
|
|
|
orderType: 1,
|
|
orderType: 1,
|
|
|
orderStatus: 2,
|
|
orderStatus: 2,
|
|
|
serviceId: null, // 当前订单的服务类型ID
|
|
serviceId: null, // 当前订单的服务类型ID
|
|
|
|
|
+ serviceMode: null, // 当前订单的服务模式 (0: 喂遛/洗护, 1: 接送)
|
|
|
petId: null, // 当前订单关联的宠物ID
|
|
petId: null, // 当前订单关联的宠物ID
|
|
|
petDetail: null, // 宠物档案详情
|
|
petDetail: null, // 宠物档案详情
|
|
|
|
|
|
|
@@ -34,13 +35,14 @@ export default {
|
|
|
serviceTag: '',
|
|
serviceTag: '',
|
|
|
startLocation: '',
|
|
startLocation: '',
|
|
|
startAddress: '',
|
|
startAddress: '',
|
|
|
- endLocation: '',
|
|
|
|
|
endAddress: '',
|
|
endAddress: '',
|
|
|
|
|
+ customerPhone: '',
|
|
|
serviceContent: '',
|
|
serviceContent: '',
|
|
|
remark: '',
|
|
remark: '',
|
|
|
orderNo: '',
|
|
orderNo: '',
|
|
|
createTime: '',
|
|
createTime: '',
|
|
|
- progressLogs: []
|
|
|
|
|
|
|
+ progressLogs: [],
|
|
|
|
|
+ nursingSummary: '' // 宠护小结
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
serviceList: [],
|
|
serviceList: [],
|
|
@@ -56,14 +58,18 @@ export default {
|
|
|
showSumModal: false,
|
|
showSumModal: false,
|
|
|
sumContent: '',
|
|
sumContent: '',
|
|
|
sumDate: '',
|
|
sumDate: '',
|
|
|
- sumSigner: '张*哥',
|
|
|
|
|
|
|
+ sumSigner: '未知',
|
|
|
|
|
|
|
|
showPetRemarkInput: false,
|
|
showPetRemarkInput: false,
|
|
|
petRemarkText: '',
|
|
petRemarkText: '',
|
|
|
|
|
|
|
|
showAnomalyModal: false,
|
|
showAnomalyModal: false,
|
|
|
anomalyList: [],
|
|
anomalyList: [],
|
|
|
- anomalyTypeDict: []
|
|
|
|
|
|
|
+ anomalyTypeDict: [],
|
|
|
|
|
+
|
|
|
|
|
+ // 媒体预览相关
|
|
|
|
|
+ videoPlayerShow: false,
|
|
|
|
|
+ videoPlayerUrl: ''
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -122,8 +128,6 @@ export default {
|
|
|
try {
|
|
try {
|
|
|
// 先加载字典
|
|
// 先加载字典
|
|
|
await this.loadAnomalyTypeDict()
|
|
await this.loadAnomalyTypeDict()
|
|
|
- // 先获取服务列表(用于匹配服务类型名称等)
|
|
|
|
|
- await this.loadServiceList()
|
|
|
|
|
// 获取订单详情(内部会拿到 serviceId,然后加载服务详情获取 clockInRemark)
|
|
// 获取订单详情(内部会拿到 serviceId,然后加载服务详情获取 clockInRemark)
|
|
|
await this.loadOrderDetail()
|
|
await this.loadOrderDetail()
|
|
|
} finally {
|
|
} finally {
|
|
@@ -143,18 +147,24 @@ export default {
|
|
|
* 根据服务类型ID获取服务详情,解析 clockInRemark 为打卡步骤
|
|
* 根据服务类型ID获取服务详情,解析 clockInRemark 为打卡步骤
|
|
|
*/
|
|
*/
|
|
|
async loadServiceDetail(serviceId) {
|
|
async loadServiceDetail(serviceId) {
|
|
|
|
|
+ console.log('开始加载服务详情, ID:', serviceId)
|
|
|
try {
|
|
try {
|
|
|
const res = await getServiceDetail(serviceId)
|
|
const res = await getServiceDetail(serviceId)
|
|
|
const serviceInfo = res.data
|
|
const serviceInfo = res.data
|
|
|
- if (serviceInfo && serviceInfo.clockInRemark) {
|
|
|
|
|
- try {
|
|
|
|
|
- const parsed = JSON.parse(serviceInfo.clockInRemark)
|
|
|
|
|
- if (Array.isArray(parsed) && parsed.length > 0) {
|
|
|
|
|
- this.clockInSteps = parsed
|
|
|
|
|
- console.log('解析打卡步骤:', this.clockInSteps)
|
|
|
|
|
|
|
+ console.log('服务详情响应结果:', serviceInfo)
|
|
|
|
|
+ if (serviceInfo) {
|
|
|
|
|
+ this.serviceMode = serviceInfo.mode
|
|
|
|
|
+ console.log('当前服务模式(mode):', this.serviceMode)
|
|
|
|
|
+ if (serviceInfo.clockInRemark) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const parsed = JSON.parse(serviceInfo.clockInRemark)
|
|
|
|
|
+ if (Array.isArray(parsed) && parsed.length > 0) {
|
|
|
|
|
+ this.clockInSteps = parsed
|
|
|
|
|
+ console.log('解析打卡步骤:', this.clockInSteps)
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (parseErr) {
|
|
|
|
|
+ console.error('解析 clockInRemark 失败:', parseErr)
|
|
|
}
|
|
}
|
|
|
- } catch (parseErr) {
|
|
|
|
|
- console.error('解析 clockInRemark 失败:', parseErr)
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
@@ -181,10 +191,13 @@ export default {
|
|
|
this.serviceId = order.service
|
|
this.serviceId = order.service
|
|
|
this.petId = order.usrPet || null
|
|
this.petId = order.usrPet || null
|
|
|
this.transformOrderData(order)
|
|
this.transformOrderData(order)
|
|
|
|
|
+ console.log('解析出的 serviceId:', this.serviceId)
|
|
|
|
|
|
|
|
// 根据订单的服务类型ID获取服务详情(含 clockInRemark)
|
|
// 根据订单的服务类型ID获取服务详情(含 clockInRemark)
|
|
|
if (this.serviceId) {
|
|
if (this.serviceId) {
|
|
|
await this.loadServiceDetail(this.serviceId)
|
|
await this.loadServiceDetail(this.serviceId)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.warn('订单中未找到 service 字段,无法加载服务步骤')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 加载宠物档案详情
|
|
// 加载宠物档案详情
|
|
@@ -230,7 +243,7 @@ export default {
|
|
|
this.currentStep = stepIndex + 1
|
|
this.currentStep = stepIndex + 1
|
|
|
} else {
|
|
} else {
|
|
|
// 兜底:直接按 step 值推算
|
|
// 兜底:直接按 step 值推算
|
|
|
- this.currentStep = latestStep
|
|
|
|
|
|
|
+ this.currentStep = Number(latestStep)
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
this.currentStep = 0
|
|
this.currentStep = 0
|
|
@@ -273,14 +286,23 @@ export default {
|
|
|
startAddress: order.fromAddress || '',
|
|
startAddress: order.fromAddress || '',
|
|
|
endLocation: (order.contact || '') + ' ' + (order.contactPhoneNumber || ''),
|
|
endLocation: (order.contact || '') + ' ' + (order.contactPhoneNumber || ''),
|
|
|
endAddress: order.toAddress || '',
|
|
endAddress: order.toAddress || '',
|
|
|
|
|
+ customerPhone: order.contactPhoneNumber || '',
|
|
|
|
|
+ ownerName: order.contact || '', // 宠主姓名(默认使用客户姓名)
|
|
|
serviceContent: '',
|
|
serviceContent: '',
|
|
|
remark: '',
|
|
remark: '',
|
|
|
orderNo: order.code || 'T' + order.id,
|
|
orderNo: order.code || 'T' + order.id,
|
|
|
createTime: order.serviceTime || '',
|
|
createTime: order.serviceTime || '',
|
|
|
|
|
+ nursingSummary: order.nursingSummary || '',
|
|
|
|
|
+ fulfillerName: order.fulfillerName || '', // 履约者/护宠师姓名
|
|
|
progressLogs: [
|
|
progressLogs: [
|
|
|
{ status: '您已接单', time: order.serviceTime || '' }
|
|
{ status: '您已接单', time: order.serviceTime || '' }
|
|
|
]
|
|
]
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 更新签名
|
|
|
|
|
+ if (this.orderDetail.fulfillerName) {
|
|
|
|
|
+ this.sumSigner = this.orderDetail.fulfillerName
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
* 根据宠物ID获取宠物档案详情
|
|
* 根据宠物ID获取宠物档案详情
|
|
@@ -295,6 +317,7 @@ export default {
|
|
|
this.orderDetail.petAvatar = pet.avatarUrl || '/static/dog.png'
|
|
this.orderDetail.petAvatar = pet.avatarUrl || '/static/dog.png'
|
|
|
this.orderDetail.petName = pet.name || this.orderDetail.petName
|
|
this.orderDetail.petName = pet.name || this.orderDetail.petName
|
|
|
this.orderDetail.petBreed = pet.breed || this.orderDetail.petBreed
|
|
this.orderDetail.petBreed = pet.breed || this.orderDetail.petBreed
|
|
|
|
|
+ this.orderDetail.ownerName = pet.ownerName || this.orderDetail.ownerName // 如果宠物档案有宠主姓名,则覆盖
|
|
|
console.log('宠物档案:', pet)
|
|
console.log('宠物档案:', pet)
|
|
|
}
|
|
}
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
@@ -355,7 +378,7 @@ export default {
|
|
|
this.currentStep = 0
|
|
this.currentStep = 0
|
|
|
} else if (this.orderStatus === 3) {
|
|
} else if (this.orderStatus === 3) {
|
|
|
this.currentStep = 1
|
|
this.currentStep = 1
|
|
|
- } else if (this.orderStatus === 5) {
|
|
|
|
|
|
|
+ } else if (this.orderStatus === 4) {
|
|
|
this.currentStep = this.steps.length - 1
|
|
this.currentStep = this.steps.length - 1
|
|
|
} else {
|
|
} else {
|
|
|
this.currentStep = 0
|
|
this.currentStep = 0
|
|
@@ -426,7 +449,7 @@ export default {
|
|
|
this.currentPetInfo.petLogs.unshift({
|
|
this.currentPetInfo.petLogs.unshift({
|
|
|
date: date,
|
|
date: date,
|
|
|
content: this.petRemarkText,
|
|
content: this.petRemarkText,
|
|
|
- recorder: '张*哥'
|
|
|
|
|
|
|
+ recorder: this.orderDetail.fulfillerName || '未知'
|
|
|
});
|
|
});
|
|
|
this.closePetRemarkInput();
|
|
this.closePetRemarkInput();
|
|
|
uni.showToast({ title: '备注已添加', icon: 'success' });
|
|
uni.showToast({ title: '备注已添加', icon: 'success' });
|
|
@@ -437,7 +460,8 @@ export default {
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
callPhone() {
|
|
callPhone() {
|
|
|
- uni.makePhoneCall({ phoneNumber: '18900008451' });
|
|
|
|
|
|
|
+ const phoneNum = this.orderDetail.customerPhone || '18900008451'
|
|
|
|
|
+ uni.makePhoneCall({ phoneNumber: phoneNum });
|
|
|
},
|
|
},
|
|
|
openNavigation(type) {
|
|
openNavigation(type) {
|
|
|
this.navTargetPointType = type;
|
|
this.navTargetPointType = type;
|
|
@@ -477,36 +501,45 @@ export default {
|
|
|
},
|
|
},
|
|
|
async chooseModalMedia() {
|
|
async chooseModalMedia() {
|
|
|
console.log('chooseModalMedia被调用');
|
|
console.log('chooseModalMedia被调用');
|
|
|
- uni.chooseImage({
|
|
|
|
|
|
|
+ // 使用 uni.chooseMedia 支持图片和视频
|
|
|
|
|
+ uni.chooseMedia({
|
|
|
count: 5 - this.modalMediaList.length,
|
|
count: 5 - this.modalMediaList.length,
|
|
|
|
|
+ mediaType: ['image', 'video'],
|
|
|
|
|
+ sourceType: ['album', 'camera'],
|
|
|
success: async (res) => {
|
|
success: async (res) => {
|
|
|
- console.log('选择图片成功,文件路径:', res.tempFilePaths);
|
|
|
|
|
- uni.showLoading({ title: '上传中...' });
|
|
|
|
|
|
|
+ console.log('选择媒体文件成功:', res.tempFiles);
|
|
|
|
|
+ uni.showLoading({ title: '上传中...', mask: true });
|
|
|
try {
|
|
try {
|
|
|
- for (const filePath of res.tempFilePaths) {
|
|
|
|
|
- console.log('上传文件:', filePath);
|
|
|
|
|
|
|
+ for (const file of res.tempFiles) {
|
|
|
|
|
+ const filePath = file.tempFilePath;
|
|
|
|
|
+ const fileType = file.fileType; // 'image' or 'video'
|
|
|
|
|
+ console.log('开始上传文件:', filePath, '类型:', fileType);
|
|
|
|
|
+
|
|
|
const uploadRes = await uploadFile(filePath);
|
|
const uploadRes = await uploadFile(filePath);
|
|
|
- console.log('上传响应:', uploadRes);
|
|
|
|
|
|
|
+ console.log('服务器响应:', uploadRes);
|
|
|
|
|
+
|
|
|
if (uploadRes.code === 200) {
|
|
if (uploadRes.code === 200) {
|
|
|
this.modalMediaList.push({
|
|
this.modalMediaList.push({
|
|
|
url: uploadRes.data.url,
|
|
url: uploadRes.data.url,
|
|
|
ossId: uploadRes.data.ossId,
|
|
ossId: uploadRes.data.ossId,
|
|
|
- localPath: filePath
|
|
|
|
|
|
|
+ localPath: filePath,
|
|
|
|
|
+ mediaType: fileType,
|
|
|
|
|
+ thumb: file.thumbTempFilePath // 视频缩略图(如果有)
|
|
|
});
|
|
});
|
|
|
- console.log('上传成功,url:', uploadRes.data.url);
|
|
|
|
|
|
|
+ console.log('媒体文件添加成功');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
uni.hideLoading();
|
|
uni.hideLoading();
|
|
|
- console.log('当前modalMediaList:', this.modalMediaList);
|
|
|
|
|
uni.showToast({ title: '上传成功', icon: 'success' });
|
|
uni.showToast({ title: '上传成功', icon: 'success' });
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
|
uni.hideLoading();
|
|
uni.hideLoading();
|
|
|
- console.error('上传失败:', err);
|
|
|
|
|
|
|
+ console.error('上传失败详情:', err);
|
|
|
uni.showToast({ title: '上传失败', icon: 'none' });
|
|
uni.showToast({ title: '上传失败', icon: 'none' });
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
fail: (err) => {
|
|
fail: (err) => {
|
|
|
- console.error('选择图片失败:', err);
|
|
|
|
|
|
|
+ console.error('选择媒体文件失败:', err);
|
|
|
|
|
+ // 某些平台如果不兼容 chooseMedia,由开发者决定是否回退到 chooseImage/chooseVideo
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
@@ -543,8 +576,10 @@ export default {
|
|
|
orderId: this.orderId,
|
|
orderId: this.orderId,
|
|
|
photos: ossIds,
|
|
photos: ossIds,
|
|
|
content: this.modalRemark || '',
|
|
content: this.modalRemark || '',
|
|
|
- type: clockInType,
|
|
|
|
|
- title: this.currentTaskTitle
|
|
|
|
|
|
|
+ step: clockInType,
|
|
|
|
|
+ title: this.currentTaskTitle,
|
|
|
|
|
+ startFlag: Number(clockInType) === 1,
|
|
|
|
|
+ endFlag: Number(this.currentStep) === this.steps.length - 1
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
console.log('打卡数据:', clockInData);
|
|
console.log('打卡数据:', clockInData);
|
|
@@ -570,15 +605,24 @@ export default {
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
openSumModal() {
|
|
openSumModal() {
|
|
|
- // 初始化日期
|
|
|
|
|
- const now = new Date();
|
|
|
|
|
- const y = now.getFullYear();
|
|
|
|
|
- const m = String(now.getMonth() + 1).padStart(2, '0');
|
|
|
|
|
- const d = String(now.getDate()).padStart(2, '0');
|
|
|
|
|
- this.sumDate = `${y}/${m}/${d}`;
|
|
|
|
|
|
|
+ // 初始化日期:优先使用订单中的服务时间,如果没有则使用当前时间
|
|
|
|
|
+ let displayDate = '';
|
|
|
|
|
+ if (this.orderDetail.time) {
|
|
|
|
|
+ // 如果是带时间的字符串,只取日期部分
|
|
|
|
|
+ displayDate = this.orderDetail.time.split(' ')[0].replace(/-/g, '/');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const now = new Date();
|
|
|
|
|
+ const y = now.getFullYear();
|
|
|
|
|
+ const m = String(now.getMonth() + 1).padStart(2, '0');
|
|
|
|
|
+ const d = String(now.getDate()).padStart(2, '0');
|
|
|
|
|
+ displayDate = `${y}/${m}/${d}`;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.sumDate = displayDate;
|
|
|
|
|
|
|
|
- // 预设服务内容模板
|
|
|
|
|
- if (!this.sumContent) {
|
|
|
|
|
|
|
+ // 优先使用后端返回的小结,如果没有则判断本地是否有输入,都没有则使用预设服务内容模板
|
|
|
|
|
+ if (this.orderDetail.nursingSummary) {
|
|
|
|
|
+ this.sumContent = this.orderDetail.nursingSummary;
|
|
|
|
|
+ } else if (!this.sumContent) {
|
|
|
this.sumContent =
|
|
this.sumContent =
|
|
|
'1. 精神/身体状态:\n' +
|
|
'1. 精神/身体状态:\n' +
|
|
|
'2. 进食/饮水:\n' +
|
|
'2. 进食/饮水:\n' +
|
|
@@ -592,13 +636,97 @@ export default {
|
|
|
closeSumModal() {
|
|
closeSumModal() {
|
|
|
this.showSumModal = false;
|
|
this.showSumModal = false;
|
|
|
},
|
|
},
|
|
|
- submitSumModal() {
|
|
|
|
|
|
|
+ async submitSumModal() {
|
|
|
if (!this.sumContent.trim()) {
|
|
if (!this.sumContent.trim()) {
|
|
|
uni.showToast({ title: '请填写服务内容', icon: 'none' });
|
|
uni.showToast({ title: '请填写服务内容', icon: 'none' });
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- this.closeSumModal();
|
|
|
|
|
- uni.showToast({ title: '小结已提交', icon: 'success' });
|
|
|
|
|
|
|
+
|
|
|
|
|
+ uni.showLoading({ title: '提交中...', mask: true });
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await submitNursingSummary({
|
|
|
|
|
+ orderId: this.orderId,
|
|
|
|
|
+ content: this.sumContent
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ uni.hideLoading();
|
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
|
+ uni.showToast({ title: '小结已提交', icon: 'success' });
|
|
|
|
|
+ this.closeSumModal();
|
|
|
|
|
+ // 重新加载订单详情以获取最新的已保存数据
|
|
|
|
|
+ await this.loadOrderDetail();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ uni.showToast({ title: res.msg || '提交失败', icon: 'none' });
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (err) {
|
|
|
|
|
+ uni.hideLoading();
|
|
|
|
|
+ console.error('提交宠护小结失败:', err);
|
|
|
|
|
+ uni.showToast({ title: '提交失败,请重试', icon: 'none' });
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 检查是否为视频
|
|
|
|
|
+ */
|
|
|
|
|
+ isVideo(url) {
|
|
|
|
|
+ if (!url) return false;
|
|
|
|
|
+ const videoExts = ['.mp4', '.mov', '.m4v', '.3gp', '.avi', '.wmv'];
|
|
|
|
|
+ const lowerUrl = url.toLowerCase();
|
|
|
|
|
+ return videoExts.some(ext => lowerUrl.includes(ext));
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取视频封面图 (第一帧)
|
|
|
|
|
+ * 兼容阿里云、腾讯云等主流 OSS
|
|
|
|
|
+ */
|
|
|
|
|
+ getVideoPoster(url) {
|
|
|
|
|
+ if (!this.isVideo(url)) return url;
|
|
|
|
|
+
|
|
|
|
|
+ // 已经带了处理逻辑的直接返回
|
|
|
|
|
+ if (url.includes('?x-oss-process') || url.includes('?ci-process') || url.includes('?vframe')) {
|
|
|
|
|
+ return url;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 兼容性尝试:
|
|
|
|
|
+ // 1. 阿里云 OSS 截图: ?x-oss-process=video/snapshot,t_1,f_jpg,w_300,m_fast
|
|
|
|
|
+ // 2. 腾讯云 COS 截图: ?ci-process=snapshot&time=1
|
|
|
|
|
+ // 3. 七牛云 截图: ?vframe/jpg/offset/1
|
|
|
|
|
+
|
|
|
|
|
+ // 默认拼接多个参数(实际使用中通常只会生效一种,根据具体后端使用的服务决定)
|
|
|
|
|
+ // 这里为了通用,先猜测阿里的
|
|
|
|
|
+ const aliyun = `?x-oss-process=video/snapshot,t_1,f_jpg,w_300,m_fast`;
|
|
|
|
|
+ const tencent = `?ci-process=snapshot&time=1`;
|
|
|
|
|
+
|
|
|
|
|
+ // 如果后端没有特殊说明,我们根据域名简单判断或直接拼接(部分OSS支持第一个 ? 后的参数)
|
|
|
|
|
+ if (url.includes('myqcloud.com')) {
|
|
|
|
|
+ return url + tencent;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return url + aliyun;
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 统一预览媒体
|
|
|
|
|
+ */
|
|
|
|
|
+ previewMedia(medias, currentIdx) {
|
|
|
|
|
+ const url = medias[currentIdx];
|
|
|
|
|
+ if (this.isVideo(url)) {
|
|
|
|
|
+ // 如果是视频,播放视频
|
|
|
|
|
+ this.videoPlayerUrl = url;
|
|
|
|
|
+ this.videoPlayerShow = true;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 如果是图片,预览图片(过滤掉数组中的视频)
|
|
|
|
|
+ const imageUrls = medias.filter(m => !this.isVideo(m));
|
|
|
|
|
+ // 调整当前图片的索引
|
|
|
|
|
+ const currentImgUrl = url;
|
|
|
|
|
+ const newIdx = imageUrls.indexOf(currentImgUrl);
|
|
|
|
|
+
|
|
|
|
|
+ uni.previewImage({
|
|
|
|
|
+ current: newIdx >= 0 ? newIdx : 0,
|
|
|
|
|
+ urls: imageUrls
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ closeVideoPlayer() {
|
|
|
|
|
+ this.videoPlayerShow = false;
|
|
|
|
|
+ this.videoPlayerUrl = '';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|