review:【antd】【mp】material、message 的迁移 v1
This commit is contained in:
@@ -10,6 +10,8 @@ import { WxVoicePlayer } from '#/views/mp/components/wx-voice-play';
|
||||
import { MsgType } from '../types';
|
||||
import MsgEvent from './MsgEvent.vue';
|
||||
|
||||
// TODO @dylan:vue 组件名小写 + 中划线
|
||||
|
||||
defineOptions({ name: 'Msg' });
|
||||
|
||||
defineProps<{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<script lang="ts" setup>
|
||||
import { Tag } from 'ant-design-vue';
|
||||
|
||||
// TODO @dylan:vue 组件名小写 + 中划线
|
||||
|
||||
defineOptions({ name: 'MsgEvent' });
|
||||
|
||||
defineProps<{
|
||||
|
||||
@@ -6,6 +6,8 @@ import { formatDateTime } from '@vben/utils';
|
||||
|
||||
import Msg from './Msg.vue';
|
||||
|
||||
// TODO @dylan:vue 组件名小写 + 中划线
|
||||
|
||||
defineOptions({ name: 'MsgList' });
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -24,6 +26,7 @@ function getAvatar(sendFrom: number) {
|
||||
: preferences.app.defaultAvatar;
|
||||
}
|
||||
|
||||
// TODO @dylan:SendFrom 告警;
|
||||
function getNickname(sendFrom: SendFrom) {
|
||||
return sendFrom === SendFrom.User ? props.user.nickname : '公众号';
|
||||
}
|
||||
@@ -61,6 +64,8 @@ function getNickname(sendFrom: SendFrom) {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 因为 joolun 实现依赖 avue 组件,该页面使用了 comment.scss、card.scc */
|
||||
/** TODO @dylan:看看有没适合 tindwind 的哈。 */
|
||||
|
||||
@import url('../comment.scss');
|
||||
@import url('../card.scss');
|
||||
|
||||
|
||||
@@ -29,21 +29,19 @@ const queryParams = reactive({
|
||||
pageSize: 14, // 每页显示多少条
|
||||
});
|
||||
|
||||
// 由于微信不再提供昵称,直接使用"用户"展示
|
||||
const user: User = reactive({
|
||||
accountId, // 公众号账号编号
|
||||
avatar: preferences.app.defaultAvatar,
|
||||
nickname: '用户',
|
||||
nickname: '用户', // 由于微信不再提供昵称,直接使用"用户"展示
|
||||
});
|
||||
|
||||
// ========= 消息发送 =========
|
||||
const sendLoading = ref(false); // 发送消息是否加载中
|
||||
// 微信发送消息
|
||||
const reply = ref<any>({
|
||||
accountId: -1,
|
||||
articles: [],
|
||||
type: 'text',
|
||||
});
|
||||
}); // 微信发送消息
|
||||
|
||||
const replySelectRef = ref<InstanceType<typeof WxReplySelect> | null>(null); // WxReplySelect组件ref,用于消息发送成功后清除内容
|
||||
const msgDivRef = ref<HTMLDivElement | null>(null); // 消息显示窗口ref,用于滚动到底部
|
||||
@@ -59,7 +57,7 @@ onMounted(async () => {
|
||||
refreshChange();
|
||||
});
|
||||
|
||||
// 执行发送
|
||||
/** 执行发送 */
|
||||
async function sendMsg() {
|
||||
if (!unref(reply)) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user