diff --git a/.env.development b/.env.development
index d3ff634..4d68e4c 100644
--- a/.env.development
+++ b/.env.development
@@ -1,3 +1,3 @@
NODE_ENV=development
VITE_APP_TITLE='肝胆相照临床病例库'
-VITE_APP_API_URL='http://127.0.0.1:5480'
\ No newline at end of file
+VITE_APP_API_URL='https://dev-casedata.igandan.com/admin/api'
\ No newline at end of file
diff --git a/.env.localhost b/.env.localhost
index 8c14ddf..b57611a 100644
--- a/.env.localhost
+++ b/.env.localhost
@@ -1,3 +1,3 @@
NODE_ENV=development
VITE_APP_TITLE='肝胆相照临床病例库'
-VITE_APP_API_URL='http://127.0.0.1:5480'
+VITE_APP_API_URL='https://dev-casedata.igandan.com/admin/api'
diff --git a/index.html b/index.html
index c88dce4..29b9dff 100644
--- a/index.html
+++ b/index.html
@@ -17,6 +17,11 @@
%VITE_APP_TITLE%
+
diff --git a/src/App.vue b/src/App.vue
index cb5c981..ab9b3c1 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -96,4 +96,5 @@
:deep(.ant-table-column-sorters) {
align-items: flex-start !important;
}
+
diff --git a/src/api/business/case-clinical-article/case-clinical-article-api.js b/src/api/business/case-clinical-article/case-clinical-article-api.js
index 87322a8..c7ec9e5 100644
--- a/src/api/business/case-clinical-article/case-clinical-article-api.js
+++ b/src/api/business/case-clinical-article/case-clinical-article-api.js
@@ -5,7 +5,7 @@
* @Date: 2025-08-04 10:17:15
* @Copyright gdxz
*/
-import { postRequest, getRequest } from '/@/lib/axios';
+import { postRequest, getRequest,uploadRequest} from '/@/lib/axios';
export const caseClinicalArticleApi = {
@@ -22,7 +22,12 @@ export const caseClinicalArticleApi = {
add: (param) => {
return postRequest('/caseClinicalArticle/add', param);
},
-
+ getOssSign:(type)=>{ //获取上传文件 Policy
+ return getRequest('/file/getOSSPolicy/'+type)
+ },
+ ossUpload:(url,data)=>{
+ return uploadRequest(url,data);
+ },
/**
* 修改 @author xing
*/
diff --git a/src/components/framework/wangeditor/index.vue b/src/components/framework/wangeditor/index.vue
index dc3c31c..e95acfe 100644
--- a/src/components/framework/wangeditor/index.vue
+++ b/src/components/framework/wangeditor/index.vue
@@ -1,16 +1,16 @@
-
-
-
+
+
import { shallowRef, onBeforeUnmount, watch, ref } from 'vue';
import { FILE_FOLDER_TYPE_ENUM } from '/@/constants/support/file-const';
- import { fileApi } from '/@/api/support/file-api';
- import '@wangeditor-next/editor/dist/css/style.css';
- import { Editor, Toolbar } from '@wangeditor-next/editor-for-vue';
+ import { caseClinicalArticleApi } from '/@/api/business/case-clinical-article/case-clinical-article-api';
+ import '@wangeditor/editor/dist/css/style.css';
+ import { Editor, Toolbar } from '@wangeditor/editor-for-vue';
import { smartSentry } from '/@/lib/smart-sentry';
-
+ import { SmartLoading } from '/@/components/framework/smart-loading';
//菜单
- const editorConfig = { MENU_CONF: {} };
+ import dayjs from 'dayjs';
+ import { FileUtil } from '/@/utils/fileutil';
+ let props = defineProps({
+ modelValue: String,
+ height: {
+ type: Number,
+ default: 500,
+ },
+ editorConfig: {
+ type: Object,
+ default: { MENU_CONF: {} }
+ },
+ toolbarConfig: {
+ type: Object,
+ default: {}
+ },
+ });
+ const editorConfig = props.editorConfig;
+ console.log(editorConfig);
+ const getImg = (file) => {
+ return new Promise((resolve, reject) => {
+ caseClinicalArticleApi.getOssSign(1).then((res) => {
+ console.log(res.data);
+ let { accessid, dir, policy, signature, host } = res.data;
+ let filename = dayjs().format('YYYYMMDDHHmmss') + FileUtil.UUID() + '.' + 'png';
+ let formData = new FormData();
+ formData.append('OSSAccessKeyId', accessid);
+ formData.append('policy', policy);
+ formData.append('signature', signature);
+ formData.append('key', dir + filename);
+ formData.append('file', file, filename);
+ formData.append('success_action_status', 200);
+ caseClinicalArticleApi
+ .ossUpload(host, formData)
+ .then((res) => {
+ console.log(host + dir + filename);
+ resolve(host + dir + filename);
+ SmartLoading.hide();
+ })
+ .catch((err) => {
+ console.log(err);
+
+ alert('上传失败');
+ SmartLoading.hide();
+ });
+ });
+ });
+
+};
//上传
let customUpload = {
async customUpload(file, insertFn) {
try {
- const formData = new FormData();
- formData.append('file', file);
- let res = await fileApi.uploadFile(formData, FILE_FOLDER_TYPE_ENUM.COMMON.value);
- let data = res.data;
- insertFn(data.fileUrl);
+ SmartLoading.show();
+ // const formData = new FormData();
+ // formData.append('file', file);
+ // let res = await fileApi.uploadFile(formData, FILE_FOLDER_TYPE_ENUM.COMMON.value);
+ // let data = res.data;
+ getImg(file).then((data) => {
+ console.log(data);
+ insertFn(data);
+ });
+ //insertFn(data.fileUrl);
} catch (error) {
smartSentry.captureError(error);
}
@@ -51,16 +104,11 @@
// ----------------------- 以下是公用变量 emits props ----------------
const editorHtml = ref();
- let props = defineProps({
- modelValue: String,
- height: {
- type: Number,
- default: 500,
- },
- });
+
watch(
() => props.modelValue,
(nVal) => {
+ console.log(nVal);
editorHtml.value = nVal;
},
{
@@ -74,6 +122,9 @@
const editorRef = shallowRef();
const handleCreated = (editor) => {
editorRef.value = editor;
+
+ console.log( Toolbar ) // 当前菜单排序和分组
+
};
const handleChange = (editor) => {
emit('update:modelValue', editorHtml.value);
@@ -99,20 +150,15 @@
getHtml,
getText,
});
-
+
-
-
diff --git a/src/lib/axios.js b/src/lib/axios.js
index 531ae55..601874a 100644
--- a/src/lib/axios.js
+++ b/src/lib/axios.js
@@ -56,9 +56,9 @@ smartAxios.interceptors.response.use(
(response) => {
// 根据content-type ,判断是否为 json 数据
let contentType = response.headers['content-type'] ? response.headers['content-type'] : response.headers['Content-Type'];
- if (contentType.indexOf('application/json') === -1) {
- return Promise.resolve(response);
- }
+ // if (contentType.indexOf('application/json') === -1) {
+ // return Promise.resolve(response);
+ // }
// 如果是json数据
if (response.data && response.data instanceof Blob) {
@@ -153,7 +153,9 @@ export const postRequest = (url, data) => {
method: 'post',
});
};
-
+export const uploadRequest = (url, data) => {
+ return request({ data, url, method: 'post', headers: { 'Content-Type': 'multipart/form-data' } });
+};
// ================================= 加密 =================================
/**
diff --git a/src/utils/fileutil.js b/src/utils/fileutil.js
new file mode 100644
index 0000000..fce7810
--- /dev/null
+++ b/src/utils/fileutil.js
@@ -0,0 +1,91 @@
+const FileUtil = {
+
+ //file 为微信file 单文件
+ getFileName(file){
+ // size: 132224
+ // thumb: "http://tmp/0ftStiYfd18K517836423bbfde024c385140a666b344.png"
+ // type: "image"
+ // url: "http://tmp/0ftStiYfd18K517836423bbfde024c385140a666b344.png"
+
+ if(file){
+ const uuid = this.UUID().replace("/-/g","");
+ if(file.url && (file.url.indexOf(".") > -1)){
+ const fileType = file.url.split(".")[1];
+ return uuid+"."+fileType;
+ }else{
+ return;
+ }
+ }
+ return;
+ },
+
+ UUID () {
+ if (typeof crypto === 'object') {
+ if (typeof crypto.randomUUID === 'function') {
+ return crypto.randomUUID();
+ }
+ if (typeof crypto.getRandomValues === 'function' && typeof Uint8Array === 'function') {
+ const callback = (c) => {
+ const num = Number(c);
+ return (num ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (num / 4)))).toString(16);
+ };
+ return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, callback);
+ }
+ }
+ let timestamp = new Date().getTime();
+ let perforNow = (typeof performance !== 'undefined' && performance.now && performance.now() * 1000) || 0;
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
+ let random = Math.random() * 16;
+ if (timestamp > 0) {
+ random = (timestamp + random) % 16 | 0;
+ timestamp = Math.floor(timestamp / 16);
+ } else {
+ random = (perforNow + random) % 16 | 0;
+ perforNow = Math.floor(perforNow / 16);
+ }
+ return (c === 'x' ? random : (random & 0x3) | 0x8).toString(16);
+ });
+ },
+
+ canvasToFile(){
+ let canvas = window.map3DControl.viewer.canvas;
+ let imgWidth = 1920;
+ let img = Canvas2Image.convertToImage(
+ canvas,
+ imgWidth,
+ (imgWidth * canvas.height) / canvas.width,
+ "png"
+ );
+ let file_name = new Date().getTime() + ".png";
+ let imgsrc = img.src.slice(22)
+
+ let file = this.convertBase64UrlToImgFile(
+ imgsrc,
+ file_name,
+ "image/png"
+ )
+ return file;
+ },
+
+ convertBase64UrlToImgFile(urlData, fileName, fileType) {
+ urlData = urlData.replace(/^data:image\/\w+;base64,/, "");
+ let bytes = wx.base64ToArrayBuffer(urlData);
+
+ // var bytes = wx.atob(urlData); //转换为byte
+ //处理异常,将ascii码小于0的转换为大于0
+ var ab = new ArrayBuffer(bytes.length);
+ var ia = new Int8Array(ab);
+ var i;
+ for (i = 0; i < bytes.length; i++) {
+ ia[i] = bytes.charCodeAt(i);
+ }
+ //转换成文件,添加文件的type,name,lastModifiedDate属性
+ var blob = new Blob([ab], { type: fileType });
+ blob.lastModifiedDate = new Date();
+ blob.name = fileName;
+ return blob;
+ }
+}
+
+
+export { FileUtil }
\ No newline at end of file
diff --git a/src/views/business/case-clinical-article/case-clinical-article-form.vue b/src/views/business/case-clinical-article/case-clinical-article-form.vue
index fd7b2fe..26b345f 100644
--- a/src/views/business/case-clinical-article/case-clinical-article-form.vue
+++ b/src/views/business/case-clinical-article/case-clinical-article-form.vue
@@ -151,7 +151,8 @@
请在此处编辑文章内容,支持富文本格式、图片上传、表格等功能
-
+
+
@@ -222,7 +223,8 @@
import { smartSentry } from '/@/lib/smart-sentry';
import FileUpload from '/@/components/support/file-upload/index.vue';
import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';
- import UEditor from '/@/components/business/ueditor.vue';
+ //import UEditor from '/@/components/business/ueditor.vue';
+ import SmartWangeditor from '/@/components/framework/wangeditor/index.vue';
import { FILE_FOLDER_TYPE_ENUM } from '/@/constants/support/file-const';
import { PlusOutlined, DeleteOutlined } from '@ant-design/icons-vue';
import dayjs from 'dayjs';
@@ -234,7 +236,12 @@
// ------------------------ 显示与隐藏 ------------------------
// 是否显示
const visibleFlag = ref(false);
+const rubricRef = ref();
+
+const rubricToolbarConfig = {
+ toolbarKeys : ['bold', 'underline', 'italic', 'through', 'code', 'sub', 'sup', 'clearStyle', 'color', 'bgColor', 'fontSize', 'fontFamily', 'indent', 'delIndent', 'justifyLeft', 'justifyRight', 'justifyCenter', 'justifyJustify', 'lineHeight', 'insertImage', 'deleteImage', 'editImage', 'divider', 'insertLink', 'editLink', 'unLink', 'viewLink', 'codeBlock', 'blockquote', 'headerSelect', 'redo', 'undo', 'fullScreen', 'enter', 'bulletedList', 'numberedList','uploadImage' ]
+}
async function show(rowData) {
// 重置表单数据
Object.assign(form, formDefault);