提交 c48a4b09 作者: Hao

add

父级 58fed0c1
/* eslint-disable */ /* eslint-disable */
/* prettier-ignore */ /* prettier-ignore */
// @ts-nocheck // @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import // Generated by unplugin-auto-import
export {} export {}
declare global { declare global {
......
<!DOCTYPE html> <!DOCTYPE html>
<html lang=""> <html lang="">
<head>
<meta charset="utf-8"> <head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>用户端</title> <title>用户端</title>
</head> </head>
<body>
<noscript> <body>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript> <noscript>
<div id="app"></div> <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
<!-- built files will be auto injected --> Please enable it to continue.</strong>
</body> </noscript>
</html> <div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
\ No newline at end of file
(function () {
let $t = function (key, val, nameSpace) {
const langPackage = $t[nameSpace] ? $t[nameSpace] : $t.package
return (langPackage || {})[key] || val;
};
let $$t = function (val) {
return val;
};
$t.locale = function (locale, nameSpace) {
if (nameSpace) {
$t[nameSpace] = locale || {};
} else {
$t.package = locale || {};
}
};
window.$t = window.$t || $t;
window.$$t = $$t;
window._getJSONKey = function (key, insertJSONObj = undefined) {
const JSONObj = insertJSONObj || JSON.parse(getLangTranslateJSONFile())
const langObj = {}
Object.keys(JSONObj).forEach((value)=>{
langObj[value] = JSONObj[value][key]
})
return langObj
}
})();
\ No newline at end of file
{
}
\ No newline at end of file
import fs from 'fs';
const originalData = JSON.parse(fs.readFileSync('index.json', 'utf8'));
console.log(originalData)
let obj = {}
for (let i in originalData) {
let record = originalData[i]
for (let e in record) {
if(obj[e]){
obj[e].push(record[e])
}else{
obj[e] = [record[e]]
}
}
}
for (let i in obj){
fs.writeFileSync(`language/${i}.mjs`, JSON.stringify(obj[i], null, 2), 'utf8');
}
This source diff could not be displayed because it is too large. You can view the blob instead.
{ {
"name": "tokcos-socket-web-ts", "name": "min-demo",
"version": "0.1.0", "version": "0.0.1",
"private": true, "type": "module",
"license":"MIT",
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "build": "vue-tsc --noEmit && vite build",
"build": "vue-cli-service build", "serve": "vite",
"lint": "vue-cli-service lint" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"@babel/core": "^7.24.3",
"@babel/types": "^7.24.0",
"@element-plus/icons-vue": "^2.3.1", "@element-plus/icons-vue": "^2.3.1",
"@luohc92/vue3-image-viewer": "^1.0.0", "@luohc92/vue3-image-viewer": "^1.0.0",
"axios": "^1.6.7", "@tinymce/tinymce-vue": "^4.0.7",
"core-js": "^3.8.3", "@vitalets/google-translate-api": "^9.2.0",
"amfe-flexible": "^2.2.1",
"axios": "^0.27.2",
"copy-webpack-plugin": "^11.0.0",
"cos-js-sdk-v5": "^1.7.0", "cos-js-sdk-v5": "^1.7.0",
"cos-wx-sdk-v5": "^1.6.0", "echarts": "^5.3.3",
"element-plus": "^2.6.1", "element-plus": "^2.2.14",
"emoji.json": "^15.1.0", "emoji.json": "^15.1.0",
"i18n-jsautotranslate": "^2.6.0",
"json-format": "^1.0.1",
"min-comp": "^0.0.4",
"mockjs": "^1.1.0", "mockjs": "^1.1.0",
"moment": "^2.30.1", "moment": "^2.30.1",
"pinia": "^2.1.7", "particles.vue3": "^2.2.3",
"pinia": "^2.0.20",
"pinia-plugin-persistedstate": "^3.2.1", "pinia-plugin-persistedstate": "^3.2.1",
"socket.io-client": "^4.7.4", "prismjs": "^1.28.0",
"unplugin-auto-import": "0.16.1", "sass": "^1.54.5",
"unplugin-vue-components": "^0.25.2", "sass-loader": "^13.0.2",
"vue": "^3.2.13", "three": "^0.143.0",
"vue-native-websocket": "^2.0.15", "tsparticles": "^2.2.3",
"vue-router": "^4.0.3", "tunnel": "^0.0.6",
"vue3-uuid": "^1.0.0", "vant": "^3.6.0",
"vuex": "^4.0.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": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.4.0", "@types/node": "^12.20.24",
"@typescript-eslint/parser": "^5.4.0", "@vitejs/plugin-vue": "^3.0.3",
"@vue/cli-plugin-babel": "~5.0.0", "rollup-plugin-copy": "^3.4.0",
"@vue/cli-plugin-eslint": "~5.0.0", "typescript": "^4.6.4",
"@vue/cli-plugin-router": "~5.0.0", "unplugin-auto-import": "^0.17.5",
"@vue/cli-plugin-typescript": "~5.0.0", "unplugin-vue-components": "^0.26.0",
"@vue/cli-plugin-vuex": "~5.0.0", "vite": "^3.0.7",
"@vue/cli-service": "~5.0.0", "vite-plugin-auto-i18n": "^0.0.9",
"@vue/eslint-config-typescript": "^9.1.0", "vue-tsc": "^0.39.5"
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"sass": "^1.32.7",
"sass-loader": "^12.0.0",
"typescript": "~4.5.5"
} }
} }
<template> <template>
<router-view /> <div>
<header>
<div class="operation">
<el-button @click="changeLang('zhcn')" class="mr10">中文</el-button>
<el-button @click="changeLang('en')" class="mr10">英文</el-button>
<el-button @click="changeLang('ko')" class="mr10">韩文</el-button>
<el-button @click="changeLang('ja')" class="mr10">日文</el-button>
</div>
</header>
<router-view />
</div>
</template> </template>
<script setup lang="ts">
const changeLang = (value:any)=> {
localStorage.setItem('lang', value)
location.reload();
}
</script>
<style lang="scss"> <style lang="scss">
* { * {
padding: 0; padding: 0;
...@@ -9,7 +24,8 @@ ...@@ -9,7 +24,8 @@
} }
html, html,
body,#app { body,
#app {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
......
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')
import './lang' //
import { createApp } from "vue"; import { createApp } from "vue";
import App from "./App.vue"; import App from "./App.vue";
import router from "./router"; import router from "./router";
import store from "./store/index"; import store from "./store/index";
import "./assets/css/reset.css"; import "./assets/css/reset.css";
import * as ElementPlusIconsVue from "@element-plus/icons-vue"; import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import UUID from 'vue3-uuid' import translate from "i18n-jsautotranslate";
import { useUserStore } from "./store/modules/user"; import UUID from "vue3-uuid";
import "@/permission"; // permission control import "@/permission"; // permission control
import "element-plus/dist/index.css"; import "element-plus/dist/index.css";
import "../src/mocks/mock"; import "./mocks/mock";
const app = createApp(App); const app = createApp(App);
app.config.globalProperties.$translate = translate;
app.use(store).use(UUID).use(router).mount("#app"); app.use(store).use(UUID).use(router).mount("#app");
for (const [key, component] of Object.entries(ElementPlusIconsVue)) { for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component); app.component(key, component);
} }
// const COS = require("cos-wx-sdk-v5");
// import { ElMessage } from "element-plus";
// import { upload, getUploadConfigInfo } from "../axios/model/user";
// export default function () {
// interface UploadMixin {
// uploadMixinPath: string;
// uploadMixinType: string;
// uploadMixinCredentials: any;
// uploadMixinTimeStamp: number;
// }
// const uploadMixin: UploadMixin = {
// uploadMixinPath: "",
// uploadMixinType: "",
// uploadMixinCredentials: {},
// uploadMixinTimeStamp: 0,
// };
// const upLoadFilesHander = (tempFilePaths:any, tempFiles:any, zip:any) => {
// return new Promise((resolve) => {
// if (tempFiles.length != 0) {
// if (typeof upLoadHander !== "function") return;
// let uploadObj = {};
// let uploadNum = tempFiles.length;
// uploadObj.length = tempFiles.length;
// //处理上传结果函数
// function loadHandler({ success, message }:any, i) {
// uploadNum = uploadNum - 1;
// uploadObj[i] = message;
// if (!success) {
// uploadObj[i] = "";
// ElMessage({
// message: `[${i + 1}]上传失败,请重新上传!`,
// type: "none",
// });
// }
// if (uploadNum == 0) {
// const arr = Array.from(uploadObj);
// // ;
// resolve({ success: true, result: arr });
// }
// }
// //进行上传
// tempFiles.forEach((file:any, i:any) => {
// upLoadHander({
// path: tempFilePaths[i],
// file: file.path,
// zip: zip || "",
// onSuccess: ({ success, message }:any) => {
// loadHandler({ success, message }, i);
// },
// onError: (res:any) => {
// loadHandler({ success: false, message: "" }, i);
// },
// });
// });
// } else {
// resolve({ success: true, result: [] });
// }
// });
// };
// const upLoadHander = (obj:any) => {
// const { path, file, biz } = obj;
// const pathArr = (path || "").split("/");
// const pathStr = pathArr[pathArr.length - 1];
// const fileName = (pathStr || "").split(".");
// let fileInfo = {
// fileTyle: fileName.length > 1 ? fileName[fileName.length - 1] : "",
// fileName: fileName[0],
// biz: biz || "temp",
// file: file,
// };
// const none = (async function hander(noCredentials) {
// let res = {
// result:{}
// },
// staticDomain = "",
// resResult = true;
// //noCredentials变量控制是否走对象存储
// if (noCredentials) {
// let query = {}
// res = await getUploadConfigInfo(query);
// console.log(res)
// if (res.code === 200 && res.result) {
// let result = res.result
// uploadMixin.uploadMixinPath = result.upLoadPath;
// uploadMixin.uploadMixinType = result.uploadType;
// staticDomain = result.staticDomain || "https://cdn.tikcos.cn";
// if (uploadMixin.uploadMixinType === "txcos") {
// const credentials = result.credentials;
// uploadMixin.uploadMixinCredentials = {
// TmpSecretId: credentials.tmpSecretId,
// TmpSecretKey: credentials.tmpSecretKey,
// SecurityToken: credentials.sessionToken,
// StartTime: result.startTime,
// ExpiredTime: result.expiredTime,
// };
// }
// } else {
// resResult = false;
// }
// }
// //resResult判断接口是否正常
// if (resResult) {
// if (uploadMixin.uploadMixinType == "txcos") {
// //走对象存储
// const cos = new COS({
// getAuthorization: (options:any, callback:any) => {
// callback(uploadMixin.uploadMixinCredentials);
// },
// });
// const tempFolder = fileInfo.biz === "temp" ? "" : `${fileInfo.biz}/`;
// const folder = `${fileInfo.fileName}_${new Date().getTime()}.${
// fileInfo.fileTyle
// }`;
// let result = res.result || {}
// cos.postObject(
// {
// FilePath: fileInfo.file,
// Bucket: result.bucketName || "tikcos-1257774783",
// Region: result.regionid || "ap-guangzhou",
// Key: uploadMixin.uploadMixinPath + tempFolder + folder,
// Body: fileInfo.file,
// onProgress: function (progressData:any) {
// obj.onProgress && obj.onProgress(progressData);
// },
// },
// (err:any, data:any) => {
// if (!err && data.statusCode === 200) {
// const imgurl = `${staticDomain}/${uploadMixin.uploadMixinPath}${tempFolder}${folder}`;
// obj.onSuccess({
// success: true,
// message: imgurl,
// });
// } else {
// obj.onError({
// success: false,
// message: err || "图片上传失败",
// });
// }
// }
// );
// } else {
// //走系统上传
// upload({
// biz: fileInfo.biz,
// file: fileInfo.file,
// }).then((uploadRes:any) => {
// if (uploadRes.success && uploadRes.message) {
// //保存绝对路径,不然小程序会有问题
// let url = uploadRes.message;
// obj.onSuccess({ success: true, message: url });
// } else {
// obj.onError({
// success: false,
// message: uploadRes.message || "图片上传失败",
// });
// }
// })
// } else {
// obj.onError({
// success: false,
// message: "服务接口报错",
// });
// }}
// })(true);
// };
// }
import { reactive, watch, ref, defineEmits, defineExpose } from "vue"; import { reactive, watch, ref, defineEmits, defineExpose } from "vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { upload, getUploadConfigInfo } from "../axios/model/user"; import { upload, getUploadConfigInfo } from "../axios/model/user";
// const COS = require("cos-wx-sdk-v5");
import COS from "cos-js-sdk-v5"; import COS from "cos-js-sdk-v5";
interface UploadMixin { interface UploadMixin {
uploadMixinPath: string; uploadMixinPath: string;
......
const COS = require('cos-wx-sdk-v5');
import { ElMessage } from 'element-plus'
const uploadMixin = {
data() {
return {
uploadMixinPath: '',
uploadMixinType: '',
uploadMixinCredentials: {},
uploadMixinTimeStamp: 0
};
},
methods: {
upLoadFilesHander(tempFilePaths, tempFiles, zip){
return new Promise((resolve)=>{
if (tempFiles.length != 0) {
if(typeof this.upLoadHander !== 'function') return;
let uploadObj = {};
let uploadNum = tempFiles.length;
uploadObj.length = tempFiles.length;
//处理上传结果函数
function loadHandler({ success, message },i){
uploadNum = uploadNum - 1;
uploadObj[i] = message;
if (!success) {
uploadObj[i] = '';
ElMessage({
message: `[${i+1}]上传失败,请重新上传!`,
type: 'none',
})
}
if (uploadNum == 0) {
const arr = Array.from(uploadObj);
// ;
resolve({success: true, result: arr})
}
}
//进行上传
tempFiles.forEach((file, i) => {
this.upLoadHander({
path: tempFilePaths[i],
file: file.path,
zip: zip || '',
onSuccess: ({ success, message }) => {
loadHandler({ success, message },i)
},
onError: (res) => {
loadHandler({ success: false, message:''}, i)
}
});
});
}else{
resolve({success: true,result: []})
}
});
},
upLoadHander(obj) {
const { path, file, biz} = obj;
const pathArr = (path || '').split('/');
const pathStr = pathArr[pathArr.length -1];
const fileName = (pathStr || '').split('.');
let fileInfo = {
fileTyle: fileName.length > 1 ? fileName[fileName.length - 1] : '',
fileName: fileName[0],
biz: biz || 'temp',
file: file
};
const that = this;
const none = (async function hander(noCredentials) {
let res = {},
staticDomain = '',
resResult = true;
//noCredentials变量控制是否走对象存储
if (noCredentials) {
console.log(that.$https,'https')
res = await that.$https.request({
url: that.$interfaces.getUploadConfigInfo,
method: "get",
});
if (res.code === 200 && res.result) {
that.uploadMixinPath = res.result.upLoadPath;
that.uploadMixinType = res.result.uploadType;
staticDomain = res.result.staticDomain || 'https://cdn.tikcos.cn';
if (that.uploadMixinType === 'txcos') {
const ress = res.result.response;
const credentials = ress.credentials;
that.uploadMixinCredentials = {
TmpSecretId: credentials.tmpSecretId,
TmpSecretKey: credentials.tmpSecretKey,
SecurityToken: credentials.sessionToken,
StartTime: ress.startTime,
ExpiredTime: ress.expiredTime
};
}
} else {
resResult = false;
}
}
//resResult判断接口是否正常
if (resResult) {
if (that.uploadMixinType == 'txcos') {
//走对象存储
const cos = new COS({
getAuthorization: (options, callback) => {
callback(that.uploadMixinCredentials);
}
});
const tempFolder = fileInfo.biz === 'temp' ? '' : `${fileInfo.biz}/`;
const folder = `${fileInfo.fileName}_${new Date().getTime()}.${fileInfo.fileTyle}`;
cos.postObject(
{
FilePath: fileInfo.file,
Bucket: res.result.bucketName || 'tikcos-1257774783',
Region: res.result.regionid || 'ap-guangzhou',
Key: that.uploadMixinPath + tempFolder + folder,
Body: fileInfo.file,
onProgress: function (progressData) {
obj.onProgress && obj.onProgress(progressData);
}
},
(err, data) => {
if (!err && data.statusCode === 200) {
const imgurl = `${staticDomain}/${that.uploadMixinPath}${tempFolder}${folder}`;
obj.onSuccess({
success: true,
message: imgurl
});
} else {
obj.onError({
success: false,
message: err || '图片上传失败'
});
}
}
);
} else {
//走系统上传
that.$utils.ossUpload(
{
biz: fileInfo.biz,
file: fileInfo.file
},
(uploadRes) => {
// ;
if (uploadRes.success && uploadRes.message) {
//保存绝对路径,不然小程序会有问题
let url = uploadRes.message;
obj.onSuccess({ success: true, message: url });
} else {
obj.onError({
success: false,
message: uploadRes.message || '图片上传失败'
});
}
}
);
}
} else {
obj.onError({
success: false,
message: '服务接口报错'
});
}
})(true);
},
setOssUpload(obj) {
ossUpload(
{
biz: obj.biz,
file: obj.file
},
(uploadRes) => {
if (uploadRes.success && uploadRes.message) {
//保存绝对路径,不然小程序会有问题
let url = uploadRes.message;
const pre = url.startsWith('/') ? '' : '/';
url = axios['imgUrl'] + url;
obj.onSuccess({ success: true, message: url });
} else {
obj.onError({
success: false,
message: uploadRes.message || '图片上传失败'
});
}
}
);
}
}
};
export { uploadMixin };
const Mock = require('mockjs') import Mock from 'mockjs'
Mock.mock("/api/login", "get", () => { Mock.mock("/api/login", "get", () => {
return { return {
code: "200", code: "200",
......
import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router"; import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import HomeView from "../views/HomeView.vue";
const routes: Array<RouteRecordRaw> = [ const routes: Array<RouteRecordRaw> = [
{ {
path: "/", path: "/",
name: "home", name: "home",
component: HomeView, component: () => import(/* @vite-ignore */ `@/views/HomeView.vue`),
}, },
// {
// path: "/login",
// name: "login",
// component: () =>
// import(/* webpackChunkName: "about" */ "../views/loginView.vue"),
// },
]; ];
const router = createRouter({ const router = createRouter({
history: createWebHistory(process.env.BASE_URL), history: createWebHistory(),
routes, routes,
}); });
......
...@@ -4,4 +4,5 @@ declare module '*.vue' { ...@@ -4,4 +4,5 @@ declare module '*.vue' {
const component: DefineComponent<{}, {}, any> const component: DefineComponent<{}, {}, any>
export default component export default component
} }
declare module 'cos-wx-sdk-v5'; declare module 'cos-wx-sdk-v5';
\ No newline at end of file declare module 'i18n-jsautotranslate'
\ No newline at end of file
...@@ -90,7 +90,14 @@ ...@@ -90,7 +90,14 @@
<script lang="ts" setup> <script lang="ts" setup>
import '../assets/font/iconfont.css' import '../assets/font/iconfont.css'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { ref, onMounted, watch, nextTick, reactive } from 'vue' import {
ref,
onMounted,
watch,
nextTick,
reactive,
getCurrentInstance,
} from 'vue'
import { getShortDate } from '../utils/index' import { getShortDate } from '../utils/index'
import { useUserStore } from '../store/modules/user' import { useUserStore } from '../store/modules/user'
import AutomaticPrompt from '../components/AutomaticPrompt.vue' import AutomaticPrompt from '../components/AutomaticPrompt.vue'
...@@ -104,7 +111,7 @@ import { getUserList, InquiryAdd, checkMesssages } from '../axios/model/user' ...@@ -104,7 +111,7 @@ import { getUserList, InquiryAdd, checkMesssages } from '../axios/model/user'
const ruleForm = ref({ const ruleForm = ref({
count: 1, count: 1,
}) })
const { appContext } = getCurrentInstance()
const ruleFormRef = ref<FormInstance>() const ruleFormRef = ref<FormInstance>()
const customerInfo = ref({}) const customerInfo = ref({})
const messages = ref([]) const messages = ref([])
...@@ -164,10 +171,11 @@ const rules = reactive({ ...@@ -164,10 +171,11 @@ const rules = reactive({
let msg = '' let msg = ''
//进入页面直接发送请求从后端获取热点数据 //进入页面直接发送请求从后端获取热点数据
onMounted(async () => { onMounted(async () => {
connectMsg().then((res) => { // connectMsg().then((res) => {
getHistoryMessage() const translate = appContext.config.globalProperties.$translate
setMessage() getHistoryMessage()
}) setMessage()
// })
}) })
const connectMsg = () => { const connectMsg = () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
...@@ -244,7 +252,7 @@ const handleButtonClick = () => { ...@@ -244,7 +252,7 @@ const handleButtonClick = () => {
to: customerInfo.value.username, to: customerInfo.value.username,
form: store.userInfo.username, form: store.userInfo.username,
} }
console.log('打印用户发送的内容',data) console.log('打印用户发送的内容', data)
messages.value?.push(data) messages.value?.push(data)
sendWebSocket(data) sendWebSocket(data)
automaticPromptRef.value.setState('') automaticPromptRef.value.setState('')
...@@ -273,7 +281,6 @@ const handleMessageClick = (event: any) => { ...@@ -273,7 +281,6 @@ const handleMessageClick = (event: any) => {
showThumbnail: true, showThumbnail: true,
handlePosition: 'bottom', handlePosition: 'bottom',
maskBgColor: 'rgba(0,0,0,0.7)', maskBgColor: 'rgba(0,0,0,0.7)',
}) })
} }
} }
...@@ -640,11 +647,8 @@ const getMessageClass = (isSent: boolean) => { ...@@ -640,11 +647,8 @@ const getMessageClass = (isSent: boolean) => {
height: auto; height: auto;
display: block; display: block;
} }
} }
.message-container-right { .message-container-right {
justify-content: flex-end; justify-content: flex-end;
} }
...@@ -659,8 +663,6 @@ const getMessageClass = (isSent: boolean) => { ...@@ -659,8 +663,6 @@ const getMessageClass = (isSent: boolean) => {
width: 102px !important; width: 102px !important;
} }
.add { .add {
display: flex; display: flex;
height: var(--Layout-lg, 32px); height: var(--Layout-lg, 32px);
......
{ {
"compilerOptions": { "compilerOptions": {
"allowJs": true,
"target": "esnext", "target": "esnext",
"module": "esnext", "module": "esnext",
"strict": true, "strict": true,
...@@ -13,7 +14,6 @@ ...@@ -13,7 +14,6 @@
"sourceMap": true, "sourceMap": true,
"baseUrl": ".", "baseUrl": ".",
"types": [ "types": [
"webpack-env"
], ],
"paths": { "paths": {
"@/*": [ "@/*": [
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
"src/**/*.vue", "src/**/*.vue",
"tests/**/*.ts", "tests/**/*.ts",
"tests/**/*.tsx" "tests/**/*.tsx"
], , "main.ts" ],
"exclude": [ "exclude": [
"node_modules" "node_modules"
] ]
......
{
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
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";
// / 注:vite-plugin-auto-i18n 只处理脚本文件因此对于.vue等类型文件,需要vuePlugin进行解析
const vuePlugin = createVuePlugin({
include: [/\.vue$/],
// 注:plugin-vue 对于静态节点默认不解析,因此这里需要下述配置
template: {
compilerOptions: {
hoistStatic: false,
cacheHandlers: false,
},
},
});
export default defineConfig({
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
plugins: [
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [VantResolver(), ElementPlusResolver()],
}),
vuePlugin,
vuePluginsAutoI18n({
option: {
globalPath: "./lang", // 配置文件生成位置
namespace: "lang", // 命名空间
targetLangList: ["en", "ko", "ja"], // 翻译目标语言
originLang: "zh-cn", // 翻译源语言
distPath: "./dist/assets", // 打包后生成文件位置
distKey: "index", // 打包后主文件名称
},
}),
],
server: {
host: "0.0.0.0",
port: 80,
open: false,
},
});
const { defineConfig } = require('@vue/cli-service')
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = defineConfig({
transpileDependencies: true,
configureWebpack: {
plugins: [
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver()],
}),
],
},
// chainWebpack: config => {
// config.plugin('html').use(HtmlWebpackPlugin, [{
// title:'用户端',
// template: 'public/index.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.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论