From b12ba47489bda209dabe8d41b42d6d7afdb1a78a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 20 九月 2022 18:26:45 +0800 Subject: [PATCH] 2022-09-20 --- public/options.json | 4 src/assets/mobimg/guanzhu.jpg | 0 src/api/index.js | 12 ++ src/mob/components/official/index.jsx | 136 ++++++++++++++++++++++++++++++++++ src/mob/components/official/index.scss | 34 ++++++++ src/mob/mobshell/index.jsx | 10 ++ src/tabviews/zshare/actionList/normalbutton/index.jsx | 6 + src/mob/mobshell/card.jsx | 3 src/mob/modulesource/option.jsx | 2 src/mob/components/official/options.jsx | 28 +++++++ 10 files changed, 231 insertions(+), 4 deletions(-) diff --git a/public/options.json b/public/options.json index c073d75..2b2dba1 100644 --- a/public/options.json +++ b/public/options.json @@ -10,10 +10,10 @@ "defaultLang": "zh-CN", "WXAppID": "wxa5dd6f28cae613fc", "WXminiAppID": "", - "debugger": "false", + "debugger": false, "licenseKey": "", "probation": "", - "transfer": "true", + "transfer": "false", "keepPassword": "true", "platforms": ["H5", "wechat", "android", "ios", "wxMiniProgram"], "host": "https://css-test.positecgroup.com", diff --git a/src/api/index.js b/src/api/index.js index 36b5bc1..b6d77c6 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -599,7 +599,11 @@ param.userid = sessionStorage.getItem('CloudUserID') || '' param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' } else if (window.GLOB.mainSystemApi) { - url = window.GLOB.mainSystemApi + if (!window.GLOB.transfer) { + url = window.GLOB.mainSystemApi + } else { + param.rduri = window.GLOB.mainSystemApi + } } param = this.encryptParam(param) @@ -629,7 +633,11 @@ param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' } } else if (window.GLOB.mainSystemApi) { - url = window.GLOB.mainSystemApi + if (!window.GLOB.transfer) { + url = window.GLOB.mainSystemApi + } else { + param.rduri = window.GLOB.mainSystemApi + } } let _param = JSON.parse(JSON.stringify(param)) // 缂撳瓨鏍¢獙锛屽幓闄ゆ椂闂村拰鍔犲瘑瀛楃 diff --git a/src/assets/mobimg/guanzhu.jpg b/src/assets/mobimg/guanzhu.jpg new file mode 100644 index 0000000..3ccf2e5 --- /dev/null +++ b/src/assets/mobimg/guanzhu.jpg Binary files differ diff --git a/src/mob/components/official/index.jsx b/src/mob/components/official/index.jsx new file mode 100644 index 0000000..65e1ebd --- /dev/null +++ b/src/mob/components/official/index.jsx @@ -0,0 +1,136 @@ +import React, { Component } from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { Popover } from 'antd' +import { ToolOutlined, EditOutlined, FontColorsOutlined, DeleteOutlined } from '@ant-design/icons' + +import zhCN from '@/locales/zh-CN/model.js' +import enUS from '@/locales/en-US/model.js' +import { resetStyle } from '@/utils/utils-custom.js' +import asyncIconComponent from '@/utils/asyncIconComponent' +import getWrapForm from './options' +import MKEmitter from '@/utils/events.js' +import officialAccount from '@/assets/mobimg/guanzhu.jpg' +import './index.scss' + +const NormalForm = asyncIconComponent(() => import('@/components/normalform')) + +class OfficialComponent extends Component { + static propTpyes = { + card: PropTypes.object, + updateConfig: PropTypes.func, + deletecomponent: PropTypes.func + } + + state = { + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + visible: false, // 妯℃�佹鎺у埗 + } + + /** + * @description 鎼滅储鏉′欢鍒濆鍖� + */ + UNSAFE_componentWillMount () { + const { card } = this.props + + if (card.isNew) { + let _card = { + uuid: card.uuid, + type: card.type, + tabId: card.tabId || '', + parentId: card.parentId || '', + width: 24, + name: card.name, + subtype: card.subtype, + wrap: { name: card.name, width: 24 }, + style: {marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px'} + } + this.setState({ + card: _card + }) + this.props.updateConfig(_card) + } else { + this.setState({ + card: fromJS(card).toJS() + }) + } + } + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 + */ + componentWillUnmount () { + this.setState = () => { + return + } + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + getStyle = (style) => { + let _card = {...this.state.card, style} + + this.setState({ + card: _card + }) + + this.props.updateConfig(_card) + } + + changeStyle = () => { + const { card } = this.state + + MKEmitter.emit('changeStyle', ['border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) + } + + /** + * @description 鍗$墖琛屽灞備俊鎭洿鏂帮紙鏁版嵁婧愶紝鏍峰紡绛夛級 + */ + updateComponent = (component) => { + this.setState({ + card: component + }) + + component.width = component.wrap.width + component.name = component.wrap.name + + this.props.updateConfig(component) + } + + getWrapForms = () => { + const { wrap } = this.state.card + + return getWrapForm(wrap) + } + + updateWrap = (res) => { + this.updateComponent({...this.state.card, wrap: res}) + } + + render() { + const { card } = this.state + let _style = resetStyle(card.style) + + return ( + <div className="official-wrap" id={card.uuid} style={_style}> + <div className="official-image" style={{backgroundImage: `url('${officialAccount}')`}}></div> + <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + <div className="mk-popover-control"> + <NormalForm title="璁剧疆" width={800} update={this.updateWrap} getForms={this.getWrapForms}> + <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/> + </NormalForm> + <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> + <DeleteOutlined className="close" onClick={() => this.props.deletecomponent(card.uuid)} /> + </div> + } trigger="hover"> + <ToolOutlined /> + </Popover> + <div className="component-name"><div className="center">{card.name}</div></div> + </div> + ) + } +} + +export default OfficialComponent \ No newline at end of file diff --git a/src/mob/components/official/index.scss b/src/mob/components/official/index.scss new file mode 100644 index 0000000..88c74e9 --- /dev/null +++ b/src/mob/components/official/index.scss @@ -0,0 +1,34 @@ +.official-wrap { + min-height: 84px; + position: relative; + background: #ffffff; + + >.anticon-tool { + position: absolute; + z-index: 3; + font-size: 16px; + right: 1px; + top: 1px; + cursor: pointer; + padding: 5px; + background: rgba(255, 255, 255, 0.55); + } + .official-image { + background: #ffffff; + overflow: hidden; + background-repeat: no-repeat; + background-size: cover; + background-position: center; + height: 84px; + } +} + +.official-wrap::after { + display: block; + content: ' '; + clear: both; +} +.official-wrap:hover { + z-index: 1; + box-shadow: 0px 0px 4px #1890ff; +} \ No newline at end of file diff --git a/src/mob/components/official/options.jsx b/src/mob/components/official/options.jsx new file mode 100644 index 0000000..93bebd4 --- /dev/null +++ b/src/mob/components/official/options.jsx @@ -0,0 +1,28 @@ +/** + * @description Wrap琛ㄥ崟閰嶇疆淇℃伅 + */ +export default function (wrap) { + const wrapForm = [ + { + type: 'text', + field: 'name', + label: '缁勪欢鍚嶇О', + initval: wrap.name || '', + tooltip: '鐢ㄤ簬缁勪欢闂寸殑鍖哄垎銆�', + required: true + }, + { + type: 'number', + field: 'width', + label: '瀹藉害', + initval: wrap.width || 24, + tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', + min: 1, + max: 24, + precision: 0, + required: true + } + ] + + return wrapForm +} \ No newline at end of file diff --git a/src/mob/mobshell/card.jsx b/src/mob/mobshell/card.jsx index 263391c..c289560 100644 --- a/src/mob/mobshell/card.jsx +++ b/src/mob/mobshell/card.jsx @@ -29,6 +29,7 @@ const CommonMenuBar = asyncComponent(() => import('@/mob/components/menubar/common-menubar')) const Balcony = asyncComponent(() => import('@/menu/components/card/balcony')) const Timeline = asyncComponent(() => import('@/menu/components/timeline/normal-timeline')) +const OfficialAccount = asyncComponent(() => import('@/mob/components/official')) const Card = ({ id, card, moveCard, findCard, delCard, updateConfig }) => { const originalIndex = findCard(id).index @@ -132,6 +133,8 @@ return (<Balcony card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } else if (card.type === 'timeline') { return (<Timeline card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) + } else if (card.type === 'officialAccount') { + return (<OfficialAccount card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } } diff --git a/src/mob/mobshell/index.jsx b/src/mob/mobshell/index.jsx index 36e8761..2df7f73 100644 --- a/src/mob/mobshell/index.jsx +++ b/src/mob/mobshell/index.jsx @@ -119,6 +119,15 @@ if (!menu.style.paddingTop) { style = {...menu.style, paddingTop: '50px'} } + } else if (item.component === 'officialAccount') { + if (cards.filter(card => card.type === 'officialAccount').length > 0) { + notification.warning({ + top: 92, + message: '鍏虫敞缁勪欢涓嶅彲閲嶅娣诲姞锛�', + duration: 5 + }) + return + } } let name = '' @@ -140,6 +149,7 @@ menubar: '鑿滃崟鏍�', balcony: '娴姩鍗�', timeline: '鏃堕棿杞�', + officialAccount: '鍏虫敞鍏紬鍙�', login: '鐧诲綍' } let i = 1 diff --git a/src/mob/modulesource/option.jsx b/src/mob/modulesource/option.jsx index 65b1e9c..6843f2a 100644 --- a/src/mob/modulesource/option.jsx +++ b/src/mob/modulesource/option.jsx @@ -26,6 +26,7 @@ import MenuBar from '@/assets/mobimg/menubar.png' import CommonBar from '@/assets/mobimg/commonbar.png' import timeline from '@/assets/mobimg/timeline.png' +import officialAccount from '@/assets/mobimg/guanzhu.jpg' // 缁勪欢閰嶇疆淇℃伅 export const menuOptions = [ @@ -59,4 +60,5 @@ { type: 'menu', url: SandBox, component: 'code', subtype: 'sandbox', title: '鑷畾涔�', width: 24 }, { type: 'menu', url: group, component: 'group', subtype: 'normalgroup', title: '鍒嗙粍', width: 24 }, { type: 'menu', url: Login, component: 'login', subtype: 'normallogin', title: '娉ㄥ唽/鐧诲綍', width: 24 }, + { type: 'menu', url: officialAccount, component: 'officialAccount', subtype: 'officialAccount', title: '鍏虫敞鍏紬鍙凤紙灏忕▼搴忎腑锛�', width: 24 }, ] diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 73750e3..7b31de2 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -2021,6 +2021,12 @@ }) } }) + } else if (re.errcode !== 0 && re.errmsg) { + notification.warning({ + top: 92, + message: re.errmsg, + duration: 5 + }) } }) }) -- Gitblit v1.8.0