From fec6c24bc3fd902f8ced64bc2600c0b0836f7e52 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 10 一月 2025 11:34:58 +0800 Subject: [PATCH] 2025-01-10 --- src/index.js | 4 ++ src/views/sso/index.jsx | 4 ++ /dev/null | 13 ------ src/menu/components/share/sourcecomponent/inputform/index.scss | 14 +++++++ src/menu/picturecontroller/index.jsx | 3 - src/menu/components/share/sourcecomponent/inputform/index.jsx | 60 +++++++++++++++++++++++++++--- src/views/billprint/index.jsx | 4 ++ src/menu/picturecontroller/index.scss | 6 +++ src/views/login/index.jsx | 4 ++ 9 files changed, 91 insertions(+), 21 deletions(-) diff --git a/src/components/Image/index.jsx b/src/components/Image/index.jsx deleted file mode 100644 index 508c7be..0000000 --- a/src/components/Image/index.jsx +++ /dev/null @@ -1,56 +0,0 @@ -import React, {Component} from 'react' -import './index.scss' - -class ImageWrap extends Component { - componentDidMount () { - let Img = new Image() - Img.src = this.props.url - - if (!this.ImageWrapDom) return - - if (Img.complete) { - this.setSize(Img.width, Img.height) - } else { - Img.onload = () => { - this.setSize(Img.width, Img.height) - } - } - } - - shouldComponentUpdate () { - return false - } - - setSize = (width, height) => { - if (!this.ImageWrapDom) return - const { clientWidth, clientHeight } = this.ImageWrapDom - - if (!clientWidth || !clientHeight || !width || !height) return - - let ratio = (width / height) / (clientWidth / clientHeight) - - if (ratio > 1.5) { - let _height = Math.floor(height * (clientWidth / width)) - this.ImageDom.style.height = 'auto' - this.ImageDom.style.top = ((clientHeight - _height) / 2) + 'px' - } else if (ratio > 1 && ratio < 1.5) { - let _width = Math.floor(width / (height / clientHeight)) - this.ImageDom.style.width = _width + 'px' - this.ImageDom.style.left = '-' + ((_width - clientWidth) / 2) + 'px' - } else if (ratio < 1) { - let _height = Math.floor(height / (width / clientWidth)) - this.ImageDom.style.height = _height + 'px' - this.ImageDom.style.top = '-' + ((_height - clientHeight) / 2) + 'px' - } - } - - render() { - return ( - <div className="mk_image-wrap" ref={dom => { this.ImageWrapDom = dom }}> - <img src={this.props.url} ref={dom => { this.ImageDom = dom }} alt=""/> - </div> - ) - } -} - -export default ImageWrap \ No newline at end of file diff --git a/src/components/Image/index.scss b/src/components/Image/index.scss deleted file mode 100644 index 3e5b646..0000000 --- a/src/components/Image/index.scss +++ /dev/null @@ -1,13 +0,0 @@ -.mk_image-wrap { - display: inline-block; - position: relative; - overflow: hidden; - width: 100%; - height: 100%; - - img { - position: absolute; - width: 100%; - height: 100%; - } -} diff --git a/src/index.js b/src/index.js index 969f8b0..f91f8c0 100644 --- a/src/index.js +++ b/src/index.js @@ -122,6 +122,10 @@ GLOB.systemType = '' GLOB.upStatus = config.updateStatus + '' !== 'false' + if (config.style_appkey) { + GLOB.style_appkey = config.style_appkey + } + // GLOB.mainSystemApi = 'https://cloud.positecgroup.com/webapi/dostars' GLOB.mainSystemApi = 'https://sso.mk9h.cn/cloud/webapi/dostars' diff --git a/src/menu/components/share/sourcecomponent/inputform/index.jsx b/src/menu/components/share/sourcecomponent/inputform/index.jsx index 4881a3f..4d4a477 100644 --- a/src/menu/components/share/sourcecomponent/inputform/index.jsx +++ b/src/menu/components/share/sourcecomponent/inputform/index.jsx @@ -13,7 +13,6 @@ const { Search } = Input const FileUpload = asyncComponent(() => import('@/tabviews/zshare/fileupload')) const Video = asyncComponent(() => import('@/menu/picturecontroller/video')) -const Image = asyncComponent(() => import('@/components/Image')) const EditForm = asyncComponent(() => import('@/menu/picturecontroller/editform')) class PopSource extends Component { @@ -24,6 +23,7 @@ state = { url: '', list: [], + icons: [], searchKey: '', selectId: '', editvisible: false, @@ -84,7 +84,36 @@ } init = (originlist) => { - this.setState({list: originlist, url: '', searchKey: ''}) + const { type } = this.props + this.setState({list: originlist, icons: window.GLOB.sIcons || [], url: '', searchKey: ''}) + + if (type !== 'video' && !window.GLOB.sIcons && sessionStorage.getItem('getIcons') !== 'fail') { + fetch(window.GLOB.baseurl + 'Content/static/data.json') + .then(response => response.json()) + .catch(() => { + sessionStorage.setItem('getIcons', 'fail') + }) + .then(res => { + if (res && res.list) { + let icons = [] + res.list.forEach(item => { + if (!item.url) return + + icons.push({ + linkurl: window.GLOB.baseurl + 'Content/static/' + item.url, + remark: item.remark || '', + id: Utils.getuuid() + }) + }) + + window.GLOB.sIcons = icons + + this.setState({icons}) + } else { + sessionStorage.setItem('getIcons', 'fail') + } + }) + } } changeValue = (e) => { @@ -96,8 +125,15 @@ } selectItem = (item) => { + const { type } = this.props + const { icons } = this.state + if (item.linkurl) { - this.setState({url: item.linkurl, selectId: item.id}) + if (type !== 'video' && icons.findIndex(n => n.id === item.id) > -1) { + this.setState({url: item.linkurl.replace(window.GLOB.baseurl, '@mywebsite@/'), selectId: item.id}) + } else { + this.setState({url: item.linkurl, selectId: item.id}) + } } } @@ -149,7 +185,7 @@ render () { const { type, keyword } = this.props - const { list, url, searchKey, selectId, editvisible, card } = this.state + const { list, icons, url, searchKey, selectId, editvisible, card } = this.state if (keyword === 'input') { return <div className="mk-source-pop-wrap"> @@ -171,9 +207,11 @@ } let pagelist = list + let iconlist = icons if (searchKey) { pagelist = list.filter(item => item.remark && item.remark.indexOf(searchKey) > -1) + iconlist = icons.filter(item => item.remark && item.remark.indexOf(searchKey) > -1) } return ( @@ -187,12 +225,22 @@ <Col span={3} key={item.id}> <div className={'image-video-box' + (selectId === item.id ? ' active' : '')} onClick={() => this.selectItem(item)}> <div className="image-video-box-body"> - {type !== 'video' ? <Image url={item.linkurl} /> : <Video value={item.linkurl} />} + {type !== 'video' ? <img src={item.linkurl} alt=""/> : <Video value={item.linkurl} />} </div> </div> </Col> ))} - {!pagelist.length ? <Empty description={null}/> : null} + {iconlist.length ? <div className="static-source">闈欐�佽祫婧�</div> : null} + {iconlist.map(item => ( + <Col span={3} key={item.id}> + <div className={'image-video-box' + (selectId === item.id ? ' active' : '')} onClick={() => this.selectItem(item)}> + <div className="image-video-box-body"> + <img src={item.linkurl} alt=""/> + </div> + </div> + </Col> + ))} + {!pagelist.length && !iconlist.length ? <Empty description={null}/> : null} </Row> <Modal title="鏂板缓" diff --git a/src/menu/components/share/sourcecomponent/inputform/index.scss b/src/menu/components/share/sourcecomponent/inputform/index.scss index 4904113..cf04bb0 100644 --- a/src/menu/components/share/sourcecomponent/inputform/index.scss +++ b/src/menu/components/share/sourcecomponent/inputform/index.scss @@ -20,6 +20,12 @@ .video-react-control-bar { display: none; } + img { + width: 100%; + height: 100%; + object-fit: contain; + object-position: center; + } } .image-video-box-body::after { content: ''; @@ -60,6 +66,14 @@ min-height: 300px; max-height: calc(100vh - 250px); clear: both; + + .static-source { + clear: both; + padding-left: 10px; + color: rgba(0, 0, 0, 0.85); + border-bottom: 1px solid rgba(0, 0, 0, 0.1); + margin-bottom: 10px; + } } } .picture-edit-model { diff --git a/src/menu/picturecontroller/index.jsx b/src/menu/picturecontroller/index.jsx index a8633f1..cee337b 100644 --- a/src/menu/picturecontroller/index.jsx +++ b/src/menu/picturecontroller/index.jsx @@ -16,7 +16,6 @@ const EditForm = asyncComponent(() => import('./editform')) const Video = asyncComponent(() => import('./video')) -const Image = asyncComponent(() => import('@/components/Image')) class SourceController extends Component { state = { @@ -295,7 +294,7 @@ <Col span={4} key={item.id}> <div className="image-video-box"> <div className="image-video-box-body"> - <Image url={item.linkurl.replace(/@mywebsite@\//ig, window.GLOB.baseurl)} /> + <img src={item.linkurl.replace(/@mywebsite@\//ig, window.GLOB.baseurl)} alt=""/> </div> <div className="image-video-control"> <CopyOutlined onClick={() => this.copySource(item)}/> diff --git a/src/menu/picturecontroller/index.scss b/src/menu/picturecontroller/index.scss index d143734..a8d3572 100644 --- a/src/menu/picturecontroller/index.scss +++ b/src/menu/picturecontroller/index.scss @@ -23,6 +23,12 @@ .video-react-control-bar { display: none; } + img { + width: 100%; + height: 100%; + object-fit: contain; + object-position: center; + } } .image-video-control { position: absolute; diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index f89e307..bb22cfb 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -190,6 +190,10 @@ LText: `select '${window.GLOB.appkey}'`, } + if (window.GLOB.style_appkey) { + _param.style_appkey = window.GLOB.style_appkey + } + _param.userid = result.UserID _param.LoginUID = result.LoginUID _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index fe3525b..3bb1685 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -558,6 +558,10 @@ appkey: appkey } + if (window.GLOB.style_appkey) { + _param.style_appkey = window.GLOB.style_appkey + } + _param.userid = result.UserID _param.LoginUID = result.LoginUID _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') diff --git a/src/views/sso/index.jsx b/src/views/sso/index.jsx index ee5bb89..41082db 100644 --- a/src/views/sso/index.jsx +++ b/src/views/sso/index.jsx @@ -57,6 +57,10 @@ LText: `select '${window.GLOB.appkey}'`, } + if (window.GLOB.style_appkey) { + _param.style_appkey = window.GLOB.style_appkey + } + _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) -- Gitblit v1.8.0