线上营销
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import request from '@/utils/request'
|
||||
import request from "@/util/oaRequest"
|
||||
|
||||
// 查询发件人邮箱账号管理列表
|
||||
export function listEmailAccount(query) {
|
||||
|
||||
35
api/oa/oss.js
Normal file
35
api/oa/oss.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import request from "@/util/oaRequest"
|
||||
|
||||
// 查询OSS对象存储列表
|
||||
export function listOss(query) {
|
||||
return request({
|
||||
url: '/system/oss/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询OSS对象基于id串
|
||||
export function listByIds(ossId) {
|
||||
return request({
|
||||
url: '/system/oss/listByIds/' + ossId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询OSS对象基于id串
|
||||
export function download(ossId) {
|
||||
return request({
|
||||
url: '/system/oss/download/' + ossId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 删除OSS对象存储
|
||||
export function delOss(ossId) {
|
||||
return request({
|
||||
url: '/system/oss/' + ossId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
161
components/Quill/Quill.vue
Normal file
161
components/Quill/Quill.vue
Normal file
@@ -0,0 +1,161 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="page-body">
|
||||
<view class='wrapper'>
|
||||
<view class='toolbar'>
|
||||
<uni-icons type="bars" size="26" :color="formats.bold ? activeColor : ''" @tap.native="formatIcon('bold')" />
|
||||
<uni-icons type="font" size="26" :color="formats.italic ? activeColor : ''" @tap.native="formatIcon('italic')" />
|
||||
<uni-icons type="down" size="26" :color="formats.underline ? activeColor : ''" @tap.native="formatIcon('underline')" />
|
||||
<uni-icons type="close" size="26" :color="formats.strike ? activeColor : ''" @tap.native="formatIcon('strike')" />
|
||||
<uni-icons type="trash" size="26" @tap.native="clear" />
|
||||
<uni-icons type="undo" size="26" @tap.native="undo" />
|
||||
<uni-icons type="redo" size="26" @tap.native="redo" />
|
||||
<uni-icons type="clear" size="26" @tap.native="removeFormat" />
|
||||
</view>
|
||||
<view class="editor-wrapper">
|
||||
<editor id="editor" class="ql-container" placeholder="开始输入..." show-img-size show-img-toolbar show-img-resize
|
||||
:read-only="readOnly" @statuschange="onStatusChange" @input="onInput" @ready="onEditorReady" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'QuillEditor',
|
||||
props: {
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
readOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formats: {},
|
||||
editorCtx: null,
|
||||
activeColor: '#2979ff'
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'uni-icons': () => import('@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue')
|
||||
},
|
||||
// watch: {
|
||||
// value(val) {
|
||||
// // 外部v-model变化时同步内容
|
||||
// if (this.editorCtx) {
|
||||
// this.editorCtx.setContents({ html: val });
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
mounted() {
|
||||
// #ifndef MP-BAIDU
|
||||
uni.loadFontFace({
|
||||
family: 'Pacifico',
|
||||
source: 'url("https://sungd.github.io/Pacifico.ttf")'
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
methods: {
|
||||
onEditorReady() {
|
||||
// #ifdef MP-BAIDU
|
||||
this.editorCtx = requireDynamicLib('editorLib').createEditorContext('editor');
|
||||
// #endif
|
||||
// #ifdef APP-PLUS || MP-WEIXIN || H5
|
||||
uni.createSelectorQuery().select('#editor').context((res) => {
|
||||
this.editorCtx = res.context;
|
||||
// 初始化内容
|
||||
if (this.value) {
|
||||
this.editorCtx.setContents({ html: this.value });
|
||||
}
|
||||
}).exec();
|
||||
// #endif
|
||||
},
|
||||
onInput(e) {
|
||||
// 触发v-model
|
||||
this.$emit('input', e.detail.html);
|
||||
this.$emit('update:value', e.detail.html);
|
||||
},
|
||||
undo() {
|
||||
this.editorCtx && this.editorCtx.undo();
|
||||
},
|
||||
redo() {
|
||||
this.editorCtx && this.editorCtx.redo();
|
||||
},
|
||||
// uni-icons点击格式化
|
||||
formatIcon(name) {
|
||||
if (!name) return;
|
||||
this.editorCtx && this.editorCtx.format(name);
|
||||
},
|
||||
onStatusChange(e) {
|
||||
this.formats = e.detail;
|
||||
},
|
||||
insertDivider() {
|
||||
this.editorCtx && this.editorCtx.insertDivider({
|
||||
success: function() {
|
||||
// divider inserted
|
||||
}
|
||||
});
|
||||
},
|
||||
clear() {
|
||||
uni.showModal({
|
||||
title: '清空编辑器',
|
||||
content: '确定清空编辑器全部内容?',
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
this.editorCtx && this.editorCtx.clear();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
removeFormat() {
|
||||
this.editorCtx && this.editorCtx.removeFormat();
|
||||
},
|
||||
insertDate() {
|
||||
const date = new Date();
|
||||
const formatDate = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
|
||||
this.editorCtx && this.editorCtx.insertText({ text: formatDate });
|
||||
},
|
||||
insertImage() {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
success: (res) => {
|
||||
this.editorCtx && this.editorCtx.insertImage({
|
||||
src: res.tempFilePaths[0],
|
||||
alt: '图像'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
width: 100%;
|
||||
}
|
||||
.toolbar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
background: #f7f7f7;
|
||||
border-radius: 8rpx 8rpx 0 0;
|
||||
padding: 8rpx 0;
|
||||
font-size: 40rpx;
|
||||
}
|
||||
.ql-active {
|
||||
color: #2979ff;
|
||||
}
|
||||
.editor-wrapper {
|
||||
min-height: 300rpx;
|
||||
background: #fff;
|
||||
border-radius: 0 0 8rpx 8rpx;
|
||||
border: 1rpx solid #eee;
|
||||
padding: 12rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -1,37 +1,198 @@
|
||||
<template>
|
||||
<view>
|
||||
<oa-file-upload @choose="onFileChoose" />
|
||||
<view v-if="fileInfo">
|
||||
已选择文件:{{ fileInfo.name }}
|
||||
</view>
|
||||
<button @click="test">测试下载</button>
|
||||
</view>
|
||||
<view class="app-container">
|
||||
<uni-forms ref="sendEmailFormRef" :model="sendEmailForm" label-width="80" label-position="top">
|
||||
<uni-forms-item label="发件人" name="emailAccountId" required>
|
||||
<uni-data-select v-model="sendEmailForm.emailAccountId" :localdata="senderOptions" placeholder="请选择发件人邮箱账号" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="选择联系人" name="toList" required>
|
||||
<input class="uni-input" v-model="contactSearch" placeholder="搜索公司名/邮箱" style="margin-bottom: 12rpx;" @input="onContactSearchInput" />
|
||||
<view class="checkbox-scroll-container">
|
||||
<uni-data-checkbox multiple v-model="sendEmailForm.toList" :localdata="contactOptions" />
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="邮件主题" name="subject" required>
|
||||
<input class="uni-input" v-model="sendEmailForm.subject" placeholder="请输入邮件主题" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="邮件正文" name="content" required>
|
||||
<Quill v-model="sendEmailForm.content" :min-height="192" />
|
||||
</uni-forms-item>
|
||||
<view class="form-actions">
|
||||
<button type="primary" :loading="sendEmailLoading" @click="submitSendEmail" :disabled="sendEmailLoading">
|
||||
{{ sendEmailLoading ? '发送中...' : '发送' }}
|
||||
</button>
|
||||
<button @click="resetSendEmailForm" :disabled="sendEmailLoading">重置</button>
|
||||
</view>
|
||||
</uni-forms>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listFurnitureTable } from "@/api/oa/contact";
|
||||
import { listEmailAccount, sendEmail } from "@/api/oa/emailAccount";
|
||||
import { listByIds } from '@/api/oa/oss';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
fileInfo: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onFileChoose(file) {
|
||||
this.fileInfo = file;
|
||||
},
|
||||
test() {
|
||||
// 替换为你的下载地址
|
||||
const downloadUrl = 'http://47.117.71.33:11295/fadapp-update/fad.wgt';
|
||||
// #ifdef APP-PLUS
|
||||
plus.runtime.openURL(downloadUrl);
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
window.open(downloadUrl, '_blank');
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
}
|
||||
name: "SalesEmailPage",
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
furnitureTableList: [],
|
||||
emailAccountList: [],
|
||||
sendEmailLoading: false,
|
||||
sendEmailForm: {
|
||||
emailAccountId: 0,
|
||||
toList: [],
|
||||
subject: '',
|
||||
content: '',
|
||||
attachments: []
|
||||
},
|
||||
contactSearch: '',
|
||||
contactSearchTimer: null,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
contactOptions() {
|
||||
// 只显示有邮箱的联系人
|
||||
return this.furnitureTableList.filter(item => item.email).map(item => ({
|
||||
text: `${item.companyName}(${item.email})`,
|
||||
value: item.furnitureId,
|
||||
companyName: item.companyName,
|
||||
email: item.email
|
||||
}));
|
||||
},
|
||||
senderOptions() {
|
||||
return this.emailAccountList.map(item => ({
|
||||
text: item.email,
|
||||
value: item.emailId
|
||||
}));
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getEmailAccountList();
|
||||
},
|
||||
methods: {
|
||||
getList(keyword = '') {
|
||||
this.loading = true;
|
||||
const params = { pageNum: 1, pageSize: 100, qualityFilter: true };
|
||||
if (keyword) {
|
||||
params.companyName = keyword;
|
||||
}
|
||||
listFurnitureTable(params).then(response => {
|
||||
this.furnitureTableList = response.rows || [];
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
onContactSearchInput(e) {
|
||||
// 远程搜索防抖
|
||||
if (this.contactSearchTimer) clearTimeout(this.contactSearchTimer);
|
||||
this.contactSearchTimer = setTimeout(() => {
|
||||
this.getList(this.contactSearch.trim());
|
||||
}, 400);
|
||||
},
|
||||
getEmailAccountList() {
|
||||
listEmailAccount({ pageSize: 100 }).then(response => {
|
||||
this.emailAccountList = response.rows || [];
|
||||
});
|
||||
},
|
||||
// onSenderChange 已不需要
|
||||
resetSendEmailForm() {
|
||||
this.sendEmailForm = {
|
||||
emailAccountId: 0,
|
||||
toList: [],
|
||||
subject: '',
|
||||
content: '',
|
||||
attachments: []
|
||||
};
|
||||
},
|
||||
async submitSendEmail() {
|
||||
// 简单校验
|
||||
if (!this.sendEmailForm.emailAccountId && this.emailAccountList.length) {
|
||||
uni.showToast({ title: '请选择发件人', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!this.sendEmailForm.toList.length) {
|
||||
uni.showToast({ title: '请选择联系人邮箱', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!this.sendEmailForm.subject) {
|
||||
uni.showToast({ title: '请输入邮件主题', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!this.sendEmailForm.content) {
|
||||
uni.showToast({ title: '请输入邮件正文', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
this.sendEmailLoading = true;
|
||||
let attachmentPaths = [];
|
||||
if (this.sendEmailForm.attachments && this.sendEmailForm.attachments.length > 0) {
|
||||
try {
|
||||
const res = await listByIds(this.sendEmailForm.attachments);
|
||||
attachmentPaths = (res.data || []).map(item => item.url);
|
||||
} catch (e) {
|
||||
uni.showToast({ title: '附件获取失败', icon: 'none' });
|
||||
this.sendEmailLoading = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
const sendData = {
|
||||
emailAccountId: this.sendEmailForm.emailAccountId,
|
||||
toList: this.sendEmailForm.toList.join(','),
|
||||
subject: this.sendEmailForm.subject,
|
||||
content: this.sendEmailForm.content,
|
||||
contentType: 'html',
|
||||
furnitureIds: this.sendEmailForm.toList.join(','),
|
||||
attachments: attachmentPaths
|
||||
};
|
||||
uni.showLoading({ title: '正在发送...' });
|
||||
console.log('发送邮件数据:', sendData);
|
||||
sendEmail(sendData).then(response => {
|
||||
uni.showToast({ title: response.msg || '邮件发送成功!', icon: 'success' });
|
||||
this.resetSendEmailForm();
|
||||
}).catch((error) => {
|
||||
console.error('邮件发送失败:', error);
|
||||
uni.showToast({ title: '邮件发送失败,请检查网络连接或稍后重试', icon: 'none' });
|
||||
}).finally(() => {
|
||||
this.sendEmailLoading = false;
|
||||
uni.hideLoading();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
<style scoped>
|
||||
.app-container {
|
||||
padding: 24rpx;
|
||||
}
|
||||
.form-section {
|
||||
/* 已由uni-forms接管布局 */
|
||||
}
|
||||
.form-item {
|
||||
/* 已由uni-forms接管布局 */
|
||||
}
|
||||
.form-label {
|
||||
/* 已由uni-forms接管布局 */
|
||||
}
|
||||
.picker-value {
|
||||
/* 已由uni-forms接管布局 */
|
||||
}
|
||||
.form-actions {
|
||||
display: flex;
|
||||
gap: 24rpx;
|
||||
}
|
||||
.list-section {
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
padding: 24rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
|
||||
}
|
||||
.checkbox-scroll-container {
|
||||
max-height: 300rpx;
|
||||
overflow-y: auto;
|
||||
border: 1rpx solid #eee;
|
||||
border-radius: 8rpx;
|
||||
padding: 12rpx;
|
||||
background: #fafbfc;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user