master
xy 3 years ago
parent 3373b1b0d1
commit 5b3cd3f923

@ -5,3 +5,4 @@ ENV = 'development'
VUE_APP_BASE_API = http://weiyuan-ziliao-test.ali251.langye.net
VUE_APP_UPLOAD_API = http://weiyuan-ziliao-test.ali251.langye.net/api/admin/upload-file
VUE_APP_AUTH_BASE_API = https://sso.szhct.edu.cn/cas/oauth2.0/authorize
VUE_APP_VIEW_API=http://view.ali251.langye.net:8012/onlinePreview

@ -1,7 +1,11 @@
# just a flag
ENV = 'production'
ENV='production'
# base api
VUE_APP_BASE_API = http://weiyuan-ziliao-test.ali251.langye.net
VUE_APP_UPLOAD_API = http://weiyuan-ziliao-test.ali251.langye.net/api/admin/upload-file
VUE_APP_AUTH_BASE_API = https://sso.szhct.edu.cn/cas/oauth2.0/authorize
#VUE_APP_BASE_API=http://192.168.105.242
VUE_APP_BASE_API = https://zlhb.szhct.edu.cn
#VUE_APP_UPLOAD_API=http://192.168.105.242/api/admin/upload-file
VUE_APP_UPLOAD_API = https://zlhb.szhct.edu.cn/api/admin/upload-file
VUE_APP_AUTH_BASE_API=https://sso.szhct.edu.cn/cas/oauth2.0/authorize
#VUE_APP_AUTH_BASE_API = https://zlhb.szhct.edu.cn/cas/oauth2.0/authorize
VUE_APP_VIEW_API=https://zlhbview.szhct.edu.cn/onlinePreview

@ -1,141 +1,141 @@
<template>
<div class="tinymce">
<Editor v-model="myValue" :init="init" :disabled="disabled"></Editor>
</div>
</template>
<script>
import {
uploads
} from '@/api/uploads.js'
import tinymce from "tinymce/tinymce";
import Editor from "@tinymce/tinymce-vue";
import "/public/tinymce/skins/skin.css";
import "/public/tinymce/langs/zh_CN";
import "tinymce/themes/silver/theme";
import "tinymce/plugins/media";
import "tinymce/plugins/lists";
import "tinymce/plugins/table";
import "tinymce/plugins/hr";
import "tinymce/plugins/autolink";
import "tinymce/plugins/help";
import "tinymce/plugins/visualblocks";
import "tinymce/plugins/fullscreen";
import "tinymce/plugins/textpattern";
import "tinymce/plugins/contextmenu";
import "tinymce/plugins/wordcount";
import "tinymce/plugins/colorpicker";
import "tinymce/plugins/textcolor";
import "tinymce/icons/default"
import 'tinymce/plugins/code'
import "tinymce/plugins/image"
<template>
<div class="tinymce">
<Editor v-model="myValue" :init="init" :disabled="disabled"></Editor>
</div>
</template>
<script>
import {
uploads
} from '@/api/uploads.js'
import tinymce from "tinymce/tinymce";
import Editor from "@tinymce/tinymce-vue";
import "/public/tinymce/skins/skin.css";
import "/public/tinymce/langs/zh_CN";
import "tinymce/themes/silver/theme";
import "tinymce/plugins/media";
import "tinymce/plugins/lists";
import "tinymce/plugins/table";
import "tinymce/plugins/hr";
import "tinymce/plugins/autolink";
import "tinymce/plugins/help";
import "tinymce/plugins/visualblocks";
import "tinymce/plugins/fullscreen";
import "tinymce/plugins/textpattern";
import "tinymce/plugins/contextmenu";
import "tinymce/plugins/wordcount";
import "tinymce/plugins/colorpicker";
import "tinymce/plugins/textcolor";
import "tinymce/icons/default"
import 'tinymce/plugins/code'
import "tinymce/plugins/image"
import "tinymce/plugins/imagetools"
import "/public/tinymce/plugins/axupimgs/plugin.js"
export default {
components: {
Editor
},
props: {
height: {
type: Number,
default: 300,
},
value: {
type: String,
default: "",
},
disabled: {
type: Boolean,
default: false,
},
plugins: {
type: [String, Array],
default: "code image axupimgs paste preview searchreplace autolink directionality visualblocks visualchars fullscreen template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount imagetools textpattern help emoticons autosave ",
},
toolbar: {
type: [String, Array],
default: ` undo redo restoredraft | code | image | axupimgs | imagetools | assignment | cut copy paste pastetext | forecolor backcolor bold italic underline strikethrough anchor | alignleft aligncenter alignright alignjustify outdent indent |
styleselect formatselect fontselect fontsizeselect | table charmap emoticons hr pagebreak | bullist numlist | blockquote subscript superscript removeformat |
insertdatetime print preview | fullscreen | bdmap indent2em lineheight formatpainter`,
},
menubar: {
type: String,
default: "edit insert view format table CardBtn",
},
},
data() {
return {
myValue: this.value,
showImg: false,
imgUploadUrl: `${process.env.VUE_APP_UPLOAD_API}`,
init: {
language_url: "/public/tinymce/langs/zh_CN.js", //
language: "zh_CN",
height: this.height,
plugins: this.plugins,
fontsize_formats: "8px 10px 12px 14px 16px 18px 24px 28px 36px",
toolbar: this.toolbar,
branding: false,
menubar: this.menubar,
//
images_upload_url: this.imgUploadUrl,
images_upload_handler: (blobInfo, success, failure) => {
this.handleImgUpload(blobInfo, success, failure);
},
},
};
},
methods: {
handleImgUpload(blobInfo, success, failure) {
console.log("我要上传", blobInfo);
let self = this;
let file = blobInfo.blob();
const isLt2M = file.size / 1024 < 2048;
if (!isLt2M) {
failure("上传失败图片不可超过2M!");
return false;
}
let formdate = new FormData();
formdate.append("file", blobInfo.blob()); //imageFile
uploads(formdate).then(res => {
if (res) {
let url = res.url;
success(url); //url
} else {
failure(res.errmsg);
this.$message.error(res.errmsg);
}
})
}
},
computed: {},
mounted() {
tinymce.init({});
},
watch: {
value(newValue) {
this.myValue = newValue;
},
myValue(newValue) {
this.$emit("input", newValue);
},
},
};
</script>
<style scoped lang="scss">
.tinymce {
position: relative;
&__upload {
z-index: 2;
position: absolute;
right: 4px;
top: 0px;
}
::v-deep .tox.tox-tinymce.tox-fullscreen {
z-index: 0
}
}
import "/public/tinymce/plugins/axupimgs/plugin.js"
export default {
components: {
Editor
},
props: {
height: {
type: Number,
default: 300,
},
value: {
type: String,
default: "",
},
disabled: {
type: Boolean,
default: false,
},
plugins: {
type: [String, Array],
default: "code image axupimgs paste preview searchreplace autolink directionality visualblocks visualchars fullscreen template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount imagetools textpattern help emoticons autosave ",
},
toolbar: {
type: [String, Array],
default: ` undo redo restoredraft | code | image | axupimgs | imagetools | assignment | cut copy paste pastetext | forecolor backcolor bold italic underline strikethrough anchor | alignleft aligncenter alignright alignjustify outdent indent |
styleselect formatselect fontselect fontsizeselect | table charmap emoticons hr pagebreak | bullist numlist | blockquote subscript superscript removeformat |
insertdatetime print preview | fullscreen | bdmap indent2em lineheight formatpainter`,
},
menubar: {
type: String,
default: "edit insert view format table CardBtn",
},
},
data() {
return {
myValue: this.value,
showImg: false,
imgUploadUrl: `${process.env.VUE_APP_UPLOAD_API}`,
init: {
language_url: "/public/tinymce/langs/zh_CN.js", //
language: "zh_CN",
height: this.height,
plugins: this.plugins,
fontsize_formats: "8px 10px 12px 14px 16px 18px 24px 28px 36px",
toolbar: this.toolbar,
branding: false,
menubar: this.menubar,
//
images_upload_url: this.imgUploadUrl,
images_upload_handler: (blobInfo, success, failure) => {
this.handleImgUpload(blobInfo, success, failure);
},
},
};
},
methods: {
handleImgUpload(blobInfo, success, failure) {
let self = this;
let file = blobInfo.blob();
const isLt2M = file.size / 1024 < 2048;
if (!isLt2M) {
failure("上传失败图片不可超过2M!");
return false;
}
let formdate = new FormData();
formdate.append("file", blobInfo.blob()); //imageFile
uploads(formdate).then(res => {
if (res) {
let url = res.url;
console.log(url,333)
success(url); //url
} else {
failure(res.errmsg);
this.$message.error(res.errmsg);
}
})
}
},
computed: {},
mounted() {
tinymce.init({});
},
watch: {
value(newValue) {
this.myValue = newValue;
},
myValue(newValue) {
this.$emit("input", newValue);
},
},
};
</script>
<style scoped lang="scss">
.tinymce {
position: relative;
&__upload {
z-index: 2;
position: absolute;
right: 4px;
top: 0px;
}
::v-deep .tox.tox-tinymce.tox-fullscreen {
z-index: 0
}
}
</style>

@ -33,7 +33,9 @@ router.beforeEach(async(to, from, next) => {
})
} else {
let redirectUri = encodeURIComponent(window.location.href)
window.location.href = `${process.env.VUE_APP_AUTH_BASE_API}?client_id=d05e4c9d07f705ef&redirect_uri=${redirectUri}&response_type=code&scope=base_api&state=wyd`
let client_id = 'db85478e4dd36937'
//let client_id = 'd05e4c9d07f705ef' dev
window.location.href = `${process.env.VUE_APP_AUTH_BASE_API}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&scope=base_api&state=wyd`
}
}

@ -398,7 +398,7 @@ export default {
res[i._relations.link_with_name] instanceof Array
? res[i._relations.link_with_name].map((i) => {
return {
name: i?.name,
name: i?.original_name,
url: i?.url,
response: i,
};

@ -620,7 +620,7 @@ export default {
prop: i.field,
label: i.name,
width: i.width,
fixed: i.field === 'biaoti' ? 'left' : 'center',
align: i.field === 'biaoti' ? 'left' : 'center',
},
linkOb
);

@ -14,6 +14,7 @@
:before-upload="beforeUpload"
:on-success="onSuccess"
:on-remove="onRemove"
multiple
:on-error="onError">
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<el-button style="margin-left: 10px;" size="small" type="success" @click="$refs['upload'].submit()"></el-button>
@ -83,7 +84,13 @@ export default {
watch: {
'form.id_material_fujian_uploads_material_id_relation': {
handler (newVal) {
this.fileList = newVal
this.fileList = newVal.map(i => {
return {
name: i?.original_name,
url: i?.url,
response: i,
}
})
},
deep: true
}

@ -97,7 +97,7 @@ export default {
}).catch(err => this.loading = false)
},
open(e) {
this.codeUri = `http://view.ali251.langye.net:8012/onlinePreview?url=${encodeURIComponent(
this.codeUri = `${process.env.VUE_APP_VIEW_API}?url=${encodeURIComponent(
new Buffer(e.url).toString("base64")
)}`;
@ -166,6 +166,9 @@ export default {
position: relative;
left: 50%;
}
.content {
overflow: scroll;
}
.file {
margin-top: 10px;

@ -250,7 +250,7 @@ export default {
},
methods: {
open (e) {
this.codeUri = `http://view.ali251.langye.net:8012/onlinePreview?url=${encodeURIComponent(new Buffer(e.url).toString('base64'))}`
this.codeUri = `${process.env.VUE_APP_VIEW_API}?url=${encodeURIComponent(new Buffer(e.url).toString('base64'))}`
this.showModal = true
//window.open(`http://view.ali251.langye.net:8012/onlinePreview?url=${codeUri}`)

@ -57,7 +57,7 @@
:command="item"
v-for="item in uploadsList"
>
{{ item.name }}
{{ item.original_name }}
</el-dropdown-item>
</template>
<template v-else>
@ -236,7 +236,7 @@ export default {
},
open(e) {
this.codeUri = `http://view.ali251.langye.net:8012/onlinePreview?url=${encodeURIComponent(
this.codeUri = `${process.env.VUE_APP_VIEW_API}?url=${encodeURIComponent(
new Buffer(e.url).toString("base64")
)}`;

Loading…
Cancel
Save