【重要性能问题】解决点击online功能测试,重新加载首页问题 issues/I5XBZF

src\settings\registerThirdComp.ts
src\components\jeecg\comment\useComment.ts
src\components\jeecg\comment\MyComment.vue
src\components\jeecg\comment\DataLogList.vue
src\components\jeecg\comment\CommentList.vue
pull/186/head
zhangdaiscott 2022-10-24 18:39:36 +08:00
parent 6bf259427c
commit 335c82e08a
5 changed files with 56 additions and 36 deletions

View File

@ -75,15 +75,15 @@
/** /**
* 评论列表 * 评论列表
*/ */
import { defineComponent, ref, onMounted, watch, watchEffect } from 'vue'; import { defineComponent, ref, onMounted, watch, watchEffect ,inject } from 'vue';
import { propTypes } from '/@/utils/propTypes'; import { propTypes } from '/@/utils/propTypes';
import dayjs from 'dayjs'; // import dayjs from 'dayjs';
import 'dayjs/locale/zh.js'; // import relativeTime from 'dayjs/plugin/relativeTime';
import relativeTime from 'dayjs/plugin/relativeTime'; // import customParseFormat from 'dayjs/plugin/customParseFormat';
import customParseFormat from 'dayjs/plugin/customParseFormat'; // dayjs.locale('zh');
dayjs.locale('zh'); // dayjs.extend(relativeTime);
dayjs.extend(relativeTime); // dayjs.extend(customParseFormat);
dayjs.extend(customParseFormat);
import { MessageOutlined } from '@ant-design/icons-vue'; import { MessageOutlined } from '@ant-design/icons-vue';
import { Comment, Tooltip } from 'ant-design-vue'; import { Comment, Tooltip } from 'ant-design-vue';
import { useUserStore } from '/@/store/modules/user'; import { useUserStore } from '/@/store/modules/user';
@ -113,6 +113,8 @@
const { createMessage } = useMessage(); const { createMessage } = useMessage();
const dataList = ref([]); const dataList = ref([]);
const { userInfo } = useUserStore(); const { userInfo } = useUserStore();
const dayjs = inject('$dayjs')
/** /**
* 获取当前用户名称 * 获取当前用户名称
*/ */
@ -245,7 +247,8 @@
} }
}); });
const { getHtml } = useEmojiHtml(); const storageEmojiIndex = inject('$globalEmojiIndex')
const { getHtml } = useEmojiHtml(storageEmojiIndex);
const bottomCommentRef = ref() const bottomCommentRef = ref()
function handleClickItem(){ function handleClickItem(){
bottomCommentRef.value.changeActive() bottomCommentRef.value.changeActive()

View File

@ -28,16 +28,15 @@
<script> <script>
import { PlusOutlined, EditOutlined } from '@ant-design/icons-vue'; import { PlusOutlined, EditOutlined } from '@ant-design/icons-vue';
import { getModalHeight, getLogList } from './useComment' import { getModalHeight, getLogList } from './useComment'
import {ref, watchEffect} from 'vue' import {inject, ref, watchEffect} from 'vue'
import { propTypes } from '/@/utils/propTypes'; import { propTypes } from '/@/utils/propTypes';
import { Tooltip } from 'ant-design-vue'; import { Tooltip } from 'ant-design-vue';
import dayjs from 'dayjs'; // import dayjs from 'dayjs';
import 'dayjs/locale/zh.js'; // import relativeTime from 'dayjs/plugin/relativeTime';
import relativeTime from 'dayjs/plugin/relativeTime'; // import customParseFormat from 'dayjs/plugin/customParseFormat';
import customParseFormat from 'dayjs/plugin/customParseFormat'; // dayjs.locale('zh');
dayjs.locale('zh'); // dayjs.extend(relativeTime);
dayjs.extend(relativeTime); // dayjs.extend(customParseFormat);
dayjs.extend(customParseFormat);
export default { export default {
name: "DataLogList", name: "DataLogList",
@ -52,6 +51,7 @@
datetime: propTypes.number.def(1), datetime: propTypes.number.def(1),
}, },
setup(props){ setup(props){
const dayjs = inject('$dayjs')
const winHeight = getModalHeight(); const winHeight = getModalHeight();
const height = ref(300); const height = ref(300);
height.value = winHeight - 46 - 57 -53 - 30; height.value = winHeight - 46 - 57 -53 - 30;

View File

@ -45,14 +45,13 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { ref, watch, computed } from 'vue'; import {ref, watch, computed, inject} from 'vue';
import { propTypes } from '/@/utils/propTypes'; import { propTypes } from '/@/utils/propTypes';
import { UserAddOutlined, PaperClipOutlined, SmileOutlined } from '@ant-design/icons-vue'; import { UserAddOutlined, PaperClipOutlined, SmileOutlined } from '@ant-design/icons-vue';
import { Tooltip } from 'ant-design-vue'; import { Tooltip } from 'ant-design-vue';
import UserSelectModal from '/@/components/Form/src/jeecg/components/modal/UserSelectModal.vue'; import UserSelectModal from '/@/components/Form/src/jeecg/components/modal/UserSelectModal.vue';
import { useModal } from '/@/components/Modal'; import { useModal } from '/@/components/Modal';
import UploadChunk from './UploadChunk.vue'; import UploadChunk from './UploadChunk.vue';
import { Picker } from 'emoji-mart-vue-fast/src';
import 'emoji-mart-vue-fast/css/emoji-mart.css'; import 'emoji-mart-vue-fast/css/emoji-mart.css';
import { useEmojiHtml } from './useComment'; import { useEmojiHtml } from './useComment';
@ -79,7 +78,6 @@
PaperClipOutlined, PaperClipOutlined,
UploadChunk, UploadChunk,
SmileOutlined, SmileOutlined,
Picker,
}, },
props: { props: {
inner: propTypes.bool.def(false), inner: propTypes.bool.def(false),
@ -222,7 +220,8 @@
visibleEmoji.value = !visibleEmoji.value; visibleEmoji.value = !visibleEmoji.value;
} }
const { emojiIndex, getHtml } = useEmojiHtml(); const emojiIndex = inject('$globalEmojiIndex')
const { getHtml } = useEmojiHtml(emojiIndex);
const commentHtml = computed(() => { const commentHtml = computed(() => {
let temp = myComment.value; let temp = myComment.value;

View File

@ -13,8 +13,6 @@ import txt from '/@/assets/svg/fileType/txt.svg';
import word from '/@/assets/svg/fileType/word.svg'; import word from '/@/assets/svg/fileType/word.svg';
import { getFileAccessHttpUrl } from '/@/utils/common/compUtils'; import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
import { createImgPreview } from '/@/components/Preview'; import { createImgPreview } from '/@/components/Preview';
import {EmojiIndex} from "emoji-mart-vue-fast/src";
import data from "emoji-mart-vue-fast/data/apple.json";
enum Api { enum Api {
list = '/sys/comment/listByForm', list = '/sys/comment/listByForm',
@ -365,15 +363,8 @@ export function useFileList() {
/** /**
* emoji * emoji
*/ */
export function useEmojiHtml(){ export function useEmojiHtml(globalEmojiIndex){
const COLONS_REGEX = new RegExp('([^:]+)?(:[a-zA-Z0-9-_+]+:(:skin-tone-[2-6]:)?)','g'); const COLONS_REGEX = new RegExp('([^:]+)?(:[a-zA-Z0-9-_+]+:(:skin-tone-[2-6]:)?)','g');
let emojisToShowFilter = function() {
return true;
}
let emojiIndex = new EmojiIndex(data, {
emojisToShowFilter,
exclude:['recent','people','nature','foods','activity','places','objects','symbols','flags']
});
function getHtml(text) { function getHtml(text) {
if(!text){ if(!text){
@ -384,7 +375,7 @@ export function useEmojiHtml(){
if (endsWith(before, 'alt="') || endsWith(before, 'data-text="')) { if (endsWith(before, 'alt="') || endsWith(before, 'data-text="')) {
return match return match
} }
let emoji = emojiIndex.findEmoji(p2) let emoji = globalEmojiIndex.findEmoji(p2)
if (!emoji) { if (!emoji) {
return match return match
} }
@ -403,7 +394,7 @@ export function useEmojiHtml(){
} }
return { return {
emojiIndex, globalEmojiIndex,
getHtml getHtml
} }
} }

View File

@ -2,9 +2,36 @@ import type { App } from 'vue';
import { registerJVxeTable } from '/@/components/jeecg/JVxeTable'; import { registerJVxeTable } from '/@/components/jeecg/JVxeTable';
import { registerJVxeCustom } from '/@/components/JVxeCustom'; import { registerJVxeCustom } from '/@/components/JVxeCustom';
import { Picker } from 'emoji-mart-vue-fast/src';
import { EmojiIndex } from "emoji-mart-vue-fast/src";
import data from "emoji-mart-vue-fast/data/apple.json";
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import customParseFormat from 'dayjs/plugin/customParseFormat';
export async function registerThirdComp(app: App) { export async function registerThirdComp(app: App) {
// 注册 JVxeTable 组件 // 注册 JVxeTable 组件
registerJVxeTable(app); registerJVxeTable(app);
// 注册 JVxeTable 自定义组件 // 注册 JVxeTable 自定义组件
await registerJVxeCustom(); await registerJVxeCustom();
//---------------------------------------------------------------------
// 注册全局聊天表情包
app.component('Picker', Picker);
let myEmojiIndex = new EmojiIndex(data, {
function() {
return true;
},
exclude:['recent','people','nature','foods','activity','places','objects','symbols','flags']
});
app.config.globalProperties.$globalEmojiIndex = myEmojiIndex
app.provide('$globalEmojiIndex', myEmojiIndex)
//---------------------------------------------------------------------
// 注册全局dayjs
dayjs.locale('zh');
dayjs.extend(relativeTime);
dayjs.extend(customParseFormat);
app.config.globalProperties.$dayjs = dayjs
app.provide('$dayjs', dayjs)
//---------------------------------------------------------------------
} }