fix: code style
This commit is contained in:
@@ -1 +1 @@
|
||||
export { default } from './main.vue';
|
||||
export { default as WxAccountSelect } from './main.vue';
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, reactive, ref, unref } from 'vue';
|
||||
import type { SelectValue } from 'ant-design-vue/es/select';
|
||||
|
||||
import type { MpAccountApi } from '#/api/mp/account';
|
||||
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
import { message, Select } from 'ant-design-vue';
|
||||
|
||||
import * as MpAccountApi from '#/api/mp/account';
|
||||
import { useTagsViewStore } from '#/store';
|
||||
import { getSimpleAccountList } from '#/api/mp/account';
|
||||
|
||||
defineOptions({ name: 'WxAccountSelect' });
|
||||
|
||||
@@ -14,8 +17,7 @@ const emit = defineEmits<{
|
||||
(e: 'change', id: number, name: string): void;
|
||||
}>();
|
||||
// 消息弹窗
|
||||
const { delView } = useTagsViewStore();
|
||||
const { push, currentRoute } = useRouter();
|
||||
const { push } = useRouter();
|
||||
|
||||
// 当前选中的公众号
|
||||
const account: MpAccountApi.Account = reactive({
|
||||
@@ -28,10 +30,9 @@ const accountList = ref<MpAccountApi.Account[]>([]);
|
||||
|
||||
// 查询公众号列表
|
||||
const handleQuery = async () => {
|
||||
accountList.value = await MpAccountApi.getSimpleAccountList();
|
||||
accountList.value = await getSimpleAccountList();
|
||||
if (accountList.value.length === 0) {
|
||||
message.error('未配置公众号,请在【公众号管理 -> 账号管理】菜单,进行配置');
|
||||
delView(unref(currentRoute));
|
||||
await push({ name: 'MpAccount' });
|
||||
return;
|
||||
}
|
||||
@@ -46,7 +47,7 @@ const handleQuery = async () => {
|
||||
};
|
||||
|
||||
// 切换选中公众号
|
||||
const onChanged = (id?: number) => {
|
||||
const onChanged = (id: SelectValue) => {
|
||||
const found = accountList.value.find((v) => v.id === id);
|
||||
if (found) {
|
||||
account.name = found.name;
|
||||
@@ -59,24 +60,14 @@ onMounted(handleQuery);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-select
|
||||
<Select
|
||||
v-model:value="account.id"
|
||||
placeholder="请选择公众号"
|
||||
class="!w-240px"
|
||||
class="!w-[240px]"
|
||||
@change="onChanged"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="item in accountList"
|
||||
:key="item.id"
|
||||
:value="item.id"
|
||||
>
|
||||
<Select.Option v-for="item in accountList" :key="item.id" :value="item.id">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</Select.Option>
|
||||
</Select>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.w-240px {
|
||||
width: 240px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1 +1 @@
|
||||
export { default } from './main.vue';
|
||||
export { default as WxLocation } from './main.vue';
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export { default } from './main.vue';
|
||||
export { default as WxMaterialSelect } from './main.vue';
|
||||
|
||||
export { MaterialType, NewsType } from './types';
|
||||
|
||||
@@ -9,9 +9,9 @@ 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/components/wx-news';
|
||||
import WxVideoPlayer from '#/views/mp/components/wx-video-play';
|
||||
import WxVoicePlayer from '#/views/mp/components/wx-voice-play';
|
||||
import { WxNews } from '#/views/mp/components/wx-news';
|
||||
import { WxVideoPlayer } from '#/views/mp/components/wx-video-play';
|
||||
import { WxVoicePlayer } from '#/views/mp/components/wx-voice-play';
|
||||
|
||||
import { NewsType } from './types';
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script lang="ts" setup>
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
import WxLocation from '#/views/mp/components/wx-location';
|
||||
import WxMusic from '#/views/mp/components/wx-music';
|
||||
import WxNews from '#/views/mp/components/wx-news';
|
||||
import WxVideoPlayer from '#/views/mp/components/wx-video-play';
|
||||
import WxVoicePlayer from '#/views/mp/components/wx-voice-play';
|
||||
import { WxLocation } from '#/views/mp/components/wx-location';
|
||||
import { WxMusic } from '#/views/mp/components/wx-music';
|
||||
import { WxNews } from '#/views/mp/components/wx-news';
|
||||
import { WxVideoPlayer } from '#/views/mp/components/wx-video-play';
|
||||
import { WxVoicePlayer } from '#/views/mp/components/wx-voice-play';
|
||||
|
||||
import { MsgType } from '../types';
|
||||
import MsgEvent from './MsgEvent.vue';
|
||||
@@ -29,7 +29,7 @@ defineProps<{
|
||||
|
||||
<div v-else-if="item.type === MsgType.Image">
|
||||
<a :href="item.mediaUrl" target="_blank">
|
||||
<img :src="item.mediaUrl" style="width: 100px" alt="图片消息" />
|
||||
<img :src="item.mediaUrl" class="w-[100px]" alt="图片消息" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -40,14 +40,14 @@ defineProps<{
|
||||
<WxVideoPlayer :url="item.mediaUrl" />
|
||||
</div>
|
||||
|
||||
<div v-else-if="item.type === MsgType.Link" class="link-card">
|
||||
<div v-else-if="item.type === MsgType.Link" class="flex flex-col gap-2">
|
||||
<a :href="item.url" target="_blank" class="text-success no-underline">
|
||||
<div class="link-title">
|
||||
<div class="flex items-center text-sm font-medium text-[#52c41a]">
|
||||
<IconifyIcon icon="mdi:link" class="mr-1" />
|
||||
{{ item.title }}
|
||||
</div>
|
||||
</a>
|
||||
<div class="link-description">{{ item.description }}</div>
|
||||
<div class="text-xs text-[#666]">{{ item.description }}</div>
|
||||
</div>
|
||||
|
||||
<div v-else-if="item.type === MsgType.Location">
|
||||
@@ -58,7 +58,7 @@ defineProps<{
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-else-if="item.type === MsgType.News" class="news-wrapper">
|
||||
<div v-else-if="item.type === MsgType.News" class="w-[300px]">
|
||||
<WxNews :articles="item.articles" />
|
||||
</div>
|
||||
|
||||
@@ -73,28 +73,3 @@ defineProps<{
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.link-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.link-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #52c41a;
|
||||
}
|
||||
|
||||
.link-description {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.news-wrapper {
|
||||
width: 300px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export { default } from './main.vue';
|
||||
export { default as WxMsg } from './main.vue';
|
||||
|
||||
export { MsgType } from './types';
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Button, message, Spin } from 'ant-design-vue';
|
||||
|
||||
import { getMessagePage, sendMessage } from '#/api/mp/message';
|
||||
import { getUser } from '#/api/mp/user';
|
||||
import WxReplySelect from '#/views/mp/components/wx-reply';
|
||||
import { WxReplySelect } from '#/views/mp/components/wx-reply';
|
||||
|
||||
import MsgList from './components/MsgList.vue';
|
||||
|
||||
@@ -144,15 +144,22 @@ const scrollToBottom = async () => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="wx-msg-container">
|
||||
<div ref="msgDivRef" class="msg-div">
|
||||
<div class="flex h-full flex-col">
|
||||
<div ref="msgDivRef" class="mx-2.5 flex-1 overflow-auto bg-[#eaeaea]">
|
||||
<!-- 加载更多 -->
|
||||
<Spin :spinning="loading" />
|
||||
<div v-if="!loading">
|
||||
<div v-if="hasMore" class="load-more-btn" @click="loadMore">
|
||||
<div
|
||||
v-if="hasMore"
|
||||
class="cursor-pointer rounded p-3 text-center text-sm text-[#409eff] transition-colors duration-300 hover:bg-[#f5f7fa]"
|
||||
@click="loadMore"
|
||||
>
|
||||
<span>点击加载更多</span>
|
||||
</div>
|
||||
<div v-else class="load-more-btn disabled">
|
||||
<div
|
||||
v-else
|
||||
class="cursor-not-allowed rounded p-3 text-center text-sm text-[#909399] hover:bg-transparent"
|
||||
>
|
||||
<span>没有更多了</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -161,62 +168,13 @@ const scrollToBottom = async () => {
|
||||
<MsgList :list="list" :account-id="accountId" :user="user" />
|
||||
</div>
|
||||
|
||||
<div class="msg-send">
|
||||
<div class="p-2.5">
|
||||
<Spin :spinning="sendLoading">
|
||||
<WxReplySelect ref="replySelectRef" v-model="reply" />
|
||||
<Button type="primary" class="send-but" @click="sendMsg">
|
||||
<Button type="primary" class="float-right mb-2 mt-2" @click="sendMsg">
|
||||
发送(S)
|
||||
</Button>
|
||||
</Spin>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.wx-msg-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.msg-div {
|
||||
flex: 1;
|
||||
height: 50vh;
|
||||
margin: 0 10px;
|
||||
overflow: auto;
|
||||
background-color: #eaeaea;
|
||||
}
|
||||
|
||||
.load-more-btn {
|
||||
padding: 12px;
|
||||
font-size: 14px;
|
||||
color: #409eff;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
transition: background-color 0.3s;
|
||||
|
||||
&:hover {
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
color: #909399;
|
||||
cursor: not-allowed;
|
||||
|
||||
&:hover {
|
||||
background-color: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.msg-send {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.send-but {
|
||||
float: right;
|
||||
margin-top: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1 +1 @@
|
||||
export { default } from './main.vue';
|
||||
export { default as WxMusic } from './main.vue';
|
||||
|
||||
@@ -1 +1 @@
|
||||
export { default } from './main.vue';
|
||||
export { default as WxNews } from './main.vue';
|
||||
|
||||
@@ -10,7 +10,7 @@ import { useAccessStore } from '@vben/stores';
|
||||
|
||||
import { Button, Col, message, Modal, Row, Upload } from 'ant-design-vue';
|
||||
|
||||
import WxMaterialSelect from '#/views/mp/components/wx-material-select';
|
||||
import { WxMaterialSelect } from '#/views/mp/components/wx-material-select';
|
||||
import { UploadType, useBeforeUpload } from '#/views/mp/hooks/useUpload';
|
||||
|
||||
defineOptions({ name: 'TabImage' });
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
Upload,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import WxMaterialSelect from '#/views/mp/components/wx-material-select';
|
||||
import { WxMaterialSelect } from '#/views/mp/components/wx-material-select';
|
||||
import { UploadType, useBeforeUpload } from '#/views/mp/hooks/useUpload';
|
||||
|
||||
defineOptions({ name: 'TabMusic' });
|
||||
|
||||
@@ -7,8 +7,8 @@ import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
import { Button, Col, Modal, Row } from 'ant-design-vue';
|
||||
|
||||
import WxMaterialSelect from '#/views/mp/components/wx-material-select';
|
||||
import WxNews from '#/views/mp/components/wx-news';
|
||||
import { WxMaterialSelect } from '#/views/mp/components/wx-material-select';
|
||||
import { WxNews } from '#/views/mp/components/wx-news';
|
||||
|
||||
import { NewsType } from './types';
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ import {
|
||||
Upload,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import WxMaterialSelect from '#/views/mp/components/wx-material-select';
|
||||
import WxVideoPlayer from '#/views/mp/components/wx-video-play';
|
||||
import { WxMaterialSelect } from '#/views/mp/components/wx-material-select';
|
||||
import { WxVideoPlayer } from '#/views/mp/components/wx-video-play';
|
||||
import { UploadType, useBeforeUpload } from '#/views/mp/hooks/useUpload';
|
||||
|
||||
defineOptions({ name: 'TabVideo' });
|
||||
|
||||
@@ -10,8 +10,8 @@ import { useAccessStore } from '@vben/stores';
|
||||
|
||||
import { Button, Col, message, Modal, Row, Upload } from 'ant-design-vue';
|
||||
|
||||
import WxMaterialSelect from '#/views/mp/components/wx-material-select';
|
||||
import WxVoicePlayer from '#/views/mp/components/wx-voice-play';
|
||||
import { WxMaterialSelect } from '#/views/mp/components/wx-material-select';
|
||||
import { WxVoicePlayer } from '#/views/mp/components/wx-voice-play';
|
||||
import { UploadType, useBeforeUpload } from '#/views/mp/hooks/useUpload';
|
||||
|
||||
defineOptions({ name: 'TabVoice' });
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export type { NewsType, Reply, ReplyType } from './components/types';
|
||||
export { createEmptyReply } from './components/types';
|
||||
|
||||
export { default } from './main.vue';
|
||||
export { default as WxReplySelect } from './main.vue';
|
||||
|
||||
@@ -1 +1 @@
|
||||
export { default } from './main.vue';
|
||||
export { default as WxVideoPlayer } from './main.vue';
|
||||
|
||||
@@ -1 +1 @@
|
||||
export { default } from './main.vue';
|
||||
export { default as WxVoicePlayer } from './main.vue';
|
||||
|
||||
Reference in New Issue
Block a user