|
@@ -143,12 +143,13 @@
|
|
|
icon="el-icon-delete"
|
|
icon="el-icon-delete"
|
|
|
@click="handleDelete(scope.row)"
|
|
@click="handleDelete(scope.row)"
|
|
|
>删除</el-button>
|
|
>删除</el-button>
|
|
|
- <!-- 一键提取链接按钮 -->
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 提取链接按钮 -->
|
|
|
<el-button
|
|
<el-button
|
|
|
size="mini"
|
|
size="mini"
|
|
|
type="text"
|
|
type="text"
|
|
|
icon="el-icon-link"
|
|
icon="el-icon-link"
|
|
|
- @click="handleCopyLink(scope.row)"
|
|
|
|
|
|
|
+ @click="handleExtractLink(scope.row)"
|
|
|
>提取链接</el-button>
|
|
>提取链接</el-button>
|
|
|
<!-- 生成二维码按钮 -->
|
|
<!-- 生成二维码按钮 -->
|
|
|
<el-button
|
|
<el-button
|
|
@@ -165,6 +166,13 @@
|
|
|
style="color: #E6A23C;"
|
|
style="color: #E6A23C;"
|
|
|
@click="handleSendSms(scope.row)"
|
|
@click="handleSendSms(scope.row)"
|
|
|
>发送短信</el-button>
|
|
>发送短信</el-button>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ icon="el-icon-upload2"
|
|
|
|
|
+ style="color: #409EFF;"
|
|
|
|
|
+ @click="handleUploadPhones(scope.row)"
|
|
|
|
|
+ >上传电话批量生成短链</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
@@ -398,6 +406,105 @@
|
|
|
<el-button @click="smsDialog.visible = false">取 消</el-button>
|
|
<el-button @click="smsDialog.visible = false">取 消</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+ <!--上传电话号码弹窗 -->
|
|
|
|
|
+ <el-dialog
|
|
|
|
|
+ title="上传电话号码文件"
|
|
|
|
|
+ :visible.sync="uploadPhoneDialog.visible"
|
|
|
|
|
+ width="500px"
|
|
|
|
|
+ append-to-body
|
|
|
|
|
+ :close-on-click-modal="false"
|
|
|
|
|
+ :close-on-press-escape="false"
|
|
|
|
|
+ :show-close="!uploadPhoneDialog.loading"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div v-loading="uploadPhoneDialog.loading" element-loading-text="处理中...">
|
|
|
|
|
+ <p style="color: #909399; font-size: 14px; margin-bottom: 20px;">
|
|
|
|
|
+ 请上传 .xls 格式的文件,文件第一行为表头,第二列为电话号码。
|
|
|
|
|
+ <br/>
|
|
|
|
|
+ <strong>当前操作链接:</strong> {{ uploadPhoneDialog.rowData ? uploadPhoneDialog.rowData.linkName : '' }}
|
|
|
|
|
+ </p>
|
|
|
|
|
+ <el-upload
|
|
|
|
|
+ ref="upload"
|
|
|
|
|
+ class="upload-demo"
|
|
|
|
|
+ drag
|
|
|
|
|
+ action="#"
|
|
|
|
|
+ :http-request="handleHttpRequest"
|
|
|
|
|
+ :on-change="handleFileChange"
|
|
|
|
|
+ :before-upload="beforeUpload"
|
|
|
|
|
+ :show-file-list="true"
|
|
|
|
|
+ accept=".xls"
|
|
|
|
|
+ :limit="1"
|
|
|
|
|
+ :on-exceed="handleExceed"
|
|
|
|
|
+ >
|
|
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
|
|
+ <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
|
|
+ <div class="el-upload__tip" slot="tip">
|
|
|
|
|
+ 仅限 .xls 文件,大小不超过 5MB
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-upload>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
|
+ <el-button @click="uploadPhoneDialog.visible = false" :disabled="uploadPhoneDialog.loading">取 消</el-button>
|
|
|
|
|
+ <el-button type="primary" @click="startUpload" :loading="uploadPhoneDialog.loading">开始上传</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 提取链接弹窗 -->
|
|
|
|
|
+ <el-dialog
|
|
|
|
|
+ title="提取链接"
|
|
|
|
|
+ :visible.sync="extractLinkDialog.visible"
|
|
|
|
|
+ width="500px"
|
|
|
|
|
+ append-to-body
|
|
|
|
|
+ :close-on-click-modal="false"
|
|
|
|
|
+ @close="closeExtractLinkDialog"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div v-loading="extractLinkDialog.loading" element-loading-text="生成中...">
|
|
|
|
|
+ <el-form :model="extractLinkDialog" label-width="100px">
|
|
|
|
|
+ <el-form-item label="手机号码" required>
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="extractLinkDialog.phone"
|
|
|
|
|
+ placeholder="请输入手机号码"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ :disabled="extractLinkDialog.resultText !== ''"
|
|
|
|
|
+ />
|
|
|
|
|
+ <div class="el-form-item__tips" style="color: #909399; font-size: 12px; margin-top: 5px;">
|
|
|
|
|
+ 请输入11位手机号码
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="链接名称">
|
|
|
|
|
+ <span>{{ extractLinkDialog.rowData ? extractLinkDialog.rowData.linkName : '' }}</span>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 结果显示区域 -->
|
|
|
|
|
+ <el-form-item label="生成结果" v-if="extractLinkDialog.resultText">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ type="textarea"
|
|
|
|
|
+ :rows="4"
|
|
|
|
|
+ v-model="extractLinkDialog.resultText"
|
|
|
|
|
+ readonly
|
|
|
|
|
+ placeholder="生成的文本内容"
|
|
|
|
|
+ />
|
|
|
|
|
+ <div class="el-form-item__tips" style="color: #67C23A; font-size: 12px; margin-top: 5px;">
|
|
|
|
|
+ 点击下方按钮复制文本
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
|
+ <template v-if="!extractLinkDialog.resultText">
|
|
|
|
|
+ <el-button type="primary" @click="confirmExtractLink" :loading="extractLinkDialog.loading">
|
|
|
|
|
+ 确 定 生 成
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ <el-button @click="closeExtractLinkDialog">取 消</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-else>
|
|
|
|
|
+ <el-button type="success" @click="copyExtractResult">
|
|
|
|
|
+ <i class="el-icon-document-copy"></i> 复制文本
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ <el-button @click="closeExtractLinkDialog">关 闭</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -411,7 +518,9 @@ import {
|
|
|
getQwUserList,
|
|
getQwUserList,
|
|
|
getQwUserListByIds,
|
|
getQwUserListByIds,
|
|
|
qwUserCompanyList,
|
|
qwUserCompanyList,
|
|
|
- sendAcquisitionMessage
|
|
|
|
|
|
|
+ sendMessageLink,
|
|
|
|
|
+ batchCreateMessageLink,
|
|
|
|
|
+ extractLink
|
|
|
} from '@/api/qw/acquisitionAssistant'
|
|
} from '@/api/qw/acquisitionAssistant'
|
|
|
|
|
|
|
|
import QRCode from 'qrcodejs2'
|
|
import QRCode from 'qrcodejs2'
|
|
@@ -420,6 +529,20 @@ export default {
|
|
|
name: 'AcquisitionAssistant',
|
|
name: 'AcquisitionAssistant',
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
|
|
+ // 提取链接弹窗数据
|
|
|
|
|
+ extractLinkDialog: {
|
|
|
|
|
+ visible: false,
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ phone: '',
|
|
|
|
|
+ rowData: null,
|
|
|
|
|
+ resultText: ''
|
|
|
|
|
+ },
|
|
|
|
|
+ // 上传电话号码弹窗数据
|
|
|
|
|
+ uploadPhoneDialog: {
|
|
|
|
|
+ visible: false,
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ rowData: null,
|
|
|
|
|
+ },
|
|
|
// 遮罩层
|
|
// 遮罩层
|
|
|
loading: true,
|
|
loading: true,
|
|
|
userLoading: false,
|
|
userLoading: false,
|
|
@@ -539,6 +662,70 @@ export default {
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ /** 提取链接按钮操作 */
|
|
|
|
|
+ handleExtractLink(row) {
|
|
|
|
|
+ // 重置表单数据
|
|
|
|
|
+ this.extractLinkDialog = {
|
|
|
|
|
+ visible: true,
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ phone: '',
|
|
|
|
|
+ rowData: row,
|
|
|
|
|
+ resultText: ''
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /** 确认提取链接 */
|
|
|
|
|
+ confirmExtractLink() {
|
|
|
|
|
+ // 验证手机号码
|
|
|
|
|
+ const phone = this.extractLinkDialog.phone.trim()
|
|
|
|
|
+ if (!phone) {
|
|
|
|
|
+ this.$message.warning('请输入手机号码')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 验证手机号码格式
|
|
|
|
|
+ const phoneRegex = /^1[3-9]\d{9}$/
|
|
|
|
|
+ if (!phoneRegex.test(phone)) {
|
|
|
|
|
+ this.$message.warning('请输入正确的11位手机号码')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 发送请求
|
|
|
|
|
+ this.extractLinkDialog.loading = true
|
|
|
|
|
+
|
|
|
|
|
+ extractLink({
|
|
|
|
|
+ id: this.extractLinkDialog.rowData.id,
|
|
|
|
|
+ phone: phone,
|
|
|
|
|
+ url: this.extractLinkDialog.rowData.url
|
|
|
|
|
+ }).then(response => {
|
|
|
|
|
+ if (response.code === 200) {
|
|
|
|
|
+ // 修改这里:使用 response.msg 而不是 response.data
|
|
|
|
|
+ this.extractLinkDialog.resultText = response.msg
|
|
|
|
|
+ this.$message.success('短链接生成成功')
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$message.error(response.msg || '生成失败')
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(error => {
|
|
|
|
|
+ const errorMsg = error.response?.data?.msg || error.message || '生成失败'
|
|
|
|
|
+ this.$message.error(errorMsg)
|
|
|
|
|
+ }).finally(() => {
|
|
|
|
|
+ this.extractLinkDialog.loading = false
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /** 复制提取的链接文本 */
|
|
|
|
|
+ copyExtractResult() {
|
|
|
|
|
+ if (!this.extractLinkDialog.resultText) return
|
|
|
|
|
+
|
|
|
|
|
+ this.copyToClipboard(this.extractLinkDialog.resultText, '文本已复制到剪贴板')
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /** 关闭提取链接弹窗 */
|
|
|
|
|
+ closeExtractLinkDialog() {
|
|
|
|
|
+ this.extractLinkDialog.visible = false
|
|
|
|
|
+ this.extractLinkDialog.phone = ''
|
|
|
|
|
+ this.extractLinkDialog.resultText = ''
|
|
|
|
|
+ },
|
|
|
/** 获取完整链接 */
|
|
/** 获取完整链接 */
|
|
|
getFullUrl(row) {
|
|
getFullUrl(row) {
|
|
|
if (!row || !row.pageParam) return `${this.baseDomain}`
|
|
if (!row || !row.pageParam) return `${this.baseDomain}`
|
|
@@ -579,7 +766,6 @@ export default {
|
|
|
this.$message.error('复制失败,请手动复制')
|
|
this.$message.error('复制失败,请手动复制')
|
|
|
}
|
|
}
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
|
- console.error('复制失败:', err)
|
|
|
|
|
this.$message.error('复制失败,请手动复制')
|
|
this.$message.error('复制失败,请手动复制')
|
|
|
} finally {
|
|
} finally {
|
|
|
document.body.removeChild(textarea)
|
|
document.body.removeChild(textarea)
|
|
@@ -635,12 +821,9 @@ export default {
|
|
|
// 转换为 data URL
|
|
// 转换为 data URL
|
|
|
this.qrCodeDialog.dataUrl = canvas.toDataURL('image/png')
|
|
this.qrCodeDialog.dataUrl = canvas.toDataURL('image/png')
|
|
|
} else {
|
|
} else {
|
|
|
- // 如果使用 table 方式生成,尝试其他方法
|
|
|
|
|
- console.warn('未找到canvas元素,尝试其他方法')
|
|
|
|
|
this.$message.warning('二维码生成方式不支持保存为图片,请更新浏览器')
|
|
this.$message.warning('二维码生成方式不支持保存为图片,请更新浏览器')
|
|
|
}
|
|
}
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
|
- console.error('获取二维码图片失败:', err)
|
|
|
|
|
this.$message.error('生成二维码失败')
|
|
this.$message.error('生成二维码失败')
|
|
|
} finally {
|
|
} finally {
|
|
|
// 清理临时容器
|
|
// 清理临时容器
|
|
@@ -649,14 +832,12 @@ export default {
|
|
|
}
|
|
}
|
|
|
}, 100)
|
|
}, 100)
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
|
- console.error('生成二维码失败:', err)
|
|
|
|
|
this.$message.error('生成二维码失败')
|
|
this.$message.error('生成二维码失败')
|
|
|
document.body.removeChild(tempDiv)
|
|
document.body.removeChild(tempDiv)
|
|
|
this.qrCodeDialog.generating = false
|
|
this.qrCodeDialog.generating = false
|
|
|
}
|
|
}
|
|
|
}, 50)
|
|
}, 50)
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
- console.error('生成二维码失败:', error)
|
|
|
|
|
this.$message.error('生成二维码失败')
|
|
this.$message.error('生成二维码失败')
|
|
|
this.qrCodeDialog.generating = false
|
|
this.qrCodeDialog.generating = false
|
|
|
}
|
|
}
|
|
@@ -716,13 +897,12 @@ export default {
|
|
|
// 发送请求
|
|
// 发送请求
|
|
|
this.smsDialog.sending = true
|
|
this.smsDialog.sending = true
|
|
|
|
|
|
|
|
- sendAcquisitionMessage(this.smsDialog.linkId, phone)
|
|
|
|
|
|
|
+ sendMessageLink(this.smsDialog.linkId, phone)
|
|
|
.then(response => {
|
|
.then(response => {
|
|
|
this.$message.success('短信发送成功')
|
|
this.$message.success('短信发送成功')
|
|
|
this.smsDialog.visible = false
|
|
this.smsDialog.visible = false
|
|
|
})
|
|
})
|
|
|
.catch(error => {
|
|
.catch(error => {
|
|
|
- console.error('发送短信失败:', error)
|
|
|
|
|
const errorMsg = error.response?.data?.msg || error.message || '发送失败'
|
|
const errorMsg = error.response?.data?.msg || error.message || '发送失败'
|
|
|
this.$message.error(errorMsg)
|
|
this.$message.error(errorMsg)
|
|
|
})
|
|
})
|
|
@@ -981,7 +1161,6 @@ export default {
|
|
|
this.userLoading = false
|
|
this.userLoading = false
|
|
|
this.loadingMore = false
|
|
this.loadingMore = false
|
|
|
}).catch(error => {
|
|
}).catch(error => {
|
|
|
- console.error('搜索用户失败:', error)
|
|
|
|
|
this.userLoading = false
|
|
this.userLoading = false
|
|
|
this.loadingMore = false
|
|
this.loadingMore = false
|
|
|
})
|
|
})
|
|
@@ -1166,7 +1345,6 @@ export default {
|
|
|
this.form.userListParam = []
|
|
this.form.userListParam = []
|
|
|
}
|
|
}
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
- console.error('解析 userList 失败:', e)
|
|
|
|
|
this.form.userListParam = []
|
|
this.form.userListParam = []
|
|
|
}
|
|
}
|
|
|
} else if (Array.isArray(data.userList)) {
|
|
} else if (Array.isArray(data.userList)) {
|
|
@@ -1229,7 +1407,6 @@ export default {
|
|
|
this.open = true
|
|
this.open = true
|
|
|
this.title = '修改获客链接'
|
|
this.title = '修改获客链接'
|
|
|
}).catch(error => {
|
|
}).catch(error => {
|
|
|
- console.error('获取详情失败:', error)
|
|
|
|
|
this.msgError('获取详情失败')
|
|
this.msgError('获取详情失败')
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
@@ -1393,7 +1570,108 @@ export default {
|
|
|
this.userPage = 1
|
|
this.userPage = 1
|
|
|
this.hasMoreUsers = true
|
|
this.hasMoreUsers = true
|
|
|
this.resetForm('form')
|
|
this.resetForm('form')
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 处理上传电话号码按钮点击事件
|
|
|
|
|
+ */
|
|
|
|
|
+ handleUploadPhones(row) {
|
|
|
|
|
+ this.uploadPhoneDialog.rowData = row;
|
|
|
|
|
+ this.uploadPhoneDialog.visible = true;
|
|
|
|
|
+ // 重置加载状态,防止上次上传的loading状态残留
|
|
|
|
|
+ this.uploadPhoneDialog.loading = false;
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 自定义上传方法,供 el-upload 调用
|
|
|
|
|
+ */
|
|
|
|
|
+ handleHttpRequest(options) {
|
|
|
|
|
+ this.uploadFile(options);
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 上传文件到后端
|
|
|
|
|
+ */
|
|
|
|
|
+ async uploadFile(file) {
|
|
|
|
|
+ // 1. 构建FormData对象
|
|
|
|
|
+ const formData = new FormData();
|
|
|
|
|
+ formData.append('file', file.file);
|
|
|
|
|
+ formData.append('qwAcquisitionAssistantId', this.uploadPhoneDialog.rowData.id);
|
|
|
|
|
+ formData.append('qwAcquisitionAssistantUrl', this.uploadPhoneDialog.rowData.url);
|
|
|
|
|
+
|
|
|
|
|
+ this.uploadPhoneDialog.loading = true;
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ const response = await batchCreateMessageLink(formData);
|
|
|
|
|
+ if (response.code === 200) {
|
|
|
|
|
+ this.$message.success(response.msg || '批量生成短链成功!');
|
|
|
|
|
+ this.uploadPhoneDialog.visible = false;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$message.error(response.msg || '操作失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('上传文件请求失败:', error);
|
|
|
|
|
+ this.$message.error(error.message || '上传失败,请稍后重试');
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ // 5. 结束加载状态
|
|
|
|
|
+ this.uploadPhoneDialog.loading = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 上传文件前的钩子函数,可以做校验
|
|
|
|
|
+ */
|
|
|
|
|
+ beforeUpload(file) {
|
|
|
|
|
+ const isXLS = file.type === 'application/vnd.ms-excel';
|
|
|
|
|
+ const isXLSAlt = file.name.toLowerCase().endsWith('.xls'); // 有些浏览器可能检测不到MIME类型
|
|
|
|
|
+
|
|
|
|
|
+ if (!isXLS && !isXLSAlt) {
|
|
|
|
|
+ this.$message.error('上传文件只能是 .xls 格式!');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return true; // 返回true才继续上传
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 上传成功后的回调
|
|
|
|
|
+ */
|
|
|
|
|
+ handleUploadSuccess(response, file, fileList) {
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 上传失败后的回调
|
|
|
|
|
+ */
|
|
|
|
|
+ handleUploadError(error, file, fileList) {
|
|
|
|
|
+ console.error('文件上传失败:', error);
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 文件状态改变时的钩子,添加文件、上传成功和失败都会被调用
|
|
|
|
|
+ * @param {Object} file - 文件对象
|
|
|
|
|
+ * @param {Array} fileList - 文件列表
|
|
|
|
|
+ */
|
|
|
|
|
+ handleFileChange(file, fileList) {
|
|
|
|
|
+ console.log('文件列表发生变化:', fileList);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 文件超出个数限制时的钩子
|
|
|
|
|
+ */
|
|
|
|
|
+ handleExceed(files, fileList) {
|
|
|
|
|
+ this.$message.warning(`最多只能上传 1 个文件!`);
|
|
|
|
|
+ console.warn('文件数量超出限制,当前文件:', files, '文件列表:', fileList);
|
|
|
|
|
+ },
|
|
|
|
|
+ /** 开始上传按钮点击事件 */
|
|
|
|
|
+ startUpload() {
|
|
|
|
|
+ // 获取 el-upload 组件实例
|
|
|
|
|
+ const uploadComponent = this.$refs.upload;
|
|
|
|
|
+ if (uploadComponent) {
|
|
|
|
|
+ // 如果有文件队列,开始上传
|
|
|
|
|
+ if (uploadComponent.uploadFiles && uploadComponent.uploadFiles.length > 0) {
|
|
|
|
|
+ uploadComponent.submit();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$message.warning('请先选择要上传的文件');
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$message.warning('请先选择要上传的文件');
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
@@ -1463,4 +1741,9 @@ export default {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
justify-content: center;
|
|
justify-content: center;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+/* 上传弹窗样式 */
|
|
|
|
|
+.upload-demo {
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|