!121 refactor: 重构MP模块

Merge pull request !121 from dhb52/dev
This commit is contained in:
芋道源码 2023-04-14 17:16:08 +00:00 committed by Gitee
commit a5a8773972
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
26 changed files with 552 additions and 835 deletions

12
.vscode/settings.json vendored
View File

@ -40,5 +40,15 @@
"i18n-ally.displayLanguage": "zh-CN", "i18n-ally.displayLanguage": "zh-CN",
"i18n-ally.enabledFrameworks": ["vue", "react"], "i18n-ally.enabledFrameworks": ["vue", "react"],
"god.tsconfig": "./tsconfig.json", "god.tsconfig": "./tsconfig.json",
"vue-i18n.i18nPaths": "src/locales" "vue-i18n.i18nPaths": "src/locales",
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": {
"*.ts": "$(capture).test.ts, $(capture).test.tsx",
"*.tsx": "$(capture).test.ts, $(capture).test.tsx",
"*.env": "$(capture).env.*",
"CHANGELOG.md": "CHANGELOG*",
"package.json": "pnpm-lock.yaml,pnpm-workspace.yaml,LICENSE,.gitattributes,.gitignore,.gitpod.yml,CNAME,README*,.npmrc,.browserslistrc,vite.config.*,windi.*,tailwind.*,tsconfig.*,postcss*",
".eslintrc.js": ".eslintignore,.eslintrc-*,.prettierignore,.stylelintignore,.commitlintrc.js,.prettierrc.js,.stylelint*,stylelint*,prettier.*,.editorconfig"
}
} }

View File

@ -32,7 +32,6 @@
"@form-create/element-ui": "^3.1.17", "@form-create/element-ui": "^3.1.17",
"@iconify/iconify": "^3.1.0", "@iconify/iconify": "^3.1.0",
"@videojs-player/vue": "^1.0.0", "@videojs-player/vue": "^1.0.0",
"@vueup/vue-quill": "^1.1.1",
"@vueuse/core": "^9.13.0", "@vueuse/core": "^9.13.0",
"@wangeditor/editor": "^5.1.23", "@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.10", "@wangeditor/editor-for-vue": "^5.1.10",

View File

@ -20,7 +20,7 @@ const props = defineProps({
editorId: propTypes.string.def('wangeEditor-1'), editorId: propTypes.string.def('wangeEditor-1'),
height: propTypes.oneOfType([Number, String]).def('500px'), height: propTypes.oneOfType([Number, String]).def('500px'),
editorConfig: { editorConfig: {
type: Object as PropType<IEditorConfig>, type: Object as PropType<Partial<IEditorConfig>>,
default: () => undefined default: () => undefined
}, },
readonly: propTypes.bool.def(false), readonly: propTypes.bool.def(false),
@ -147,6 +147,7 @@ const editorConfig = computed((): IEditorConfig => {
props.editorConfig || {} props.editorConfig || {}
) )
}) })
const editorStyle = computed(() => { const editorStyle = computed(() => {
return { return {
height: isNumber(props.height) ? `${props.height}px` : props.height height: isNumber(props.height) ? `${props.height}px` : props.height

View File

@ -111,7 +111,8 @@
> >
<el-divider direction="vertical" /> <el-divider direction="vertical" />
<el-button <el-button
type="text" type="primary"
link
style="color: #ff4d4f" style="color: #ff4d4f"
@click="removeFieldOptionItem(scope, scope.$index, 'enum')" @click="removeFieldOptionItem(scope, scope.$index, 'enum')"
>移除</el-button >移除</el-button
@ -143,7 +144,8 @@
> >
<el-divider direction="vertical" /> <el-divider direction="vertical" />
<el-button <el-button
type="text" type="primary"
link
style="color: #ff4d4f" style="color: #ff4d4f"
@click="removeFieldOptionItem(scope, scope.$index, 'constraint')" @click="removeFieldOptionItem(scope, scope.$index, 'constraint')"
>移除</el-button >移除</el-button
@ -174,7 +176,8 @@
> >
<el-divider direction="vertical" /> <el-divider direction="vertical" />
<el-button <el-button
type="text" type="primary"
link
style="color: #ff4d4f" style="color: #ff4d4f"
@click="removeFieldOptionItem(scope, scope.$index, 'property')" @click="removeFieldOptionItem(scope, scope.$index, 'property')"
>移除</el-button >移除</el-button

1
src/types/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
auto-*.d.ts

View File

@ -1,128 +0,0 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'
export {}
declare module '@vue/runtime-core' {
export interface GlobalComponents {
Backtop: typeof import('./../components/Backtop/src/Backtop.vue')['default']
ConfigGlobal: typeof import('./../components/ConfigGlobal/src/ConfigGlobal.vue')['default']
ContentDetailWrap: typeof import('./../components/ContentDetailWrap/src/ContentDetailWrap.vue')['default']
ContentWrap: typeof import('./../components/ContentWrap/src/ContentWrap.vue')['default']
CopperModal: typeof import('./../components/Cropper/src/CopperModal.vue')['default']
CountTo: typeof import('./../components/CountTo/src/CountTo.vue')['default']
Crontab: typeof import('./../components/Crontab/src/Crontab.vue')['default']
Cropper: typeof import('./../components/Cropper/src/Cropper.vue')['default']
CropperAvatar: typeof import('./../components/Cropper/src/CropperAvatar.vue')['default']
Descriptions: typeof import('./../components/Descriptions/src/Descriptions.vue')['default']
Dialog: typeof import('./../components/Dialog/src/Dialog.vue')['default']
DictTag: typeof import('./../components/DictTag/src/DictTag.vue')['default']
DocAlert: typeof import('./../components/DocAlert/index.vue')['default']
Echart: typeof import('./../components/Echart/src/Echart.vue')['default']
Editor: typeof import('./../components/Editor/src/Editor.vue')['default']
ElAlert: typeof import('element-plus/es')['ElAlert']
ElAutoResizer: typeof import('element-plus/es')['ElAutoResizer']
ElAvatar: typeof import('element-plus/es')['ElAvatar']
ElBadge: typeof import('element-plus/es')['ElBadge']
ElButton: typeof import('element-plus/es')['ElButton']
ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
ElCard: typeof import('element-plus/es')['ElCard']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup']
ElCol: typeof import('element-plus/es')['ElCol']
ElCollapse: typeof import('element-plus/es')['ElCollapse']
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
ElCollapseTransition: typeof import('element-plus/es')['ElCollapseTransition']
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
ElDialog: typeof import('element-plus/es')['ElDialog']
ElDivider: typeof import('element-plus/es')['ElDivider']
ElDrawer: typeof import('element-plus/es')['ElDrawer']
ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
ElementBaseInfo: typeof import('./../components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue')['default']
ElementForm: typeof import('./../components/bpmnProcessDesigner/package/penal/form/ElementForm.vue')['default']
ElementListeners: typeof import('./../components/bpmnProcessDesigner/package/penal/listeners/ElementListeners.vue')['default']
ElementMultiInstance: typeof import('./../components/bpmnProcessDesigner/package/penal/multi-instance/ElementMultiInstance.vue')['default']
ElementOtherConfig: typeof import('./../components/bpmnProcessDesigner/package/penal/other/ElementOtherConfig.vue')['default']
ElementProperties: typeof import('./../components/bpmnProcessDesigner/package/penal/properties/ElementProperties.vue')['default']
ElementTask: typeof import('./../components/bpmnProcessDesigner/package/penal/task/ElementTask.vue')['default']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElImage: typeof import('element-plus/es')['ElImage']
ElImageViewer: typeof import('element-plus/es')['ElImageViewer']
ElInput: typeof import('element-plus/es')['ElInput']
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
ElLink: typeof import('element-plus/es')['ElLink']
ElOption: typeof import('element-plus/es')['ElOption']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopover: typeof import('element-plus/es')['ElPopover']
ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElRow: typeof import('element-plus/es')['ElRow']
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElSkeleton: typeof import('element-plus/es')['ElSkeleton']
ElSpace: typeof import('element-plus/es')['ElSpace']
ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTableV2: typeof import('element-plus/es')['ElTableV2']
ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs']
ElTag: typeof import('element-plus/es')['ElTag']
ElTimeline: typeof import('element-plus/es')['ElTimeline']
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree']
ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
ElUpload: typeof import('element-plus/es')['ElUpload']
Error: typeof import('./../components/Error/src/Error.vue')['default']
FlowCondition: typeof import('./../components/bpmnProcessDesigner/package/penal/flow-condition/FlowCondition.vue')['default']
Form: typeof import('./../components/Form/src/Form.vue')['default']
Highlight: typeof import('./../components/Highlight/src/Highlight.vue')['default']
Icon: typeof import('./../components/Icon/src/Icon.vue')['default']
IconSelect: typeof import('./../components/Icon/src/IconSelect.vue')['default']
IFrame: typeof import('./../components/IFrame/src/IFrame.vue')['default']
ImageViewer: typeof import('./../components/ImageViewer/src/ImageViewer.vue')['default']
Infotip: typeof import('./../components/Infotip/src/Infotip.vue')['default']
InputPassword: typeof import('./../components/InputPassword/src/InputPassword.vue')['default']
Pagination: typeof import('./../components/Pagination/index.vue')['default']
ProcessDesigner: typeof import('./../components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue')['default']
ProcessPalette: typeof import('./../components/bpmnProcessDesigner/package/palette/ProcessPalette.vue')['default']
ProcessViewer: typeof import('./../components/bpmnProcessDesigner/package/designer/ProcessViewer.vue')['default']
PropertiesPanel: typeof import('./../components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue')['default']
Qrcode: typeof import('./../components/Qrcode/src/Qrcode.vue')['default']
ReceiveTask: typeof import('./../components/bpmnProcessDesigner/package/penal/task/task-components/ReceiveTask.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
ScriptTask: typeof import('./../components/bpmnProcessDesigner/package/penal/task/task-components/ScriptTask.vue')['default']
Search: typeof import('./../components/Search/src/Search.vue')['default']
SignalAndMessage: typeof import('./../components/bpmnProcessDesigner/package/penal/signal-message/SignalAndMessage.vue')['default']
Sticky: typeof import('./../components/Sticky/src/Sticky.vue')['default']
Table: typeof import('./../components/Table/src/Table.vue')['default']
Tooltip: typeof import('./../components/Tooltip/src/Tooltip.vue')['default']
UploadFile: typeof import('./../components/UploadFile/src/UploadFile.vue')['default']
UploadImg: typeof import('./../components/UploadFile/src/UploadImg.vue')['default']
UploadImgs: typeof import('./../components/UploadFile/src/UploadImgs.vue')['default']
UserTask: typeof import('./../components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue')['default']
UserTaskListeners: typeof import('./../components/bpmnProcessDesigner/package/penal/listeners/UserTaskListeners.vue')['default']
Verify: typeof import('./../components/Verifition/src/Verify.vue')['default']
VerifyPoints: typeof import('./../components/Verifition/src/Verify/VerifyPoints.vue')['default']
VerifySlide: typeof import('./../components/Verifition/src/Verify/VerifySlide.vue')['default']
XButton: typeof import('./../components/XButton/src/XButton.vue')['default']
XTextButton: typeof import('./../components/XButton/src/XTextButton.vue')['default']
}
export interface ComponentCustomProperties {
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
}
}

View File

@ -1,76 +0,0 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-auto-import
export {}
declare global {
const DICT_TYPE: typeof import('@/utils/dict')['DICT_TYPE']
const EffectScope: typeof import('vue')['EffectScope']
const computed: typeof import('vue')['computed']
const createApp: typeof import('vue')['createApp']
const customRef: typeof import('vue')['customRef']
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
const defineComponent: typeof import('vue')['defineComponent']
const effectScope: typeof import('vue')['effectScope']
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope']
const h: typeof import('vue')['h']
const inject: typeof import('vue')['inject']
const isProxy: typeof import('vue')['isProxy']
const isReactive: typeof import('vue')['isReactive']
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
const markRaw: typeof import('vue')['markRaw']
const nextTick: typeof import('vue')['nextTick']
const onActivated: typeof import('vue')['onActivated']
const onBeforeMount: typeof import('vue')['onBeforeMount']
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
const onDeactivated: typeof import('vue')['onDeactivated']
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
const onMounted: typeof import('vue')['onMounted']
const onRenderTracked: typeof import('vue')['onRenderTracked']
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
const onScopeDispose: typeof import('vue')['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
const onUnmounted: typeof import('vue')['onUnmounted']
const onUpdated: typeof import('vue')['onUpdated']
const provide: typeof import('vue')['provide']
const reactive: typeof import('vue')['reactive']
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
const required: typeof import('@/utils/formRules')['required']
const resolveComponent: typeof import('vue')['resolveComponent']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
const useCrudSchemas: typeof import('@/hooks/web/useCrudSchemas')['useCrudSchemas']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars']
const useI18n: typeof import('@/hooks/web/useI18n')['useI18n']
const useLink: typeof import('vue-router')['useLink']
const useMessage: typeof import('@/hooks/web/useMessage')['useMessage']
const useRoute: typeof import('vue-router')['useRoute']
const useRouter: typeof import('vue-router')['useRouter']
const useSlots: typeof import('vue')['useSlots']
const useTable: typeof import('@/hooks/web/useTable')['useTable']
const useVxeCrudSchemas: typeof import('@/hooks/web/useVxeCrudSchemas')['useVxeCrudSchemas']
const useXTable: typeof import('@/hooks/web/useXTable')['useXTable']
const watch: typeof import('vue')['watch']
const watchEffect: typeof import('vue')['watchEffect']
const watchPostEffect: typeof import('vue')['watchPostEffect']
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
}
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode } from 'vue'
}

View File

@ -18,7 +18,8 @@
<el-col :span="24" style="padding-left: 10px; padding-right: 10px"> <el-col :span="24" style="padding-left: 10px; padding-right: 10px">
<el-form-item prop="tenantName" v-if="loginData.tenantEnable === 'true'"> <el-form-item prop="tenantName" v-if="loginData.tenantEnable === 'true'">
<el-input <el-input
type="text" type="primary"
link
v-model="loginData.loginForm.tenantName" v-model="loginData.loginForm.tenantName"
:placeholder="t('login.tenantNamePlaceholder')" :placeholder="t('login.tenantNamePlaceholder')"
:prefix-icon="iconHouse" :prefix-icon="iconHouse"

View File

@ -19,7 +19,8 @@
<el-col :span="24" style="padding-left: 10px; padding-right: 10px"> <el-col :span="24" style="padding-left: 10px; padding-right: 10px">
<el-form-item prop="tenantName" v-if="loginData.tenantEnable === 'true'"> <el-form-item prop="tenantName" v-if="loginData.tenantEnable === 'true'">
<el-input <el-input
type="text" type="primary"
link
v-model="loginData.loginForm.tenantName" v-model="loginData.loginForm.tenantName"
:placeholder="t('login.tenantNamePlaceholder')" :placeholder="t('login.tenantNamePlaceholder')"
:prefix-icon="iconHouse" :prefix-icon="iconHouse"

View File

@ -18,7 +18,8 @@
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-if="scope.row.formType === 10" v-if="scope.row.formType === 10"
type="text" type="primary"
link
@click="handleFormDetail(scope.row)" @click="handleFormDetail(scope.row)"
> >
<span>{{ scope.row.formName }}</span> <span>{{ scope.row.formName }}</span>

View File

@ -79,14 +79,16 @@
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-if="scope.row.formType === 10" v-if="scope.row.formType === 10"
type="text" type="primary"
link
@click="handleFormDetail(scope.row)" @click="handleFormDetail(scope.row)"
> >
<span>{{ scope.row.formName }}</span> <span>{{ scope.row.formName }}</span>
</el-button> </el-button>
<el-button <el-button
v-else-if="scope.row.formType === 20" v-else-if="scope.row.formType === 20"
type="text" type="primary"
link
@click="handleFormDetail(scope.row)" @click="handleFormDetail(scope.row)"
> >
<span>{{ scope.row.formCustomCreatePath }}</span> <span>{{ scope.row.formCustomCreatePath }}</span>

View File

@ -5,7 +5,7 @@
<ContentWrap> <ContentWrap>
<el-form class="-mb-15px" :model="queryParams" :inline="true" label-width="68px"> <el-form class="-mb-15px" :model="queryParams" :inline="true" label-width="68px">
<el-form-item label="公众号" prop="accountId"> <el-form-item label="公众号" prop="accountId">
<WxMpSelect @change="onAccountChanged" /> <WxAccountSelect @change="onAccountChanged" />
</el-form-item> </el-form-item>
</el-form> </el-form>
</ContentWrap> </ContentWrap>
@ -140,7 +140,7 @@
</el-table> </el-table>
<!-- 添加或修改自动回复的对话框 --> <!-- 添加或修改自动回复的对话框 -->
<el-dialog :title="title" v-model="showReplyFormDialog" width="800px" append-to-body> <el-dialog :title="title" v-model="showReplyFormDialog" width="800px" destroy-on-close>
<el-form ref="formRef" :model="replyForm" :rules="rules" label-width="80px"> <el-form ref="formRef" :model="replyForm" :rules="rules" label-width="80px">
<el-form-item label="消息类型" prop="requestMessageType" v-if="msgType === MsgType.Message"> <el-form-item label="消息类型" prop="requestMessageType" v-if="msgType === MsgType.Message">
<el-select v-model="replyForm.requestMessageType" placeholder="请选择"> <el-select v-model="replyForm.requestMessageType" placeholder="请选择">
@ -167,7 +167,7 @@
<el-input v-model="replyForm.requestKeyword" placeholder="请输入内容" clearable /> <el-input v-model="replyForm.requestKeyword" placeholder="请输入内容" clearable />
</el-form-item> </el-form-item>
<el-form-item label="回复消息"> <el-form-item label="回复消息">
<WxReplySelect :objData="objData" v-if="hackResetWxReplySelect" /> <WxReplySelect :objData="objData" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
@ -183,7 +183,7 @@ import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue'
import WxMusic from '@/views/mp/components/wx-music/main.vue' import WxMusic from '@/views/mp/components/wx-music/main.vue'
import WxNews from '@/views/mp/components/wx-news/main.vue' import WxNews from '@/views/mp/components/wx-news/main.vue'
import WxReplySelect from '@/views/mp/components/wx-reply/main.vue' import WxReplySelect from '@/views/mp/components/wx-reply/main.vue'
import WxMpSelect from '@/views/mp/components/WxMpSelect.vue' import WxAccountSelect from '@/views/mp/components/wx-account-select/main.vue'
import * as MpAutoReplyApi from '@/api/mp/autoReply' import * as MpAutoReplyApi from '@/api/mp/autoReply'
import { DICT_TYPE, getDictOptions } from '@/utils/dict' import { DICT_TYPE, getDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
@ -195,7 +195,7 @@ const message = useMessage()
const formRef = ref() const formRef = ref()
// Follow: Message: Keyword: // Follow: Message: Keyword:
// tab.name // tab.nameenumapi
enum MsgType { enum MsgType {
Follow = 1, Follow = 1,
Message = 2, Message = 2,
@ -277,9 +277,6 @@ const rules = {
requestMatch: [{ required: true, message: '请求的关键字的匹配不能为空', trigger: 'blur' }] requestMatch: [{ required: true, message: '请求的关键字的匹配不能为空', trigger: 'blur' }]
} }
// WxReplySelect
const hackResetWxReplySelect = ref(false)
const onAccountChanged = (id?: number) => { const onAccountChanged = (id?: number) => {
queryParams.accountId = id queryParams.accountId = id
getList() getList()
@ -314,7 +311,6 @@ const handleTabChange = (tabName: TabPaneName) => {
/** 新增按钮操作 */ /** 新增按钮操作 */
const handleAdd = () => { const handleAdd = () => {
reset() reset()
resetEditor()
// //
objData.value = { objData.value = {
type: 'text', type: 'text',
@ -328,7 +324,6 @@ const handleAdd = () => {
/** 修改按钮操作 */ /** 修改按钮操作 */
const handleUpdate = async (row: any) => { const handleUpdate = async (row: any) => {
reset() reset()
resetEditor()
const data = await MpAutoReplyApi.getAutoReply(row.id) const data = await MpAutoReplyApi.getAutoReply(row.id)
// //
@ -386,7 +381,7 @@ const handleSubmit = async () => {
} }
showReplyFormDialog.value = false showReplyFormDialog.value = false
getList() await getList()
} }
// //
@ -408,14 +403,6 @@ const cancel = () => {
reset() reset()
} }
// Editor
const resetEditor = () => {
hackResetWxReplySelect.value = false //
nextTick(() => {
hackResetWxReplySelect.value = true //
})
}
const handleDelete = async (row) => { const handleDelete = async (row) => {
await message.confirm('是否确认删除此数据?') await message.confirm('是否确认删除此数据?')
await MpAutoReplyApi.deleteAutoReply(row.id) await MpAutoReplyApi.deleteAutoReply(row.id)

View File

@ -1,36 +0,0 @@
<template>
<el-select v-model="account.id" placeholder="请选择公众号" class="!w-240px" @change="onChanged">
<el-option v-for="item in accountList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</template>
<!-- TODO @芋艿WxMpSelect 改成 WxAccountSelect然后挪到现有的 wx-account-select 包下 -->
<script lang="ts" setup name="WxMpSelect">
import * as MpAccountApi from '@/api/mp/account'
const account: MpAccountApi.AccountVO = reactive({
id: undefined,
name: ''
})
const accountList: Ref<MpAccountApi.AccountVO[]> = ref([])
const emit = defineEmits<{
(e: 'change', id?: number, name?: string): void
}>()
onMounted(() => {
handleQuery()
})
const handleQuery = async () => {
accountList.value = await MpAccountApi.getSimpleAccountList()
//
if (accountList.value.length > 0) {
account.id = accountList.value[0].id
emit('change', account.id, account.name)
}
}
const onChanged = () => {
emit('change', account.id, account.name)
}
</script>

View File

@ -1,29 +1,21 @@
<template> <template>
<el-form class="-mb-15px" ref="queryFormRef" :inline="true" label-width="68px"> <el-select v-model="account.id" placeholder="请选择公众号" class="!w-240px" @change="onChanged">
<el-form-item label="公众号" prop="accountId">
<!-- TODO 芋艿需要将 el-form el-select 解耦 -->
<el-select
v-model="accountId"
placeholder="请选择公众号"
class="!w-240px"
@change="accountChanged()"
>
<el-option v-for="item in accountList" :key="item.id" :label="item.name" :value="item.id" /> <el-option v-for="item in accountList" :key="item.id" :label="item.name" :value="item.id" />
</el-select> </el-select>
</el-form-item>
<el-form-item>
<slot name="actions"></slot>
</el-form-item>
</el-form>
</template> </template>
<script setup name="WxAccountSelect"> <script lang="ts" setup name="WxAccountSelect">
import * as MpAccountApi from '@/api/mp/account' import * as MpAccountApi from '@/api/mp/account'
const accountId = ref()
const accountList = ref([])
const queryFormRef = ref()
const emit = defineEmits(['change']) const account: MpAccountApi.AccountVO = reactive({
id: undefined,
name: ''
})
const accountList: Ref<MpAccountApi.AccountVO[]> = ref([])
const emit = defineEmits<{
(e: 'change', id?: number, name?: string): void
}>()
onMounted(() => { onMounted(() => {
handleQuery() handleQuery()
@ -33,12 +25,12 @@ const handleQuery = async () => {
accountList.value = await MpAccountApi.getSimpleAccountList() accountList.value = await MpAccountApi.getSimpleAccountList()
// //
if (accountList.value.length > 0) { if (accountList.value.length > 0) {
accountId.value = accountList.value[0].id account.id = accountList.value[0].id
emit('change', accountId.value) emit('change', account.id, account.name)
} }
} }
const accountChanged = () => { const onChanged = () => {
emit('change', accountId.value) emit('change', account.id, account.name)
} }
</script> </script>

View File

@ -1,104 +0,0 @@
<script setup>
import { ref, reactive } from 'vue'
import { getAccessToken } from '@/utils/auth'
import { Editor } from '@/components/Editor'
const BASE_URL = import.meta.env.VITE_BASE_URL
const actionUrl = BASE_URL + '/admin-api/mp/material/upload-news-image' //
const headers = { Authorization: 'Bearer ' + getAccessToken() } //
const message = useMessage()
const props = defineProps({
/* 公众号账号编号 */
accountId: {
type: Number,
required: true
},
/* 编辑器的内容 */
value: {
type: String,
default: ''
},
/* 图片大小 */
maxSize: {
type: Number,
default: 4000 // kb
}
})
const emit = defineEmits(['input'])
const myQuillEditorRef = ref()
const content = ref(props.value.replace(/data-src/g, 'src'))
const loading = ref(false) // loadingfalse,
const uploadData = reactive({
type: 'image', // TODO thumb
accountId: props.accountId
})
const onEditorChange = (text) => {
//
emit('input', text)
}
//
const beforeUpload = () => {
// loading
loading.value = true
}
//
// 访
const uploadSuccess = (res) => {
// res
//
const quill = myQuillEditorRef.value.quill
//
const link = res.data
if (link) {
//
let length = quill.getSelection().index
// res.info
quill.insertEmbed(length, 'image', link)
//
quill.setSelection(length + 1)
} else {
message.error('图片插入失败')
}
// loading
loading.value = false
}
//
const uploadError = () => {
// loading
loading.value = false
message.error('图片插入失败')
}
</script>
<template>
<div id="wxEditor">
<div v-loading="loading" element-loading-text="请稍等,图片上传中">
<!-- 图片上传组件辅助-->
<el-upload
class="avatar-uploader"
name="file"
:action="actionUrl"
:headers="headers"
:show-file-list="false"
:data="uploadData"
:on-success="uploadSuccess"
:on-error="uploadError"
:before-upload="beforeUpload"
/>
<Editor
editor-id="wxEditor"
ref="quillEditorRef"
:modelValue="content"
@change="(editor) => onEditorChange(editor.getText())"
/>
</div>
</div>
</template>

View File

@ -1,45 +0,0 @@
const toolbarOptions = [
['bold', 'italic', 'underline', 'strike'], // 加粗 斜体 下划线 删除线
['blockquote', 'code-block'], // 引用 代码块
[{ header: 1 }, { header: 2 }], // 1、2 级标题
[{ list: 'ordered' }, { list: 'bullet' }], // 有序、无序列表
[{ script: 'sub' }, { script: 'super' }], // 上标/下标
[{ indent: '-1' }, { indent: '+1' }], // 缩进
// [{'direction': 'rtl'}], // 文本方向
[{ size: ['small', false, 'large', 'huge'] }], // 字体大小
[{ header: [1, 2, 3, 4, 5, 6, false] }], // 标题
[{ color: [] }, { background: [] }], // 字体颜色、字体背景颜色
[{ font: [] }], // 字体种类
[{ align: [] }], // 对齐方式
['clean'], // 清除文本格式
['link', 'image', 'video'] // 链接、图片、视频
]
export default {
theme: 'snow',
placeholder: '请输入文章内容',
modules: {
toolbar: {
container: toolbarOptions,
// container: "#toolbar",
handlers: {
image: function (value) {
if (value) {
// 触发input框选择图片文件
document.querySelector('.avatar-uploader input').click()
} else {
this.quill.format('image', false)
}
},
link: function (value) {
if (value) {
const href = prompt('注意!只支持公众号图文链接')
this.quill.format('link', href)
} else {
this.quill.format('link', false)
}
}
}
}
}
}

View File

@ -231,7 +231,7 @@
:on-success="handleUploadSuccess" :on-success="handleUploadSuccess"
> >
<template #trigger> <template #trigger>
<el-button type="text">本地上传</el-button> <el-button type="primary" link>本地上传</el-button>
</template> </template>
<el-button type="primary" link @click="openMaterial" style="margin-left: 5px" <el-button type="primary" link @click="openMaterial" style="margin-left: 5px"
>素材库选择 >素材库选择

View File

@ -0,0 +1,72 @@
import { IEditorConfig } from '@wangeditor/editor'
import { getAccessToken, getTenantId } from '@/utils/auth'
const message = useMessage()
type InsertFnType = (url: string, alt: string, href: string) => void
export const createEditorConfig = (
server: string,
accountId: number | undefined
): Partial<IEditorConfig> => {
return {
MENU_CONF: {
['uploadImage']: {
server,
// 单个文件的最大体积限制,默认为 2M
maxFileSize: 5 * 1024 * 1024,
// 最多可上传几个文件,默认为 100
maxNumberOfFiles: 10,
// 选择文件时的类型限制,默认为 ['image/*'] 。如不想限制,则设置为 []
allowedFileTypes: ['image/*'],
// 自定义上传参数,例如传递验证的 token 等。参数会被添加到 formData 中,一起上传到服务端。
meta: { accountId: accountId },
// 将 meta 拼接到 url 参数中,默认 false
metaWithUrl: true,
// 自定义增加 http header
headers: {
Accept: '*',
Authorization: 'Bearer ' + getAccessToken(),
'tenant-id': getTenantId()
},
// 跨域是否传递 cookie ,默认为 false
withCredentials: true,
// 超时时间,默认为 10 秒
timeout: 5 * 1000, // 5 秒
// form-data fieldName后端接口参数名称默认值wangeditor-uploaded-image
fieldName: 'file',
// 上传之前触发
onBeforeUpload(file: File) {
console.log(file)
return file
},
// 上传进度的回调函数
onProgress(progress: number) {
// progress 是 0-100 的数字
console.log('progress', progress)
},
onSuccess(file: File, res: any) {
console.log('onSuccess', file, res)
},
onFailed(file: File, res: any) {
message.alertError(res.message)
console.log('onFailed', file, res)
},
onError(file: File, err: any, res: any) {
message.alertError(err.message)
console.error('onError', file, err, res)
},
// 自定义插入图片
customInsert(res: any, insertFn: InsertFnType) {
insertFn(res.data, 'image', res.data)
}
}
}
}
}

View File

@ -11,7 +11,7 @@
label-width="68px" label-width="68px"
> >
<el-form-item label="公众号" prop="accountId"> <el-form-item label="公众号" prop="accountId">
<WxMpSelect @change="onAccountChanged" /> <WxAccountSelect @change="onAccountChanged" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" plain @click="handleAdd" v-hasPermi="['mp:draft:create']"> <el-button type="primary" plain @click="handleAdd" v-hasPermi="['mp:draft:create']">
@ -71,12 +71,12 @@
<el-dialog <el-dialog
:title="operateMaterial === 'add' ? '新建图文' : '修改图文'" :title="operateMaterial === 'add' ? '新建图文' : '修改图文'"
width="80%" width="80%"
top="20px"
v-model="dialogNewsVisible" v-model="dialogNewsVisible"
:before-close="dialogNewsClose" :before-close="dialogNewsClose"
:close-on-click-modal="false" destroy-on-close
> >
<div class="left"> <el-container>
<el-aside width="40%">
<div class="select-item"> <div class="select-item">
<div v-for="(news, index) in articlesAdd" :key="news.id"> <div v-for="(news, index) in articlesAdd" :key="news.id">
<div <div
@ -111,7 +111,7 @@
class="material-img" class="material-img"
v-if="news.thumbUrl" v-if="news.thumbUrl"
:src="news.thumbUrl" :src="news.thumbUrl"
height="100%" width="100%"
/> />
</div> </div>
</div> </div>
@ -146,14 +146,15 @@
</el-button> </el-button>
</el-row> </el-row>
</div> </div>
</div> </el-aside>
<div class="right" v-loading="addMaterialLoading" v-if="articlesAdd.length > 0"> <el-main>
<br /> <div class="" v-loading="addMaterialLoading" v-if="articlesAdd.length > 0">
<br />
<br />
<br />
<!-- 标题作者原文地址 --> <!-- 标题作者原文地址 -->
<el-input v-model="articlesAdd[isActiveAddNews].title" placeholder="请输入标题(必填)" /> <el-row :gutter="20">
<el-input
v-model="articlesAdd[isActiveAddNews].title"
placeholder="请输入标题(必填)"
/>
<el-input <el-input
v-model="articlesAdd[isActiveAddNews].author" v-model="articlesAdd[isActiveAddNews].author"
placeholder="请输入作者" placeholder="请输入作者"
@ -164,15 +165,17 @@
placeholder="请输入原文地址" placeholder="请输入原文地址"
style="margin-top: 5px" style="margin-top: 5px"
/> />
</el-row>
<!-- 封面和摘要 --> <!-- 封面和摘要 -->
<div class="input-tt">封面和摘要</div> <el-row :gutter="20">
<div> <el-col :span="12">
<p>封面:</p>
<div class="thumb-div"> <div class="thumb-div">
<img <el-image
class="material-img"
v-if="articlesAdd[isActiveAddNews].thumbUrl" v-if="articlesAdd[isActiveAddNews].thumbUrl"
style="width: 300px; max-height: 300px"
:src="articlesAdd[isActiveAddNews].thumbUrl" :src="articlesAdd[isActiveAddNews].thumbUrl"
:class="isActiveAddNews === 0 ? 'avatar' : 'avatar1'" fit="contain"
/> />
<Icon <Icon
v-else v-else
@ -202,11 +205,18 @@
>素材库选择</el-button >素材库选择</el-button
> >
<template #tip> <template #tip>
<div class="el-upload__tip">支持 bmp/png/jpeg/jpg/gif 格式大小不超过 2M</div> <div class="el-upload__tip"
>支持 bmp/png/jpeg/jpg/gif 格式大小不超过 2M</div
>
</template> </template>
</el-upload> </el-upload>
</div> </div>
<el-dialog title="选择图片" v-model="dialogImageVisible" width="80%" append-to-body> <el-dialog
title="选择图片"
v-model="dialogImageVisible"
width="80%"
append-to-body
>
<WxMaterialSelect <WxMaterialSelect
ref="materialSelectRef" ref="materialSelectRef"
:objData="{ type: 'image', accountId: queryParams.accountId }" :objData="{ type: 'image', accountId: queryParams.accountId }"
@ -214,6 +224,9 @@
/> />
</el-dialog> </el-dialog>
</div> </div>
</el-col>
<el-col :span="12">
<p>摘要:</p>
<el-input <el-input
:rows="8" :rows="8"
type="textarea" type="textarea"
@ -221,18 +234,19 @@
placeholder="请输入摘要" placeholder="请输入摘要"
class="digest" class="digest"
maxlength="120" maxlength="120"
style="float: right"
/> />
</div> </el-col>
</el-row>
<!--富文本编辑器组件--> <!--富文本编辑器组件-->
<el-row> <el-row>
<WxEditor <Editor
v-model="articlesAdd[isActiveAddNews].content" v-model="articlesAdd[isActiveAddNews].content"
:account-id="uploadData.accountId" :editor-config="editorConfig"
v-if="hackResetEditor"
/> />
</el-row> </el-row>
</div> </div>
</el-main>
</el-container>
<template #footer> <template #footer>
<el-button @click="dialogNewsVisible = false"> </el-button> <el-button @click="dialogNewsVisible = false"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -242,16 +256,19 @@
</template> </template>
<script setup lang="ts" name="MpDraft"> <script setup lang="ts" name="MpDraft">
import WxEditor from '@/views/mp/components/wx-editor/WxEditor.vue' import { Editor } from '@/components/Editor'
import WxNews from '@/views/mp/components/wx-news/main.vue' import WxNews from '@/views/mp/components/wx-news/main.vue'
import WxMaterialSelect from '@/views/mp/components/wx-material-select/main.vue' import WxMaterialSelect from '@/views/mp/components/wx-material-select/main.vue'
import WxMpSelect from '@/views/mp/components/WxMpSelect.vue' import WxAccountSelect from '@/views/mp/components/wx-account-select/main.vue'
import { getAccessToken } from '@/utils/auth' import { getAccessToken } from '@/utils/auth'
import * as MpDraftApi from '@/api/mp/draft' import * as MpDraftApi from '@/api/mp/draft'
import * as MpFreePublishApi from '@/api/mp/freePublish' import * as MpFreePublishApi from '@/api/mp/freePublish'
import type { UploadFiles, UploadProps, UploadRawFile } from 'element-plus' import type { UploadFiles, UploadProps, UploadRawFile } from 'element-plus'
import { createEditorConfig } from './editor-config'
// API // API
// import drafts from './mock' import drafts from './mock'
import { IEditorConfig } from '@wangeditor/editor'
const message = useMessage() // const message = useMessage() //
const loading = ref(true) // const loading = ref(true) //
@ -285,14 +302,25 @@ const uploadData: UploadData = reactive({
}) })
// ========== 稿 or ========== // ========== 稿 or ==========
interface Article {
title: string
thumbMediaId: string
author: string
digest: string
showCoverPic: string
content: string
contentSourceUrl: string
needOpenComment: string
onlyFansCanComment: string
thumbUrl: string
}
const dialogNewsVisible = ref(false) const dialogNewsVisible = ref(false)
const addMaterialLoading = ref(false) // 稿 loading const addMaterialLoading = ref(false) // 稿 loading
const articlesAdd = ref<any[]>([]) const articlesAdd = ref<Article[]>([])
const isActiveAddNews = ref(0) const isActiveAddNews = ref(0)
const dialogImageVisible = ref(false) const dialogImageVisible = ref(false)
const operateMaterial = ref<'add' | 'edit'>('add') const operateMaterial = ref<'add' | 'edit'>('add')
const articlesMediaId = ref('') const articlesMediaId = ref('')
const hackResetEditor = ref(false)
/** 侦听公众号变化 **/ /** 侦听公众号变化 **/
const onAccountChanged = (id?: number) => { const onAccountChanged = (id?: number) => {
@ -305,13 +333,16 @@ const onAccountChanged = (id?: number) => {
const setAccountId = (id?: number) => { const setAccountId = (id?: number) => {
queryParams.accountId = id queryParams.accountId = id
uploadData.accountId = id uploadData.accountId = id
editorConfig.value = createEditorConfig(uploadUrl, queryParams.accountId)
} }
const editorConfig = ref<Partial<IEditorConfig>>({})
/** 查询列表 */ /** 查询列表 */
const getList = async () => { const getList = async () => {
loading.value = true loading.value = true
try { try {
const drafts = await MpDraftApi.getDraftPage(queryParams) // const drafts = await MpDraftApi.getDraftPage(queryParams)
drafts.list.forEach((item) => { drafts.list.forEach((item) => {
const newsItem = item.content.newsItem const newsItem = item.content.newsItem
// thumbUrl picUrl wx-news // thumbUrl picUrl wx-news
@ -329,7 +360,6 @@ const getList = async () => {
// ======================== /稿 ======================== // ======================== /稿 ========================
/** 新增按钮操作 */ /** 新增按钮操作 */
const handleAdd = () => { const handleAdd = () => {
resetEditor()
reset() reset()
// //
operateMaterial.value = 'add' operateMaterial.value = 'add'
@ -338,7 +368,6 @@ const handleAdd = () => {
/** 更新按钮操作 */ /** 更新按钮操作 */
const handleUpdate = (item: any) => { const handleUpdate = (item: any) => {
resetEditor()
reset() reset()
articlesMediaId.value = item.mediaId articlesMediaId.value = item.mediaId
articlesAdd.value = JSON.parse(JSON.stringify(item.content.newsItem)) articlesAdd.value = JSON.parse(JSON.stringify(item.content.newsItem))
@ -370,7 +399,6 @@ const dialogNewsClose = async (onDone: () => {}) => {
try { try {
await message.confirm('修改内容可能还未保存,确定关闭吗?') await message.confirm('修改内容可能还未保存,确定关闭吗?')
reset() reset()
resetEditor()
onDone() onDone()
} catch {} } catch {}
} }
@ -381,14 +409,6 @@ const reset = () => {
articlesAdd.value = [buildEmptyArticle()] articlesAdd.value = [buildEmptyArticle()]
} }
// Editor
const resetEditor = () => {
hackResetEditor.value = false //
nextTick(() => {
hackResetEditor.value = true //
})
}
// //
const downNews = (index: number) => { const downNews = (index: number) => {
let temp = articlesAdd.value[index] let temp = articlesAdd.value[index]
@ -398,8 +418,8 @@ const downNews = (index: number) => {
} }
// //
const upNews = (index) => { const upNews = (index: number) => {
let temp = articlesAdd.value[index] const temp = articlesAdd.value[index]
articlesAdd.value[index] = articlesAdd.value[index - 1] articlesAdd.value[index] = articlesAdd.value[index - 1]
articlesAdd.value[index - 1] = temp articlesAdd.value[index - 1] = temp
isActiveAddNews.value = index - 1 isActiveAddNews.value = index - 1
@ -407,7 +427,6 @@ const upNews = (index) => {
// index // index
const activeNews = (index: number) => { const activeNews = (index: number) => {
resetEditor()
isActiveAddNews.value = index isActiveAddNews.value = index
} }
@ -429,7 +448,7 @@ const plusNews = () => {
} }
// article // article
const buildEmptyArticle = () => { const buildEmptyArticle = (): Article => {
return { return {
title: '', title: '',
thumbMediaId: '', thumbMediaId: '',
@ -455,8 +474,8 @@ const beforeThumbImageUpload: UploadProps['beforeUpload'] = (rawFile: UploadRawF
addMaterialLoading.value = false addMaterialLoading.value = false
return false return false
} }
const isLt = rawFile.size / 1024 / 1024 < 2
if (!isLt) { if (rawFile.size / 1024 / 1024 > 2) {
message.error('上传图片大小不能超过 2M!') message.error('上传图片大小不能超过 2M!')
addMaterialLoading.value = false addMaterialLoading.value = false
return false return false
@ -465,10 +484,10 @@ const beforeThumbImageUpload: UploadProps['beforeUpload'] = (rawFile: UploadRawF
return true return true
} }
const handleUploadSuccess: UploadProps['onSuccess'] = (response: any) => { const handleUploadSuccess: UploadProps['onSuccess'] = (res: any) => {
addMaterialLoading.value = false addMaterialLoading.value = false
if (response.code !== 0) { if (res.code !== 0) {
message.error('上传出错:' + response.msg) message.error('上传出错:' + res.msg)
return false return false
} }
@ -476,8 +495,8 @@ const handleUploadSuccess: UploadProps['onSuccess'] = (response: any) => {
fileList.value = [] fileList.value = []
// 稿 // 稿
articlesAdd.value[isActiveAddNews.value].thumbMediaId = response.data.mediaId articlesAdd.value[isActiveAddNews.value].thumbMediaId = res.data.mediaId
articlesAdd.value[isActiveAddNews.value].thumbUrl = response.data.url articlesAdd.value[isActiveAddNews.value].thumbUrl = res.data.url
} }
// or 稿 // or 稿
@ -502,7 +521,7 @@ const handlePublish = async (item: any) => {
await message.confirm(content) await message.confirm(content)
await MpFreePublishApi.submitFreePublish(accountId, mediaId) await MpFreePublishApi.submitFreePublish(accountId, mediaId)
message.notifySuccess('发布成功') message.notifySuccess('发布成功')
getList() await getList()
} catch {} } catch {}
} }
@ -514,7 +533,7 @@ const handleDelete = async (item: any) => {
await message.confirm('此操作将永久删除该草稿, 是否继续?') await message.confirm('此操作将永久删除该草稿, 是否继续?')
await MpDraftApi.deleteDraft(accountId, mediaId) await MpDraftApi.deleteDraft(accountId, mediaId)
message.notifySuccess('删除成功') message.notifySuccess('删除成功')
getList() await getList()
} catch {} } catch {}
} }
</script> </script>
@ -535,6 +554,13 @@ const handleDelete = async (item: any) => {
padding-top: 5px; padding-top: 5px;
} }
.el-row {
margin-bottom: 20px;
}
.el-row:last-child {
margin-bottom: 0;
}
.item-name { .item-name {
font-size: 12px; font-size: 12px;
overflow: hidden; overflow: hidden;
@ -548,35 +574,33 @@ const handleDelete = async (item: any) => {
} }
/*新增图文*/ /*新增图文*/
.left { // .left {
display: inline-block; // display: inline-block;
width: 35%; // vertical-align: top;
vertical-align: top; // margin-top: 200px;
margin-top: 200px; // }
}
.right { // .right {
display: inline-block; // display: inline-block;
width: 60%; // width: 100%;
margin-top: -40px; // }
}
.avatar-uploader { // .avatar-uploader {
width: 20%; // width: 20%;
display: inline-block; // display: inline-block;
} // }
.avatar-uploader .el-upload { // .avatar-uploader .el-upload {
border-radius: 6px; // border-radius: 6px;
cursor: pointer; // cursor: pointer;
position: relative; // position: relative;
overflow: hidden; // overflow: hidden;
text-align: unset !important; // text-align: unset !important;
} // }
.avatar-uploader .el-upload:hover { // .avatar-uploader .el-upload:hover {
border-color: #165dff; // border-color: #165dff;
} // }
.avatar-uploader-icon { .avatar-uploader-icon {
border: 1px solid #d9d9d9; border: 1px solid #d9d9d9;
@ -599,7 +623,7 @@ const handleDelete = async (item: any) => {
} }
.digest { .digest {
width: 60%; width: 100%;
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
} }
@ -620,28 +644,16 @@ const handleDelete = async (item: any) => {
border: 1px solid #eaeaea; border: 1px solid #eaeaea;
} }
p {
line-height: 30px;
}
@media (min-width: 992px) and (max-width: 1300px) { @media (min-width: 992px) and (max-width: 1300px) {
.waterfall { .waterfall {
column-count: 3; column-count: 3;
} }
p {
color: red;
}
} }
@media (min-width: 768px) and (max-width: 991px) { @media (min-width: 768px) and (max-width: 991px) {
.waterfall { .waterfall {
column-count: 2; column-count: 2;
} }
p {
color: orange;
}
} }
@media (max-width: 767px) { @media (max-width: 767px) {
@ -707,10 +719,6 @@ p {
background-color: #acadae; background-color: #acadae;
} }
.input-tt {
padding: 5px;
}
.activeAddNews { .activeAddNews {
border: 5px solid #2bb673; border: 5px solid #2bb673;
} }
@ -747,7 +755,7 @@ p {
.thumb-div { .thumb-div {
display: inline-block; display: inline-block;
width: 30%; width: 100%;
text-align: center; text-align: center;
} }

View File

@ -11,7 +11,7 @@
label-width="68px" label-width="68px"
> >
<el-form-item label="公众号" prop="accountId"> <el-form-item label="公众号" prop="accountId">
<WxMpSelect @change="onAccountChanged" /> <WxAccountSelect @change="onAccountChanged" />
</el-form-item> </el-form-item>
</el-form> </el-form>
</ContentWrap> </ContentWrap>
@ -51,7 +51,7 @@
<script lang="ts" setup name="MpFreePublish"> <script lang="ts" setup name="MpFreePublish">
import * as FreePublishApi from '@/api/mp/freePublish' import * as FreePublishApi from '@/api/mp/freePublish'
import WxNews from '@/views/mp/components/wx-news/main.vue' import WxNews from '@/views/mp/components/wx-news/main.vue'
import WxMpSelect from '@/views/mp/components/WxMpSelect.vue' import WxAccountSelect from '@/views/mp/components/wx-account-select/main.vue'
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //

View File

@ -4,7 +4,7 @@
<ContentWrap> <ContentWrap>
<el-form class="-mb-15px" :inline="true" label-width="68px"> <el-form class="-mb-15px" :inline="true" label-width="68px">
<el-form-item label="公众号" prop="accountId"> <el-form-item label="公众号" prop="accountId">
<WxMpSelect @change="onAccountChanged" /> <WxAccountSelect @change="onAccountChanged" />
</el-form-item> </el-form-item>
</el-form> </el-form>
</ContentWrap> </ContentWrap>
@ -248,7 +248,7 @@
<script lang="ts" setup name="MpMaterial"> <script lang="ts" setup name="MpMaterial">
import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue' import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue'
import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue' import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue'
import WxMpSelect from '@/views/mp/components/WxMpSelect.vue' import WxAccountSelect from '@/views/mp/components/wx-account-select/main.vue'
import * as MpMaterialApi from '@/api/mp/material' import * as MpMaterialApi from '@/api/mp/material'
import * as authUtil from '@/utils/auth' import * as authUtil from '@/utils/auth'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'

View File

@ -4,7 +4,7 @@
<ContentWrap> <ContentWrap>
<el-form class="-mb-15px" ref="queryFormRef" :inline="true" label-width="68px"> <el-form class="-mb-15px" ref="queryFormRef" :inline="true" label-width="68px">
<el-form-item label="公众号" prop="accountId"> <el-form-item label="公众号" prop="accountId">
<WxMpSelect @change="onAccountChanged" /> <WxAccountSelect @change="onAccountChanged" />
</el-form-item> </el-form-item>
</el-form> </el-form>
</ContentWrap> </ContentWrap>
@ -192,7 +192,7 @@
import WxReplySelect from '@/views/mp/components/wx-reply/main.vue' import WxReplySelect from '@/views/mp/components/wx-reply/main.vue'
import WxNews from '@/views/mp/components/wx-news/main.vue' import WxNews from '@/views/mp/components/wx-news/main.vue'
import WxMaterialSelect from '@/views/mp/components/wx-material-select/main.vue' import WxMaterialSelect from '@/views/mp/components/wx-material-select/main.vue'
import WxMpSelect from '@/views/mp/components/WxMpSelect.vue' import WxAccountSelect from '@/views/mp/components/wx-account-select/main.vue'
import * as MpMenuApi from '@/api/mp/menu' import * as MpMenuApi from '@/api/mp/menu'
import { handleTree } from '@/utils/tree' import { handleTree } from '@/utils/tree'
import menuOptions from './menuOptions' import menuOptions from './menuOptions'

View File

@ -0,0 +1,147 @@
<template>
<div>
<el-table v-loading="props.loading" :data="props.list">
<el-table-column
label="发送时间"
align="center"
prop="createTime"
width="180"
:formatter="dateFormatter"
/>
<el-table-column label="消息类型" align="center" prop="type" width="80" />
<el-table-column label="发送方" align="center" prop="sendFrom" width="80">
<template #default="scope">
<el-tag v-if="scope.row.sendFrom === 1" type="success">粉丝</el-tag>
<el-tag v-else type="info">公众号</el-tag>
</template>
</el-table-column>
<el-table-column label="用户标识" align="center" prop="openid" width="300" />
<el-table-column label="内容" prop="content">
<template #default="scope">
<!-- 事件区域 -->
<div v-if="scope.row.type === MsgType.Event && scope.row.event === 'subscribe'">
<el-tag type="success">关注</el-tag>
</div>
<div v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'unsubscribe'">
<el-tag type="danger">取消关注</el-tag>
</div>
<div v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'CLICK'">
<el-tag>点击菜单</el-tag>
{{ scope.row.eventKey }}
</div>
<div v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'VIEW'">
<el-tag>点击菜单链接</el-tag>
{{ scope.row.eventKey }}
</div>
<div
v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'scancode_waitmsg'"
>
<el-tag>扫码结果</el-tag>
{{ scope.row.eventKey }}
</div>
<div v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'scancode_push'">
<el-tag>扫码结果</el-tag>
{{ scope.row.eventKey }}
</div>
<div v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'pic_sysphoto'">
<el-tag>系统拍照发图</el-tag>
</div>
<div
v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'pic_photo_or_album'"
>
<el-tag>拍照或者相册</el-tag>
</div>
<div v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'pic_weixin'">
<el-tag>微信相册</el-tag>
</div>
<div
v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'location_select'"
>
<el-tag>选择地理位置</el-tag>
</div>
<div v-else-if="scope.row.type === MsgType.Event">
<el-tag type="danger">未知事件类型</el-tag>
</div>
<!-- 消息区域 -->
<div v-else-if="scope.row.type === MsgType.Text">{{ scope.row.content }}</div>
<div v-else-if="scope.row.type === MsgType.Voice">
<wx-voice-player :url="scope.row.mediaUrl" :content="scope.row.recognition" />
</div>
<div v-else-if="scope.row.type === MsgType.Image">
<a target="_blank" :href="scope.row.mediaUrl">
<img :src="scope.row.mediaUrl" style="width: 100px" />
</a>
</div>
<div v-else-if="scope.row.type === MsgType.Video || scope.row.type === 'shortvideo'">
<wx-video-player :url="scope.row.mediaUrl" style="margin-top: 10px" />
</div>
<div v-else-if="scope.row.type === MsgType.Link">
<el-tag>链接</el-tag>
<a :href="scope.row.url" target="_blank">{{ scope.row.title }}</a>
</div>
<div v-else-if="scope.row.type === MsgType.Location">
<WxLocation
:label="scope.row.label"
:location-y="scope.row.locationY"
:location-x="scope.row.locationX"
/>
</div>
<div v-else-if="scope.row.type === MsgType.Music">
<WxMusic
:title="scope.row.title"
:description="scope.row.description"
:thumb-media-url="scope.row.thumbMediaUrl"
:music-url="scope.row.musicUrl"
:hq-music-url="scope.row.hqMusicUrl"
/>
</div>
<div v-else-if="scope.row.type === MsgType.News">
<WxNews :articles="scope.row.articles" />
</div>
<div v-else>
<el-tag type="danger">未知消息类型</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button
link
type="primary"
@click="emit('send', scope.row.userId)"
v-hasPermi="['mp:message:send']"
>
消息
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
</div>
</template>
<script setup lang="ts">
import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue'
import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue'
import WxLocation from '@/views/mp/components/wx-location/main.vue'
import WxMusic from '@/views/mp/components/wx-music/main.vue'
import WxNews from '@/views/mp/components/wx-news/main.vue'
import { dateFormatter } from '@/utils/formatTime'
import { MsgType } from '@/views/mp/components/wx-msg/types'
const props = defineProps({
list: {
type: Array,
required: true
},
loading: {
type: Boolean,
required: true
}
})
const emit = defineEmits<{ (e: 'send', v: number) }>()
</script>
<style scoped></style>

View File

@ -9,7 +9,7 @@
label-width="68px" label-width="68px"
> >
<el-form-item label="公众号" prop="accountId"> <el-form-item label="公众号" prop="accountId">
<WxMpSelect @change="onAccountChanged" /> <WxAccountSelect @change="onAccountChanged" />
</el-form-item> </el-form-item>
<el-form-item label="消息类型" prop="type"> <el-form-item label="消息类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择消息类型" class="!w-240px"> <el-select v-model="queryParams.type" placeholder="请选择消息类型" class="!w-240px">
@ -58,124 +58,7 @@
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list"> <DataGrid :list="list" :loading="loading" @send="handleSend" />
<el-table-column
label="发送时间"
align="center"
prop="createTime"
width="180"
:formatter="dateFormatter"
/>
<el-table-column label="消息类型" align="center" prop="type" width="80" />
<el-table-column label="发送方" align="center" prop="sendFrom" width="80">
<template #default="scope">
<el-tag v-if="scope.row.sendFrom === 1" type="success">粉丝</el-tag>
<el-tag v-else type="info">公众号</el-tag>
</template>
</el-table-column>
<el-table-column label="用户标识" align="center" prop="openid" width="300" />
<el-table-column label="内容" prop="content">
<template #default="scope">
<!-- 事件区域 -->
<div v-if="scope.row.type === MsgType.Event && scope.row.event === 'subscribe'">
<el-tag type="success">关注</el-tag>
</div>
<div v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'unsubscribe'">
<el-tag type="danger">取消关注</el-tag>
</div>
<div v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'CLICK'">
<el-tag>点击菜单</el-tag>
{{ scope.row.eventKey }}
</div>
<div v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'VIEW'">
<el-tag>点击菜单链接</el-tag>
{{ scope.row.eventKey }}
</div>
<div
v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'scancode_waitmsg'"
>
<el-tag>扫码结果</el-tag>
{{ scope.row.eventKey }}
</div>
<div v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'scancode_push'">
<el-tag>扫码结果</el-tag>
{{ scope.row.eventKey }}
</div>
<div v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'pic_sysphoto'">
<el-tag>系统拍照发图</el-tag>
</div>
<div
v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'pic_photo_or_album'"
>
<el-tag>拍照或者相册</el-tag>
</div>
<div v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'pic_weixin'">
<el-tag>微信相册</el-tag>
</div>
<div
v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'location_select'"
>
<el-tag>选择地理位置</el-tag>
</div>
<div v-else-if="scope.row.type === MsgType.Event">
<el-tag type="danger">未知事件类型</el-tag>
</div>
<!-- 消息区域 -->
<div v-else-if="scope.row.type === MsgType.Text">{{ scope.row.content }}</div>
<div v-else-if="scope.row.type === MsgType.Voice">
<wx-voice-player :url="scope.row.mediaUrl" :content="scope.row.recognition" />
</div>
<div v-else-if="scope.row.type === MsgType.Image">
<a target="_blank" :href="scope.row.mediaUrl">
<img :src="scope.row.mediaUrl" style="width: 100px" />
</a>
</div>
<div v-else-if="scope.row.type === MsgType.Video || scope.row.type === 'shortvideo'">
<wx-video-player :url="scope.row.mediaUrl" style="margin-top: 10px" />
</div>
<div v-else-if="scope.row.type === MsgType.Link">
<el-tag>链接</el-tag>
<a :href="scope.row.url" target="_blank">{{ scope.row.title }}</a>
</div>
<div v-else-if="scope.row.type === MsgType.Location">
<WxLocation
:label="scope.row.label"
:location-y="scope.row.locationY"
:location-x="scope.row.locationX"
/>
</div>
<div v-else-if="scope.row.type === MsgType.Music">
<WxMusic
:title="scope.row.title"
:description="scope.row.description"
:thumb-media-url="scope.row.thumbMediaUrl"
:music-url="scope.row.musicUrl"
:hq-music-url="scope.row.hqMusicUrl"
/>
</div>
<div v-else-if="scope.row.type === MsgType.News">
<WxNews :articles="scope.row.articles" />
</div>
<div v-else>
<el-tag type="danger">未知消息类型</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button
link
type="primary"
@click="handleSend(scope.row)"
v-hasPermi="['mp:message:send']"
>
消息
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<Pagination <Pagination
v-show="total > 0" v-show="total > 0"
:total="total" :total="total"
@ -183,37 +66,31 @@
v-model:limit="queryParams.pageSize" v-model:limit="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
</ContentWrap>
<!-- 发送消息的弹窗 --> <!-- 发送消息的弹窗 -->
<el-dialog <el-dialog
title="粉丝消息列表" title="粉丝消息列表"
v-model="showMessageBox" v-model="messageBox.show"
@click="showMessageBox = true" @click="messageBox.show = true"
width="50%" width="50%"
destroy-on-close
> >
<template #footer> <WxMsg :user-id="messageBox.userId" />
<WxMsg :user-id="userId" v-if="showMessageBox" />
</template>
</el-dialog> </el-dialog>
</ContentWrap>
</template> </template>
<script setup lang="ts" name="MpMessage"> <script setup lang="ts" name="MpMessage">
import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue'
import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue'
import WxMsg from '@/views/mp/components/wx-msg/main.vue'
import WxLocation from '@/views/mp/components/wx-location/main.vue'
import WxMusic from '@/views/mp/components/wx-music/main.vue'
import WxNews from '@/views/mp/components/wx-news/main.vue'
import WxMpSelect from '@/views/mp/components/WxMpSelect.vue'
import * as MpMessageApi from '@/api/mp/message' import * as MpMessageApi from '@/api/mp/message'
import WxMsg from '@/views/mp/components/wx-msg/main.vue'
import WxAccountSelect from '@/views/mp/components/wx-account-select/main.vue'
import DataGrid from './DataGrid.vue'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import { MsgType } from '@/views/mp/components/wx-msg/types' import { MsgType } from '@/views/mp/components/wx-msg/types'
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
const loading = ref(true) // const loading = ref(false)
const total = ref(0) // const total = ref(0) //
const list = ref<any[]>([]) // const list = ref<any[]>([]) //
// //
interface QueryParams { interface QueryParams {
@ -233,8 +110,12 @@ const queryParams: QueryParams = reactive({
createTime: [] createTime: []
}) })
const queryFormRef = ref<FormInstance | null>(null) // const queryFormRef = ref<FormInstance | null>(null) //
const showMessageBox = ref(false) //
const userId = ref(0) // //
const messageBox = reactive({
show: false,
userId: 0
})
/** 侦听accountId */ /** 侦听accountId */
const onAccountChanged = (id?: number) => { const onAccountChanged = (id?: number) => {
@ -243,6 +124,11 @@ const onAccountChanged = (id?: number) => {
} }
/** 查询列表 */ /** 查询列表 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
const getList = async () => { const getList = async () => {
try { try {
loading.value = true loading.value = true
@ -254,14 +140,9 @@ const getList = async () => {
} }
} }
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */ /** 重置按钮操作 */
const resetQuery = async () => { const resetQuery = async () => {
// accountIdreset
const accountId = queryParams.accountId const accountId = queryParams.accountId
queryFormRef.value?.resetFields() queryFormRef.value?.resetFields()
queryParams.accountId = accountId queryParams.accountId = accountId
@ -269,8 +150,8 @@ const resetQuery = async () => {
} }
/** 打开消息发送窗口 */ /** 打开消息发送窗口 */
const handleSend = async (row: any) => { const handleSend = async (userId: number) => {
userId.value = row.userId messageBox.userId = userId
showMessageBox.value = true messageBox.show = true
} }
</script> </script>

View File

@ -11,7 +11,7 @@
label-width="68px" label-width="68px"
> >
<el-form-item label="公众号" prop="accountId"> <el-form-item label="公众号" prop="accountId">
<WxMpSelect @change="onAccountChanged" /> <WxAccountSelect @change="onAccountChanged" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" plain @click="openForm('create')" v-hasPermi="['mp:tag:create']"> <el-button type="primary" plain @click="openForm('create')" v-hasPermi="['mp:tag:create']">
@ -74,7 +74,7 @@
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import * as MpTagApi from '@/api/mp/tag' import * as MpTagApi from '@/api/mp/tag'
import TagForm from './TagForm.vue' import TagForm from './TagForm.vue'
import WxMpSelect from '@/views/mp/components/WxMpSelect.vue' import WxAccountSelect from '@/views/mp/components/wx-account-select/main.vue'
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //

View File

@ -11,7 +11,7 @@
label-width="68px" label-width="68px"
> >
<el-form-item label="公众号" prop="accountId"> <el-form-item label="公众号" prop="accountId">
<WxMpSelect @change="onAccountChanged" /> <WxAccountSelect @change="onAccountChanged" />
</el-form-item> </el-form-item>
<el-form-item label="用户标识" prop="openid"> <el-form-item label="用户标识" prop="openid">
<el-input <el-input
@ -97,7 +97,7 @@
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import * as MpUserApi from '@/api/mp/user' import * as MpUserApi from '@/api/mp/user'
import * as MpTagApi from '@/api/mp/tag' import * as MpTagApi from '@/api/mp/tag'
import WxMpSelect from '@/views/mp/components/WxMpSelect.vue' import WxAccountSelect from '@/views/mp/components/wx-account-select/main.vue'
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import UserForm from './UserForm.vue' import UserForm from './UserForm.vue'