发货方式优化及消息功能优化
This commit is contained in:
@@ -8,6 +8,8 @@ Page({
|
||||
data: {
|
||||
demandId: 0,
|
||||
remark: '',
|
||||
// 交付链接(Git仓库/网盘等持久获取方式),选填
|
||||
deliverLinks: '',
|
||||
// 开发完成凭证截图(软件成品展示图等)
|
||||
imageFiles: [],
|
||||
imageMax: 9,
|
||||
@@ -43,6 +45,19 @@ Page({
|
||||
this.setData({ remark: e.detail.value });
|
||||
},
|
||||
|
||||
// 交付链接变更
|
||||
onDeliverLinksChange(e) {
|
||||
this.setData({ deliverLinks: e.detail.value });
|
||||
},
|
||||
|
||||
// 交付链接(单个):只取第一行,避免粘贴时带入多余内容
|
||||
getDeliverLinks() {
|
||||
const link = String(this.data.deliverLinks || '')
|
||||
.split(/[\r\n]+/)[0]
|
||||
.trim();
|
||||
return link ? [link] : [];
|
||||
},
|
||||
|
||||
// 凭证截图选择成功
|
||||
// 注意:t-upload 绑定了 files,success 事件返回的是完整文件列表(含已选的旧文件),
|
||||
// 必须整体覆盖,不能往 imageFiles 里追加,否则已选图片会重复
|
||||
@@ -209,7 +224,7 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
// 表单验证
|
||||
// 表单验证:源码一般在沟通群交付,平台仅凭证截图必填,附件与链接选填
|
||||
validateForm() {
|
||||
const { imageFiles, attachFiles } = this.data;
|
||||
if (!imageFiles.length) {
|
||||
@@ -219,9 +234,17 @@ Page({
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (!attachFiles.length) {
|
||||
const links = this.getDeliverLinks();
|
||||
if (links.length > 1) {
|
||||
wx.showToast({
|
||||
title: '请上传源码或软件附件',
|
||||
title: '只能填写1个交付链接',
|
||||
icon: 'none'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (links.some(item => !/^https?:\/\//i.test(item))) {
|
||||
wx.showToast({
|
||||
title: '交付链接需以 http:// 或 https:// 开头',
|
||||
icon: 'none'
|
||||
});
|
||||
return false;
|
||||
@@ -251,6 +274,7 @@ Page({
|
||||
opType: 'deliverGoods',
|
||||
images: imageFiles.map(file => file.fullUrl || file.url),
|
||||
files: attachFiles.map(file => file.fullUrl || file.url),
|
||||
links: this.getDeliverLinks(),
|
||||
remark
|
||||
};
|
||||
demandOperate(params).then(
|
||||
|
||||
Reference in New Issue
Block a user