提交 4e581bb4 作者: Hao

拉取最新代码

父级 3cd0f8bb
NODE_ENV=development
VITE_USER_APP_API_URL=192.168.31.135
\ No newline at end of file
NODE_ENV=production
VITE_USER_APP_API_URL=192.168.31.101
\ No newline at end of file
......@@ -15,9 +15,7 @@ module.exports = defineConfig({
}),
],
},
// chainWebpack: config => {
// config.plugin('html').use(HtmlWebpackPlugin, [{
// title:'客服端',
// }])
// }
chainWebpack: config => {
console.log(config,'config')
}
})
\ No newline at end of file
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
export {}
declare global {
......
......@@ -11,6 +11,7 @@ declare module 'vue' {
ElAside: typeof import('element-plus/es')['ElAside']
ElButton: typeof import('element-plus/es')['ElButton']
ElContainer: typeof import('element-plus/es')['ElContainer']
ElDialog: typeof import('element-plus/es')['ElDialog']
ElFooter: typeof import('element-plus/es')['ElFooter']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
......@@ -19,12 +20,16 @@ declare module 'vue' {
ElInput: typeof import('element-plus/es')['ElInput']
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
ElMain: typeof import('element-plus/es')['ElMain']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
EmotionComponent: typeof import('./src/components/EmotionComponent.vue')['default']
IndexComponent: typeof import('./src/components/IndexComponent.vue')['default']
LogingComponent: typeof import('./src/components/loging/logingComponent.vue')['default']
MenuComponent: typeof import('./src/components/Menu/MenuComponent.vue')['default']
RightClickMenu: typeof import('./src/components/RightClickMenu.vue')['default']
RightClickMenu: typeof import('./src/components/Menu/RightClickMenu.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
ShopList: typeof import('./src/components/ShopList.vue')['default']
}
}
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>客服端</title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>客服端</title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "tokcos-socket-web-ts",
"version": "0.1.0",
"private": true,
"name": "min-demo",
"version": "0.0.1",
"type": "module",
"license": "MIT",
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
"build": "vue-tsc --noEmit && vite build --mode production",
"serve": "vite --mode development",
"preview": "vite preview"
},
"dependencies": {
"@babel/core": "^7.24.3",
"@babel/types": "^7.24.0",
"@element-plus/icons-vue": "^2.3.1",
"@luohc92/vue3-image-viewer": "^1.0.0",
"axios": "^1.6.7",
"core-js": "^3.8.3",
"@tinymce/tinymce-vue": "^4.0.7",
"@vitalets/google-translate-api": "^9.2.0",
"amfe-flexible": "^2.2.1",
"axios": "^0.27.2",
"clipboard": "^2.0.11",
"copy-webpack-plugin": "^11.0.0",
"cos-js-sdk-v5": "^1.7.0",
"cos-wx-sdk-v5": "^1.6.0",
"element-plus": "^2.6.1",
"echarts": "^5.3.3",
"element-plus": "^2.2.14",
"emoji.json": "^15.1.0",
"html-webpack-plugin": "^5.6.0",
"i18n-jsautotranslate": "^2.6.0",
"json-format": "^1.0.1",
"min-comp": "^0.0.4",
"mockjs": "^1.1.0",
"moment": "^2.30.1",
"pinia": "^2.1.7",
"particles.vue3": "^2.2.3",
"pinia": "^2.0.20",
"pinia-plugin-persistedstate": "^3.2.1",
"socket.io-client": "^4.7.4",
"unplugin-auto-import": "0.16.1",
"unplugin-vue-components": "^0.25.2",
"vue": "^3.2.13",
"vue-native-websocket": "^2.0.15",
"vue-router": "^4.0.3",
"vuex": "^4.0.0"
"prismjs": "^1.28.0",
"sass": "^1.54.5",
"sass-loader": "^13.0.2",
"three": "^0.143.0",
"tsparticles": "^2.2.3",
"tunnel": "^0.0.6",
"v-clipboard": "^3.0.0-next.1",
"vant": "^3.6.0",
"vite-plugin-dts": "^1.4.1",
"vite-plugin-md": "^0.20.2",
"vue": "^3.2.37",
"vue-router": "^4.1.3",
"vue3-uuid": "^1.0.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-plugin-typescript": "~5.0.0",
"@vue/cli-plugin-vuex": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"@vue/eslint-config-typescript": "^9.1.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"sass": "^1.32.7",
"sass-loader": "^12.0.0",
"typescript": "~4.5.5"
"@types/node": "^12.20.24",
"@vitejs/plugin-vue": "^3.0.3",
"rollup-plugin-copy": "^3.4.0",
"typescript": "^4.6.4",
"unplugin-auto-import": "^0.17.5",
"unplugin-vue-components": "^0.26.0",
"vite": "^3.0.7",
"vite-plugin-auto-i18n": "^0.0.9",
"vue-tsc": "^0.39.5"
}
}
No preview for this file type
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1713946537964" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="49096" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M896 346.8c-0.1 0 0 0 0 0 0-0.9-0.1-1.7-0.2-2.5 0-0.1 0-0.3-0.1-0.4-0.2-1.7-0.5-3.3-1-4.9-0.5-1.7-1-3.3-1.7-4.9v-0.1c-0.3-0.8-0.7-1.5-1.1-2.3v-0.1c-0.4-0.7-0.8-1.5-1.2-2.2-0.1-0.1-0.1-0.2-0.2-0.3-0.4-0.6-0.8-1.2-1.3-1.9-0.1-0.1-0.1-0.2-0.2-0.2-0.5-0.6-1-1.3-1.5-1.9-0.1-0.1-0.2-0.3-0.4-0.4-0.5-0.6-1-1.2-1.6-1.7l-0.1-0.1L637.3 74.5c-0.6-0.6-1.2-1.1-1.8-1.6-0.1-0.1-0.3-0.2-0.4-0.4-0.6-0.5-1.2-1-1.9-1.5-0.1 0-0.1-0.1-0.2-0.1-0.6-0.5-1.3-0.9-1.9-1.3-0.1-0.1-0.2-0.1-0.3-0.2-0.7-0.4-1.4-0.9-2.2-1.3-0.8-0.4-1.5-0.8-2.3-1.1h-0.1c-1.6-0.7-3.2-1.3-4.9-1.7-1.6-0.4-3.2-0.8-4.9-1-0.1 0-0.3 0-0.4-0.1-1.4-0.2-2.8-0.3-4.3-0.3H164c-19.9 0-36 16.1-36 36v823.3c0 19.9 16.1 36 36 36h696c19.9 0 36-16.1 36-36V346.8zM647.8 186.9l125.4 125.6H647.8V186.9zM200 887.2V135.9h375.8v212.7c0 19.9 16.1 36 36 36H824v502.7H200z" fill="#2c2c2c" p-id="49097"></path><path d="M363.5 661.5c-7.2 6.3-15.8 9.5-25.8 9.5-13.5 0-24.5-5-33-15S292 629.3 292 605.7c0-22.2 4.3-38.2 12.9-48.1 8.6-9.9 19.8-14.9 33.6-14.9 10 0 18.5 2.8 25.5 8.4s11.6 13.2 13.8 22.9l37.2-8.9c-4.2-14.9-10.6-26.3-19-34.3-14.2-13.5-32.7-20.2-55.5-20.2-26.1 0-47.1 8.6-63.1 25.7s-24 41.2-24 72.2c0 29.3 8 52.4 23.9 69.3 15.9 16.9 36.2 25.3 60.9 25.3 20 0 36.5-4.9 49.4-14.8 13-9.9 22.3-24.9 27.9-45.3L379 631.6c-3.1 13.6-8.3 23.6-15.5 29.9z m198-64.3c-8.8-4.6-22.3-9.1-40.6-13.4s-29.8-8.5-34.5-12.4c-3.7-3.1-5.6-6.9-5.6-11.3 0-4.8 2-8.7 6-11.6 6.2-4.5 14.7-6.7 25.6-6.7 10.6 0 18.5 2.1 23.8 6.3 5.3 4.2 8.7 11.1 10.3 20.6l37.6-1.7c-0.6-17.1-6.8-30.8-18.6-41s-29.4-15.4-52.7-15.4c-14.3 0-26.5 2.2-36.6 6.5-10.1 4.3-17.9 10.6-23.2 18.9-5.4 8.3-8.1 17.1-8.1 26.6 0 14.7 5.7 27.2 17.1 37.5 8.1 7.3 22.3 13.4 42.4 18.4 15.7 3.9 25.7 6.6 30.1 8.1 6.4 2.3 10.9 5 13.5 8.1 2.6 3.1 3.9 6.8 3.9 11.2 0 6.9-3.1 12.8-9.2 18-6.1 5.1-15.3 7.7-27.4 7.7-11.4 0-20.5-2.9-27.2-8.6-6.7-5.8-11.2-14.8-13.4-27l-36.6 3.6c2.5 20.8 10 36.7 22.6 47.5 12.6 10.9 30.7 16.3 54.2 16.3 16.2 0 29.7-2.3 40.5-6.8s19.2-11.4 25.1-20.8c5.9-9.3 8.9-19.3 8.9-30 0-11.8-2.5-21.6-7.4-29.6s-11.7-14.3-20.5-19z m128.4 54.4l-47.1-137.7h-40.7L668.6 700h40.1l66.7-186.1h-39.9z" fill="#2c2c2c" p-id="49098"></path></svg>
\ No newline at end of file
......@@ -2,8 +2,7 @@
import { useUserStore } from '../store/modules/user'
import axios from "axios";
const instance = axios.create({
baseURL: "http://192.168.31.123:8080", // 设置基础 URL
// baseURL:'',
baseURL: `http://${import.meta.env.VITE_USER_APP_API_URL}:8080`, // 设置基础 URL
timeout: 1000, // 设置请求超时时间
});
instance.interceptors.request.use(
......
......@@ -43,7 +43,7 @@ const checkMesssages = (query: any) => {
const getUploadConfigInfo = (query: any) => {
return http({
url: "/getUploadConfigInfo",
url: "/upload/getUploadConfigInfo",
method: "get",
data: query,
});
......@@ -52,7 +52,7 @@ const getUploadConfigInfo = (query: any) => {
const upload = (query: any) => {
return http({
url: "/sys/common/upload",
method: "get",
method: "post",
data: query,
});
};
......
......@@ -37,14 +37,13 @@
ref="elAutocomplete"
placeholder="输入信息"
contenteditable="true"
style="outline: none; height: 150px;"
style="outline: none; "
@paste.prevent="handlePaste"
@focus="removeDefaultContent"
@input="handleSelect"
@blur="addDefaultContent"
></div>
</div>
<emotion
v-if="showEmotion"
style="position: absolute; top: calc(100% - 465px); background: #fff;"
......@@ -62,7 +61,7 @@
</template>
<script lang="ts" setup>
import Emotion from './IndexComponent.vue'
import emotion from './IndexComponent.vue'
import { ElLoading } from 'element-plus'
import { ref, watch, defineEmits, defineExpose } from 'vue'
import { upLoadFilesHander } from '../minxins/UploadMixin'
......@@ -247,8 +246,8 @@ defineExpose({
}
.el-autocomplete {
width: 100%;
height: calc(100vh - 732px);
max-width: 100%;
max-height: 150px;
overflow: auto;
}
.el-autocomplete img {
......
......@@ -16,13 +16,14 @@
import { ref, watch, defineEmits, defineExpose, defineProps } from 'vue'
const list = ref([])
import * as emoji from 'emoji.json'
console.log(emoji,'打印emoji')
console.log(emoji,'emoji')
const getList = () => {
list.value = emoji.slice(0, 50)
list.value.push(emoji[55])
list.value.push(emoji[56])
list.value.push(emoji[57])
list.value.push(emoji[60])
let info = emoji.default
list.value = info.slice(0, 50)
list.value.push(info[55])
list.value.push(info[56])
list.value.push(info[57])
list.value.push(info[60])
}
const emits = defineEmits(['emotion'])
const clickHandler = (i: number | string) => {
......
<template>
<div class="select-box">
<div class="active">复制</div>
<div>翻译</div>
<div>设为客户名称</div>
<div>设置国家/地区</div>
<div>设为Email</div>
<div>设为watchApp</div>
</div>
</template>
<script></script>
<style scoped lang="scss">
.select-box {
display: flex;
width: 136px;
padding: var(--Spacing-md, 8px);
flex-direction: column;
align-items: flex-start;
gap: var(--Spacing-xs, 4px);
border-radius: var(--Radius-md, 8px);
background: var(--color-bg-Program-White, #fff);
box-shadow: 0 2px 12px 0 #08112914;
div {
padding: 6px 8px;
height: 32px;
line-height: 32px;
}
.active {
display: flex;
padding: var(--Spacing-sm, 6px) var(--Spacing-md, 8px);
align-items: center;
gap: var(--Spacing-none, 0);
align-self: stretch;
color: #fff;
border-radius: 4px;
background: #010914;
font-size: 14px;
}
}
</style>
import { Callback } from "./../../../node_modules/escalade/sync/index.d";
import { h, render, reactive, ref, defineEmits } from "vue";
import RightClickMenu from "./RightClickMenu.vue";
import { copyText } from "@/utils/index";
export default function useMenu(e: MouseEvent) {
const contextMenuVisible = ref(true);
const contextMenuTop = ref(0);
......@@ -9,6 +11,9 @@ export default function useMenu(e: MouseEvent) {
let containerEl = reactive<HTMLElement | any>(null);
let vnode = reactive<any>(null);
let props = reactive<any>({});
let itemInfo = reactive<any>({});
let callbackFn = reactive<any>(function () {});
let emit = defineEmits(["RightClickItemEmits"]);
const setComponent = () => {
props = {
visible: contextMenuVisible.value,
......@@ -22,7 +27,12 @@ export default function useMenu(e: MouseEvent) {
],
active: contextMenuIndex.value,
"onUpdate:info": (info: any) => {
contextMenuIndex.value = info.index;
let { index } = info;
contextMenuIndex.value = index;
callbackFn({
...info,
itemInfo: itemInfo.value,
});
setComponent();
},
};
......@@ -36,7 +46,10 @@ export default function useMenu(e: MouseEvent) {
if (containerEl) containerEl.style.position = "fixed";
if (containerEl) containerEl.style["z-index"] = "1000";
};
const showContextMenu = (event: any, item: any) => {
const showContextMenu = (event: any, item: any, callback: Function) => {
itemInfo.value = item;
callbackFn = callback;
//阻止默认右键事件
event.preventDefault();
//菜单可见
......@@ -48,7 +61,6 @@ export default function useMenu(e: MouseEvent) {
// 检测是否超出浏览器视口区域 一个菜单40px*6个
const menuHeight = 300; // 右键菜单的高度
const windowHeight = window.innerHeight;
if (event.clientY + menuHeight > windowHeight) {
// 如果右键菜单超出视口底部,调整位置为向上弹出
contextMenuTop.value -= menuHeight;
......
......@@ -17,7 +17,7 @@
</teleport>
</template>
<script setup lang="ts">
import { defineProps, onMounted, defineEmits } from 'vue'
import { defineProps, defineEmits } from 'vue'
defineProps(['top', 'left', 'visible', 'menuList', 'active'])
const emit = defineEmits(['update:info'])
const handleItemClick = (item: any, index: any) => {
......
<template>
<teleport to="body">
<div
id="select-box"
v-if="visible"
:style="{ top: `${top}px`, left: `${left}px` }"
>
<ul
v-for="(item, index) in menuList"
:class="{ active: active == index }"
:key="index"
@click.stop="handleItemClick(item,index)"
>
<li >{{ item }}</li>
</ul>
<!-- <div>翻译</div>
<div>设为客户名称</div>
<div>设置国家/地区</div>
<div>设为Email</div>
<div>设为watchApp</div> -->
</div>
</teleport>
</template>
<script setup lang="ts">
import { defineProps } from 'vue'
defineProps(['top', 'left', 'handleItemClick', 'visible', 'menuList', 'active'])
</script>
<style scoped lang="scss">
#select-box {
position: fixed;
z-index: 1000;
display: flex;
width: 136px;
padding: var(--Spacing-md, 8px);
flex-direction: column;
align-items: flex-start;
gap: var(--Spacing-xs, 4px);
border-radius: var(--Radius-md, 8px);
background: var(--color-bg-Program-White, #fff);
box-shadow: 0 2px 12px 0 #08112914;
ul {
padding: 6px 8px;
height: 32px;
line-height: 32px;
}
.active {
display: flex;
padding: var(--Spacing-sm, 6px) var(--Spacing-md, 8px);
align-items: center;
gap: var(--Spacing-none, 0);
align-self: stretch;
color: #fff;
border-radius: 4px;
background: #010914;
font-size: 14px;
}
}
</style>
<template>
<el-dialog
v-model="dialogVisible"
title="添加商品"
:before-close="handleClose"
>
<el-table
:data="tableData"
ref="multipleTableRef"
border
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="name" label="商品名称" width="300" />
<el-table-column
prop="productImg"
label="商品图片"
width="100"
align="center"
>
<template #default="scope">
<el-image
style="width: 40px; height: 40px;"
:src="scope.row.productImg"
/>
</template>
</el-table-column>
<el-table-column prop="productPrice" label="商品价格" width="300">
<template #default="scope">${{ scope.row.productPrice }}</template>
</el-table-column>
<el-table-column prop="productPrice" label="商品库存" width="300">
<template #default="scope">{{ scope.row.stock }}</template>
</el-table-column>
</el-table>
<el-pagination
background
layout="prev, pager, next"
:total="tableData.length"
/>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleOk">
确认
</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { require } from '@/utils/index'
import { ref, defineExpose } from 'vue'
const tableData = [
{
name: '商品商品商品商品商品商品商品商品商品商品商品商品1',
productImg: require('../assets/login.jpg'),
productPrice: '10',
stock: 10,
unit:'USD'
},
{
name: '商品商品商品商品商品商品商品商品商品商品商品2',
productImg: require('../assets/login.jpg'),
productPrice: '10',
stock: 10,
unit:'USD'
},
{
name: '商品商品商品商品商品商品商品商品商品商品商品3',
productImg: require('../assets/login.jpg'),
productPrice: '10',
stock: 10,
unit:'USD'
},
{
name: '商品商品商品商品商品商品商品商品商品商品商品4',
productImg: require('../assets/login.jpg'),
productPrice: '10',
stock: 10,
unit:'USD'
},
]
const selectionValues = ref([])
const multipleTableRef = ref(null)
//勾选
const emits = defineEmits(['selectionChange'])
const handleSelectionChange = (e) => {
selectionValues.value = e;
}
let dialogVisible = ref(false)
const handleClose = () => {
dialogVisible.value = false
}
const handleOk = ()=>{
emits('selectionChange',selectionValues.value)
toggleSelection()
dialogVisible.value = false
}
const toggleSelection = (rows?:User[])=>{
if (rows) {
rows.forEach((row) => {
multipleTableRef.value!.toggleRowSelection(row, undefined)
})
} else {
multipleTableRef.value!.clearSelection()
}
}
defineExpose({
dialogShow(res: any) {
dialogVisible.value = true
},
})
</script>
<style>
.el-pagination {
display: flex;
margin-top: 10px;
justify-content: end;
}
</style>
import '../../lang/index'
import langJSON from '../../lang/index.json'
const langMap = {
zhcn: window?.lang?.zhcn || _getJSONKey('zh-cn', langJSON),
en: window?.lang?.en || _getJSONKey('en', langJSON),
ko: window?.lang?.ko || _getJSONKey('ko', langJSON),
ja: window?.lang?.ja || _getJSONKey('ja', langJSON),
}
const lang = window.localStorage.getItem('lang') || 'zhcn'
console.log(langMap[lang])
window.$t.locale(langMap[lang], 'lang')
......@@ -4,12 +4,12 @@ import router from "./router";
import store from "./store/index";
import "./assets/css/reset.css";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import { useUserStore } from "./store/modules/user";
import "@/permission"; // permission control
import "element-plus/dist/index.css";
import "../src/mocks/mock";
const app = createApp(App);
app.use(store).use(router).mount("#app");
import Clipboard from 'v-clipboard'
app.use(Clipboard).use(store).use(router).mount("#app");
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component);
}
......
const Mock = require('mockjs')
import Mock from 'mockjs'
Mock.mock("/kf/auth/login", "post", () => {
return {
code: "200",
......
......@@ -21,7 +21,7 @@ const routes: Array<RouteRecordRaw> = [
];
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
history: createWebHistory(),
routes,
});
......
......@@ -4,4 +4,5 @@ declare module '*.vue' {
const component: DefineComponent<{}, {}, any>
export default component
}
declare module 'cos-wx-sdk-v5';
\ No newline at end of file
declare module 'cos-wx-sdk-v5';
declare module 'i18n-jsautotranslate'
\ No newline at end of file
......@@ -6,7 +6,9 @@ export const useUserStore = defineStore("user", {
return {
isConnected: false, //连接状态
messages: [],
customerInfo: {},
customerInfo: {
sessionId: "",
},
count: 0,
userInfo: {
username: "admin",
......@@ -37,11 +39,10 @@ export const useUserStore = defineStore("user", {
return {
...item,
username: item.id,
userImg:"https://cdn.lirimall.com//lirigo/filetempImage/新鲜水果_1661668973048.png",
userImg: "https://img2.baidu.com/it/u=3369130612,2858330241&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1713891600&t=a5f6e80de48d2a4a5158a68aeafa0ecf",
messages: [],
};
});
console.log(this.userList);
resolve(result);
}
});
......
import ClipboardJS from "clipboard";
import { ElMessage } from "element-plus";
export function getShortDate(): string {
const now = new Date();
let month: string = (now.getMonth() + 1).toString();
......@@ -19,3 +21,30 @@ export function getShortDate(): string {
return month + "-" + day + " " + hour + ":" + minutes;
}
export const require = (imgPath: any) => {
try {
const handlePath = imgPath.replace("@", "..");
return new URL(handlePath, import.meta.url).href;
} catch (error) {
console.warn(error);
}
};
export const copyText = (text) => {
const textarea = document.createElement("textarea");
textarea.value = text;
document.body.appendChild(textarea);
textarea.focus();
textarea.select();
ElMessage("复制成功!");
return new Promise((resolve, reject) => {
document.execCommand("copy") ? resolve() : reject();
textarea.remove();
});
};
export const regexText = (html) => {
var result = html.replace(/<[^<>]+>/g, "");
console.log(result,'result')
return result;
};
......@@ -14,7 +14,6 @@ function creatWebSocket(wsUrl: string) {
} else {
console.log("当前浏览器不支持 WebSocket");
}
try {
initWebSocket(wsUrl); // 初始化websocket连接
} catch (e) {
......@@ -65,13 +64,13 @@ function websocketOpen() {
// 数据接收
function websocketonmessage(e: MessageEvent<any>) {
const res = JSON.parse(e.data); // 解析JSON格式的数据
console.log(res,'res')
console.log(res, "res");
if (res.command == 11) {
//将数据放在store中
// 下面的判断则是后台返回的接收到的数据 如何处理自己决定
useUserStore()
.setUserListMessages(res.data)
.then();
setTimeout(() => {
useUserStore().setUserListMessages(res.data).then();
}, 10);
}
}
......
declare module "*.vue" {
import type { DefineComponent } from "vue";
const component: DefineComponent<{}, {}, any>;
export default component;
}
import { defineConfig } from "vite";
import Components from "unplugin-vue-components/vite";
import vuePluginsAutoI18n from "vite-plugin-auto-i18n";
import createVuePlugin from '@vitejs/plugin-vue';
import AutoImport from "unplugin-auto-import/vite";
import { VantResolver } from "unplugin-vue-components/resolvers";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
import path from "path";
export default defineConfig({
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
plugins: [
createVuePlugin(),
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [VantResolver(), ElementPlusResolver()],
}),
],
server: {
host: "0.0.0.0",
port: 8082,
open: false,
},
});
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论