From a02fc6a77fa1b35c6516b2d37108d80e260c6c85 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 07 十一月 2024 22:05:08 +0800 Subject: [PATCH] 2024-11-07 --- src/views/appcheck/index.jsx | 261 +++++++++++++++++++++++++++------------------------ 1 files changed, 137 insertions(+), 124 deletions(-) diff --git a/src/views/appcheck/index.jsx b/src/views/appcheck/index.jsx index 7317ebb..5e669d2 100644 --- a/src/views/appcheck/index.jsx +++ b/src/views/appcheck/index.jsx @@ -1,24 +1,16 @@ import React, {Component} from 'react' -import { Spin, notification, Table, ConfigProvider, Typography, Row, Col, Tooltip } from 'antd' +import { withRouter } from 'react-router-dom' +import { Spin, notification, Table, Typography, Row, Col, Tooltip } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' -import enUS from 'antd/es/locale/en_US' -import zhCN from 'antd/es/locale/zh_CN' import Api from '@/api' +import { langs } from '@/store/options.js' import asyncComponent from '@/utils/asyncComponent' import './index.scss' const { Paragraph } = Typography -const _locale = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS const Header = asyncComponent(() => import('./header')) - -let base_url = '' -if (process.env.NODE_ENV === 'production') { - base_url = document.location.origin + '/' + window.GLOB.service -} else { - base_url = window.GLOB.location + '/' + window.GLOB.service -} const skinStyle = { bg_black_style_blue: {name: '钃濊壊', color: '#1890ff'}, @@ -34,7 +26,8 @@ bg_black_style_purple: {name: '绱壊', color: '#722ed1'}, bg_black_style_magenta: {name: '娲嬬孩鑹�', color: '#eb2f96'}, bg_black_style_grass_green: {name: '鑽夌豢鑹�', color: '#aeb303'}, - bg_black_style_deep_red: {name: '娣辩孩鑹�', color: '#c32539'} + bg_black_style_deep_red: {name: '娣辩孩鑹�', color: '#c32539'}, + bg_black_style_deep_blue: {name: '娣辫摑鑹�', color: '#1d3661'} } class AppCheck extends Component { @@ -50,7 +43,17 @@ UNSAFE_componentWillMount() { document.body.className = '' - this.getAppList() + if (sessionStorage.getItem('UserID')) { + this.getAppList() + return + } + } + + componentDidMount() { + if (!sessionStorage.getItem('UserID')) { + this.props.history.replace('/login') + return + } } /** @@ -67,13 +70,15 @@ func: 's_get_kei' } - param.rduri = window.GLOB.mainSystemApi + if (window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } this.setState({ loading: true }) - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { let selectApp = null let applist = result.data.map(item => { @@ -90,6 +95,10 @@ } cell.copyright = _param.copyright || '' cell.logo = _param.logo || '' + cell.wxAppId = _param.wxAppId || '' + cell.wxAppName = _param.wxAppName || '' + cell.wxMerchId = _param.wxMerchId || '' + cell.wxMerchName = _param.wxMerchName || '' } return cell @@ -141,121 +150,125 @@ render () { const { loading, columns, applist, selectApp } = this.state + if (!sessionStorage.getItem('UserID')) return null + return ( <div className="mk-app-check"> - <ConfigProvider locale={_locale}> - <Header view="manage" /> - {loading ? - <div className="loading-mask"> - <Spin size="large" /> - </div> : null - } - <div className="view-wrap"> - <div className="left-view"> - <div className="app-table"> - <Table - rowKey="ID" - columns={columns} - dataSource={applist} - pagination={false} - rowSelection={{ type: 'radio', selectedRowKeys: selectApp ? [selectApp.ID] : [], onChange: this.onSelectChange }} - onRow={(record) => ({ onClick: () => this.setState({ selectApp: record })})} - /> - </div> - </div> - <div className="right-view"> - {selectApp ? <div className="app-title">{selectApp.remark}</div> : null} - {selectApp && selectApp.sublist.map((item, index) => { - let css = skinStyle[item.css] ? skinStyle[item.css].name : '' - let color = skinStyle[item.css] ? skinStyle[item.css].color : '#e8e8e8' - let binding = '' - if (item.user_binding) { - if (item.user_binding.indexOf('uname_pwd') > -1) { - binding = '鐢ㄦ埛鍚�' - } - if (item.user_binding.indexOf('sms_vcode') > -1) { - binding = binding ? binding + '锛屾墜鏈哄彿' : '鎵嬫満鍙�' - } - } - return ( - <div className="sub-app" key={index} style={{borderColor: color}}> - <Row> - <Col span={12}> - <div className="app-item"> - <div className="label">搴旂敤绫诲瀷:</div> - <div className="content" style={{fontSize: '18px', fontWeight: 600}}>{item.typename}</div> - </div> - </Col> - <Col span={12}> - <div className="app-item"> - <div className="label">璇█:</div> - <div className="content" style={{textDecoration: 'underline'}}>{item.lang === 'en-US' ? '鑻辨枃' : '涓枃'}</div> - </div> - </Col> - <Col span={12}> - <div className="app-item"> - <div className="label">鏉冮檺绠$悊:</div> - <div className="content">{item.role_type === 'false' ? '涓嶅惎鐢�' : '鍚敤'}</div> - </div> - </Col> - <Col span={12}> - <div className="app-item"> - </div> - </Col> - <Col span={12}> - <div className="app-item"> - <div className="label">鐨偆:</div> - <div className="content" style={{color: color}}>{css}</div> - </div> - </Col> - <Col span={12}> - <div className="app-item"> - {binding ? <div className="label"> - <Tooltip placement="topLeft" title="寰俊鍏紬鍙风櫥褰曟椂锛岀郴缁熺敤鎴蜂笌寰俊鐢ㄦ埛鐨勭粦瀹氭柟寮忋��"> - <QuestionCircleOutlined className="mk-form-tip" /> - 鐢ㄦ埛缁戝畾: - </Tooltip> - </div> : null} - <div className="content">{binding}</div> - </div> - </Col> - <Col span={12}> - <div className="app-item"> - <div className="label">鏍囬:</div> - <div className="content">{item.title || '鏃�'}</div> - </div> - </Col> - <Col span={12}> - <div className="app-item"> - <div className="label">缃戠珯澶村儚:</div> - <div className="content">{item.favicon ? <img style={{width: '18px', height: '18px'}} src={item.favicon} alt="" /> : '鏃�'}</div> - </div> - </Col> - <Col span={12}> - <div className="app-item"> - <div className="label">鐗堟潈:</div> - <div className="content">{item.copyright || '鏃�'}</div> - </div> - </Col> - <Col span={12}> - <div className="app-item"> - <div className="label">LOGO:</div> - <div className="content">{item.logo ? <img style={{height: '18px'}} src={item.logo} alt="" /> : '鏃�'}</div> - </div> - </Col> - </Row> - <div className="action"> - <Paragraph style={{display: 'inline-block', margin: 0}} copyable={{ text: `${base_url}${item.typename === 'pad' ? 'mob' : item.typename}/index.html#/index/${this.state.selectApp.kei_no}/${item.typename !== 'pc' ? item.typename + '/' : ''}${item.lang}` }}></Paragraph> - </div> - </div> - ) - })} + <Header view="manage" /> + {loading ? + <div className="loading-mask"> + <Spin size="large" /> + </div> : null + } + <div className="view-wrap"> + <div className="left-view"> + <div className="app-table"> + <Table + rowKey="ID" + columns={columns} + dataSource={applist} + pagination={false} + rowSelection={{ type: 'radio', selectedRowKeys: selectApp ? [selectApp.ID] : [], onChange: this.onSelectChange }} + onRow={(record) => ({ onClick: () => this.setState({ selectApp: record })})} + /> </div> </div> - </ConfigProvider> + <div className="right-view"> + {selectApp ? <div className="app-title">{selectApp.remark}</div> : null} + {selectApp && selectApp.sublist.map((item, index) => { + let css = skinStyle[item.css] ? skinStyle[item.css].name : '' + let color = skinStyle[item.css] ? skinStyle[item.css].color : '#e8e8e8' + let binding = '' + if (item.user_binding) { + if (item.user_binding.indexOf('uname_pwd') > -1) { + binding = '鐢ㄦ埛鍚�' + } + if (item.user_binding.indexOf('sms_vcode') > -1) { + binding = binding ? binding + '锛屾墜鏈哄彿' : '鎵嬫満鍙�' + } + } + return ( + <div className="sub-app" key={index} style={{borderColor: color}}> + <Row> + <Col span={12}> + <div className="app-item"> + <div className="label">搴旂敤绫诲瀷:</div> + <div className="content" style={{fontSize: '18px', fontWeight: 600}}>{item.typename}</div> + </div> + </Col> + <Col span={12}> + <div className="app-item"> + <div className="label">璇█:</div> + <div className="content" style={{textDecoration: 'underline'}}>{langs[item.lang]}</div> + </div> + </Col> + <Col span={12}> + <div className="app-item"> + <div className="label">鏉冮檺绠$悊:</div> + <div className="content">{item.role_type === 'false' ? '涓嶅惎鐢�' : '鍚敤'}</div> + </div> + </Col> + <Col span={12}> + <div className="app-item"> + {item.wxAppName || item.wxMerchName ? <> + <div className="label">鍏宠仈搴旂敤:</div> + <div className="content">{`${item.wxAppName}${item.wxAppName && item.wxMerchName ? ' / ' + item.wxMerchName : item.wxMerchName || ''}`}</div> + </> : null} + </div> + </Col> + <Col span={12}> + <div className="app-item"> + <div className="label">鐨偆:</div> + <div className="content" style={{color: color}}>{css}</div> + </div> + </Col> + <Col span={12}> + <div className="app-item"> + {binding ? <div className="label"> + <Tooltip placement="topLeft" title="寰俊鍏紬鍙风櫥褰曟椂锛岀郴缁熺敤鎴蜂笌寰俊鐢ㄦ埛鐨勭粦瀹氭柟寮忋��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鐢ㄦ埛缁戝畾: + </Tooltip> + </div> : null} + <div className="content">{binding}</div> + </div> + </Col> + <Col span={12}> + <div className="app-item"> + <div className="label">鏍囬:</div> + <div className="content">{item.title || '鏃�'}</div> + </div> + </Col> + <Col span={12}> + <div className="app-item"> + <div className="label">缃戠珯澶村儚:</div> + <div className="content">{item.favicon ? <img style={{width: '18px', height: '18px'}} src={item.favicon} alt="" /> : '鏃�'}</div> + </div> + </Col> + <Col span={12}> + <div className="app-item"> + <div className="label">鐗堟潈:</div> + <div className="content">{item.copyright || '鏃�'}</div> + </div> + </Col> + <Col span={12}> + <div className="app-item"> + <div className="label">LOGO:</div> + <div className="content">{item.logo ? <img style={{height: '18px'}} src={item.logo} alt="" /> : '鏃�'}</div> + </div> + </Col> + </Row> + <div className="action"> + <Paragraph style={{display: 'inline-block', margin: 0}} copyable={{ text: `${window.GLOB.baseurl}${item.typename === 'pad' ? 'mob' : item.typename}/index.html#/index/${this.state.selectApp.kei_no}/${item.typename !== 'pc' ? item.typename + '/' : ''}${item.lang}${item.wxAppId ? '/' + item.wxAppId : ''}` }}></Paragraph> + </div> + </div> + ) + })} + </div> + </div> </div> ) } } -export default AppCheck \ No newline at end of file +export default withRouter(AppCheck) \ No newline at end of file -- Gitblit v1.8.0