Commit 4ab41a59 by 吴春元

适配低版本浏览器、修改样式

parent 147e640e
File added
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -27,11 +27,14 @@
"devDependencies": {
"@tsconfig/node22": "^22.0.0",
"@types/node": "^22.10.2",
"@vitejs/plugin-vue": "^5.2.1",
"@vitejs/plugin-legacy": "^6.1.1",
"@vitejs/plugin-vue": "^5.2.4",
"@vue/tsconfig": "^0.7.0",
"autoprefixer": "^10.4.20",
"core-js": "^3.46.0",
"npm-run-all2": "^7.0.2",
"postcss": "^8.4.49",
"rollup-plugin-esbuild": "^6.2.1",
"tailwindcss": "^3.4.17",
"typescript": "~5.6.3",
"vite": "^6.0.5",
......
......@@ -9,11 +9,12 @@
<div class="space-y-2">
<p>地址:{{ inject("VITE_ADDRESS") }}</p>
<p>电话:{{ inject("VITE_PHONE") }}</p>
<p>
<p>邮箱:{{ inject("VITE_EMAIL") }}</p>
<!-- <p>
邮箱:<a href="mailto:{{ inject('VITE_EMAIL') }}">{{
inject("VITE_EMAIL")
}}</a>
</p>
</p> -->
</div>
</div>
......
import axios from 'axios'
import { ElLoading, ElMessage } from 'element-plus'
import { saveAs } from 'file-saver'
import { getToken } from '@/utils/auth'
import errorCode from '@/utils/errorCode'
import { blobValidate } from '@/utils/ruoyi'
import axios from "axios";
import { ElLoading, ElMessage } from "element-plus";
import { saveAs } from "file-saver";
import { getToken } from "@/utils/auth";
import errorCode from "@/utils/errorCode";
import { blobValidate } from "@/utils/ruoyi";
const baseURL = import.meta.env.VITE_APP_BASE_API
const baseURL = import.meta.env.VITE_APP_BASE_API;
let downloadLoadingInstance;
export default {
name(name, isDelete = true) {
var url = baseURL + "/common/download?fileName=" + encodeURIComponent(name) + "&delete=" + isDelete
var url =
baseURL +
"/common/download?fileName=" +
encodeURIComponent(name) +
"&delete=" +
isDelete;
axios({
method: 'get',
method: "get",
url: url,
responseType: 'blob',
headers: { 'Authorization': 'Bearer ' + getToken() }
responseType: "blob",
headers: { Authorization: "Bearer " + getToken() },
}).then((res) => {
const isBlob = blobValidate(res.data);
if (isBlob) {
const blob = new Blob([res.data])
this.saveAs(blob, decodeURIComponent(res.headers['download-filename']))
const blob = new Blob([res.data]);
this.saveAs(blob, decodeURIComponent(res.headers["download-filename"]));
} else {
this.printErrMsg(res.data);
}
})
});
},
resource(resource) {
var url = baseURL + "/common/download/resource?resource=" + encodeURIComponent(resource);
var url =
baseURL +
"/common/download/resource?resource=" +
encodeURIComponent(resource);
axios({
method: 'get',
method: "get",
url: url,
responseType: 'blob',
headers: { 'Authorization': 'Bearer ' + getToken() }
responseType: "blob",
headers: { Authorization: "Bearer " + getToken() },
}).then((res) => {
const isBlob = blobValidate(res.data);
if (isBlob) {
const blob = new Blob([res.data])
this.saveAs(blob, decodeURIComponent(res.headers['download-filename']))
const blob = new Blob([res.data]);
this.saveAs(blob, decodeURIComponent(res.headers["download-filename"]));
} else {
this.printErrMsg(res.data);
}
})
});
},
zip(url, name) {
var url = baseURL + url
downloadLoadingInstance = ElLoading.service({ text: "正在下载数据,请稍候", background: "rgba(0, 0, 0, 0.7)", })
var url = baseURL + url;
downloadLoadingInstance = ElLoading.service({
text: "正在下载数据,请稍候",
background: "rgba(0, 0, 0, 0.7)",
});
axios({
method: 'get',
method: "get",
url: url,
responseType: 'blob',
headers: { 'Authorization': 'Bearer ' + getToken() }
}).then((res) => {
const isBlob = blobValidate(res.data);
if (isBlob) {
const blob = new Blob([res.data], { type: 'application/zip' })
this.saveAs(blob, name)
} else {
this.printErrMsg(res.data);
}
downloadLoadingInstance.close();
}).catch((r) => {
console.error(r)
ElMessage.error('下载文件出现错误,请联系管理员!')
downloadLoadingInstance.close();
responseType: "blob",
headers: { Authorization: "Bearer " + getToken() },
})
.then((res) => {
const isBlob = blobValidate(res.data);
if (isBlob) {
const blob = new Blob([res.data], { type: "application/zip" });
this.saveAs(blob, name);
} else {
this.printErrMsg(res.data);
}
downloadLoadingInstance.close();
})
.catch((r) => {
console.error(r);
ElMessage.error("下载文件出现错误,请联系管理员!");
downloadLoadingInstance.close();
});
},
saveAs(text, name, opts) {
saveAs(text, name, opts);
......@@ -72,8 +85,7 @@ export default {
async printErrMsg(data) {
const resText = await data.text();
const rspObj = JSON.parse(resText);
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode["default"];
ElMessage.error(errMsg);
}
}
},
};
......@@ -385,5 +385,10 @@ function getNewsDetails(id: any) {
}
:deep(.editor-content p img) {
max-width: 100%;
display: block;
margin: 0 auto;
}
:deep(.editor-content video) {
max-width: 100%;
}
</style>
......@@ -4,10 +4,26 @@ import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";
import vueDevTools from "vite-plugin-vue-devtools";
import legacy from "@vitejs/plugin-legacy";
// https://vite.dev/config/
export default defineConfig({
plugins: [vue(), vueDevTools()],
plugins: [
vue(),
vueDevTools(),
legacy({
targets: ["chrome 50"], // 明确兼容 Chrome 50
additionalLegacyPolyfills: ["core-js/features/object/entries"], // 按需补充 polyfill
renderLegacyChunks: true, // 生成旧浏览器专用代码块
polyfills: [
"es.symbol",
"es.array.filter",
"es.object.get-own-property-descriptor",
"es.array.flat-map",
"es.array.flat",
],
}),
],
resolve: {
// https://cn.vitejs.dev/config/#resolve-alias
alias: {
......@@ -41,9 +57,4 @@ export default defineConfig({
},
cors: true,
},
// resolve: {
// alias: {
// "@": fileURLToPath(new URL("./src", import.meta.url)),
// },
// },
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment