✨ 新增only office组件
This commit is contained in:
parent
e32b5a9bb1
commit
2336b39a79
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jmal-cloud-view",
|
"name": "jmal-cloud-view",
|
||||||
"version": "2.2.35",
|
"version": "2.2.36",
|
||||||
"description": "jmalcloud",
|
"description": "jmalcloud",
|
||||||
"author": "Jmal <zhushilun084@163.com>",
|
"author": "Jmal <zhushilun084@163.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@ -377,6 +377,7 @@
|
|||||||
<sim-text-preview :file.sync="textPreviewRow" :status.sync="textPreviewVisible"></sim-text-preview>
|
<sim-text-preview :file.sync="textPreviewRow" :status.sync="textPreviewVisible"></sim-text-preview>
|
||||||
<image-viewer :fileList="fileList" :file="imagePreviewRow" :status.sync="imagePreviewVisible"></image-viewer>
|
<image-viewer :fileList="fileList" :file="imagePreviewRow" :status.sync="imagePreviewVisible"></image-viewer>
|
||||||
<video-preview :file="videoPreviewRow" :status.sync="videoPreviewVisible"></video-preview>
|
<video-preview :file="videoPreviewRow" :status.sync="videoPreviewVisible"></video-preview>
|
||||||
|
<office-preview :file="officePreviewRow" :status.sync="officePreviewVisible"></office-preview>
|
||||||
<!-- <audio-preview :file="audioPreviewRow" :status.sync="audioPreviewVisible"></audio-preview> -->
|
<!-- <audio-preview :file="audioPreviewRow" :status.sync="audioPreviewVisible"></audio-preview> -->
|
||||||
<!--文件详细信息-->
|
<!--文件详细信息-->
|
||||||
<el-drawer
|
<el-drawer
|
||||||
@ -544,11 +545,13 @@ import '@/utils/directives.js'
|
|||||||
|
|
||||||
import fileConfig from '@/utils/file-config'
|
import fileConfig from '@/utils/file-config'
|
||||||
import EditElement from "@/views/markdown/EditElement";
|
import EditElement from "@/views/markdown/EditElement";
|
||||||
|
import OfficePreview from "@/components/preview/OfficePreview";
|
||||||
|
|
||||||
var rowStyleExecuting = false
|
var rowStyleExecuting = false
|
||||||
export default {
|
export default {
|
||||||
name: 'ShowFile',
|
name: 'ShowFile',
|
||||||
components: {
|
components: {
|
||||||
|
OfficePreview,
|
||||||
EditElement,
|
EditElement,
|
||||||
MessageDialog, AudioPreview, VideoPreview, ImageViewer, SimTextPreview, IconFile, BreadcrumbFilePath, EmptyFile,
|
MessageDialog, AudioPreview, VideoPreview, ImageViewer, SimTextPreview, IconFile, BreadcrumbFilePath, EmptyFile,
|
||||||
ButtonUpload,
|
ButtonUpload,
|
||||||
@ -774,6 +777,8 @@ export default {
|
|||||||
imagePreviewVisible: false,
|
imagePreviewVisible: false,
|
||||||
videoPreviewRow: {},
|
videoPreviewRow: {},
|
||||||
videoPreviewVisible: false,
|
videoPreviewVisible: false,
|
||||||
|
officePreviewRow: {},
|
||||||
|
officePreviewVisible: false,
|
||||||
audioPreviewRow: {},
|
audioPreviewRow: {},
|
||||||
audioPreviewVisible: false,
|
audioPreviewVisible: false,
|
||||||
drawer: false,
|
drawer: false,
|
||||||
@ -3109,6 +3114,12 @@ export default {
|
|||||||
Bus.$emit('onAddAudio', row, this.audioCoverUrl)
|
Bus.$emit('onAddAudio', row, this.audioCoverUrl)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (row.contentType.indexOf('office') > -1) {
|
||||||
|
// office文件
|
||||||
|
this.officePreviewVisible = true
|
||||||
|
this.officePreviewRow = row
|
||||||
|
return
|
||||||
|
}
|
||||||
if (row.suffix === 'pdf') {
|
if (row.suffix === 'pdf') {
|
||||||
// pdf文件
|
// pdf文件
|
||||||
fileConfig.preview(this.$store.state.user.name, row, this.$store.getters.token)
|
fileConfig.preview(this.$store.state.user.name, row, this.$store.getters.token)
|
||||||
|
|||||||
@ -5,36 +5,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.component-only-office {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
.placeholder {
|
|
||||||
flex: 1;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
.office-loading {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
import fileConfig from "@/utils/file-config";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "OnlyOfficeEditor",
|
name: "OnlyOfficeEditor",
|
||||||
props: {
|
props: {
|
||||||
@ -70,7 +44,6 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
//
|
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
@ -83,14 +56,13 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
|
|
||||||
fileType() {
|
fileType() {
|
||||||
return this.getType(this.value.type);
|
return this.getType(this.value.suffix);
|
||||||
},
|
},
|
||||||
|
|
||||||
fileName() {
|
fileName() {
|
||||||
return this.value.name;
|
return this.value.name;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
'value.id': {
|
'value.id': {
|
||||||
handler(id) {
|
handler(id) {
|
||||||
@ -98,10 +70,10 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.loadIng++;
|
this.loadIng++;
|
||||||
$A.loadScript($A.apiUrl("../office/web-apps/apps/api/documents/api.js"), (e) => {
|
$J.loadScript($J.apiUrl("http://nps.jmal.top:18849/web-apps/apps/api/documents/api.js"), (e) => {
|
||||||
this.loadIng--;
|
this.loadIng--;
|
||||||
if (e !== null) {
|
if (e !== null) {
|
||||||
$A.modalAlert("组件加载失败!");
|
$J.modalAlert("组件加载失败!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this.documentKey) {
|
if (!this.documentKey) {
|
||||||
@ -138,61 +110,67 @@ export default {
|
|||||||
this.docEditor.destroyEditor();
|
this.docEditor.destroyEditor();
|
||||||
this.docEditor = null;
|
this.docEditor = null;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
let lang = "zh";
|
|
||||||
switch (this.getLanguage()) {
|
|
||||||
case 'CN':
|
|
||||||
case 'TC':
|
|
||||||
lang = "zh";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
lang = 'en';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
let fileKey = this.code || this.value.id;
|
let fileKey = this.code || this.value.id;
|
||||||
let fileName = $A.strExists(this.fileName, '.') ? this.fileName : (this.fileName + '.' + this.fileType);
|
let fileName = $J.strExists(this.fileName, '.') ? this.fileName : (this.fileName + '.' + this.fileType);
|
||||||
const config = {
|
const config = {
|
||||||
"document": {
|
"document": {
|
||||||
"fileType": this.fileType,
|
"fileType": this.fileType,
|
||||||
"key": `${this.fileType}-${fileKey}-${keyAppend}`,
|
"key": `${this.fileType}-${$J.randNum(0,45678)}`,
|
||||||
"title": fileName,
|
"title": fileName,
|
||||||
"url": `http://nginx/api/file/content/?id=${fileKey}&token=${this.userToken}`,
|
//"url": window.location.origin + fileConfig.previewUrl(this.$store.state.user.name, this.value, this.$store.getters.token),
|
||||||
|
"url": "http://nps.jmal.top:19957/download?fileName=new+%281%29.docx&userAddress=%2FUsers%2Fjmal%2FDownloads%2Ftest%2F",
|
||||||
},
|
},
|
||||||
"editorConfig": {
|
"editorConfig": {
|
||||||
"mode": "edit",
|
"mode": "edit",
|
||||||
"lang": lang,
|
"lang": "zh",
|
||||||
"user": {
|
"user": {
|
||||||
"id": this.userInfo.userid,
|
"id": this.$store.state.user.name,
|
||||||
"name": this.userInfo.nickname
|
"name": this.$store.state.user.name
|
||||||
},
|
},
|
||||||
|
// "customization": {
|
||||||
|
// "uiTheme": this.themeIsDark ? "theme-dark" : "theme-classic-light",
|
||||||
|
// },
|
||||||
"customization": {
|
"customization": {
|
||||||
"uiTheme": this.themeIsDark ? "theme-dark" : "theme-classic-light",
|
"logo": null,
|
||||||
|
"autosave": true,
|
||||||
|
"comments": true,
|
||||||
|
"compactHeader": false,
|
||||||
|
"compactToolbar": false,
|
||||||
|
"compatibleFeatures": false,
|
||||||
|
"forcesave": false,
|
||||||
|
"help": false,
|
||||||
|
"hideRightMenu": false,
|
||||||
|
"hideRulers": false,
|
||||||
|
"submitForm": false,
|
||||||
|
"about": false,
|
||||||
|
"feedback": false
|
||||||
},
|
},
|
||||||
"callbackUrl": `http://nginx/api/file/content/office?id=${fileKey}&token=${this.userToken}`,
|
// "callbackUrl": `${window.location.origin}/api/office/track?jmal-token=${this.$store.getters.token}&fileName=new.docx&userAddress=%2FUsers%2Fjmal%2FDownloads%2Ftest%2F`,
|
||||||
|
callbackUrl: "http://nps.jmal.top:19957/track?fileName=new+%281%29.docx&userAddress=%2FUsers%2Fjmal%2FDownloads%2Ftest%2F",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (/\/hideenOfficeTitle\//.test(window.navigator.userAgent)) {
|
if (/\/hideenOfficeTitle\//.test(window.navigator.userAgent)) {
|
||||||
config.document.title = " ";
|
config.document.title = " ";
|
||||||
}
|
}
|
||||||
if ($A.leftExists(fileKey, "msgFile_")) {
|
console.log(config.document, config.editorConfig)
|
||||||
config.document.url = `http://nginx/api/dialog/msg/download/?msg_id=${$A.leftDelete(fileKey, "msgFile_")}&token=${this.userToken}`;
|
// if ($J.leftExists(fileKey, "msgFile_")) {
|
||||||
} else if ($A.leftExists(fileKey, "taskFile_")) {
|
// config.document.url = `http://nginx/api/dialog/msg/download/?msg_id=${$J.leftDelete(fileKey, "msgFile_")}&token=${this.userToken}`;
|
||||||
config.document.url = `http://nginx/api/project/task/filedown/?file_id=${$A.leftDelete(fileKey, "taskFile_")}&token=${this.userToken}`;
|
// } else if ($J.leftExists(fileKey, "taskFile_")) {
|
||||||
}
|
// config.document.url = `http://nginx/api/project/task/filedown/?file_id=${$J.leftDelete(fileKey, "taskFile_")}&token=${this.userToken}`;
|
||||||
if (this.readOnly) {
|
// }
|
||||||
config.editorConfig.mode = "view";
|
// if (this.readOnly) {
|
||||||
config.editorConfig.callbackUrl = null;
|
// config.editorConfig.mode = "view";
|
||||||
if (!config.editorConfig.user.id) {
|
// config.editorConfig.callbackUrl = null;
|
||||||
let viewer = $A.getStorageInt("viewer")
|
// if (!config.editorConfig.user.id) {
|
||||||
if (!viewer) {
|
// let viewer = $J.getStorageInt("viewer")
|
||||||
viewer = $A.randNum(1000, 99999);
|
// if (!viewer) {
|
||||||
$A.setStorage("viewer", viewer)
|
// viewer = $J.randNum(1000, 99999);
|
||||||
}
|
// $J.setStorage("viewer", viewer)
|
||||||
config.editorConfig.user.id = "viewer_" + viewer;
|
// }
|
||||||
config.editorConfig.user.name = "Viewer_" + viewer
|
// config.editorConfig.user.id = "viewer_" + viewer;
|
||||||
}
|
// config.editorConfig.user.name = "Viewer_" + viewer
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.docEditor = new DocsAPI.DocEditor(this.id, config);
|
this.docEditor = new DocsAPI.DocEditor(this.id, config);
|
||||||
})
|
})
|
||||||
@ -200,3 +178,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|||||||
146
src/components/preview/OfficePreview.vue
Normal file
146
src/components/preview/OfficePreview.vue
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
<template>
|
||||||
|
<div class="preview" v-if="show">
|
||||||
|
<van-overlay :show="show">
|
||||||
|
<div class="block">
|
||||||
|
<div class="close-bar" @click="close">
|
||||||
|
<svg-icon class="preview-close" icon-class="close"/>
|
||||||
|
</div>
|
||||||
|
<div class="wrapper">
|
||||||
|
<div class="block">
|
||||||
|
<only-office-editor v-model="file" :documentKey="documentKey"></only-office-editor>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</van-overlay>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import 'vue-video-player/src/custom-theme.css'
|
||||||
|
import 'video.js/dist/video-js.css'
|
||||||
|
import OnlyOfficeEditor from "@/components/office/OnlyOfficeEditor";
|
||||||
|
import fileConfig from "@/utils/file-config";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'OfficePreview',
|
||||||
|
components: {
|
||||||
|
OnlyOfficeEditor,
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
file: {
|
||||||
|
type: Object,
|
||||||
|
default: function () {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
shareId: {
|
||||||
|
type: String,
|
||||||
|
default: undefined
|
||||||
|
},
|
||||||
|
status: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
pc: this.$pc,
|
||||||
|
show: this.status,
|
||||||
|
url: '',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
status: function(visible){
|
||||||
|
if(visible){
|
||||||
|
this.url = fileConfig.previewUrl(this.$store.state.user.name, this.file, this.$store.getters.token)
|
||||||
|
if(this.shareId){
|
||||||
|
this.url = fileConfig.publicPreviewUrl(this.file.id, window.shareId);
|
||||||
|
}
|
||||||
|
this.show = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
close() {
|
||||||
|
this.show = false
|
||||||
|
this.$emit('update:status', false)
|
||||||
|
},
|
||||||
|
documentKey() {
|
||||||
|
console.log("documentKey")
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
.preview {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1002;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.van-overlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1003;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: rgba(0,0,0,.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
.block {
|
||||||
|
.close-bar {
|
||||||
|
z-index: 2006;
|
||||||
|
background-color: rgba(0,0,0,.5);
|
||||||
|
position: relative;
|
||||||
|
top: -36px;
|
||||||
|
right: -36px;
|
||||||
|
float: right;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
border-radius: 36px;
|
||||||
|
border-width: 36px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: transparent transparent transparent #d4d4d475;
|
||||||
|
line-height: 36px;
|
||||||
|
opacity: 1;
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-bar:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
border-color: transparent transparent transparent #69696975;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-close {
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
z-index: 2009;
|
||||||
|
position: absolute;
|
||||||
|
font-size: 18px;
|
||||||
|
top: -8px;
|
||||||
|
right: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
|
|
||||||
|
>>> .component-only-office {
|
||||||
|
position: absolute;
|
||||||
|
top: 36px;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
@ -1,5 +1,8 @@
|
|||||||
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
|
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
|
||||||
|
|
||||||
|
import '@/utils/common'
|
||||||
|
import '@/utils/web'
|
||||||
|
|
||||||
import '@/styles/index.scss' // global css
|
import '@/styles/index.scss' // global css
|
||||||
import uploader from 'vue-simple-uploader'
|
import uploader from 'vue-simple-uploader'
|
||||||
import EVueContextmenu from 'e-vue-contextmenu'
|
import EVueContextmenu from 'e-vue-contextmenu'
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* 基础函数
|
* 基础函数
|
||||||
*/
|
*/
|
||||||
(function (window, $, undefined) {
|
(function (window, fuc, undefined) {
|
||||||
window.systemInfo = window.systemInfo || {};
|
window.systemInfo = window.systemInfo || {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -9,7 +9,7 @@
|
|||||||
* ******************************* 基础函数类 *******************************
|
* ******************************* 基础函数类 *******************************
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*/
|
*/
|
||||||
$.extend({
|
fuc.extend({
|
||||||
/**
|
/**
|
||||||
* 是否数组
|
* 是否数组
|
||||||
* @param obj
|
* @param obj
|
||||||
@ -27,20 +27,6 @@
|
|||||||
isJson(obj) {
|
isJson(obj) {
|
||||||
return typeof (obj) == "object" && Object.prototype.toString.call(obj).toLowerCase() === "[object object]" && typeof obj.length == "undefined";
|
return typeof (obj) == "object" && Object.prototype.toString.call(obj).toLowerCase() === "[object object]" && typeof obj.length == "undefined";
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否在数组里
|
|
||||||
* @param key
|
|
||||||
* @param array
|
|
||||||
* @returns {boolean|*}
|
|
||||||
*/
|
|
||||||
inArray(key, array) {
|
|
||||||
if (!this.isArray(array)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return array.includes(key);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 随机获取范围
|
* 随机获取范围
|
||||||
* @param Min
|
* @param Min
|
||||||
@ -168,21 +154,6 @@
|
|||||||
return string;
|
return string;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* 截取字符串
|
|
||||||
* @param string
|
|
||||||
* @param start
|
|
||||||
* @param end
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
subString(string, start, end) {
|
|
||||||
string += "";
|
|
||||||
if (!this.isHave(end)) {
|
|
||||||
end = string.length;
|
|
||||||
}
|
|
||||||
return string.substring(start, end);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 随机字符
|
* 随机字符
|
||||||
* @param len
|
* @param len
|
||||||
@ -232,63 +203,7 @@
|
|||||||
return _s;
|
return _s;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回10位数时间戳
|
|
||||||
* @param v
|
|
||||||
* @returns {number}
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
Time(v) {
|
|
||||||
let time
|
|
||||||
if (typeof v === "string" && this.strExists(v, "-")) {
|
|
||||||
v = v.replace(/-/g, '/');
|
|
||||||
time = new Date(v).getTime();
|
|
||||||
} else {
|
|
||||||
time = new Date().getTime();
|
|
||||||
}
|
|
||||||
return Math.round(time / 1000)
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回 时间对象|时间戳
|
|
||||||
* @param v
|
|
||||||
* @param stamp 是否返回时间戳
|
|
||||||
* @returns {Date|number}
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
Date(v, stamp = false) {
|
|
||||||
if (typeof v === "string" && this.strExists(v, "-")) {
|
|
||||||
v = v.replace(/-/g, '/');
|
|
||||||
}
|
|
||||||
if (stamp === true) {
|
|
||||||
return Math.round(new Date(v).getTime() / 1000)
|
|
||||||
}
|
|
||||||
return new Date(v);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 补零
|
|
||||||
* @param str
|
|
||||||
* @param length
|
|
||||||
* @param after
|
|
||||||
* @returns {*}
|
|
||||||
*/
|
|
||||||
zeroFill(str, length, after) {
|
|
||||||
str+= "";
|
|
||||||
if (str.length >= length) {
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
let _str = '', _ret = '';
|
|
||||||
for (let i = 0; i < length; i++) {
|
|
||||||
_str += '0';
|
|
||||||
}
|
|
||||||
if (after || typeof after === 'undefined') {
|
|
||||||
_ret = (_str + "" + str).substr(length * -1);
|
|
||||||
} else {
|
|
||||||
_ret = (str + "" + _str).substr(0, length);
|
|
||||||
}
|
|
||||||
return _ret;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 时间戳转时间格式
|
* 时间戳转时间格式
|
||||||
@ -319,7 +234,7 @@
|
|||||||
} else {
|
} else {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
dateObj = $A.Date(v);
|
dateObj = $J.Date(v);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
format = format.replace(/Y/g, dateObj.getFullYear());
|
format = format.replace(/Y/g, dateObj.getFullYear());
|
||||||
@ -339,7 +254,7 @@
|
|||||||
*/
|
*/
|
||||||
timeDiff(s, e) {
|
timeDiff(s, e) {
|
||||||
if (typeof e === 'undefined') {
|
if (typeof e === 'undefined') {
|
||||||
e = $A.Time();
|
e = $J.Time();
|
||||||
}
|
}
|
||||||
let d = e - s;
|
let d = e - s;
|
||||||
if (d > 86400) {
|
if (d > 86400) {
|
||||||
@ -448,7 +363,7 @@
|
|||||||
if(typeof(myObj) !== 'object') return myObj;
|
if(typeof(myObj) !== 'object') return myObj;
|
||||||
if(myObj === null) return myObj;
|
if(myObj === null) return myObj;
|
||||||
//
|
//
|
||||||
return $A.jsonParse($A.jsonStringify(myObj))
|
return $J.jsonParse($J.jsonStringify(myObj))
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -494,7 +409,7 @@
|
|||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
resize(obj, callback) {
|
resize(obj, callback) {
|
||||||
let myObj = $A(obj);
|
let myObj = $J(obj);
|
||||||
if (myObj.length === 0) return;
|
if (myObj.length === 0) return;
|
||||||
let height = parseInt(myObj.outerHeight()),
|
let height = parseInt(myObj.outerHeight()),
|
||||||
width = parseInt(myObj.outerWidth());
|
width = parseInt(myObj.outerWidth());
|
||||||
@ -611,7 +526,7 @@
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
let str = "";
|
let str = "";
|
||||||
$A.each(obj, (val) => {
|
$J.each(obj, (val) => {
|
||||||
if (val !== null) {
|
if (val !== null) {
|
||||||
if (typeof val === "object" && this.count(val) > 0) {
|
if (typeof val === "object" && this.count(val) > 0) {
|
||||||
str += this.objImplode(val);
|
str += this.objImplode(val);
|
||||||
@ -658,7 +573,7 @@
|
|||||||
removeURLParameter(url, parameter) {
|
removeURLParameter(url, parameter) {
|
||||||
if (parameter instanceof Array) {
|
if (parameter instanceof Array) {
|
||||||
parameter.forEach((key) => {
|
parameter.forEach((key) => {
|
||||||
url = $A.removeURLParameter(url, key)
|
url = $J.removeURLParameter(url, key)
|
||||||
});
|
});
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
@ -688,7 +603,7 @@
|
|||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
urlAddParams(url, params) {
|
urlAddParams(url, params) {
|
||||||
if ($A.isJson(params)) {
|
if ($J.isJson(params)) {
|
||||||
if (url) {
|
if (url) {
|
||||||
url = this.removeURLParameter(url, Object.keys(params))
|
url = this.removeURLParameter(url, Object.keys(params))
|
||||||
}
|
}
|
||||||
@ -763,7 +678,7 @@
|
|||||||
if (object === null || typeof object !== "object") return;
|
if (object === null || typeof object !== "object") return;
|
||||||
if (typeof object.length === 'number' && object.length > 0) object = object[0];
|
if (typeof object.length === 'number' && object.length > 0) object = object[0];
|
||||||
|
|
||||||
let ele = typeof object.$el === "object" ? $A(object.$el) : $A(object);
|
let ele = typeof object.$el === "object" ? $J(object.$el) : $J(object);
|
||||||
if (ele.length === 0) return;
|
if (ele.length === 0) return;
|
||||||
let eleDom = ele[0];
|
let eleDom = ele[0];
|
||||||
|
|
||||||
@ -811,7 +726,7 @@
|
|||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
loadScript(url, callback) {
|
loadScript(url, callback) {
|
||||||
url = $A.originUrl(url);
|
url = $J.originUrl(url);
|
||||||
if (this.rightExists(url, '.css')) {
|
if (this.rightExists(url, '.css')) {
|
||||||
this.loadCss(url, callback)
|
this.loadCss(url, callback)
|
||||||
return;
|
return;
|
||||||
@ -865,7 +780,7 @@
|
|||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
loadCss(url, callback) {
|
loadCss(url, callback) {
|
||||||
url = $A.originUrl(url);
|
url = $J.originUrl(url);
|
||||||
if (this.rightExists(url, '.js')) {
|
if (this.rightExists(url, '.js')) {
|
||||||
this.loadScript(url, callback)
|
this.loadScript(url, callback)
|
||||||
return;
|
return;
|
||||||
@ -929,17 +844,17 @@
|
|||||||
format = "Y-m-d H:i:s";
|
format = "Y-m-d H:i:s";
|
||||||
}
|
}
|
||||||
if (params instanceof Date) {
|
if (params instanceof Date) {
|
||||||
params = $A.formatDate(format, params);
|
params = $J.formatDate(format, params);
|
||||||
} else if ($A.isJson(params)) {
|
} else if ($J.isJson(params)) {
|
||||||
params = Object.assign({}, params)
|
params = Object.assign({}, params)
|
||||||
for (let key in params) {
|
for (let key in params) {
|
||||||
if (!params.hasOwnProperty(key)) continue;
|
if (!params.hasOwnProperty(key)) continue;
|
||||||
params[key] = $A.date2string(params[key], format);
|
params[key] = $J.date2string(params[key], format);
|
||||||
}
|
}
|
||||||
} else if ($A.isArray(params)) {
|
} else if ($J.isArray(params)) {
|
||||||
params = Object.assign([], params)
|
params = Object.assign([], params)
|
||||||
params.forEach((val, index) => {
|
params.forEach((val, index) => {
|
||||||
params[index] = $A.date2string(val, format);
|
params[index] = $J.date2string(val, format);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return params;
|
return params;
|
||||||
@ -958,7 +873,7 @@
|
|||||||
if (typeof sizes[i] === "undefined") {
|
if (typeof sizes[i] === "undefined") {
|
||||||
return '0 B';
|
return '0 B';
|
||||||
}
|
}
|
||||||
return $A.runNum((bytes / Math.pow(k, i)), 2) + ' ' + sizes[i];
|
return $J.runNum((bytes / Math.pow(k, i)), 2) + ' ' + sizes[i];
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1014,7 +929,7 @@
|
|||||||
* ******************************** storage ********************************
|
* ******************************** storage ********************************
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*/
|
*/
|
||||||
$.extend({
|
fuc.extend({
|
||||||
setStorage(key, value) {
|
setStorage(key, value) {
|
||||||
return this.storage(key, value);
|
return this.storage(key, value);
|
||||||
},
|
},
|
||||||
@ -1102,7 +1017,7 @@
|
|||||||
* ********************************* ihttp *********************************
|
* ********************************* ihttp *********************************
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*/
|
*/
|
||||||
$.extend({
|
fuc.extend({
|
||||||
serializeObject(obj, parents) {
|
serializeObject(obj, parents) {
|
||||||
if (typeof obj === 'string') return obj;
|
if (typeof obj === 'string') return obj;
|
||||||
let resultArray = [];
|
let resultArray = [];
|
||||||
@ -1446,7 +1361,7 @@
|
|||||||
* ***************************** ajaxc ****************************
|
* ***************************** ajaxc ****************************
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*/
|
*/
|
||||||
$.extend({
|
fuc.extend({
|
||||||
ajaxc(params) {
|
ajaxc(params) {
|
||||||
if (!params) return false;
|
if (!params) return false;
|
||||||
if (typeof params.url === 'undefined') return false;
|
if (typeof params.url === 'undefined') return false;
|
||||||
@ -1463,7 +1378,7 @@
|
|||||||
if (typeof params.header == 'undefined') params.header = {};
|
if (typeof params.header == 'undefined') params.header = {};
|
||||||
//
|
//
|
||||||
params.before();
|
params.before();
|
||||||
$A.ihttp({
|
$J.ihttp({
|
||||||
url: params.url,
|
url: params.url,
|
||||||
data: params.data,
|
data: params.data,
|
||||||
cache: params.cache,
|
cache: params.cache,
|
||||||
@ -1487,5 +1402,5 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.$A = $;
|
window.$J = fuc;
|
||||||
})(window, window.$ = window.jQuery = require('jquery'));
|
})(window, window.fuc = window.jQuery = require('jquery'));
|
||||||
|
|||||||
@ -53,6 +53,8 @@ iconClass.set('pkg','file-pkg')
|
|||||||
iconClass.set('mpkg','file-pkg')
|
iconClass.set('mpkg','file-pkg')
|
||||||
iconClass.set('exe','file-exe')
|
iconClass.set('exe','file-exe')
|
||||||
iconClass.set('word','file-word')
|
iconClass.set('word','file-word')
|
||||||
|
iconClass.set('doc','file-word')
|
||||||
|
iconClass.set('docx','file-word')
|
||||||
iconClass.set('pdf','file-pdf')
|
iconClass.set('pdf','file-pdf')
|
||||||
iconClass.set('zip','zip')
|
iconClass.set('zip','zip')
|
||||||
iconClass.set('rar','zip')
|
iconClass.set('rar','zip')
|
||||||
|
|||||||
126
src/utils/web.js
126
src/utils/web.js
@ -2,7 +2,7 @@
|
|||||||
* 页面专用
|
* 页面专用
|
||||||
*/
|
*/
|
||||||
(function (window) {
|
(function (window) {
|
||||||
const $ = window.$A;
|
const $ = window.$J;
|
||||||
/**
|
/**
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* ******************************* web extra *******************************
|
* ******************************* web extra *******************************
|
||||||
@ -81,14 +81,14 @@
|
|||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
formatWebsocketMessageDetail(data) {
|
formatWebsocketMessageDetail(data) {
|
||||||
if ($A.isJson(data)) {
|
if ($J.isJson(data)) {
|
||||||
for (let key in data) {
|
for (let key in data) {
|
||||||
if (!data.hasOwnProperty(key)) continue;
|
if (!data.hasOwnProperty(key)) continue;
|
||||||
data[key] = $A.formatWebsocketMessageDetail(data[key]);
|
data[key] = $J.formatWebsocketMessageDetail(data[key]);
|
||||||
}
|
}
|
||||||
} else if ($A.isArray(data)) {
|
} else if ($J.isArray(data)) {
|
||||||
data.forEach((val, index) => {
|
data.forEach((val, index) => {
|
||||||
data[index] = $A.formatWebsocketMessageDetail(val);
|
data[index] = $J.formatWebsocketMessageDetail(val);
|
||||||
});
|
});
|
||||||
} else if (typeof data === "string") {
|
} else if (typeof data === "string") {
|
||||||
data = data.replace(/\{\{RemoteURL\}\}/g, this.apiUrl('../'))
|
data = data.replace(/\{\{RemoteURL\}\}/g, this.apiUrl('../'))
|
||||||
@ -102,14 +102,14 @@
|
|||||||
* @returns {*|string}
|
* @returns {*|string}
|
||||||
*/
|
*/
|
||||||
formatTime(date) {
|
formatTime(date) {
|
||||||
let time = $A.Date(date, true),
|
let time = $J.Date(date, true),
|
||||||
string = '';
|
string = '';
|
||||||
if ($A.formatDate('Ymd') === $A.formatDate('Ymd', time)) {
|
if ($J.formatDate('Ymd') === $J.formatDate('Ymd', time)) {
|
||||||
string = $A.formatDate('H:i', time)
|
string = $J.formatDate('H:i', time)
|
||||||
} else if ($A.formatDate('Y') === $A.formatDate('Y', time)) {
|
} else if ($J.formatDate('Y') === $J.formatDate('Y', time)) {
|
||||||
string = $A.formatDate('m-d', time)
|
string = $J.formatDate('m-d', time)
|
||||||
} else {
|
} else {
|
||||||
string = $A.formatDate('Y-m-d', time)
|
string = $J.formatDate('Y-m-d', time)
|
||||||
}
|
}
|
||||||
return string || '';
|
return string || '';
|
||||||
},
|
},
|
||||||
@ -262,7 +262,7 @@
|
|||||||
if (retInt === true) {
|
if (retInt === true) {
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
return $A.formatDate("Y-m-d", parseInt(time / 1000))
|
return $J.formatDate("Y-m-d", parseInt(time / 1000))
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -271,46 +271,46 @@
|
|||||||
*/
|
*/
|
||||||
timeOptionShortcuts() {
|
timeOptionShortcuts() {
|
||||||
const lastSecond = (e) => {
|
const lastSecond = (e) => {
|
||||||
return $A.Date($A.formatDate("Y-m-d 23:59:29", Math.round(e / 1000)))
|
return $J.Date($J.formatDate("Y-m-d 23:59:29", Math.round(e / 1000)))
|
||||||
};
|
};
|
||||||
return [{
|
return [{
|
||||||
text: $A.L('今天'),
|
text: $J.L('今天'),
|
||||||
value() {
|
value() {
|
||||||
return [new Date(), lastSecond(new Date().getTime())];
|
return [new Date(), lastSecond(new Date().getTime())];
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
text: $A.L('明天'),
|
text: $J.L('明天'),
|
||||||
value() {
|
value() {
|
||||||
let e = new Date();
|
let e = new Date();
|
||||||
e.setDate(e.getDate() + 1);
|
e.setDate(e.getDate() + 1);
|
||||||
return [new Date(), lastSecond(e.getTime())];
|
return [new Date(), lastSecond(e.getTime())];
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
text: $A.L('本周'),
|
text: $J.L('本周'),
|
||||||
value() {
|
value() {
|
||||||
return [$A.getData('今天', true), lastSecond($A.getData('本周结束2', true))];
|
return [$J.getData('今天', true), lastSecond($J.getData('本周结束2', true))];
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
text: $A.L('本月'),
|
text: $J.L('本月'),
|
||||||
value() {
|
value() {
|
||||||
return [$A.getData('今天', true), lastSecond($A.getData('本月结束', true))];
|
return [$J.getData('今天', true), lastSecond($J.getData('本月结束', true))];
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
text: $A.L('3天'),
|
text: $J.L('3天'),
|
||||||
value() {
|
value() {
|
||||||
let e = new Date();
|
let e = new Date();
|
||||||
e.setDate(e.getDate() + 2);
|
e.setDate(e.getDate() + 2);
|
||||||
return [new Date(), lastSecond(e.getTime())];
|
return [new Date(), lastSecond(e.getTime())];
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
text: $A.L('5天'),
|
text: $J.L('5天'),
|
||||||
value() {
|
value() {
|
||||||
let e = new Date();
|
let e = new Date();
|
||||||
e.setDate(e.getDate() + 4);
|
e.setDate(e.getDate() + 4);
|
||||||
return [new Date(), lastSecond(e.getTime())];
|
return [new Date(), lastSecond(e.getTime())];
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
text: $A.L('7天'),
|
text: $J.L('7天'),
|
||||||
value() {
|
value() {
|
||||||
let e = new Date();
|
let e = new Date();
|
||||||
e.setDate(e.getDate() + 6);
|
e.setDate(e.getDate() + 6);
|
||||||
@ -327,7 +327,7 @@
|
|||||||
dialogTags(dialog) {
|
dialogTags(dialog) {
|
||||||
let tags = [];
|
let tags = [];
|
||||||
if (dialog.type === 'group') {
|
if (dialog.type === 'group') {
|
||||||
if (['project', 'task'].includes(dialog.group_type) && $A.isJson(dialog.group_info)) {
|
if (['project', 'task'].includes(dialog.group_type) && $J.isJson(dialog.group_info)) {
|
||||||
if (dialog.group_type === 'task' && dialog.group_info.complete_at) {
|
if (dialog.group_type === 'task' && dialog.group_info.complete_at) {
|
||||||
tags.push({
|
tags.push({
|
||||||
color: 'success',
|
color: 'success',
|
||||||
@ -377,8 +377,8 @@
|
|||||||
$.extend({
|
$.extend({
|
||||||
// 加载器
|
// 加载器
|
||||||
spinnerShow() {
|
spinnerShow() {
|
||||||
$A.spinnerLoadNum++
|
$J.spinnerLoadNum++
|
||||||
if ($A.spinnerLoadNum > 0) {
|
if ($J.spinnerLoadNum > 0) {
|
||||||
const spinner = document.getElementById("common-spinner");
|
const spinner = document.getElementById("common-spinner");
|
||||||
if (spinner) {
|
if (spinner) {
|
||||||
spinner.style.display = "block"
|
spinner.style.display = "block"
|
||||||
@ -387,8 +387,8 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
spinnerHide() {
|
spinnerHide() {
|
||||||
$A.spinnerLoadNum--
|
$J.spinnerLoadNum--
|
||||||
if ($A.spinnerLoadNum <= 0) {
|
if ($J.spinnerLoadNum <= 0) {
|
||||||
const spinner = document.getElementById("common-spinner");
|
const spinner = document.getElementById("common-spinner");
|
||||||
if (spinner) {
|
if (spinner) {
|
||||||
spinner.style.display = "none"
|
spinner.style.display = "none"
|
||||||
@ -404,29 +404,29 @@
|
|||||||
} else if (typeof config === "string") {
|
} else if (typeof config === "string") {
|
||||||
config = {content: config};
|
config = {content: config};
|
||||||
}
|
}
|
||||||
config.title = $A.L(config.title || (typeof config.render === 'undefined' ? '温馨提示' : ''));
|
config.title = $J.L(config.title || (typeof config.render === 'undefined' ? '温馨提示' : ''));
|
||||||
config.content = $A.L(config.content || '');
|
config.content = $J.L(config.content || '');
|
||||||
config.okText = $A.L(config.okText || '确定');
|
config.okText = $J.L(config.okText || '确定');
|
||||||
config.cancelText = $A.L(config.cancelText || '取消');
|
config.cancelText = $J.L(config.cancelText || '取消');
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
|
|
||||||
modalInput(config, millisecond = 0) {
|
modalInput(config, millisecond = 0) {
|
||||||
if (millisecond > 0) {
|
if (millisecond > 0) {
|
||||||
setTimeout(() => { $A.modalInput(config) }, millisecond);
|
setTimeout(() => { $J.modalInput(config) }, millisecond);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (typeof config === "string") config = {title:config};
|
if (typeof config === "string") config = {title:config};
|
||||||
let inputId = "modalInput_" + $A.randomString(6);
|
let inputId = "modalInput_" + $J.randomString(6);
|
||||||
const onOk = () => {
|
const onOk = () => {
|
||||||
if (typeof config.onOk === "function") {
|
if (typeof config.onOk === "function") {
|
||||||
if (config.onOk(config.value, () => {
|
if (config.onOk(config.value, () => {
|
||||||
$A.Modal.remove();
|
$J.Modal.remove();
|
||||||
}) === true) {
|
}) === true) {
|
||||||
$A.Modal.remove();
|
$J.Modal.remove();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$A.Modal.remove();
|
$J.Modal.remove();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const onCancel = () => {
|
const onCancel = () => {
|
||||||
@ -434,7 +434,7 @@
|
|||||||
config.onCancel();
|
config.onCancel();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$A.Modal.confirm({
|
$J.Modal.confirm({
|
||||||
render: (h) => {
|
render: (h) => {
|
||||||
return h('div', [
|
return h('div', [
|
||||||
h('div', {
|
h('div', {
|
||||||
@ -443,11 +443,11 @@
|
|||||||
fontWeight: '500',
|
fontWeight: '500',
|
||||||
marginBottom: '20px',
|
marginBottom: '20px',
|
||||||
}
|
}
|
||||||
}, $A.L(config.title)),
|
}, $J.L(config.title)),
|
||||||
h('Input', {
|
h('Input', {
|
||||||
props: {
|
props: {
|
||||||
value: config.value,
|
value: config.value,
|
||||||
placeholder: $A.L(config.placeholder),
|
placeholder: $J.L(config.placeholder),
|
||||||
elementId: inputId,
|
elementId: inputId,
|
||||||
},
|
},
|
||||||
on: {
|
on: {
|
||||||
@ -455,7 +455,7 @@
|
|||||||
config.value = val;
|
config.value = val;
|
||||||
},
|
},
|
||||||
'on-enter': (e) => {
|
'on-enter': (e) => {
|
||||||
$A(e.target).parents(".ivu-modal-body").find(".ivu-btn-primary").click();
|
$J(e.target).parents(".ivu-modal-body").find(".ivu-btn-primary").click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -464,8 +464,8 @@
|
|||||||
onOk,
|
onOk,
|
||||||
onCancel,
|
onCancel,
|
||||||
loading: true,
|
loading: true,
|
||||||
okText: $A.L(config.okText || '确定'),
|
okText: $J.L(config.okText || '确定'),
|
||||||
cancelText: $A.L(config.cancelText || '取消'),
|
cancelText: $J.L(config.cancelText || '取消'),
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document.getElementById(inputId) && document.getElementById(inputId).focus();
|
document.getElementById(inputId) && document.getElementById(inputId).focus();
|
||||||
@ -477,10 +477,10 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (millisecond > 0) {
|
if (millisecond > 0) {
|
||||||
setTimeout(() => { $A.modalConfirm(config) }, millisecond);
|
setTimeout(() => { $J.modalConfirm(config) }, millisecond);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$A.Modal.confirm($A.modalConfig(config));
|
$J.Modal.confirm($J.modalConfig(config));
|
||||||
},
|
},
|
||||||
|
|
||||||
modalSuccess(config, millisecond = 0) {
|
modalSuccess(config, millisecond = 0) {
|
||||||
@ -488,10 +488,10 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (millisecond > 0) {
|
if (millisecond > 0) {
|
||||||
setTimeout(() => { $A.modalSuccess(config) }, millisecond);
|
setTimeout(() => { $J.modalSuccess(config) }, millisecond);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$A.Modal.success($A.modalConfig(config));
|
$J.Modal.success($J.modalConfig(config));
|
||||||
},
|
},
|
||||||
|
|
||||||
modalInfo(config, millisecond = 0) {
|
modalInfo(config, millisecond = 0) {
|
||||||
@ -499,10 +499,10 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (millisecond > 0) {
|
if (millisecond > 0) {
|
||||||
setTimeout(() => { $A.modalInfo(config) }, millisecond);
|
setTimeout(() => { $J.modalInfo(config) }, millisecond);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$A.Modal.info($A.modalConfig(config));
|
$J.Modal.info($J.modalConfig(config));
|
||||||
},
|
},
|
||||||
|
|
||||||
modalWarning(config, millisecond = 0) {
|
modalWarning(config, millisecond = 0) {
|
||||||
@ -510,10 +510,10 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (millisecond > 0) {
|
if (millisecond > 0) {
|
||||||
setTimeout(() => { $A.modalWarning(config) }, millisecond);
|
setTimeout(() => { $J.modalWarning(config) }, millisecond);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$A.Modal.warning($A.modalConfig(config));
|
$J.Modal.warning($J.modalConfig(config));
|
||||||
},
|
},
|
||||||
|
|
||||||
modalError(config, millisecond = 0) {
|
modalError(config, millisecond = 0) {
|
||||||
@ -521,30 +521,30 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (millisecond > 0) {
|
if (millisecond > 0) {
|
||||||
setTimeout(() => { $A.modalError(config) }, millisecond);
|
setTimeout(() => { $J.modalError(config) }, millisecond);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$A.Modal.error($A.modalConfig(config));
|
$J.Modal.error($J.modalConfig(config));
|
||||||
},
|
},
|
||||||
|
|
||||||
modalAlert(msg) {
|
modalAlert(msg) {
|
||||||
if (msg === false) {
|
if (msg === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
alert($A.L(msg));
|
alert($J.L(msg));
|
||||||
},
|
},
|
||||||
|
|
||||||
//提示
|
//提示
|
||||||
messageSuccess(msg) {
|
messageSuccess(msg) {
|
||||||
$A.Message.success($A.L(msg));
|
$J.Message.success($J.L(msg));
|
||||||
},
|
},
|
||||||
|
|
||||||
messageWarning(msg) {
|
messageWarning(msg) {
|
||||||
$A.Message.warning($A.L(msg));
|
$J.Message.warning($J.L(msg));
|
||||||
},
|
},
|
||||||
|
|
||||||
messageError(msg) {
|
messageError(msg) {
|
||||||
$A.Message.error($A.L(msg));
|
$J.Message.error($J.L(msg));
|
||||||
},
|
},
|
||||||
|
|
||||||
//通知
|
//通知
|
||||||
@ -554,17 +554,17 @@
|
|||||||
} else if (typeof config === "string") {
|
} else if (typeof config === "string") {
|
||||||
config = {desc: config};
|
config = {desc: config};
|
||||||
}
|
}
|
||||||
config.title = $A.L(config.title || (typeof config.render === 'undefined' ? '温馨提示' : ''));
|
config.title = $J.L(config.title || (typeof config.render === 'undefined' ? '温馨提示' : ''));
|
||||||
config.desc = $A.L(config.desc || '');
|
config.desc = $J.L(config.desc || '');
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
|
|
||||||
noticeSuccess(config) {
|
noticeSuccess(config) {
|
||||||
$A.Notice.success($A.noticeConfig(config));
|
$J.Notice.success($J.noticeConfig(config));
|
||||||
},
|
},
|
||||||
|
|
||||||
noticeWarning(config) {
|
noticeWarning(config) {
|
||||||
$A.Notice.warning($A.noticeConfig(config));
|
$J.Notice.warning($J.noticeConfig(config));
|
||||||
},
|
},
|
||||||
|
|
||||||
noticeError(config) {
|
noticeError(config) {
|
||||||
@ -574,7 +574,7 @@
|
|||||||
duration: 6
|
duration: 6
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
$A.Notice.error($A.noticeConfig(config));
|
$J.Notice.error($J.noticeConfig(config));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -718,7 +718,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
enableDarkMode() {
|
enableDarkMode() {
|
||||||
if (!$A.isChrome()) {
|
if (!$J.isChrome()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.isDarkEnabled()) {
|
if (this.isDarkEnabled()) {
|
||||||
@ -753,5 +753,5 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.$A = $;
|
window.$J = $;
|
||||||
})(window);
|
})(window);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user