feat: antd菜单模块迁移
This commit is contained in:
@@ -4,9 +4,9 @@ VITE_PORT=5666
|
||||
VITE_BASE=/
|
||||
|
||||
# 请求路径
|
||||
VITE_BASE_URL=http://127.0.0.1:48080
|
||||
VITE_BASE_URL=http://47.103.66.220:48080
|
||||
# 接口地址
|
||||
VITE_GLOB_API_URL=/admin-api
|
||||
VITE_GLOB_API_URL=http://47.103.66.220:48080/admin-api
|
||||
# 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持S3服务
|
||||
VITE_UPLOAD_TYPE=server
|
||||
# 是否打开 devtools,true 为打开,false 为关闭
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"@vueuse/core": "catalog:",
|
||||
"@vueuse/integrations": "catalog:",
|
||||
"ant-design-vue": "catalog:",
|
||||
"benz-amr-recorder": "^1.1.5",
|
||||
"bpmn-js": "catalog:",
|
||||
"bpmn-js-properties-panel": "catalog:",
|
||||
"bpmn-js-token-simulation": "catalog:",
|
||||
|
||||
63
apps/web-antd/src/utils/useUpload.ts
Normal file
63
apps/web-antd/src/utils/useUpload.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
enum UploadType {
|
||||
Image = 'image',
|
||||
Video = 'video',
|
||||
Voice = 'voice',
|
||||
}
|
||||
|
||||
const useBeforeUpload = (type: UploadType, maxSizeMB: number) => {
|
||||
const fn = (file: File): boolean => {
|
||||
let allowTypes: string[] = [];
|
||||
let name = '';
|
||||
|
||||
switch (type) {
|
||||
case UploadType.Image: {
|
||||
allowTypes = [
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/gif',
|
||||
'image/bmp',
|
||||
'image/jpg',
|
||||
];
|
||||
maxSizeMB = 2;
|
||||
name = '图片';
|
||||
break;
|
||||
}
|
||||
case UploadType.Video: {
|
||||
allowTypes = ['video/mp4'];
|
||||
maxSizeMB = 10;
|
||||
name = '视频';
|
||||
break;
|
||||
}
|
||||
case UploadType.Voice: {
|
||||
allowTypes = [
|
||||
'audio/mp3',
|
||||
'audio/mpeg',
|
||||
'audio/wma',
|
||||
'audio/wav',
|
||||
'audio/amr',
|
||||
];
|
||||
maxSizeMB = 2;
|
||||
name = '语音';
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 格式不正确
|
||||
if (!allowTypes.includes(file.type)) {
|
||||
message.error(`上传${name}格式不对!`);
|
||||
return false;
|
||||
}
|
||||
// 大小不正确
|
||||
if (file.size / 1024 / 1024 > maxSizeMB) {
|
||||
message.error(`上传${name}大小不能超过${maxSizeMB}M!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
return fn;
|
||||
};
|
||||
|
||||
export { UploadType, useBeforeUpload };
|
||||
BIN
apps/web-antd/src/views/mp/menu/assets/iphone_backImg.png
Normal file
BIN
apps/web-antd/src/views/mp/menu/assets/iphone_backImg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
BIN
apps/web-antd/src/views/mp/menu/assets/menu_foot.png
Normal file
BIN
apps/web-antd/src/views/mp/menu/assets/menu_foot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
apps/web-antd/src/views/mp/menu/assets/menu_head.png
Normal file
BIN
apps/web-antd/src/views/mp/menu/assets/menu_head.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
9
apps/web-antd/src/views/mp/menu/data.ts
Normal file
9
apps/web-antd/src/views/mp/menu/data.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/** 菜单未选中标识 */
|
||||
export const MENU_NOT_SELECTED = '__MENU_NOT_SELECTED__';
|
||||
|
||||
/** 菜单级别枚举 */
|
||||
export enum Level {
|
||||
Child = '2',
|
||||
Parent = '1',
|
||||
Undefined = '0',
|
||||
}
|
||||
@@ -1,29 +1,407 @@
|
||||
<script lang="ts" setup>
|
||||
import { DocAlert, Page } from '@vben/common-ui';
|
||||
import type { Menu, RawMenu } from './modules/types';
|
||||
|
||||
import { Button } from 'ant-design-vue';
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { confirm, ContentWrap, DocAlert, Page } from '@vben/common-ui';
|
||||
import { handleTree } from '@vben/utils';
|
||||
|
||||
import { Button, Form, message } from 'ant-design-vue';
|
||||
|
||||
import * as MpMenuApi from '#/api/mp/menu';
|
||||
import { Level, MENU_NOT_SELECTED } from '#/views/mp/menu/data';
|
||||
import MenuEditor from '#/views/mp/menu/modules/menu-editor.vue';
|
||||
import MenuPreviewer from '#/views/mp/menu/modules/menu-previewer.vue';
|
||||
import WxAccountSelect from '#/views/mp/modules/wx-account-select/main.vue';
|
||||
|
||||
defineOptions({ name: 'MpMenu' });
|
||||
|
||||
// ======================== 列表查询 ========================
|
||||
const loading = ref(false); // 遮罩层
|
||||
const accountId = ref(-1);
|
||||
const accountName = ref<string>('');
|
||||
const menuList = ref<Menu[]>([]);
|
||||
|
||||
// ======================== 菜单操作 ========================
|
||||
// 当前选中菜单编码:
|
||||
// * 一级('x')
|
||||
// * 二级('x-y')
|
||||
// * 未选中(MENU_NOT_SELECTED)
|
||||
const activeIndex = ref<string>(MENU_NOT_SELECTED);
|
||||
// 二级菜单显示标志: 归属的一级菜单index
|
||||
// * 未初始化:-1
|
||||
// * 初始化:x
|
||||
const parentIndex = ref(-1);
|
||||
|
||||
// ======================== 菜单编辑 ========================
|
||||
const showRightPanel = ref(false); // 右边配置显示默认详情还是配置详情
|
||||
const isParent = ref<boolean>(true); // 是否一级菜单,控制MenuEditor中name字段长度
|
||||
const activeMenu = ref<Menu>({}); // 选中菜单,MenuEditor的modelValue
|
||||
|
||||
// 一些临时值放在这里进行判断,如果放在 activeMenu,由于引用关系,menu 也会多了多余的参数
|
||||
const tempSelfObj = ref<{
|
||||
grand: Level;
|
||||
x: number;
|
||||
y: number;
|
||||
}>({
|
||||
grand: Level.Undefined,
|
||||
x: 0,
|
||||
y: 0,
|
||||
});
|
||||
const dialogNewsVisible = ref(false); // 跳转图文时的素材选择弹窗
|
||||
|
||||
/** 侦听公众号变化 */
|
||||
function onAccountChanged(id: number, name: string) {
|
||||
accountId.value = id;
|
||||
accountName.value = name;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 查询并转换菜单 */
|
||||
async function getList() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const data = await MpMenuApi.getMenuList(accountId.value);
|
||||
const menuData = menuListToFrontend(data);
|
||||
menuList.value = handleTree(menuData, 'id') as Menu[];
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
resetForm();
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 将后端返回的 menuList,转换成前端的 menuList */
|
||||
function menuListToFrontend(list: any[]) {
|
||||
if (!list) return [];
|
||||
|
||||
const result: RawMenu[] = [];
|
||||
list.forEach((item: RawMenu) => {
|
||||
const menu: any = {
|
||||
...item,
|
||||
};
|
||||
menu.reply = {
|
||||
type: item.replyMessageType,
|
||||
accountId: item.accountId,
|
||||
content: item.replyContent,
|
||||
mediaId: item.replyMediaId,
|
||||
url: item.replyMediaUrl,
|
||||
title: item.replyTitle,
|
||||
description: item.replyDescription,
|
||||
thumbMediaId: item.replyThumbMediaId,
|
||||
thumbMediaUrl: item.replyThumbMediaUrl,
|
||||
articles: item.replyArticles,
|
||||
musicUrl: item.replyMusicUrl,
|
||||
hqMusicUrl: item.replyHqMusicUrl,
|
||||
};
|
||||
result.push(menu as RawMenu);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/** 重置表单,清空表单数据 */
|
||||
function resetForm() {
|
||||
// 菜单操作
|
||||
activeIndex.value = MENU_NOT_SELECTED;
|
||||
parentIndex.value = -1;
|
||||
|
||||
// 菜单编辑
|
||||
showRightPanel.value = false;
|
||||
activeMenu.value = {};
|
||||
tempSelfObj.value = { grand: Level.Undefined, x: 0, y: 0 };
|
||||
dialogNewsVisible.value = false;
|
||||
}
|
||||
|
||||
// ======================== 菜单操作 ========================
|
||||
/** 一级菜单点击事件 */
|
||||
function menuClicked(parent: Menu, x: number) {
|
||||
// 右侧的表单相关
|
||||
showRightPanel.value = true; // 右边菜单
|
||||
activeMenu.value = parent; // 这个如果放在顶部,flag 会没有。因为重新赋值了。
|
||||
tempSelfObj.value.grand = Level.Parent; // 表示一级菜单
|
||||
tempSelfObj.value.x = x; // 表示一级菜单索引
|
||||
isParent.value = true;
|
||||
|
||||
// 左侧的选中
|
||||
activeIndex.value = `${x}`; // 菜单选中样式
|
||||
parentIndex.value = x; // 二级菜单显示标志
|
||||
}
|
||||
|
||||
/** 二级菜单点击事件 */
|
||||
function subMenuClicked(child: Menu, x: number, y: number) {
|
||||
// 右侧的表单相关
|
||||
showRightPanel.value = true; // 右边菜单
|
||||
activeMenu.value = child; // 将点击的数据放到临时变量,对象有引用作用
|
||||
tempSelfObj.value.grand = Level.Child; // 表示二级菜单
|
||||
tempSelfObj.value.x = x; // 表示一级菜单索引
|
||||
tempSelfObj.value.y = y; // 表示二级菜单索引
|
||||
isParent.value = false;
|
||||
|
||||
// 左侧的选中
|
||||
activeIndex.value = `${x}-${y}`;
|
||||
}
|
||||
|
||||
/** 删除当前菜单 */
|
||||
async function onDeleteMenu() {
|
||||
try {
|
||||
await confirm('确定要删除吗?');
|
||||
if (tempSelfObj.value.grand === Level.Parent) {
|
||||
// 一级菜单的删除方法
|
||||
menuList.value.splice(tempSelfObj.value.x, 1);
|
||||
} else if (tempSelfObj.value.grand === Level.Child) {
|
||||
// 二级菜单的删除方法
|
||||
menuList.value[tempSelfObj.value.x]?.children?.splice(
|
||||
tempSelfObj.value.y,
|
||||
1,
|
||||
);
|
||||
}
|
||||
// 提示
|
||||
message.success('删除成功');
|
||||
|
||||
// 处理菜单的选中
|
||||
activeMenu.value = {};
|
||||
showRightPanel.value = false;
|
||||
activeIndex.value = MENU_NOT_SELECTED;
|
||||
} catch {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
// ======================== 菜单编辑 ========================
|
||||
/** 保存菜单 */
|
||||
async function onSave() {
|
||||
try {
|
||||
await confirm('确定要保存吗?');
|
||||
const hideLoading = message.loading({
|
||||
content: '保存中...',
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
await MpMenuApi.saveMenu(accountId.value, menuListToBackend());
|
||||
getList();
|
||||
message.success('发布成功');
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
} catch {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
/** 清空菜单 */
|
||||
async function onClear() {
|
||||
try {
|
||||
await confirm('确定要删除吗?');
|
||||
const hideLoading = message.loading({
|
||||
content: '删除中...',
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
await MpMenuApi.deleteMenu(accountId.value);
|
||||
handleQuery();
|
||||
message.success('清空成功');
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
} catch {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
/** 将前端的 menuList,转换成后端接收的 menuList */
|
||||
function menuListToBackend() {
|
||||
const result: any[] = [];
|
||||
menuList.value.forEach((item) => {
|
||||
const menu = menuToBackend(item);
|
||||
result.push(menu);
|
||||
|
||||
// 处理子菜单
|
||||
if (!item.children || item.children.length <= 0) {
|
||||
return;
|
||||
}
|
||||
menu.children = [];
|
||||
item.children.forEach((subItem) => {
|
||||
menu.children.push(menuToBackend(subItem));
|
||||
});
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/** 将前端的 menu,转换成后端接收的 menu */
|
||||
// TODO: @芋艿,需要根据后台API删除不需要的字段
|
||||
function menuToBackend(menu: any) {
|
||||
const result = {
|
||||
...menu,
|
||||
children: undefined, // 不处理子节点
|
||||
reply: undefined, // 稍后复制
|
||||
};
|
||||
result.replyMessageType = menu.reply.type;
|
||||
result.replyContent = menu.reply.content;
|
||||
result.replyMediaId = menu.reply.mediaId;
|
||||
result.replyMediaUrl = menu.reply.url;
|
||||
result.replyTitle = menu.reply.title;
|
||||
result.replyDescription = menu.reply.description;
|
||||
result.replyThumbMediaId = menu.reply.thumbMediaId;
|
||||
result.replyThumbMediaUrl = menu.reply.thumbMediaUrl;
|
||||
result.replyArticles = menu.reply.articles;
|
||||
result.replyMusicUrl = menu.reply.musicUrl;
|
||||
result.replyHqMusicUrl = menu.reply.hqMusicUrl;
|
||||
|
||||
return result;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page>
|
||||
<DocAlert title="公众号菜单" url="https://doc.iocoder.cn/mp/menu/" />
|
||||
<Button
|
||||
danger
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
||||
>
|
||||
该功能支持 Vue3 + element-plus 版本!
|
||||
</Button>
|
||||
<br />
|
||||
<Button
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/mp/menu/index"
|
||||
>
|
||||
可参考
|
||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/mp/menu/index
|
||||
代码,pull request 贡献给我们!
|
||||
</Button>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert title="公众号菜单" url="https://doc.iocoder.cn/mp/menu/" />
|
||||
</template>
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<!-- <ContentWrap> -->
|
||||
<Form layout="inline" class="-mb-15px w-240px">
|
||||
<Form.Item label="公众号" prop="accountId" class="w-240px">
|
||||
<WxAccountSelect @change="onAccountChanged" />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
<!-- </ContentWrap> -->
|
||||
|
||||
<ContentWrap>
|
||||
<div class="clearfix public-account-management" v-loading="loading">
|
||||
<!--左边配置菜单-->
|
||||
<div class="left">
|
||||
<div class="weixin-hd">
|
||||
<div class="weixin-title">{{ accountName }}</div>
|
||||
</div>
|
||||
<div class="clearfix weixin-menu">
|
||||
<MenuPreviewer
|
||||
v-model="menuList"
|
||||
:account-id="accountId"
|
||||
:active-index="activeIndex"
|
||||
:parent-index="parentIndex"
|
||||
@menu-clicked="(parent, x) => menuClicked(parent, x)"
|
||||
@submenu-clicked="(child, x, y) => subMenuClicked(child, x, y)"
|
||||
/>
|
||||
</div>
|
||||
<div class="save-div">
|
||||
<Button
|
||||
class="save-btn"
|
||||
type="primary"
|
||||
@click="onSave"
|
||||
v-hasPermi="['mp:menu:save']"
|
||||
>
|
||||
保存并发布菜单
|
||||
</Button>
|
||||
<Button
|
||||
class="save-btn"
|
||||
danger
|
||||
@click="onClear"
|
||||
v-hasPermi="['mp:menu:delete']"
|
||||
>
|
||||
清空菜单
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<!--右边配置-->
|
||||
<div class="right" v-if="showRightPanel">
|
||||
<MenuEditor
|
||||
:account-id="accountId"
|
||||
:is-parent="isParent"
|
||||
v-model="activeMenu"
|
||||
@delete="onDeleteMenu"
|
||||
/>
|
||||
</div>
|
||||
<!-- 一进页面就显示的默认页面,当点击左边按钮的时候,就不显示了-->
|
||||
<div v-else class="right">
|
||||
<p>请选择菜单配置</p>
|
||||
</div>
|
||||
</div>
|
||||
</ContentWrap>
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 公共颜色变量 */
|
||||
.clearfix {
|
||||
*zoom: 1;
|
||||
}
|
||||
|
||||
.clearfix::after {
|
||||
clear: both;
|
||||
display: table;
|
||||
content: '';
|
||||
}
|
||||
|
||||
div {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.weixin-hd {
|
||||
position: relative;
|
||||
bottom: 426px;
|
||||
left: 0;
|
||||
width: 300px;
|
||||
height: 64px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
background: transparent url('./assets/menu_head.png') no-repeat 0 0;
|
||||
background-position: 0 0;
|
||||
background-size: 100%;
|
||||
}
|
||||
|
||||
.weixin-title {
|
||||
position: absolute;
|
||||
top: 33px;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.weixin-menu {
|
||||
padding-left: 43px;
|
||||
font-size: 12px;
|
||||
background: transparent url('./assets/menu_foot.png') no-repeat 0 0;
|
||||
}
|
||||
|
||||
.public-account-management {
|
||||
width: 1200px;
|
||||
// min-width: 1200px;
|
||||
margin: 0 auto;
|
||||
|
||||
.left {
|
||||
position: relative;
|
||||
float: left;
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
width: 350px;
|
||||
height: 715px;
|
||||
padding: 518px 25px 88px;
|
||||
background: url('./assets/iphone_backImg.png') no-repeat;
|
||||
background-size: 100% auto;
|
||||
|
||||
.save-div {
|
||||
margin-top: 15px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 右边菜单内容 */
|
||||
.right {
|
||||
float: left;
|
||||
box-sizing: border-box;
|
||||
width: 63%;
|
||||
padding: 20px;
|
||||
margin-left: 20px;
|
||||
background-color: #e8e7e7;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
286
apps/web-antd/src/views/mp/menu/modules/menu-editor.vue
Normal file
286
apps/web-antd/src/views/mp/menu/modules/menu-editor.vue
Normal file
@@ -0,0 +1,286 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, nextTick, ref, watch } from 'vue';
|
||||
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Col,
|
||||
Input,
|
||||
message,
|
||||
Modal,
|
||||
Row,
|
||||
Select,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import WxMaterialSelect from '#/views/mp/modules/wx-material-select/main.vue';
|
||||
import WxNews from '#/views/mp/modules/wx-news/main.vue';
|
||||
import WxReplySelect from '#/views/mp/modules/wx-reply/main.vue';
|
||||
|
||||
import menuOptions from './menuOptions';
|
||||
|
||||
const props = defineProps<{
|
||||
accountId: number;
|
||||
isParent: boolean;
|
||||
modelValue: any;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'delete', v: void): void;
|
||||
(e: 'update:modelValue', v: any): void;
|
||||
}>();
|
||||
|
||||
const menu = computed({
|
||||
get() {
|
||||
return props.modelValue;
|
||||
},
|
||||
set(val) {
|
||||
emit('update:modelValue', val);
|
||||
},
|
||||
});
|
||||
const showNewsDialog = ref(false);
|
||||
const hackResetWxReplySelect = ref(false);
|
||||
const isLeave = computed<boolean>(() => !(menu.value.children?.length > 0));
|
||||
|
||||
watch(menu, () => {
|
||||
hackResetWxReplySelect.value = false; // 销毁组件
|
||||
nextTick(() => {
|
||||
hackResetWxReplySelect.value = true; // 重建组件
|
||||
});
|
||||
});
|
||||
|
||||
// ======================== 菜单编辑(素材选择) ========================
|
||||
/** 选择素材 */
|
||||
function selectMaterial(item: any) {
|
||||
const articleId = item.articleId;
|
||||
const articles = item.content.newsItem;
|
||||
// 提示,针对多图文
|
||||
if (articles.length > 1) {
|
||||
message.warning('您选择的是多图文,将默认跳转第一篇');
|
||||
}
|
||||
showNewsDialog.value = false;
|
||||
|
||||
// 设置菜单的回复
|
||||
menu.value.articleId = articleId;
|
||||
menu.value.replyArticles = [];
|
||||
articles.forEach((article: any) => {
|
||||
menu.value.replyArticles.push({
|
||||
title: article.title,
|
||||
description: article.digest,
|
||||
picUrl: article.picUrl,
|
||||
url: article.url,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除素材 */
|
||||
function deleteMaterial() {
|
||||
delete menu.value.articleId;
|
||||
delete menu.value.replyArticles;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="configure-page">
|
||||
<div class="delete-btn">
|
||||
<Button type="primary" danger @click="emit('delete')">
|
||||
<IconifyIcon icon="ep:delete" />
|
||||
删除当前菜单
|
||||
</Button>
|
||||
</div>
|
||||
<div>
|
||||
<span>菜单名称:</span>
|
||||
<Input
|
||||
class="input-width"
|
||||
v-model:value="menu.name"
|
||||
placeholder="请输入菜单名称"
|
||||
:maxlength="isParent ? 4 : 7"
|
||||
allow-clear
|
||||
/>
|
||||
</div>
|
||||
<div v-if="isLeave">
|
||||
<div class="menu-content">
|
||||
<span>菜单标识:</span>
|
||||
<Input
|
||||
class="input-width"
|
||||
v-model:value="menu.menuKey"
|
||||
placeholder="请输入菜单 KEY"
|
||||
allow-clear
|
||||
/>
|
||||
</div>
|
||||
<div class="menu-content">
|
||||
<span>菜单内容:</span>
|
||||
<Select
|
||||
v-model:value="menu.type"
|
||||
placeholder="请选择"
|
||||
class="input-width"
|
||||
allow-clear
|
||||
>
|
||||
<Select.Option
|
||||
v-for="item in menuOptions"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
:key="item.value"
|
||||
>
|
||||
{{ item.label }}
|
||||
</Select.Option>
|
||||
</Select>
|
||||
</div>
|
||||
<div class="configur-content" v-if="menu.type === 'view'">
|
||||
<span>跳转链接:</span>
|
||||
<Input
|
||||
class="input-width"
|
||||
v-model:value="menu.url"
|
||||
placeholder="请输入链接"
|
||||
allow-clear
|
||||
/>
|
||||
</div>
|
||||
<div class="configur-content" v-if="menu.type === 'miniprogram'">
|
||||
<div class="applet">
|
||||
<span>小程序的 appid :</span>
|
||||
<Input
|
||||
class="input-width"
|
||||
v-model:value="menu.miniProgramAppId"
|
||||
placeholder="请输入小程序的appid"
|
||||
allow-clear
|
||||
/>
|
||||
</div>
|
||||
<div class="applet">
|
||||
<span>小程序的页面路径:</span>
|
||||
<Input
|
||||
class="input-width"
|
||||
v-model:value="menu.miniProgramPagePath"
|
||||
placeholder="请输入小程序的页面路径,如:pages/index"
|
||||
allow-clear
|
||||
/>
|
||||
</div>
|
||||
<div class="applet">
|
||||
<span>小程序的备用网页:</span>
|
||||
<Input
|
||||
class="input-width"
|
||||
v-model:value="menu.url"
|
||||
placeholder="不支持小程序的老版本客户端将打开本网页"
|
||||
allow-clear
|
||||
/>
|
||||
</div>
|
||||
<p class="blue">
|
||||
tips:需要和公众号进行关联才可以把小程序绑定带微信菜单上哟!
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
class="configur-content"
|
||||
v-if="menu.type === 'article_view_limited'"
|
||||
>
|
||||
<Row>
|
||||
<div class="select-item" v-if="menu && menu.replyArticles">
|
||||
<WxNews :articles="menu.replyArticles" />
|
||||
<Row class="ope-row" justify="center" align="middle">
|
||||
<Button
|
||||
type="primary"
|
||||
danger
|
||||
shape="circle"
|
||||
@click="deleteMaterial"
|
||||
>
|
||||
<IconifyIcon icon="ep:delete" />
|
||||
</Button>
|
||||
</Row>
|
||||
</div>
|
||||
<div v-else>
|
||||
<Row justify="center">
|
||||
<Col :span="24" style="text-align: center">
|
||||
<Button type="primary" @click="showNewsDialog = true">
|
||||
素材库选择
|
||||
<IconifyIcon icon="ep:circle-check" />
|
||||
</Button>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
<Modal
|
||||
title="选择图文"
|
||||
v-model:open="showNewsDialog"
|
||||
width="80%"
|
||||
destroy-on-close
|
||||
>
|
||||
<WxMaterialSelect
|
||||
type="news"
|
||||
:account-id="props.accountId"
|
||||
@select-material="selectMaterial"
|
||||
/>
|
||||
</Modal>
|
||||
</Row>
|
||||
</div>
|
||||
<div
|
||||
class="configur-content"
|
||||
v-if="menu.type === 'click' || menu.type === 'scancode_waitmsg'"
|
||||
>
|
||||
<WxReplySelect v-if="hackResetWxReplySelect" v-model="menu.reply" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.ant-input) {
|
||||
// width: 70%;
|
||||
margin-right: 2%;
|
||||
}
|
||||
|
||||
.configure-page {
|
||||
.delete-btn {
|
||||
margin-bottom: 15px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.menu-content {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.configur-content {
|
||||
padding: 20px 10px;
|
||||
margin-top: 20px;
|
||||
background-color: #fff;
|
||||
border-radius: 5px;
|
||||
|
||||
.select-item {
|
||||
width: 280px;
|
||||
padding: 10px;
|
||||
margin: 0 auto 10px;
|
||||
border: 1px solid #eaeaea;
|
||||
|
||||
.ope-row {
|
||||
padding-top: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.blue {
|
||||
margin-top: 10px;
|
||||
color: #29b6f6;
|
||||
}
|
||||
|
||||
.applet {
|
||||
margin-bottom: 20px;
|
||||
|
||||
span {
|
||||
width: 20%;
|
||||
}
|
||||
}
|
||||
|
||||
.input-width {
|
||||
width: 240px;
|
||||
}
|
||||
|
||||
.material {
|
||||
.input-width {
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
:deep(.ant-input) {
|
||||
width: 80%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
252
apps/web-antd/src/views/mp/menu/modules/menu-previewer.vue
Normal file
252
apps/web-antd/src/views/mp/menu/modules/menu-previewer.vue
Normal file
@@ -0,0 +1,252 @@
|
||||
<script lang="ts" setup>
|
||||
import type { Menu } from './types';
|
||||
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
import draggable from 'vuedraggable';
|
||||
|
||||
const props = defineProps<{
|
||||
accountId: number;
|
||||
activeIndex: string;
|
||||
modelValue: Menu[];
|
||||
parentIndex: number;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', v: Menu[]): void;
|
||||
(e: 'menuClicked', parent: Menu, x: number): void;
|
||||
(e: 'submenuClicked', child: Menu, x: number, y: number): void;
|
||||
}>();
|
||||
|
||||
const menuList = computed<Menu[]>({
|
||||
get: () => props.modelValue,
|
||||
set: (val) => emit('update:modelValue', val),
|
||||
});
|
||||
|
||||
/** 添加横向一级菜单 */
|
||||
function addMenu() {
|
||||
const index = menuList.value.length;
|
||||
const menu = {
|
||||
name: '菜单名称',
|
||||
children: [],
|
||||
reply: {
|
||||
// 用于存储回复内容
|
||||
type: 'text',
|
||||
accountId: props.accountId, // 保证组件里,可以使用到对应的公众号
|
||||
},
|
||||
};
|
||||
menuList.value[index] = menu;
|
||||
menuClicked(menu, index - 1);
|
||||
}
|
||||
|
||||
/** 添加横向二级菜单;parent 表示要操作的父菜单 */
|
||||
function addSubMenu(i: number, parent: any) {
|
||||
const subMenuKeyLength = parent.children.length; // 获取二级菜单key长度
|
||||
const addButton = {
|
||||
name: '子菜单名称',
|
||||
reply: {
|
||||
// 用于存储回复内容
|
||||
type: 'text',
|
||||
accountId: props.accountId, // 保证组件里,可以使用到对应的公众号
|
||||
},
|
||||
};
|
||||
parent.children[subMenuKeyLength] = addButton;
|
||||
subMenuClicked(parent.children[subMenuKeyLength], i, subMenuKeyLength);
|
||||
}
|
||||
|
||||
/** 一级菜单点击 */
|
||||
function menuClicked(parent: Menu, x: number) {
|
||||
emit('menuClicked', parent, x);
|
||||
}
|
||||
|
||||
/** 二级菜单点击 */
|
||||
function subMenuClicked(child: Menu, x: number, y: number) {
|
||||
emit('submenuClicked', child, x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理一级菜单展开后被拖动,激活(展开)原来活动的一级菜单
|
||||
*
|
||||
* @param options - 拖动参数对象
|
||||
* @param options.oldIndex - 一级菜单拖动前的位置
|
||||
* @param options.newIndex - 一级菜单拖动后的位置
|
||||
*/
|
||||
function onParentDragEnd({
|
||||
oldIndex,
|
||||
newIndex,
|
||||
}: {
|
||||
newIndex: number;
|
||||
oldIndex: number;
|
||||
}) {
|
||||
// 二级菜单没有展开,直接返回
|
||||
if (props.activeIndex === '__MENU_NOT_SELECTED__') {
|
||||
return;
|
||||
}
|
||||
|
||||
// 使用一个辅助数组来模拟菜单移动,然后找到展开的二级菜单的新下标`newParent`
|
||||
const positions = Array.from({ length: menuList.value.length }).fill(false);
|
||||
positions[props.parentIndex] = true;
|
||||
const [out] = positions.splice(oldIndex, 1); // 移出菜单,保存到变量out
|
||||
positions.splice(newIndex, 0, out ?? false); // 把out变量插入被移出的菜单
|
||||
const newParentIndex = positions.indexOf(true);
|
||||
|
||||
// 找到菜单元素,触发一级菜单点击
|
||||
const parent = menuList.value[newParentIndex];
|
||||
if (parent && newParentIndex !== -1) {
|
||||
emit('menuClicked', parent, newParentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理二级菜单展开后被拖动,激活被拖动的菜单
|
||||
*
|
||||
* @param options - 拖动参数对象
|
||||
* @param options.newIndex - 二级菜单拖动后的位置
|
||||
*/
|
||||
function onChildDragEnd({ newIndex }: { newIndex: number }) {
|
||||
const x = props.parentIndex;
|
||||
const y = newIndex;
|
||||
const children = menuList.value[x]?.children;
|
||||
if (children && children?.length > 0) {
|
||||
const child = children[y];
|
||||
if (child) {
|
||||
emit('submenuClicked', child, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<draggable
|
||||
v-model="menuList"
|
||||
item-key="id"
|
||||
ghost-class="draggable-ghost"
|
||||
:animation="400"
|
||||
@end="onParentDragEnd"
|
||||
>
|
||||
<template #item="{ element: parent, index: x }">
|
||||
<div class="menu-bottom">
|
||||
<!-- 一级菜单 -->
|
||||
<div
|
||||
@click="menuClicked(parent, x)"
|
||||
class="menu-item"
|
||||
:class="{ active: props.activeIndex === `${x}` }"
|
||||
>
|
||||
<IconifyIcon icon="ep:fold" color="black" />{{ parent.name }}
|
||||
</div>
|
||||
<!-- 以下为二级菜单-->
|
||||
<div class="submenu" v-if="props.parentIndex === x && parent.children">
|
||||
<draggable
|
||||
v-model="parent.children"
|
||||
item-key="id"
|
||||
ghost-class="draggable-ghost"
|
||||
:animation="400"
|
||||
@end="onChildDragEnd"
|
||||
>
|
||||
<template #item="{ element: child, index: y }">
|
||||
<div class="menu-bottom subtitle">
|
||||
<div
|
||||
class="menu-sub-item"
|
||||
v-if="parent.children"
|
||||
:class="{ active: props.activeIndex === `${x}-${y}` }"
|
||||
@click="subMenuClicked(child, x, y)"
|
||||
>
|
||||
{{ child.name }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</draggable>
|
||||
<!-- 二级菜单加号, 当长度 小于 5 才显示二级菜单的加号 -->
|
||||
<div
|
||||
class="menu-bottom menu-addicon"
|
||||
v-if="!parent.children || parent.children.length < 5"
|
||||
@click="addSubMenu(x, parent)"
|
||||
>
|
||||
<IconifyIcon icon="ep:plus" class="plus" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</draggable>
|
||||
|
||||
<!-- 一级菜单加号 -->
|
||||
<div
|
||||
class="menu-bottom menu-addicon"
|
||||
v-if="menuList.length < 3"
|
||||
@click="addMenu"
|
||||
>
|
||||
<IconifyIcon icon="ep:plus" class="plus" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.menu-bottom {
|
||||
position: relative;
|
||||
float: left;
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
width: 85.5px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ebedee;
|
||||
|
||||
&.menu-addicon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 46px;
|
||||
line-height: 46px;
|
||||
|
||||
.plus {
|
||||
color: #2bb673;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
// text-align: center;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
|
||||
&.active {
|
||||
border: 1px solid #2bb673;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-sub-item {
|
||||
box-sizing: border-box;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
text-align: center;
|
||||
|
||||
&.active {
|
||||
border: 1px solid #2bb673;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 第二级菜单 */
|
||||
.submenu {
|
||||
position: absolute;
|
||||
bottom: 45px;
|
||||
width: 85.5px;
|
||||
|
||||
.subtitle {
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.draggable-ghost {
|
||||
background: #f7fafc;
|
||||
border: 1px solid #4299e1;
|
||||
opacity: 0.5;
|
||||
}
|
||||
</style>
|
||||
42
apps/web-antd/src/views/mp/menu/modules/menuOptions.ts
Normal file
42
apps/web-antd/src/views/mp/menu/modules/menuOptions.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
export default [
|
||||
{
|
||||
value: 'view',
|
||||
label: '跳转网页',
|
||||
},
|
||||
{
|
||||
value: 'miniprogram',
|
||||
label: '跳转小程序',
|
||||
},
|
||||
{
|
||||
value: 'click',
|
||||
label: '点击回复',
|
||||
},
|
||||
{
|
||||
value: 'article_view_limited',
|
||||
label: '跳转图文消息',
|
||||
},
|
||||
{
|
||||
value: 'scancode_push',
|
||||
label: '扫码直接返回结果',
|
||||
},
|
||||
{
|
||||
value: 'scancode_waitmsg',
|
||||
label: '扫码回复',
|
||||
},
|
||||
{
|
||||
value: 'pic_sysphoto',
|
||||
label: '系统拍照发图',
|
||||
},
|
||||
{
|
||||
value: 'pic_photo_or_album',
|
||||
label: '拍照或者相册',
|
||||
},
|
||||
{
|
||||
value: 'pic_weixin',
|
||||
label: '微信相册',
|
||||
},
|
||||
{
|
||||
value: 'location_select',
|
||||
label: '选择地理位置',
|
||||
},
|
||||
];
|
||||
73
apps/web-antd/src/views/mp/menu/modules/types.ts
Normal file
73
apps/web-antd/src/views/mp/menu/modules/types.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
export interface Replay {
|
||||
title: string;
|
||||
description: string;
|
||||
picUrl: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export type MenuType =
|
||||
| ''
|
||||
| 'article_view_limited'
|
||||
| 'click'
|
||||
| 'location_select'
|
||||
| 'pic_photo_or_album'
|
||||
| 'pic_sysphoto'
|
||||
| 'pic_weixin'
|
||||
| 'scancode_push'
|
||||
| 'scancode_waitmsg'
|
||||
| 'view';
|
||||
|
||||
interface _RawMenu {
|
||||
// db
|
||||
id: number;
|
||||
parentId: number;
|
||||
accountId: number;
|
||||
appId: string;
|
||||
createTime: number;
|
||||
|
||||
// mp-native
|
||||
name: string;
|
||||
menuKey: string;
|
||||
type: MenuType;
|
||||
url: string;
|
||||
miniProgramAppId: string;
|
||||
miniProgramPagePath: string;
|
||||
articleId: string;
|
||||
replyMessageType: string;
|
||||
replyContent: string;
|
||||
replyMediaId: string;
|
||||
replyMediaUrl: string;
|
||||
replyThumbMediaId: string;
|
||||
replyThumbMediaUrl: string;
|
||||
replyTitle: string;
|
||||
replyDescription: string;
|
||||
replyArticles: Replay;
|
||||
replyMusicUrl: string;
|
||||
replyHqMusicUrl: string;
|
||||
}
|
||||
|
||||
export type RawMenu = Partial<_RawMenu>;
|
||||
|
||||
interface _Reply {
|
||||
type: string;
|
||||
accountId: number;
|
||||
content: string;
|
||||
mediaId: string;
|
||||
url: string;
|
||||
thumbMediaId: string;
|
||||
thumbMediaUrl: string;
|
||||
title: string;
|
||||
description: string;
|
||||
articles: null | Replay[];
|
||||
musicUrl: string;
|
||||
hqMusicUrl: string;
|
||||
}
|
||||
|
||||
export type Reply = Partial<_Reply>;
|
||||
|
||||
interface _Menu extends RawMenu {
|
||||
children: _Menu[];
|
||||
reply: Reply;
|
||||
}
|
||||
|
||||
export type Menu = Partial<_Menu>;
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from './main.vue';
|
||||
@@ -0,0 +1,91 @@
|
||||
<script lang="ts" setup>
|
||||
import type { MpAccountApi } from '#/api/mp/account';
|
||||
|
||||
import { onMounted, reactive, ref, unref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { useTabs } from '@vben/hooks';
|
||||
|
||||
import { message, Select } from 'ant-design-vue';
|
||||
|
||||
import { getSimpleAccountList } from '#/api/mp/account';
|
||||
|
||||
defineOptions({ name: 'WxAccountSelect' });
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'change', id: number, name: string): void;
|
||||
}>();
|
||||
|
||||
// 消息弹窗
|
||||
const { closeCurrentTab } = useTabs(); // 视图操作
|
||||
const { push, currentRoute } = useRouter();
|
||||
|
||||
const account: MpAccountApi.AccountSimple = reactive({
|
||||
id: -1,
|
||||
name: '',
|
||||
});
|
||||
|
||||
const accountList = ref<MpAccountApi.AccountSimple[]>([]);
|
||||
|
||||
/** 查询公众号列表 */
|
||||
async function handleQuery() {
|
||||
accountList.value = await getSimpleAccountList();
|
||||
if (accountList.value.length === 0) {
|
||||
message.error('未配置公众号,请在【公众号管理 -> 账号管理】菜单,进行配置');
|
||||
await closeCurrentTab(unref(currentRoute));
|
||||
await push({ name: 'MpAccount' });
|
||||
return;
|
||||
}
|
||||
// 默认选中第一个
|
||||
const firstAccount = accountList.value[0];
|
||||
if (firstAccount) {
|
||||
account.id = firstAccount.id;
|
||||
if (account.id) {
|
||||
account.name = firstAccount.name;
|
||||
emit('change', account.id, account.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 公众号变化 */
|
||||
function onChanged(value: any) {
|
||||
if (value === undefined || Array.isArray(value)) return;
|
||||
const id = typeof value === 'number' ? value : Number(value);
|
||||
account.id = id;
|
||||
const found = accountList.value.find(
|
||||
(v: MpAccountApi.AccountSimple) => v.id === id,
|
||||
);
|
||||
if (account.id && found) {
|
||||
account.name = found.name;
|
||||
emit('change', account.id, account.name);
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(() => {
|
||||
handleQuery();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Select
|
||||
v-model:value="account.id"
|
||||
placeholder="请选择公众号"
|
||||
class="!w-240px"
|
||||
@change="onChanged"
|
||||
>
|
||||
<Select.Option
|
||||
v-for="item in accountList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
{{ item.name }}
|
||||
</Select.Option>
|
||||
</Select>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
:deep(.ant-select-selector) {
|
||||
width: 240px !important;
|
||||
}
|
||||
</style>
|
||||
1
apps/web-antd/src/views/mp/modules/wx-location/index.ts
Normal file
1
apps/web-antd/src/views/mp/modules/wx-location/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from './main.vue';
|
||||
62
apps/web-antd/src/views/mp/modules/wx-location/main.vue
Normal file
62
apps/web-antd/src/views/mp/modules/wx-location/main.vue
Normal file
@@ -0,0 +1,62 @@
|
||||
<!--
|
||||
【微信消息 - 定位】TODO @Dhb52 目前未启用
|
||||
-->
|
||||
<script lang="ts" setup>
|
||||
import { Col, Row } from 'ant-design-vue';
|
||||
|
||||
defineOptions({ name: 'WxLocation' });
|
||||
|
||||
const props = defineProps({
|
||||
locationX: {
|
||||
required: true,
|
||||
type: Number,
|
||||
},
|
||||
locationY: {
|
||||
required: true,
|
||||
type: Number,
|
||||
},
|
||||
label: {
|
||||
// 地名
|
||||
required: true,
|
||||
type: String,
|
||||
},
|
||||
qqMapKey: {
|
||||
// QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc
|
||||
required: false,
|
||||
type: String,
|
||||
default: 'TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E', // 需要自定义
|
||||
},
|
||||
});
|
||||
|
||||
defineExpose({
|
||||
locationX: props.locationX,
|
||||
locationY: props.locationY,
|
||||
label: props.label,
|
||||
qqMapKey: props.qqMapKey,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<a
|
||||
target="_blank"
|
||||
:href="`https://map.qq.com/?type=marker&isopeninfowin=1&markertype=1&pointx=${
|
||||
locationY
|
||||
}&pointy=${locationX}&name=${label}&ref=yudao`"
|
||||
>
|
||||
<Col>
|
||||
<Row>
|
||||
<img
|
||||
:src="`https://apis.map.qq.com/ws/staticmap/v2/?zoom=10&markers=color:blue|label:A|${
|
||||
locationX
|
||||
},${locationY}&key=${qqMapKey}&size=250*180`"
|
||||
/>
|
||||
</Row>
|
||||
<Row>
|
||||
<Icon icon="ep:location" />
|
||||
{{ label }}
|
||||
</Row>
|
||||
</Col>
|
||||
</a>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,3 @@
|
||||
export { default } from './main.vue';
|
||||
|
||||
export { MaterialType, NewsType } from './types';
|
||||
283
apps/web-antd/src/views/mp/modules/wx-material-select/main.vue
Normal file
283
apps/web-antd/src/views/mp/modules/wx-material-select/main.vue
Normal file
@@ -0,0 +1,283 @@
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
|
||||
import { formatTime } from '@vben/utils';
|
||||
|
||||
import { Button, Pagination, Row, Spin, Table } from 'ant-design-vue';
|
||||
|
||||
import * as MpDraftApi from '#/api/mp/draft';
|
||||
import * as MpFreePublishApi from '#/api/mp/freePublish';
|
||||
import * as MpMaterialApi from '#/api/mp/material';
|
||||
import WxNews from '#/views/mp/modules/wx-news';
|
||||
import WxVideoPlayer from '#/views/mp/modules/wx-video-play';
|
||||
import WxVoicePlayer from '#/views/mp/modules/wx-voice-play';
|
||||
|
||||
import { NewsType } from './types';
|
||||
|
||||
defineOptions({ name: 'WxMaterialSelect' });
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
accountId: number;
|
||||
newsType?: NewsType;
|
||||
type: string;
|
||||
}>(),
|
||||
{
|
||||
newsType: NewsType.Published,
|
||||
},
|
||||
);
|
||||
|
||||
const emit = defineEmits(['selectMaterial']);
|
||||
|
||||
// 遮罩层
|
||||
const loading = ref(false);
|
||||
// 总条数
|
||||
const total = ref(0);
|
||||
// 数据列表
|
||||
const list = ref<any[]>([]);
|
||||
// 查询参数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
accountId: props.accountId,
|
||||
});
|
||||
|
||||
/** 选择素材 */
|
||||
function selectMaterialFun(item: any) {
|
||||
emit('selectMaterial', item);
|
||||
}
|
||||
|
||||
/** 获取分页数据 */
|
||||
async function getPage() {
|
||||
loading.value = true;
|
||||
try {
|
||||
if (props.type === 'news' && props.newsType === NewsType.Published) {
|
||||
// 【图文】+ 【已发布】
|
||||
await getFreePublishPageFun();
|
||||
} else if (props.type === 'news' && props.newsType === NewsType.Draft) {
|
||||
// 【图文】+ 【草稿】
|
||||
await getDraftPageFun();
|
||||
} else {
|
||||
// 【素材】
|
||||
await getMaterialPageFun();
|
||||
}
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取素材分页 */
|
||||
async function getMaterialPageFun() {
|
||||
const data = await MpMaterialApi.getMaterialPage({
|
||||
...queryParams,
|
||||
type: props.type,
|
||||
});
|
||||
list.value = data.list;
|
||||
total.value = data.total;
|
||||
}
|
||||
|
||||
/** 获取已发布图文分页 */
|
||||
async function getFreePublishPageFun() {
|
||||
const data = await MpFreePublishApi.getFreePublishPage(queryParams);
|
||||
data.list.forEach((item: any) => {
|
||||
const articles = item.content.newsItem;
|
||||
articles.forEach((article: any) => {
|
||||
article.picUrl = article.thumbUrl;
|
||||
});
|
||||
});
|
||||
list.value = data.list;
|
||||
total.value = data.total;
|
||||
}
|
||||
|
||||
/** 获取草稿图文分页 */
|
||||
async function getDraftPageFun() {
|
||||
const data = await MpDraftApi.getDraftPage(queryParams);
|
||||
data.list.forEach((draft: any) => {
|
||||
const articles = draft.content.newsItem;
|
||||
articles.forEach((article: any) => {
|
||||
article.picUrl = article.thumbUrl;
|
||||
});
|
||||
});
|
||||
list.value = data.list;
|
||||
total.value = data.total;
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
getPage();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="pb-30px">
|
||||
<!-- 类型:image -->
|
||||
<div v-if="props.type === 'image'">
|
||||
<Spin :spinning="loading">
|
||||
<div class="waterfall">
|
||||
<div class="waterfall-item" v-for="item in list" :key="item.mediaId">
|
||||
<img class="material-img" :src="item.url" />
|
||||
<p class="item-name">{{ item.name }}</p>
|
||||
<Row class="ope-row">
|
||||
<Button type="primary" @click="selectMaterialFun(item)">
|
||||
选择
|
||||
<Icon icon="ep:circle-check" />
|
||||
</Button>
|
||||
</Row>
|
||||
</div>
|
||||
</div>
|
||||
</Spin>
|
||||
<!-- 分页组件 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:current="queryParams.pageNo"
|
||||
v-model:page-size="queryParams.pageSize"
|
||||
@change="getMaterialPageFun"
|
||||
/>
|
||||
</div>
|
||||
<!-- 类型:voice -->
|
||||
<div v-else-if="props.type === 'voice'">
|
||||
<!-- 列表 -->
|
||||
<Spin :spinning="loading">
|
||||
<Table :data-source="list">
|
||||
<Table.Column title="编号" data-index="mediaId" align="center" />
|
||||
<Table.Column title="文件名" data-index="name" align="center" />
|
||||
<Table.Column title="语音" align="center">
|
||||
<template #default="{ record }">
|
||||
<WxVoicePlayer :url="record.url" />
|
||||
</template>
|
||||
</Table.Column>
|
||||
<Table.Column title="上传时间" align="center" width="180">
|
||||
<template #default="{ record }">
|
||||
{{ formatTime(record.createTime, 'YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</Table.Column>
|
||||
<Table.Column title="操作" align="center" fixed="right">
|
||||
<template #default="{ record }">
|
||||
<Button type="link" @click="selectMaterialFun(record)">
|
||||
选择
|
||||
<Icon icon="ep:plus" />
|
||||
</Button>
|
||||
</template>
|
||||
</Table.Column>
|
||||
</Table>
|
||||
</Spin>
|
||||
<!-- 分页组件 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:current="queryParams.pageNo"
|
||||
v-model:page-size="queryParams.pageSize"
|
||||
@change="getPage"
|
||||
/>
|
||||
</div>
|
||||
<!-- 类型:video -->
|
||||
<div v-else-if="props.type === 'video'">
|
||||
<!-- 列表 -->
|
||||
<Spin :spinning="loading">
|
||||
<Table :data-source="list">
|
||||
<Table.Column title="编号" data-index="mediaId" align="center" />
|
||||
<Table.Column title="文件名" data-index="name" align="center" />
|
||||
<Table.Column title="标题" data-index="title" align="center" />
|
||||
<Table.Column title="介绍" data-index="introduction" align="center" />
|
||||
<Table.Column title="视频" align="center">
|
||||
<template #default="{ record }">
|
||||
<WxVideoPlayer :url="record.url" />
|
||||
</template>
|
||||
</Table.Column>
|
||||
<Table.Column title="上传时间" align="center" width="180">
|
||||
<template #default="{ record }">
|
||||
{{ formatTime(record.createTime, 'YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</Table.Column>
|
||||
<Table.Column title="操作" align="center" fixed="right">
|
||||
<template #default="{ record }">
|
||||
<Button type="link" @click="selectMaterialFun(record)">
|
||||
选择
|
||||
<Icon icon="akar-icons:circle-plus" />
|
||||
</Button>
|
||||
</template>
|
||||
</Table.Column>
|
||||
</Table>
|
||||
</Spin>
|
||||
<!-- 分页组件 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:current="queryParams.pageNo"
|
||||
v-model:page-size="queryParams.pageSize"
|
||||
@change="getMaterialPageFun"
|
||||
/>
|
||||
</div>
|
||||
<!-- 类型:news -->
|
||||
<div v-else-if="props.type === 'news'">
|
||||
<Spin :spinning="loading">
|
||||
<div class="waterfall">
|
||||
<div class="waterfall-item" v-for="item in list" :key="item.mediaId">
|
||||
<div v-if="item.content && item.content.newsItem">
|
||||
<WxNews :articles="item.content.newsItem" />
|
||||
<Row class="ope-row">
|
||||
<Button type="primary" @click="selectMaterialFun(item)">
|
||||
选择
|
||||
<Icon icon="ep:circle-check" />
|
||||
</Button>
|
||||
</Row>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Spin>
|
||||
<!-- 分页组件 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:current="queryParams.pageNo"
|
||||
v-model:page-size="queryParams.pageSize"
|
||||
@change="getMaterialPageFun"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
@media (width >= 992px) and (width <= 1300px) {
|
||||
.waterfall {
|
||||
column-count: 3;
|
||||
}
|
||||
|
||||
p {
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
@media (width >= 768px) and (width <= 991px) {
|
||||
.waterfall {
|
||||
column-count: 2;
|
||||
}
|
||||
|
||||
p {
|
||||
color: orange;
|
||||
}
|
||||
}
|
||||
|
||||
@media (width <= 767px) {
|
||||
.waterfall {
|
||||
column-count: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.waterfall {
|
||||
column-gap: 10px;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
column-count: 5;
|
||||
}
|
||||
|
||||
.waterfall-item {
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
border: 1px solid #eaeaea;
|
||||
break-inside: avoid;
|
||||
}
|
||||
|
||||
.material-img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
p {
|
||||
line-height: 30px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,11 @@
|
||||
export enum NewsType {
|
||||
Draft = '2',
|
||||
Published = '1',
|
||||
}
|
||||
|
||||
export enum MaterialType {
|
||||
Image = 'image',
|
||||
News = 'news',
|
||||
Video = 'video',
|
||||
Voice = 'voice',
|
||||
}
|
||||
116
apps/web-antd/src/views/mp/modules/wx-msg/card.scss
Normal file
116
apps/web-antd/src/views/mp/modules/wx-msg/card.scss
Normal file
@@ -0,0 +1,116 @@
|
||||
.avue-card {
|
||||
&__item {
|
||||
box-sizing: border-box;
|
||||
height: 200px;
|
||||
margin-bottom: 16px;
|
||||
font-size: 14px;
|
||||
font-feature-settings: 'tnum';
|
||||
font-variant: tabular-nums;
|
||||
line-height: 1.5;
|
||||
color: rgb(0 0 0 / 65%);
|
||||
cursor: pointer;
|
||||
list-style: none;
|
||||
background-color: #fff;
|
||||
border: 1px solid #e8e8e8;
|
||||
|
||||
&:hover {
|
||||
border-color: rgb(0 0 0 / 9%);
|
||||
box-shadow: 0 2px 8px rgb(0 0 0 / 9%);
|
||||
}
|
||||
|
||||
&--add {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
font-size: 16px;
|
||||
color: rgb(0 0 0 / 45%);
|
||||
background-color: #fff;
|
||||
border: 1px dashed #000;
|
||||
border-color: #d9d9d9;
|
||||
border-radius: 2px;
|
||||
|
||||
i {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: #40a9ff;
|
||||
background-color: #fff;
|
||||
border-color: #40a9ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__body {
|
||||
display: flex;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
&__detail {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&__avatar {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
margin-right: 12px;
|
||||
overflow: hidden;
|
||||
border-radius: 48px;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
&__title {
|
||||
margin-bottom: 12px;
|
||||
font-size: 16px;
|
||||
color: rgb(0 0 0 / 85%);
|
||||
|
||||
&:hover {
|
||||
color: #1890ff;
|
||||
}
|
||||
}
|
||||
|
||||
&__info {
|
||||
display: -webkit-box;
|
||||
height: 64px;
|
||||
overflow: hidden;
|
||||
-webkit-line-clamp: 3;
|
||||
color: rgb(0 0 0 / 45%);
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
&__menu {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
color: rgb(0 0 0 / 45%);
|
||||
text-align: center;
|
||||
background: #f7f9fa;
|
||||
|
||||
&:hover {
|
||||
color: #1890ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** joolun 额外加的 */
|
||||
.avue-comment__main {
|
||||
flex: unset !important;
|
||||
margin: 0 8px !important;
|
||||
border-radius: 5px !important;
|
||||
}
|
||||
|
||||
.avue-comment__header {
|
||||
border-top-left-radius: 5px;
|
||||
border-top-right-radius: 5px;
|
||||
}
|
||||
|
||||
.avue-comment__body {
|
||||
border-bottom-right-radius: 5px;
|
||||
border-bottom-left-radius: 5px;
|
||||
}
|
||||
109
apps/web-antd/src/views/mp/modules/wx-msg/comment.scss
Normal file
109
apps/web-antd/src/views/mp/modules/wx-msg/comment.scss
Normal file
@@ -0,0 +1,109 @@
|
||||
/* 来自 https://github.com/nmxiaowei/avue/blob/master/styles/src/element-ui/comment.scss */
|
||||
.avue-comment {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 30px;
|
||||
|
||||
&--reverse {
|
||||
flex-direction: row-reverse;
|
||||
|
||||
.avue-comment__main {
|
||||
&::before,
|
||||
&::after {
|
||||
right: -8px;
|
||||
left: auto;
|
||||
border-width: 8px 0 8px 8px;
|
||||
}
|
||||
|
||||
&::before {
|
||||
border-left-color: #dedede;
|
||||
}
|
||||
|
||||
&::after {
|
||||
margin-right: 1px;
|
||||
margin-left: auto;
|
||||
border-left-color: #f8f8f8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__avatar {
|
||||
box-sizing: border-box;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
vertical-align: middle;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 5px 15px;
|
||||
background: #f8f8f8;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
&__author {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
&__main {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
margin: 0 20px;
|
||||
border: 1px solid #dedede;
|
||||
border-radius: 2px;
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 100%;
|
||||
left: -8px;
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
pointer-events: none;
|
||||
content: ' ';
|
||||
border-color: transparent;
|
||||
border-style: solid solid outset;
|
||||
border-width: 8px 8px 8px 0;
|
||||
}
|
||||
|
||||
&::before {
|
||||
z-index: 1;
|
||||
border-right-color: #dedede;
|
||||
}
|
||||
|
||||
&::after {
|
||||
z-index: 2;
|
||||
margin-left: 1px;
|
||||
border-right-color: #f8f8f8;
|
||||
}
|
||||
}
|
||||
|
||||
&__body {
|
||||
padding: 15px;
|
||||
overflow: hidden;
|
||||
font-family:
|
||||
'Segoe UI', 'Lucida Grande', Helvetica, Arial, 'Microsoft YaHei',
|
||||
FreeSans, Arimo, 'Droid Sans', 'wenquanyi micro hei', 'Hiragino Sans GB',
|
||||
'Hiragino Sans GB W3', FontAwesome, sans-serif;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
padding: 1px 0 1px 15px;
|
||||
margin: 0;
|
||||
font-family:
|
||||
Georgia, 'Times New Roman', Times, Kai, 'Kaiti SC', KaiTi, BiauKai,
|
||||
FontAwesome, serif;
|
||||
border-left: 4px solid #ddd;
|
||||
}
|
||||
}
|
||||
80
apps/web-antd/src/views/mp/modules/wx-msg/components/Msg.vue
Normal file
80
apps/web-antd/src/views/mp/modules/wx-msg/components/Msg.vue
Normal file
@@ -0,0 +1,80 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import WxLocation from '#/views/mp/modules/wx-location';
|
||||
import WxMusic from '#/views/mp/modules/wx-music';
|
||||
import WxNews from '#/views/mp/modules/wx-news';
|
||||
import WxVideoPlayer from '#/views/mp/modules/wx-video-play';
|
||||
import WxVoicePlayer from '#/views/mp/modules/wx-voice-play';
|
||||
|
||||
import { MsgType } from '../types';
|
||||
import MsgEvent from './MsgEvent.vue';
|
||||
|
||||
defineOptions({ name: 'Msg' });
|
||||
|
||||
const props = defineProps<{
|
||||
item: any;
|
||||
}>();
|
||||
|
||||
const item = ref<any>(props.item);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<MsgEvent v-if="item.type === MsgType.Event" :item="item" />
|
||||
|
||||
<div v-else-if="item.type === MsgType.Text">{{ item.content }}</div>
|
||||
|
||||
<div v-else-if="item.type === MsgType.Voice">
|
||||
<WxVoicePlayer :url="item.mediaUrl" :content="item.recognition" />
|
||||
</div>
|
||||
|
||||
<div v-else-if="item.type === MsgType.Image">
|
||||
<a target="_blank" :href="item.mediaUrl">
|
||||
<img :src="item.mediaUrl" style="width: 100px" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-else-if="item.type === MsgType.Video || item.type === 'shortvideo'"
|
||||
style="text-align: center"
|
||||
>
|
||||
<WxVideoPlayer :url="item.mediaUrl" />
|
||||
</div>
|
||||
|
||||
<div v-else-if="item.type === MsgType.Link" class="avue-card__detail">
|
||||
<a target="_blank" :href="item.url">
|
||||
<div class="avue-card__title">
|
||||
<Icon icon="ep:link" />{{ item.title }}
|
||||
</div>
|
||||
</a>
|
||||
<div class="avue-card__info" style="height: unset">
|
||||
{{ item.description }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else-if="item.type === MsgType.Location">
|
||||
<WxLocation
|
||||
:label="item.label"
|
||||
:location-y="item.locationY"
|
||||
:location-x="item.locationX"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-else-if="item.type === MsgType.News" style="width: 300px">
|
||||
<WxNews :articles="item.articles" />
|
||||
</div>
|
||||
|
||||
<div v-else-if="item.type === MsgType.Music">
|
||||
<WxMusic
|
||||
:title="item.title"
|
||||
:description="item.description"
|
||||
:thumb-media-url="item.thumbMediaUrl"
|
||||
:music-url="item.musicUrl"
|
||||
:hq-music-url="item.hqMusicUrl"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -0,0 +1,56 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Tag } from 'ant-design-vue';
|
||||
|
||||
const props = defineProps<{
|
||||
item: any;
|
||||
}>();
|
||||
|
||||
const item = ref(props.item);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div v-if="item.event === 'subscribe'">
|
||||
<Tag color="success">关注</Tag>
|
||||
</div>
|
||||
<div v-else-if="item.event === 'unsubscribe'">
|
||||
<Tag color="error">取消关注</Tag>
|
||||
</div>
|
||||
<div v-else-if="item.event === 'CLICK'">
|
||||
<Tag>点击菜单</Tag>
|
||||
【{{ item.eventKey }}】
|
||||
</div>
|
||||
<div v-else-if="item.event === 'VIEW'">
|
||||
<Tag>点击菜单链接</Tag>
|
||||
【{{ item.eventKey }}】
|
||||
</div>
|
||||
<div v-else-if="item.event === 'scancode_waitmsg'">
|
||||
<Tag>扫码结果</Tag>
|
||||
【{{ item.eventKey }}】
|
||||
</div>
|
||||
<div v-else-if="item.event === 'scancode_push'">
|
||||
<Tag>扫码结果</Tag>
|
||||
【{{ item.eventKey }}】
|
||||
</div>
|
||||
<div v-else-if="item.event === 'pic_sysphoto'">
|
||||
<Tag>系统拍照发图</Tag>
|
||||
</div>
|
||||
<div v-else-if="item.event === 'pic_photo_or_album'">
|
||||
<Tag>拍照或者相册</Tag>
|
||||
</div>
|
||||
<div v-else-if="item.event === 'pic_weixin'">
|
||||
<Tag>微信相册</Tag>
|
||||
</div>
|
||||
<div v-else-if="item.event === 'location_select'">
|
||||
<Tag>选择地理位置</Tag>
|
||||
</div>
|
||||
<div v-else-if="item.event === 'SCAN'">
|
||||
<Tag>扫码</Tag>
|
||||
</div>
|
||||
<div v-else>
|
||||
<Tag color="error">未知事件类型</Tag>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,77 @@
|
||||
<script lang="ts" setup>
|
||||
import type { User } from '../types';
|
||||
|
||||
import { formatDateTime } from '@vben/utils';
|
||||
|
||||
import avatarWechat from '@/assets/imgs/wechat.png';
|
||||
|
||||
import Msg from './Msg.vue';
|
||||
|
||||
// 确保 User 类型被识别为已使用
|
||||
type PropsUser = User;
|
||||
|
||||
defineOptions({ name: 'MsgList' });
|
||||
|
||||
const props = defineProps<{
|
||||
accountId: number;
|
||||
list: any[];
|
||||
user: PropsUser;
|
||||
}>();
|
||||
|
||||
// 使用常量对象替代枚举,避免 linter 误报
|
||||
const SendFrom = {
|
||||
MpBot: 2,
|
||||
User: 1,
|
||||
} as const;
|
||||
|
||||
type SendFromType = (typeof SendFrom)[keyof typeof SendFrom];
|
||||
|
||||
// 显式引用枚举成员供模板使用
|
||||
const MpBotValue = SendFrom.MpBot;
|
||||
const UserValue = SendFrom.User;
|
||||
|
||||
const getAvatar = (sendFrom: SendFromType) =>
|
||||
sendFrom === UserValue ? props.user.avatar : avatarWechat;
|
||||
|
||||
const getNickname = (sendFrom: SendFromType) =>
|
||||
sendFrom === UserValue ? props.user.nickname : '公众号';
|
||||
</script>
|
||||
<template>
|
||||
<div class="execution" v-for="item in props.list" :key="item.id">
|
||||
<div
|
||||
class="avue-comment"
|
||||
:class="{ 'avue-comment--reverse': item.sendFrom === MpBotValue }"
|
||||
>
|
||||
<div class="avatar-div">
|
||||
<img :src="getAvatar(item.sendFrom)" class="avue-comment__avatar" />
|
||||
<div class="avue-comment__author">
|
||||
{{ getNickname(item.sendFrom) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="avue-comment__main">
|
||||
<div class="avue-comment__header">
|
||||
<div class="avue-comment__create_time">
|
||||
{{ formatDateTime(item.createTime) }}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="avue-comment__body"
|
||||
:style="item.sendFrom === MpBotValue ? 'background: #6BED72;' : ''"
|
||||
>
|
||||
<Msg :item="item" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 因为 joolun 实现依赖 avue 组件,该页面使用了 comment.scss、card.scc */
|
||||
@import url('../comment.scss');
|
||||
@import url('../card.scss');
|
||||
|
||||
.avatar-div {
|
||||
width: 80px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
3
apps/web-antd/src/views/mp/modules/wx-msg/index.ts
Normal file
3
apps/web-antd/src/views/mp/modules/wx-msg/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export { default } from './main.vue';
|
||||
|
||||
export { MsgType } from './types';
|
||||
226
apps/web-antd/src/views/mp/modules/wx-msg/main.vue
Normal file
226
apps/web-antd/src/views/mp/modules/wx-msg/main.vue
Normal file
@@ -0,0 +1,226 @@
|
||||
<!--
|
||||
- Copyright (C) 2018-2019
|
||||
- All rights reserved, Designed By www.joolun.com
|
||||
芋道源码:
|
||||
① 移除暂时用不到的 websocket
|
||||
② 代码优化,补充注释,提升阅读性
|
||||
-->
|
||||
<script lang="ts" setup>
|
||||
import type { User } from './types';
|
||||
|
||||
import type { Reply } from '#/views/mp/modules/wx-reply';
|
||||
|
||||
import { nextTick, onMounted, reactive, ref, unref } from 'vue';
|
||||
|
||||
import { Button, message, Spin } from 'ant-design-vue';
|
||||
|
||||
import { getMessagePage, sendMessage } from '#/api/mp/message';
|
||||
import { getUser } from '#/api/mp/user';
|
||||
import profile from '#/assets/imgs/profile.jpg';
|
||||
import WxReplySelect, { ReplyType } from '#/views/mp/modules/wx-reply';
|
||||
|
||||
import MsgList from './components/MsgList.vue';
|
||||
|
||||
defineOptions({ name: 'WxMsg' });
|
||||
|
||||
const props = defineProps({
|
||||
userId: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
// 消息弹窗
|
||||
const accountId = ref(-1); // 公众号ID,需要通过userId初始化
|
||||
const loading = ref(false); // 消息列表是否正在加载中
|
||||
const hasMore = ref(true); // 是否可以加载更多
|
||||
const list = ref<any[]>([]); // 消息列表
|
||||
const queryParams = reactive({
|
||||
pageNo: 1, // 当前页数
|
||||
pageSize: 14, // 每页显示多少条
|
||||
accountId,
|
||||
});
|
||||
|
||||
// 由于微信不再提供昵称,直接使用"用户"展示
|
||||
const user: User = reactive({
|
||||
nickname: '用户',
|
||||
avatar: profile,
|
||||
accountId, // 公众号账号编号
|
||||
});
|
||||
|
||||
// ========= 消息发送 =========
|
||||
const sendLoading = ref(false); // 发送消息是否加载中
|
||||
// 微信发送消息
|
||||
const reply = ref<Reply>({
|
||||
type: ReplyType.Text,
|
||||
accountId: -1,
|
||||
articles: [],
|
||||
});
|
||||
|
||||
const replySelectRef = ref<InstanceType<typeof WxReplySelect> | null>(null); // WxReplySelect组件ref,用于消息发送成功后清除内容
|
||||
const msgDivRef = ref<HTMLDivElement | null>(null); // 消息显示窗口ref,用于滚动到底部
|
||||
|
||||
/** 完成加载 */
|
||||
onMounted(async () => {
|
||||
const data = await getUser(props.userId);
|
||||
user.nickname = data.nickname?.length > 0 ? data.nickname : user.nickname;
|
||||
// API 返回的数据可能包含 headImageUrl,但类型定义中没有,使用类型断言
|
||||
const userData = data as typeof data & { headImageUrl?: string };
|
||||
user.avatar =
|
||||
userData.headImageUrl && userData.headImageUrl.length > 0
|
||||
? userData.headImageUrl
|
||||
: user.avatar;
|
||||
accountId.value = data.accountId;
|
||||
reply.value.accountId = data.accountId;
|
||||
|
||||
refreshChange();
|
||||
});
|
||||
|
||||
/** 执行发送 */
|
||||
async function sendMsg() {
|
||||
if (!unref(reply)) {
|
||||
return;
|
||||
}
|
||||
// 公众号限制:客服消息,公众号只允许发送一条
|
||||
if (
|
||||
reply.value.type === ReplyType.News &&
|
||||
reply.value.articles &&
|
||||
reply.value.articles.length > 1
|
||||
) {
|
||||
reply.value.articles = [reply.value.articles[0]];
|
||||
message.success('图文消息条数限制在 1 条以内,已默认发送第一条');
|
||||
}
|
||||
|
||||
// 注意:sendMessage API 需要 openid,但这里传入的是 userId
|
||||
// 这可能是后端 API 的特殊处理,使用类型断言绕过类型检查
|
||||
const data = await sendMessage({
|
||||
userId: props.userId,
|
||||
...reply.value,
|
||||
} as any);
|
||||
sendLoading.value = false;
|
||||
|
||||
list.value = [...list.value, data];
|
||||
await scrollToBottom();
|
||||
|
||||
// 发送后清空数据
|
||||
replySelectRef.value?.clear();
|
||||
}
|
||||
|
||||
/** 加载更多 */
|
||||
function loadMore() {
|
||||
queryParams.pageNo++;
|
||||
getPage(queryParams, null);
|
||||
}
|
||||
|
||||
/** 获取分页数据 */
|
||||
async function getPage(page: any, params: any = null) {
|
||||
loading.value = true;
|
||||
const dataTemp = await getMessagePage(
|
||||
Object.assign(
|
||||
{
|
||||
pageNo: page.pageNo,
|
||||
pageSize: page.pageSize,
|
||||
userId: props.userId,
|
||||
accountId: page.accountId,
|
||||
},
|
||||
params,
|
||||
),
|
||||
);
|
||||
|
||||
const scrollHeight = msgDivRef.value?.scrollHeight ?? 0;
|
||||
// 处理数据
|
||||
const data = dataTemp.list.reverse();
|
||||
list.value = [...data, ...list.value];
|
||||
loading.value = false;
|
||||
if (data.length < queryParams.pageSize || data.length === 0) {
|
||||
hasMore.value = false;
|
||||
}
|
||||
queryParams.pageNo = page.pageNo;
|
||||
queryParams.pageSize = page.pageSize;
|
||||
// 滚动到原来的位置
|
||||
if (queryParams.pageNo === 1) {
|
||||
// 定位到消息底部
|
||||
await scrollToBottom();
|
||||
} else if (data.length > 0) {
|
||||
// 定位滚动条
|
||||
await nextTick();
|
||||
if (scrollHeight !== 0 && msgDivRef.value) {
|
||||
msgDivRef.value.scrollTop =
|
||||
msgDivRef.value.scrollHeight - scrollHeight - 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 刷新消息 */
|
||||
function refreshChange() {
|
||||
getPage(queryParams);
|
||||
}
|
||||
|
||||
/** 定位到消息底部 */
|
||||
async function scrollToBottom() {
|
||||
await nextTick();
|
||||
if (msgDivRef.value) {
|
||||
msgDivRef.value.scrollTop = msgDivRef.value.scrollHeight;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<Spin :spinning="loading">
|
||||
<div class="msg-div" ref="msgDivRef">
|
||||
<!-- 加载更多 -->
|
||||
<div v-if="!loading">
|
||||
<div class="empty-block" v-if="hasMore" @click="loadMore">
|
||||
<span class="empty-text">点击加载更多</span>
|
||||
</div>
|
||||
<div class="empty-block" v-if="!hasMore">
|
||||
<span class="empty-text">没有更多了</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 消息列表 -->
|
||||
<MsgList :list="list" :account-id="accountId" :user="user" />
|
||||
</div>
|
||||
</Spin>
|
||||
|
||||
<Spin :spinning="sendLoading">
|
||||
<div class="msg-send">
|
||||
<WxReplySelect ref="replySelectRef" v-model="reply" />
|
||||
<Button type="primary" class="send-but" @click="sendMsg">
|
||||
发送(S)
|
||||
</Button>
|
||||
</div>
|
||||
</Spin>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.msg-div {
|
||||
height: 50vh;
|
||||
margin-right: 10px;
|
||||
margin-left: 10px;
|
||||
overflow: auto;
|
||||
background-color: #eaeaea;
|
||||
}
|
||||
|
||||
.msg-send {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.send-but {
|
||||
float: right;
|
||||
margin-top: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.empty-block {
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
17
apps/web-antd/src/views/mp/modules/wx-msg/types.ts
Normal file
17
apps/web-antd/src/views/mp/modules/wx-msg/types.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
export enum MsgType {
|
||||
Event = 'event',
|
||||
Image = 'image',
|
||||
Link = 'link',
|
||||
Location = 'location',
|
||||
Music = 'music',
|
||||
News = 'news',
|
||||
Text = 'text',
|
||||
Video = 'video',
|
||||
Voice = 'voice',
|
||||
}
|
||||
|
||||
export interface User {
|
||||
nickname: string;
|
||||
avatar: string;
|
||||
accountId: number;
|
||||
}
|
||||
1
apps/web-antd/src/views/mp/modules/wx-music/index.ts
Normal file
1
apps/web-antd/src/views/mp/modules/wx-music/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from './main.vue';
|
||||
69
apps/web-antd/src/views/mp/modules/wx-music/main.vue
Normal file
69
apps/web-antd/src/views/mp/modules/wx-music/main.vue
Normal file
@@ -0,0 +1,69 @@
|
||||
<!--
|
||||
【微信消息 - 音乐】
|
||||
-->
|
||||
<script lang="ts" setup>
|
||||
defineOptions({ name: 'WxMusic' });
|
||||
|
||||
const props = defineProps({
|
||||
title: {
|
||||
required: false,
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
description: {
|
||||
required: false,
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
musicUrl: {
|
||||
required: false,
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
hqMusicUrl: {
|
||||
required: false,
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
thumbMediaUrl: {
|
||||
required: true,
|
||||
type: String,
|
||||
},
|
||||
});
|
||||
|
||||
defineExpose({
|
||||
musicUrl: props.musicUrl,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<a
|
||||
target="_blank"
|
||||
:href="hqMusicUrl ? hqMusicUrl : musicUrl"
|
||||
style="text-decoration: none"
|
||||
>
|
||||
<div
|
||||
class="avue-card__body"
|
||||
style="padding: 10px; background-color: #fff; border-radius: 5px"
|
||||
>
|
||||
<div class="avue-card__avatar">
|
||||
<img :src="thumbMediaUrl" alt="" />
|
||||
</div>
|
||||
<div class="avue-card__detail">
|
||||
<div class="avue-card__title" style="margin-bottom: unset">
|
||||
{{ title }}
|
||||
</div>
|
||||
<div class="avue-card__info" style="height: unset">
|
||||
{{ description }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 因为 joolun 实现依赖 avue 组件,该页面使用了 card.scss */
|
||||
@import url('../wx-msg/card.scss');
|
||||
</style>
|
||||
1
apps/web-antd/src/views/mp/modules/wx-news/index.ts
Normal file
1
apps/web-antd/src/views/mp/modules/wx-news/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from './main.vue';
|
||||
126
apps/web-antd/src/views/mp/modules/wx-news/main.vue
Normal file
126
apps/web-antd/src/views/mp/modules/wx-news/main.vue
Normal file
@@ -0,0 +1,126 @@
|
||||
<!--
|
||||
- Copyright (C) 2018-2019
|
||||
- All rights reserved, Designed By www.joolun.com
|
||||
【微信消息 - 图文】
|
||||
芋道源码:
|
||||
① 代码优化,补充注释,提升阅读性
|
||||
-->
|
||||
<script lang="ts" setup>
|
||||
import { Image } from 'ant-design-vue';
|
||||
|
||||
defineOptions({ name: 'WxNews' });
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
articles?: any[] | null;
|
||||
}>(),
|
||||
{
|
||||
articles: null,
|
||||
},
|
||||
);
|
||||
|
||||
defineExpose({
|
||||
articles: props.articles,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="news-home">
|
||||
<div v-for="(article, index) in articles" :key="index" class="news-div">
|
||||
<!-- 头条 -->
|
||||
<a v-if="index === 0" :href="article.url" target="_blank">
|
||||
<div class="news-main">
|
||||
<div class="news-content">
|
||||
<Image
|
||||
:src="article.picUrl || article.thumbUrl"
|
||||
class="material-img"
|
||||
:preview="false"
|
||||
style="width: 100%; height: 120px"
|
||||
/>
|
||||
<div class="news-content-title">
|
||||
<span>{{ article.title }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<!-- 二条/三条等等 -->
|
||||
<a v-else :href="article.url" target="_blank">
|
||||
<div class="news-main-item">
|
||||
<div class="news-content-item">
|
||||
<div class="news-content-item-title">{{ article.title }}</div>
|
||||
<div class="news-content-item-img">
|
||||
<img
|
||||
:src="article.picUrl || article.thumbUrl"
|
||||
class="material-img"
|
||||
height="100%"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.news-home {
|
||||
width: 100%;
|
||||
margin: auto;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.news-main {
|
||||
width: 100%;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.news-content {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
background-color: #acadae;
|
||||
}
|
||||
|
||||
.news-content-title {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
box-sizing: unset !important;
|
||||
display: inline-block;
|
||||
width: 98%;
|
||||
padding: 1%;
|
||||
font-size: 12px;
|
||||
color: #fff;
|
||||
white-space: normal;
|
||||
background-color: black;
|
||||
opacity: 0.65;
|
||||
}
|
||||
|
||||
.news-main-item {
|
||||
padding: 5px 0;
|
||||
background-color: #fff;
|
||||
border-top: 1px solid #eaeaea;
|
||||
}
|
||||
|
||||
.news-content-item {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.news-content-item-title {
|
||||
display: inline-block;
|
||||
width: 70%;
|
||||
margin-left: 1%;
|
||||
font-size: 10px;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.news-content-item-img {
|
||||
display: inline-block;
|
||||
width: 25%;
|
||||
margin-right: 1%;
|
||||
background-color: #acadae;
|
||||
}
|
||||
|
||||
.material-img {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,193 @@
|
||||
<script lang="ts" setup>
|
||||
import type { UploadFile } from 'ant-design-vue';
|
||||
|
||||
import type { Reply } from './types';
|
||||
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
|
||||
import { Button, Col, message, Modal, Row, Upload } from 'ant-design-vue';
|
||||
|
||||
import { UploadType, useBeforeUpload } from '#/utils/useUpload';
|
||||
import WxMaterialSelect from '#/views/mp/modules/wx-material-select';
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: Reply;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', v: Reply): void;
|
||||
}>();
|
||||
|
||||
// 消息弹窗
|
||||
|
||||
const UPLOAD_URL = `${import.meta.env.VITE_BASE_URL}/admin-api/mp/material/upload-temporary`;
|
||||
const HEADERS = { Authorization: `Bearer ${useAccessStore().accessToken}` };
|
||||
const reply = computed<Reply>({
|
||||
get: () => props.modelValue,
|
||||
set: (val) => emit('update:modelValue', val),
|
||||
});
|
||||
|
||||
const showDialog = ref(false);
|
||||
const fileList = ref([]);
|
||||
const uploadData = reactive({
|
||||
accountId: reply.value.accountId,
|
||||
type: 'image',
|
||||
title: '',
|
||||
introduction: '',
|
||||
});
|
||||
|
||||
/** 图片上传前校验 */
|
||||
function beforeImageUpload(file: UploadFile) {
|
||||
return useBeforeUpload(UploadType.Image, 2)(file as any);
|
||||
}
|
||||
|
||||
/** 上传成功 */
|
||||
function onUploadSuccess(info: any) {
|
||||
const res = info.response || info;
|
||||
if (res.code !== 0) {
|
||||
message.error(`上传出错:${res.msg}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 清空上传时的各种数据
|
||||
fileList.value = [];
|
||||
uploadData.title = '';
|
||||
uploadData.introduction = '';
|
||||
|
||||
// 上传好的文件,本质是个素材,所以可以进行选中
|
||||
selectMaterial(res.data);
|
||||
}
|
||||
|
||||
/** 删除图片 */
|
||||
function onDelete() {
|
||||
reply.value.mediaId = null;
|
||||
reply.value.url = null;
|
||||
reply.value.name = null;
|
||||
}
|
||||
|
||||
/** 选择素材 */
|
||||
function selectMaterial(item: any) {
|
||||
showDialog.value = false;
|
||||
|
||||
// reply.value.type = 'image'
|
||||
reply.value.mediaId = item.mediaId;
|
||||
reply.value.url = item.url;
|
||||
reply.value.name = item.name;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<!-- 情况一:已经选择好素材、或者上传好图片 -->
|
||||
<div class="select-item" v-if="reply.url">
|
||||
<img class="material-img" :src="reply.url" />
|
||||
<p class="item-name" v-if="reply.name">{{ reply.name }}</p>
|
||||
<Row class="ope-row" justify="center">
|
||||
<Button type="primary" danger shape="circle" @click="onDelete">
|
||||
<IconifyIcon icon="ep:delete" />
|
||||
</Button>
|
||||
</Row>
|
||||
</div>
|
||||
<!-- 情况二:未做完上述操作 -->
|
||||
<Row v-else style="text-align: center" align="middle">
|
||||
<!-- 选择素材 -->
|
||||
<Col :span="12" class="col-select">
|
||||
<Button type="primary" @click="showDialog = true">
|
||||
素材库选择 <IconifyIcon icon="ep:circle-check" />
|
||||
</Button>
|
||||
<Modal
|
||||
title="选择图片"
|
||||
v-model:open="showDialog"
|
||||
width="90%"
|
||||
destroy-on-close
|
||||
>
|
||||
<WxMaterialSelect
|
||||
type="image"
|
||||
:account-id="reply.accountId"
|
||||
@select-material="selectMaterial"
|
||||
/>
|
||||
</Modal>
|
||||
</Col>
|
||||
<!-- 文件上传 -->
|
||||
<Col :span="12" class="col-add">
|
||||
<Upload
|
||||
:action="UPLOAD_URL"
|
||||
:headers="HEADERS"
|
||||
:file-list="fileList"
|
||||
:data="uploadData"
|
||||
:before-upload="beforeImageUpload"
|
||||
@change="
|
||||
(info) => {
|
||||
if (info.file.status === 'done') {
|
||||
onUploadSuccess(info.file.response || info.file);
|
||||
}
|
||||
}
|
||||
"
|
||||
>
|
||||
<Button type="primary">上传图片</Button>
|
||||
<template #tip>
|
||||
<span>
|
||||
<div class="upload-tip">
|
||||
支持 bmp/png/jpeg/jpg/gif 格式,大小不超过 2M
|
||||
</div>
|
||||
</span>
|
||||
</template>
|
||||
</Upload>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.select-item {
|
||||
width: 280px;
|
||||
padding: 10px;
|
||||
margin: 0 auto 10px;
|
||||
border: 1px solid #eaeaea;
|
||||
|
||||
.material-img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.item-name {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
|
||||
.item-infos {
|
||||
width: 30%;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.ope-row {
|
||||
padding-top: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.col-select {
|
||||
width: 49.5%;
|
||||
height: 160px;
|
||||
padding: 50px 0;
|
||||
border: 1px solid rgb(234 234 234);
|
||||
}
|
||||
|
||||
.col-add {
|
||||
float: right;
|
||||
width: 49.5%;
|
||||
height: 160px;
|
||||
padding: 50px 0;
|
||||
border: 1px solid rgb(234 234 234);
|
||||
|
||||
.upload-tip {
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,162 @@
|
||||
<script lang="ts" setup>
|
||||
import type { UploadFile } from 'ant-design-vue';
|
||||
|
||||
import type { Reply } from './types';
|
||||
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Col,
|
||||
Input,
|
||||
message,
|
||||
Modal,
|
||||
Row,
|
||||
Upload,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { UploadType, useBeforeUpload } from '#/utils/useUpload';
|
||||
// import { getAccessToken } from '@/utils/auth'
|
||||
import WxMaterialSelect from '#/views/mp/modules/wx-material-select';
|
||||
|
||||
// 设置上传的请求头部
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: Reply;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', v: Reply): void;
|
||||
}>();
|
||||
|
||||
// 消息弹窗
|
||||
|
||||
const UPLOAD_URL = `${import.meta.env.VITE_BASE_URL}/admin-api/mp/material/upload-temporary`;
|
||||
const HEADERS = { Authorization: `Bearer ${useAccessStore().accessToken}` };
|
||||
const reply = computed<Reply>({
|
||||
get: () => props.modelValue,
|
||||
set: (val) => emit('update:modelValue', val),
|
||||
});
|
||||
|
||||
const showDialog = ref(false);
|
||||
const fileList = ref([]);
|
||||
const uploadData = reactive({
|
||||
accountId: reply.value.accountId,
|
||||
type: 'thumb', // 音乐类型为thumb
|
||||
title: '',
|
||||
introduction: '',
|
||||
});
|
||||
|
||||
/** 图片上传前校验 */
|
||||
function beforeImageUpload(file: UploadFile) {
|
||||
return useBeforeUpload(UploadType.Image, 2)(file as any);
|
||||
}
|
||||
|
||||
/** 上传成功 */
|
||||
function onUploadSuccess(info: any) {
|
||||
const res = info.response || info;
|
||||
if (res.code !== 0) {
|
||||
message.error(`上传出错:${res.msg}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 清空上传时的各种数据
|
||||
fileList.value = [];
|
||||
uploadData.title = '';
|
||||
uploadData.introduction = '';
|
||||
|
||||
// 上传好的文件,本质是个素材,所以可以进行选中
|
||||
selectMaterial(res.data);
|
||||
}
|
||||
|
||||
/** 选择素材 */
|
||||
function selectMaterial(item: any) {
|
||||
showDialog.value = false;
|
||||
|
||||
reply.value.thumbMediaId = item.mediaId;
|
||||
reply.value.thumbMediaUrl = item.url;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<Row align="middle" justify="center">
|
||||
<Col :span="6">
|
||||
<Row align="middle" justify="center" class="thumb-div">
|
||||
<Col :span="24">
|
||||
<Row align="middle" justify="center">
|
||||
<img
|
||||
style="width: 100px"
|
||||
v-if="reply.thumbMediaUrl"
|
||||
:src="reply.thumbMediaUrl"
|
||||
/>
|
||||
<IconifyIcon v-else icon="ep:plus" />
|
||||
</Row>
|
||||
<Row align="middle" justify="center" style="margin-top: 2%">
|
||||
<div class="thumb-but">
|
||||
<Upload
|
||||
:action="UPLOAD_URL"
|
||||
:headers="HEADERS"
|
||||
:file-list="fileList"
|
||||
:data="uploadData"
|
||||
:before-upload="beforeImageUpload"
|
||||
@change="
|
||||
(info) => {
|
||||
if (info.file.status === 'done') {
|
||||
onUploadSuccess(info.file.response || info.file);
|
||||
}
|
||||
}
|
||||
"
|
||||
>
|
||||
<template #default>
|
||||
<Button type="link">本地上传</Button>
|
||||
</template>
|
||||
</Upload>
|
||||
<Button
|
||||
type="link"
|
||||
@click="showDialog = true"
|
||||
style="margin-left: 5px"
|
||||
>
|
||||
素材库选择
|
||||
</Button>
|
||||
</div>
|
||||
</Row>
|
||||
</Col>
|
||||
</Row>
|
||||
<Modal
|
||||
title="选择图片"
|
||||
v-model:open="showDialog"
|
||||
width="80%"
|
||||
destroy-on-close
|
||||
>
|
||||
<WxMaterialSelect
|
||||
type="image"
|
||||
:account-id="reply.accountId"
|
||||
@select-material="selectMaterial"
|
||||
/>
|
||||
</Modal>
|
||||
</Col>
|
||||
<Col :span="18">
|
||||
<Input v-model:value="reply.title as string" placeholder="请输入标题" />
|
||||
<div style="margin: 20px 0"></div>
|
||||
<Input
|
||||
v-model:value="reply.description as string"
|
||||
placeholder="请输入描述"
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
<div style="margin: 20px 0"></div>
|
||||
<Input
|
||||
v-model:value="reply.musicUrl as string"
|
||||
placeholder="请输入音乐链接"
|
||||
/>
|
||||
<div style="margin: 20px 0"></div>
|
||||
<Input
|
||||
v-model:value="reply.hqMusicUrl as string"
|
||||
placeholder="请输入高质量音乐链接"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,99 @@
|
||||
<script lang="ts" setup>
|
||||
import type { Reply } from './types';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
import { Button, Col, Modal, Row } from 'ant-design-vue';
|
||||
|
||||
import WxMaterialSelect from '#/views/mp/modules/wx-material-select';
|
||||
import WxNews from '#/views/mp/modules/wx-news';
|
||||
|
||||
import { NewsType } from './types';
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: Reply;
|
||||
newsType: NewsType;
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', v: Reply): void;
|
||||
}>();
|
||||
const reply = computed<Reply>({
|
||||
get: () => props.modelValue,
|
||||
set: (val) => emit('update:modelValue', val),
|
||||
});
|
||||
|
||||
const showDialog = ref(false);
|
||||
|
||||
/** 选择素材 */
|
||||
function selectMaterial(item: any) {
|
||||
showDialog.value = false;
|
||||
reply.value.articles = item.content.newsItem;
|
||||
}
|
||||
|
||||
/** 删除图文 */
|
||||
function onDelete() {
|
||||
reply.value.articles = [];
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<Row>
|
||||
<div
|
||||
class="select-item"
|
||||
v-if="reply.articles && reply.articles.length > 0"
|
||||
>
|
||||
<WxNews :articles="reply.articles" />
|
||||
<Col class="ope-row">
|
||||
<Button type="primary" danger shape="circle" @click="onDelete">
|
||||
<IconifyIcon icon="ep:delete" />
|
||||
</Button>
|
||||
</Col>
|
||||
</div>
|
||||
<!-- 选择素材 -->
|
||||
<Col :span="24" v-if="!reply.content">
|
||||
<Row style="text-align: center" align="middle">
|
||||
<Col :span="24">
|
||||
<Button type="primary" @click="showDialog = true">
|
||||
{{
|
||||
newsType === NewsType.Published
|
||||
? '选择已发布图文'
|
||||
: '选择草稿箱图文'
|
||||
}}
|
||||
<IconifyIcon icon="ep:circle-check" />
|
||||
</Button>
|
||||
</Col>
|
||||
</Row>
|
||||
</Col>
|
||||
<Modal
|
||||
title="选择图文"
|
||||
v-model:open="showDialog"
|
||||
width="90%"
|
||||
destroy-on-close
|
||||
>
|
||||
<WxMaterialSelect
|
||||
type="news"
|
||||
:account-id="reply.accountId"
|
||||
:news-type="newsType"
|
||||
@select-material="selectMaterial"
|
||||
/>
|
||||
</Modal>
|
||||
</Row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.select-item {
|
||||
width: 280px;
|
||||
padding: 10px;
|
||||
margin: 0 auto 10px;
|
||||
border: 1px solid #eaeaea;
|
||||
|
||||
.ope-row {
|
||||
padding-top: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,30 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { Input } from 'ant-design-vue';
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue?: null | string;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', v: null | string): void;
|
||||
(e: 'input', v: null | string): void;
|
||||
}>();
|
||||
|
||||
const content = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (val: null | string) => {
|
||||
emit('update:modelValue', val);
|
||||
emit('input', val);
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Input.TextArea
|
||||
:rows="5"
|
||||
placeholder="请输入内容"
|
||||
v-model:value="content as string"
|
||||
/>
|
||||
</template>
|
||||
@@ -0,0 +1,164 @@
|
||||
<script lang="ts" setup>
|
||||
import type { UploadFile } from 'ant-design-vue';
|
||||
|
||||
import type { Reply } from './types';
|
||||
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Col,
|
||||
Input,
|
||||
message,
|
||||
Modal,
|
||||
Row,
|
||||
Upload,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { UploadType, useBeforeUpload } from '#/utils/useUpload';
|
||||
import WxMaterialSelect from '#/views/mp/modules/wx-material-select';
|
||||
import WxVideoPlayer from '#/views/mp/modules/wx-video-play';
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: Reply;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', v: Reply): void;
|
||||
}>();
|
||||
|
||||
// 消息弹窗
|
||||
|
||||
const UPLOAD_URL = `${import.meta.env.VITE_BASE_URL}/admin-api/mp/material/upload-temporary`;
|
||||
const HEADERS = { Authorization: `Bearer ${useAccessStore().accessToken}` };
|
||||
|
||||
const reply = computed<Reply>({
|
||||
get: () => props.modelValue,
|
||||
set: (val: Reply) => emit('update:modelValue', val),
|
||||
});
|
||||
|
||||
const showDialog = ref(false);
|
||||
const fileList = ref([]);
|
||||
const uploadData = reactive({
|
||||
accountId: reply.value.accountId,
|
||||
type: 'video',
|
||||
title: '',
|
||||
introduction: '',
|
||||
});
|
||||
|
||||
/** 视频上传前校验 */
|
||||
function beforeVideoUpload(file: UploadFile) {
|
||||
return useBeforeUpload(UploadType.Video, 10)(file as any);
|
||||
}
|
||||
|
||||
/** 上传成功 */
|
||||
function onUploadSuccess(info: any) {
|
||||
const res = info.response || info;
|
||||
if (res.code !== 0) {
|
||||
message.error(`上传出错:${res.msg}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 清空上传时的各种数据
|
||||
fileList.value = [];
|
||||
uploadData.title = '';
|
||||
uploadData.introduction = '';
|
||||
|
||||
selectMaterial(res.data);
|
||||
}
|
||||
|
||||
/** 选择素材后设置 */
|
||||
function selectMaterial(item: any) {
|
||||
showDialog.value = false;
|
||||
|
||||
reply.value.mediaId = item.mediaId;
|
||||
reply.value.url = item.url;
|
||||
reply.value.name = item.name;
|
||||
|
||||
// title、introduction:从 item 到 tempObjItem,因为素材里有 title、introduction
|
||||
if (item.title) {
|
||||
reply.value.title = item.title || '';
|
||||
}
|
||||
if (item.introduction) {
|
||||
reply.value.description = item.introduction || '';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<Row>
|
||||
<Input
|
||||
v-model:value="reply.title as string"
|
||||
class="input-margin-bottom"
|
||||
placeholder="请输入标题"
|
||||
/>
|
||||
<Input
|
||||
class="input-margin-bottom"
|
||||
v-model:value="reply.description as string"
|
||||
placeholder="请输入描述"
|
||||
/>
|
||||
<Row class="ope-row" justify="center">
|
||||
<WxVideoPlayer v-if="reply.url" :url="reply.url" />
|
||||
</Row>
|
||||
<Col class="w-full">
|
||||
<Row style="text-align: center" align="middle">
|
||||
<!-- 选择素材 -->
|
||||
<Col :span="12">
|
||||
<Button type="primary" @click="showDialog = true">
|
||||
素材库选择 <IconifyIcon icon="ep:circle-check" />
|
||||
</Button>
|
||||
<Modal
|
||||
title="选择视频"
|
||||
v-model:open="showDialog"
|
||||
width="90%"
|
||||
destroy-on-close
|
||||
>
|
||||
<WxMaterialSelect
|
||||
type="video"
|
||||
:account-id="reply.accountId"
|
||||
@select-material="selectMaterial"
|
||||
/>
|
||||
</Modal>
|
||||
</Col>
|
||||
<!-- 文件上传 -->
|
||||
<Col :span="12">
|
||||
<Upload
|
||||
:action="UPLOAD_URL"
|
||||
:headers="HEADERS"
|
||||
:file-list="fileList"
|
||||
:data="uploadData"
|
||||
:before-upload="beforeVideoUpload"
|
||||
@change="
|
||||
(info) => {
|
||||
if (info.file.status === 'done') {
|
||||
onUploadSuccess(info.file.response || info.file);
|
||||
}
|
||||
}
|
||||
"
|
||||
>
|
||||
<Button type="primary">
|
||||
新建视频 <IconifyIcon icon="ep:upload" />
|
||||
</Button>
|
||||
</Upload>
|
||||
</Col>
|
||||
</Row>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.input-margin-bottom {
|
||||
margin-bottom: 2%;
|
||||
}
|
||||
|
||||
.ope-row {
|
||||
width: 100%;
|
||||
padding-top: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,184 @@
|
||||
<script lang="ts" setup>
|
||||
import type { UploadFile } from 'ant-design-vue';
|
||||
|
||||
import type { Reply } from './types';
|
||||
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
|
||||
import { Button, Col, message, Modal, Row, Upload } from 'ant-design-vue';
|
||||
|
||||
import { UploadType, useBeforeUpload } from '#/utils/useUpload';
|
||||
import WxMaterialSelect from '#/views/mp/modules/wx-material-select';
|
||||
import WxVoicePlayer from '#/views/mp/modules/wx-voice-play';
|
||||
|
||||
// 设置上传的请求头部
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: Reply;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', v: Reply): void;
|
||||
}>();
|
||||
|
||||
// 消息弹窗
|
||||
|
||||
const UPLOAD_URL = `${import.meta.env.VITE_BASE_URL}/admin-api/mp/material/upload-temporary`;
|
||||
const HEADERS = { Authorization: `Bearer ${useAccessStore().accessToken}` };
|
||||
const reply = computed<Reply>({
|
||||
get: () => props.modelValue,
|
||||
set: (val: Reply) => emit('update:modelValue', val),
|
||||
});
|
||||
|
||||
const showDialog = ref(false);
|
||||
const fileList = ref([]);
|
||||
const uploadData = reactive({
|
||||
accountId: reply.value.accountId,
|
||||
type: 'voice',
|
||||
title: '',
|
||||
introduction: '',
|
||||
});
|
||||
|
||||
/** 语音上传前校验 */
|
||||
function beforeVoiceUpload(file: UploadFile) {
|
||||
return useBeforeUpload(UploadType.Voice, 10)(file as any);
|
||||
}
|
||||
|
||||
/** 上传成功 */
|
||||
function onUploadSuccess(info: any) {
|
||||
const res = info.response || info;
|
||||
if (res.code !== 0) {
|
||||
message.error(`上传出错:${res.msg}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 清空上传时的各种数据
|
||||
fileList.value = [];
|
||||
uploadData.title = '';
|
||||
uploadData.introduction = '';
|
||||
|
||||
// 上传好的文件,本质是个素材,所以可以进行选中
|
||||
selectMaterial(res.data);
|
||||
}
|
||||
|
||||
/** 删除语音 */
|
||||
function onDelete() {
|
||||
reply.value.mediaId = null;
|
||||
reply.value.url = null;
|
||||
reply.value.name = null;
|
||||
}
|
||||
|
||||
/** 选择素材 */
|
||||
function selectMaterial(item: Reply) {
|
||||
showDialog.value = false;
|
||||
|
||||
// reply.value.type = ReplyType.Voice
|
||||
reply.value.mediaId = item.mediaId;
|
||||
reply.value.url = item.url;
|
||||
reply.value.name = item.name;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
<div class="select-item2" v-if="reply.url">
|
||||
<p class="item-name">{{ reply.name }}</p>
|
||||
<Row class="ope-row" justify="center">
|
||||
<WxVoicePlayer :url="reply.url" />
|
||||
</Row>
|
||||
<Row class="ope-row" justify="center">
|
||||
<Button type="primary" danger shape="circle" @click="onDelete">
|
||||
<IconifyIcon icon="ep:delete" />
|
||||
</Button>
|
||||
</Row>
|
||||
</div>
|
||||
<Row v-else style="text-align: center">
|
||||
<!-- 选择素材 -->
|
||||
<Col :span="12" class="col-select">
|
||||
<Button type="primary" @click="showDialog = true">
|
||||
素材库选择<IconifyIcon icon="ep:circle-check" />
|
||||
</Button>
|
||||
<Modal
|
||||
title="选择语音"
|
||||
v-model:open="showDialog"
|
||||
width="90%"
|
||||
destroy-on-close
|
||||
>
|
||||
<WxMaterialSelect
|
||||
type="voice"
|
||||
:account-id="reply.accountId"
|
||||
@select-material="selectMaterial"
|
||||
/>
|
||||
</Modal>
|
||||
</Col>
|
||||
<!-- 文件上传 -->
|
||||
<Col :span="12" class="col-add">
|
||||
<Upload
|
||||
:action="UPLOAD_URL"
|
||||
:headers="HEADERS"
|
||||
:file-list="fileList"
|
||||
:data="uploadData"
|
||||
:before-upload="beforeVoiceUpload"
|
||||
@change="
|
||||
(info) => {
|
||||
if (info.file.status === 'done') {
|
||||
onUploadSuccess(info.file.response || info.file);
|
||||
}
|
||||
}
|
||||
"
|
||||
>
|
||||
<Button type="primary">点击上传</Button>
|
||||
<template #tip>
|
||||
<div class="upload-tip">
|
||||
格式支持 mp3/wma/wav/amr,文件大小不超过 2M,播放长度不超过 60s
|
||||
</div>
|
||||
</template>
|
||||
</Upload>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.select-item2 {
|
||||
padding: 10px;
|
||||
margin: 0 auto 10px;
|
||||
border: 1px solid #eaeaea;
|
||||
|
||||
.item-name {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
|
||||
.ope-row {
|
||||
width: 100%;
|
||||
padding-top: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.col-select {
|
||||
width: 49.5%;
|
||||
height: 160px;
|
||||
padding: 50px 0;
|
||||
border: 1px solid rgb(234 234 234);
|
||||
}
|
||||
|
||||
.col-add {
|
||||
float: right;
|
||||
width: 49.5%;
|
||||
height: 160px;
|
||||
padding: 50px 0;
|
||||
border: 1px solid rgb(234 234 234);
|
||||
|
||||
.upload-tip {
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,58 @@
|
||||
import type { Ref } from 'vue';
|
||||
|
||||
import { unref } from 'vue';
|
||||
|
||||
enum ReplyType {
|
||||
Image = 'image',
|
||||
Music = 'music',
|
||||
News = 'news',
|
||||
Text = 'text',
|
||||
Video = 'video',
|
||||
Voice = 'voice',
|
||||
}
|
||||
|
||||
interface _Reply {
|
||||
accountId: number;
|
||||
type: ReplyType;
|
||||
name?: null | string;
|
||||
content?: null | string;
|
||||
mediaId?: null | string;
|
||||
url?: null | string;
|
||||
title?: null | string;
|
||||
description?: null | string;
|
||||
thumbMediaId?: null | string;
|
||||
thumbMediaUrl?: null | string;
|
||||
musicUrl?: null | string;
|
||||
hqMusicUrl?: null | string;
|
||||
introduction?: null | string;
|
||||
articles?: any[];
|
||||
}
|
||||
|
||||
type Reply = _Reply; // Partial<_Reply>
|
||||
|
||||
enum NewsType {
|
||||
Draft = '2',
|
||||
Published = '1',
|
||||
}
|
||||
|
||||
/** 利用旧的reply[accountId, type]初始化新的Reply */
|
||||
const createEmptyReply = (old: Ref<Reply> | Reply): Reply => {
|
||||
return {
|
||||
accountId: unref(old).accountId,
|
||||
type: unref(old).type,
|
||||
name: null,
|
||||
content: null,
|
||||
mediaId: null,
|
||||
url: null,
|
||||
title: null,
|
||||
description: null,
|
||||
thumbMediaId: null,
|
||||
thumbMediaUrl: null,
|
||||
musicUrl: null,
|
||||
hqMusicUrl: null,
|
||||
introduction: null,
|
||||
articles: [],
|
||||
};
|
||||
};
|
||||
|
||||
export { createEmptyReply, NewsType, type Reply, ReplyType };
|
||||
8
apps/web-antd/src/views/mp/modules/wx-reply/index.ts
Normal file
8
apps/web-antd/src/views/mp/modules/wx-reply/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export {
|
||||
createEmptyReply,
|
||||
NewsType,
|
||||
type Reply,
|
||||
ReplyType,
|
||||
} from './components/types';
|
||||
|
||||
export { default } from './main.vue';
|
||||
219
apps/web-antd/src/views/mp/modules/wx-reply/main.vue
Normal file
219
apps/web-antd/src/views/mp/modules/wx-reply/main.vue
Normal file
@@ -0,0 +1,219 @@
|
||||
<!--
|
||||
- Copyright (C) 2018-2019
|
||||
- All rights reserved, Designed By www.joolun.com
|
||||
芋道源码:
|
||||
① 移除多余的 rep 为前缀的变量,让 message 消息更简单
|
||||
② 代码优化,补充注释,提升阅读性
|
||||
③ 优化消息的临时缓存策略,发送消息时,只清理被发送消息的 tab,不会强制切回到 text 输入
|
||||
④ 支持发送【视频】消息时,支持新建视频
|
||||
-->
|
||||
<script lang="ts" setup>
|
||||
import type { Reply } from './components/types';
|
||||
|
||||
import { computed, ref, unref, watch } from 'vue';
|
||||
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
import { Row, Tabs } from 'ant-design-vue';
|
||||
|
||||
import TabImage from './components/TabImage.vue';
|
||||
import TabMusic from './components/TabMusic.vue';
|
||||
import TabNews from './components/TabNews.vue';
|
||||
import TabText from './components/TabText.vue';
|
||||
import TabVideo from './components/TabVideo.vue';
|
||||
import TabVoice from './components/TabVoice.vue';
|
||||
import { createEmptyReply, NewsType, ReplyType } from './components/types';
|
||||
|
||||
defineOptions({ name: 'WxReplySelect' });
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
modelValue: Reply;
|
||||
newsType?: NewsType;
|
||||
}>(),
|
||||
{
|
||||
newsType: () => NewsType.Published,
|
||||
},
|
||||
);
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', v: Reply): void;
|
||||
}>();
|
||||
const reply = computed<Reply>({
|
||||
get: () => props.modelValue,
|
||||
set: (val) => emit('update:modelValue', val),
|
||||
});
|
||||
// 作为多个标签保存各自Reply的缓存
|
||||
const tabCache = new Map<ReplyType, Reply>();
|
||||
// 采用独立的ref来保存当前tab,避免在watch标签变化,对reply进行赋值会产生了循环调用
|
||||
const currentTab = ref<ReplyType>(props.modelValue.type || ReplyType.Text);
|
||||
|
||||
watch(
|
||||
currentTab,
|
||||
(newTab, oldTab) => {
|
||||
// 第一次进入:oldTab 为 undefined
|
||||
// 判断 newTab 是因为 Reply 为 Partial
|
||||
if (oldTab === undefined || newTab === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
tabCache.set(oldTab, unref(reply));
|
||||
|
||||
// 从缓存里面取出新tab内容,有则覆盖Reply,没有则创建空Reply
|
||||
const temp = tabCache.get(newTab);
|
||||
if (temp) {
|
||||
reply.value = temp;
|
||||
} else {
|
||||
const newData = createEmptyReply(reply);
|
||||
newData.type = newTab;
|
||||
reply.value = newData;
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
},
|
||||
);
|
||||
|
||||
/** 清除除了`type`, `accountId`的字段 */
|
||||
function clear() {
|
||||
reply.value = createEmptyReply(reply);
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
clear,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Tabs v-model:active-key="currentTab" type="card">
|
||||
<!-- 类型 1:文本 -->
|
||||
<Tabs.TabPane :key="ReplyType.Text">
|
||||
<template #tab>
|
||||
<Row align="middle"><IconifyIcon icon="ep:document" /> 文本</Row>
|
||||
</template>
|
||||
<TabText v-model="reply.content" />
|
||||
</Tabs.TabPane>
|
||||
|
||||
<!-- 类型 2:图片 -->
|
||||
<Tabs.TabPane :key="ReplyType.Image">
|
||||
<template #tab>
|
||||
<Row align="middle">
|
||||
<IconifyIcon icon="ep:picture" class="mr-5px" /> 图片
|
||||
</Row>
|
||||
</template>
|
||||
<TabImage v-model="reply" />
|
||||
</Tabs.TabPane>
|
||||
|
||||
<!-- 类型 3:语音 -->
|
||||
<Tabs.TabPane :key="ReplyType.Voice">
|
||||
<template #tab>
|
||||
<Row align="middle"><IconifyIcon icon="ep:phone" /> 语音</Row>
|
||||
</template>
|
||||
<TabVoice v-model="reply" />
|
||||
</Tabs.TabPane>
|
||||
|
||||
<!-- 类型 4:视频 -->
|
||||
<Tabs.TabPane :key="ReplyType.Video">
|
||||
<template #tab>
|
||||
<Row align="middle"><IconifyIcon icon="ep:share" /> 视频</Row>
|
||||
</template>
|
||||
<TabVideo v-model="reply" />
|
||||
</Tabs.TabPane>
|
||||
|
||||
<!-- 类型 5:图文 -->
|
||||
<Tabs.TabPane :key="ReplyType.News">
|
||||
<template #tab>
|
||||
<Row align="middle"><IconifyIcon icon="ep:reading" /> 图文</Row>
|
||||
</template>
|
||||
<TabNews v-model="reply" :news-type="newsType" />
|
||||
</Tabs.TabPane>
|
||||
|
||||
<!-- 类型 6:音乐 -->
|
||||
<Tabs.TabPane :key="ReplyType.Music">
|
||||
<template #tab>
|
||||
<Row align="middle"><IconifyIcon icon="ep:service" />音乐</Row>
|
||||
</template>
|
||||
<TabMusic v-model="reply" />
|
||||
</Tabs.TabPane>
|
||||
</Tabs>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.select-item {
|
||||
width: 280px;
|
||||
padding: 10px;
|
||||
margin: 0 auto 10px;
|
||||
border: 1px solid #eaeaea;
|
||||
}
|
||||
|
||||
.select-item2 {
|
||||
padding: 10px;
|
||||
margin: 0 auto 10px;
|
||||
border: 1px solid #eaeaea;
|
||||
}
|
||||
|
||||
.ope-row {
|
||||
padding-top: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.input-margin-bottom {
|
||||
margin-bottom: 2%;
|
||||
}
|
||||
|
||||
.item-name {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.el-form-item__content {
|
||||
line-height: unset !important;
|
||||
}
|
||||
|
||||
.col-select {
|
||||
width: 49.5%;
|
||||
height: 160px;
|
||||
padding: 50px 0;
|
||||
border: 1px solid rgb(234 234 234);
|
||||
}
|
||||
|
||||
.col-select2 {
|
||||
height: 160px;
|
||||
padding: 50px 0;
|
||||
border: 1px solid rgb(234 234 234);
|
||||
}
|
||||
|
||||
.col-add {
|
||||
float: right;
|
||||
width: 49.5%;
|
||||
height: 160px;
|
||||
padding: 50px 0;
|
||||
border: 1px solid rgb(234 234 234);
|
||||
}
|
||||
|
||||
.avatar-uploader-icon {
|
||||
width: 100px !important;
|
||||
height: 100px !important;
|
||||
font-size: 28px;
|
||||
line-height: 100px !important;
|
||||
color: #8c939d;
|
||||
text-align: center;
|
||||
border: 1px solid #d9d9d9;
|
||||
}
|
||||
|
||||
.material-img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.thumb-div {
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.item-infos {
|
||||
width: 30%;
|
||||
margin: auto;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from './main.vue';
|
||||
78
apps/web-antd/src/views/mp/modules/wx-video-play/main.vue
Normal file
78
apps/web-antd/src/views/mp/modules/wx-video-play/main.vue
Normal file
@@ -0,0 +1,78 @@
|
||||
<!--
|
||||
- Copyright (C) 2018-2019
|
||||
- All rights reserved, Designed By www.joolun.com
|
||||
【微信消息 - 视频】
|
||||
芋道源码:
|
||||
① bug 修复:
|
||||
1)joolun 的做法:使用 mediaId 从微信公众号,下载对应的 mp4 素材,从而播放内容;
|
||||
存在的问题:mediaId 有效期是 3 天,超过时间后无法播放
|
||||
2)重构后的做法:后端接收到微信公众号的视频消息后,将视频消息的 media_id 的文件内容保存到文件服务器中,这样前端可以直接使用 URL 播放。
|
||||
② 体验优化:弹窗关闭后,自动暂停视频的播放
|
||||
|
||||
-->
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Modal } from 'ant-design-vue';
|
||||
|
||||
// import { VideoPlayer } from '@videojs-player/vue';
|
||||
|
||||
// import 'video.js/dist/video-js.css';
|
||||
|
||||
defineOptions({ name: 'WxVideoPlayer' });
|
||||
|
||||
const props = defineProps({
|
||||
url: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const dialogVideo = ref(false);
|
||||
|
||||
// const handleEvent = (log) => {
|
||||
// console.log('Basic player event', log)
|
||||
// }
|
||||
|
||||
const playVideo = () => {
|
||||
dialogVideo.value = true;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div @click="playVideo()">
|
||||
<!-- 提示 -->
|
||||
<div>
|
||||
<Icon icon="ep:video-play" :size="32" class="mr-5px" />
|
||||
<p class="text-sm">点击播放视频</p>
|
||||
</div>
|
||||
|
||||
<!-- 弹窗播放 -->
|
||||
<Modal v-model:open="dialogVideo" title="视频播放" width="800px">
|
||||
<VideoPlayer
|
||||
v-if="dialogVideo"
|
||||
class="video-player vjs-big-play-centered"
|
||||
:src="props.url"
|
||||
poster=""
|
||||
crossorigin="anonymous"
|
||||
controls
|
||||
playsinline
|
||||
:volume="0.6"
|
||||
:width="800"
|
||||
:playback-rates="[0.7, 1.0, 1.5, 2.0]"
|
||||
/>
|
||||
<!-- 事件,暫時沒用
|
||||
@mounted="handleMounted"-->
|
||||
<!-- @ready="handleEvent($event)"-->
|
||||
<!-- @play="handleEvent($event)"-->
|
||||
<!-- @pause="handleEvent($event)"-->
|
||||
<!-- @ended="handleEvent($event)"-->
|
||||
<!-- @loadeddata="handleEvent($event)"-->
|
||||
<!-- @waiting="handleEvent($event)"-->
|
||||
<!-- @playing="handleEvent($event)"-->
|
||||
<!-- @canplay="handleEvent($event)"-->
|
||||
<!-- @canplaythrough="handleEvent($event)"-->
|
||||
<!-- @timeupdate="handleEvent(player?.currentTime())"-->
|
||||
</Modal>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from './main.vue';
|
||||
107
apps/web-antd/src/views/mp/modules/wx-voice-play/main.vue
Normal file
107
apps/web-antd/src/views/mp/modules/wx-voice-play/main.vue
Normal file
@@ -0,0 +1,107 @@
|
||||
<!--
|
||||
- Copyright (C) 2018-2019
|
||||
- All rights reserved, Designed By www.joolun.com
|
||||
【微信消息 - 语音】
|
||||
芋道源码:
|
||||
① bug 修复:
|
||||
1)joolun 的做法:使用 mediaId 从微信公众号,下载对应的 mp4 素材,从而播放内容;
|
||||
存在的问题:mediaId 有效期是 3 天,超过时间后无法播放
|
||||
2)重构后的做法:后端接收到微信公众号的视频消息后,将视频消息的 media_id 的文件内容保存到文件服务器中,这样前端可以直接使用 URL 播放。
|
||||
② 代码优化:将 props 中的 reply 调成为 data 中对应的属性,并补充相关注释
|
||||
-->
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Tag } from 'ant-design-vue';
|
||||
// 因为微信语音是 amr 格式,所以需要用到 amr 解码器:https://www.npmjs.com/package/benz-amr-recorder
|
||||
import BenzAMRRecorder from 'benz-amr-recorder';
|
||||
|
||||
defineOptions({ name: 'WxVoicePlayer' });
|
||||
|
||||
const props = defineProps({
|
||||
url: {
|
||||
type: String, // 语音地址,例如说:https://www.iocoder.cn/xxx.amr
|
||||
required: true,
|
||||
},
|
||||
content: {
|
||||
type: String, // 语音文本
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
|
||||
const amr = ref();
|
||||
const playing = ref(false);
|
||||
const duration = ref();
|
||||
|
||||
/** 处理点击,播放或暂停 */
|
||||
const playVoice = () => {
|
||||
// 情况一:未初始化,则创建 BenzAMRRecorder
|
||||
if (amr.value === undefined) {
|
||||
amrInit();
|
||||
return;
|
||||
}
|
||||
// 情况二:已经初始化,则根据情况播放或暂时
|
||||
if (amr.value.isPlaying()) {
|
||||
amrStop();
|
||||
} else {
|
||||
amrPlay();
|
||||
}
|
||||
};
|
||||
|
||||
/** 音频初始化 */
|
||||
const amrInit = () => {
|
||||
amr.value = new BenzAMRRecorder();
|
||||
// 设置播放
|
||||
amr.value.initWithUrl(props.url).then(() => {
|
||||
amrPlay();
|
||||
duration.value = amr.value.getDuration();
|
||||
});
|
||||
// 监听暂停
|
||||
amr.value.onEnded(() => {
|
||||
playing.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
/** 音频播放 */
|
||||
const amrPlay = () => {
|
||||
playing.value = true;
|
||||
amr.value.play();
|
||||
};
|
||||
|
||||
/** 音频暂停 */
|
||||
const amrStop = () => {
|
||||
playing.value = false;
|
||||
amr.value.stop();
|
||||
};
|
||||
// TODO 芋艿:下面样式有点问题
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="wx-voice-div" @click="playVoice">
|
||||
<Icon v-if="playing !== true" icon="ep:video-play" :size="32" />
|
||||
<Icon v-else icon="ep:video-pause" :size="32" />
|
||||
<span class="amr-duration" v-if="duration">{{ duration }} 秒</span>
|
||||
<div v-if="content">
|
||||
<Tag color="success" size="small">语音识别</Tag>
|
||||
{{ content }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.wx-voice-div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 120px;
|
||||
height: 50px;
|
||||
padding: 5px;
|
||||
background-color: #eaeaea;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.amr-duration {
|
||||
margin-left: 5px;
|
||||
font-size: 11px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,10 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { ElColorPicker, ElInput } from 'element-plus';
|
||||
|
||||
import { PREDEFINE_COLORS } from '@vben/constants';
|
||||
|
||||
import { ElColorPicker, ElInput } from 'element-plus';
|
||||
|
||||
/** 颜色输入框 */
|
||||
defineOptions({ name: 'ColorInput' });
|
||||
|
||||
|
||||
@@ -17,5 +17,5 @@ defineProps<{ property: ImageBarProperty }>();
|
||||
>
|
||||
<IconifyIcon icon="ep:picture" class="text-3xl text-gray-600" />
|
||||
</div>
|
||||
<ElImage v-else class="block w-full h-full" :src="property.imgUrl" />
|
||||
<ElImage v-else class="block h-full w-full" :src="property.imgUrl" />
|
||||
</template>
|
||||
|
||||
@@ -255,11 +255,11 @@ const eachCube = (callback: (x: number, y: number, cube: Cube) => void) => {
|
||||
|
||||
.cube {
|
||||
box-sizing: border-box;
|
||||
line-height: 1;
|
||||
color: var(--el-text-color-secondary);
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
border: 1px solid var(--el-border-color);
|
||||
line-height: 1;
|
||||
|
||||
:deep(.iconify) {
|
||||
display: inline-block;
|
||||
|
||||
@@ -7,10 +7,7 @@ import { useVbenModal } from '@vben/common-ui';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import * as CouponTemplateApi from '#/api/mall/promotion/coupon/couponTemplate';
|
||||
|
||||
import {
|
||||
useGridColumns,
|
||||
useGridFormSchema,
|
||||
} from './select-data';
|
||||
import { useGridColumns, useGridFormSchema } from './select-data';
|
||||
|
||||
defineOptions({ name: 'CouponSelect' });
|
||||
|
||||
@@ -54,7 +51,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onConfirm() {
|
||||
// 从 gridApi 获取选中的记录
|
||||
const selectedRecords = (gridApi.grid?.getCheckboxRecords() || []) as MallCouponTemplateApi.CouponTemplate[];
|
||||
const selectedRecords = (gridApi.grid?.getCheckboxRecords() ||
|
||||
[]) as MallCouponTemplateApi.CouponTemplate[];
|
||||
await modalApi.close();
|
||||
emit('success', selectedRecords);
|
||||
},
|
||||
@@ -66,4 +64,3 @@ const [Modal, modalApi] = useVbenModal({
|
||||
<Grid />
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
ElUpload,
|
||||
} from 'element-plus';
|
||||
|
||||
import { UploadType, useBeforeUpload } from '#/views/mp/hooks/useUpload';
|
||||
import { UploadType, useBeforeUpload } from '#/utils/useUpload';
|
||||
import WxMaterialSelect from '#/views/mp/modules/wx-material-select';
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
ElUpload,
|
||||
} from 'element-plus';
|
||||
|
||||
import { UploadType, useBeforeUpload } from '#/views/mp/hooks/useUpload';
|
||||
import { UploadType, useBeforeUpload } from '#/utils/useUpload';
|
||||
// import { getAccessToken } from '@/utils/auth'
|
||||
import WxMaterialSelect from '#/views/mp/modules/wx-material-select';
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
ElUpload,
|
||||
} from 'element-plus';
|
||||
|
||||
import { UploadType, useBeforeUpload } from '#/views/mp/hooks/useUpload';
|
||||
import { UploadType, useBeforeUpload } from '#/utils/useUpload';
|
||||
import WxMaterialSelect from '#/views/mp/modules/wx-material-select';
|
||||
import WxVideoPlayer from '#/views/mp/modules/wx-video-play';
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
ElUpload,
|
||||
} from 'element-plus';
|
||||
|
||||
import { UploadType, useBeforeUpload } from '#/views/mp/hooks/useUpload';
|
||||
import { UploadType, useBeforeUpload } from '#/utils/useUpload';
|
||||
import WxMaterialSelect from '#/views/mp/modules/wx-material-select';
|
||||
import WxVoicePlayer from '#/views/mp/modules/wx-voice-play';
|
||||
|
||||
|
||||
21
pnpm-lock.yaml
generated
21
pnpm-lock.yaml
generated
@@ -669,17 +669,10 @@ importers:
|
||||
version: link:scripts/vsh
|
||||
'@vitejs/plugin-vue':
|
||||
specifier: 'catalog:'
|
||||
<<<<<<< HEAD
|
||||
version: 6.0.1(vite@7.1.11(@types/node@22.18.11)(jiti@1.21.7)(less@4.4.2)(sass@1.93.2)(terser@5.44.0)(yaml@2.8.1))(vue@3.5.22(typescript@5.9.3))
|
||||
'@vitejs/plugin-vue-jsx':
|
||||
specifier: 'catalog:'
|
||||
version: 5.1.1(vite@7.1.11(@types/node@22.18.11)(jiti@1.21.7)(less@4.4.2)(sass@1.93.2)(terser@5.44.0)(yaml@2.8.1))(vue@3.5.22(typescript@5.9.3))
|
||||
=======
|
||||
version: 6.0.1(vite@7.1.11(@types/node@22.18.12)(jiti@2.6.1)(less@4.4.2)(sass@1.93.2)(terser@5.44.0)(yaml@2.8.1))(vue@3.5.22(typescript@5.9.3))
|
||||
'@vitejs/plugin-vue-jsx':
|
||||
specifier: 'catalog:'
|
||||
version: 5.1.1(vite@7.1.11(@types/node@22.18.12)(jiti@2.6.1)(less@4.4.2)(sass@1.93.2)(terser@5.44.0)(yaml@2.8.1))(vue@3.5.22(typescript@5.9.3))
|
||||
>>>>>>> 38df83e2812cb9d116a68a6057ac21a965e33b7e
|
||||
'@vue/test-utils':
|
||||
specifier: 'catalog:'
|
||||
version: 2.4.6
|
||||
@@ -721,17 +714,10 @@ importers:
|
||||
version: 3.6.1(sass@1.93.2)(typescript@5.9.3)(vue-tsc@2.2.10(typescript@5.9.3))(vue@3.5.22(typescript@5.9.3))
|
||||
vite:
|
||||
specifier: 'catalog:'
|
||||
<<<<<<< HEAD
|
||||
version: 7.1.11(@types/node@22.18.11)(jiti@1.21.7)(less@4.4.2)(sass@1.93.2)(terser@5.44.0)(yaml@2.8.1)
|
||||
vitest:
|
||||
specifier: 'catalog:'
|
||||
version: 3.2.4(@types/node@22.18.11)(happy-dom@17.6.3)(jiti@1.21.7)(less@4.4.2)(sass@1.93.2)(terser@5.44.0)(yaml@2.8.1)
|
||||
=======
|
||||
version: 7.1.11(@types/node@22.18.12)(jiti@2.6.1)(less@4.4.2)(sass@1.93.2)(terser@5.44.0)(yaml@2.8.1)
|
||||
vitest:
|
||||
specifier: 'catalog:'
|
||||
version: 3.2.4(@types/node@22.18.12)(happy-dom@17.6.3)(jiti@2.6.1)(less@4.4.2)(sass@1.93.2)(terser@5.44.0)(yaml@2.8.1)
|
||||
>>>>>>> 38df83e2812cb9d116a68a6057ac21a965e33b7e
|
||||
vue:
|
||||
specifier: ^3.5.17
|
||||
version: 3.5.22(typescript@5.9.3)
|
||||
@@ -820,6 +806,9 @@ importers:
|
||||
ant-design-vue:
|
||||
specifier: 'catalog:'
|
||||
version: 4.2.6(vue@3.5.22(typescript@5.9.3))
|
||||
benz-amr-recorder:
|
||||
specifier: ^1.1.5
|
||||
version: 1.1.5
|
||||
bpmn-js:
|
||||
specifier: 'catalog:'
|
||||
version: 17.11.1
|
||||
@@ -2135,7 +2124,7 @@ importers:
|
||||
version: 1.0.4
|
||||
vite:
|
||||
specifier: 'catalog:'
|
||||
version: 7.1.11(@types/node@24.8.1)(jiti@2.6.1)(less@4.4.2)(sass@1.93.2)(terser@5.44.0)(yaml@2.8.1)
|
||||
version: 7.1.11(@types/node@24.9.1)(jiti@2.6.1)(less@4.4.2)(sass@1.93.2)(terser@5.44.0)(yaml@2.8.1)
|
||||
|
||||
scripts/turbo-run:
|
||||
dependencies:
|
||||
@@ -21805,7 +21794,7 @@ snapshots:
|
||||
optionalDependencies:
|
||||
'@types/node': 22.18.12
|
||||
fsevents: 2.3.3
|
||||
jiti: 1.21.7
|
||||
jiti: 2.6.1
|
||||
less: 4.4.2
|
||||
sass: 1.93.2
|
||||
terser: 5.44.0
|
||||
|
||||
Reference in New Issue
Block a user