| | |
| | | import React, {Component} from 'react' |
| | | import { fromJS } from 'immutable' |
| | | import { Spin, notification, Button, Table, Modal, ConfigProvider } from 'antd' |
| | | import { Spin, notification, Button, Table, Modal, ConfigProvider, Typography } from 'antd' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | | import enUS from 'antd/es/locale/en_US' |
| | |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | const { Paragraph } = Typography |
| | | |
| | | const _locale = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | const Header = asyncComponent(() => import('@/mob/header')) |
| | | const MutilForm = asyncComponent(() => import('./mutilform')) |
| | | const SubMutilForm = asyncComponent(() => import('./submutilform')) |
| | | |
| | | 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 |
| | | } |
| | | |
| | | sessionStorage.setItem('isEditState', 'true') |
| | | |
| | | class AppManage extends Component { |
| | | state = { |
| | |
| | | { title: '应用名称', dataIndex: 'remark', key: 'remark', align: 'center' }, |
| | | { title: '应用编码', dataIndex: 'kei_no', key: 'kei_no', align: 'center' }, |
| | | { |
| | | title: 'Action', |
| | | title: '操作', |
| | | key: 'action', |
| | | align: 'center', |
| | | render: (text, record) => (<Button type="link" onClick={() => this.deleteApp(record)} style={{color: '#ff4d4f'}}>删除</Button>), |
| | |
| | | render: (text, record) => text === 'false' ? '不启用' : '启用' |
| | | }, |
| | | { |
| | | title: '短连接', dataIndex: 'link_type', key: 'link_type', align: 'center', |
| | | render: (text, record) => text === 'false' ? '不启用' : '启用' |
| | | title: '用户绑定', dataIndex: 'user_binding', key: 'user_binding', align: 'center', |
| | | render: (text, record) => { |
| | | let val = '' |
| | | if (!text) return '无' |
| | | if (text.indexOf('uname_pwd') > -1) { |
| | | val = '用户名' |
| | | } |
| | | if (text.indexOf('sms_vcode') > -1) { |
| | | val = val ? val + ',手机号' : '手机号' |
| | | } |
| | | return val |
| | | } |
| | | }, |
| | | { |
| | | title: '皮肤', dataIndex: 'css', key: 'css', align: 'center', |
| | |
| | | render: (text, record) => (text ? <img style={{width: '32px', height: '32px'}} src={text} alt="" /> : null) |
| | | }, |
| | | { |
| | | title: 'Action', |
| | | title: '操作', |
| | | key: 'action', |
| | | align: 'center', |
| | | width: '190px', |
| | | width: '250px', |
| | | render: (text, record) => ( |
| | | <div> |
| | | <Button type="link" onClick={() => this.deleteSubApp(record)} style={{color: '#ff4d4f'}}>删除</Button> |
| | | <Button type="link" onClick={() => this.jumpApp(record)}>编辑应用</Button> |
| | | <Paragraph style={{display: 'inline-block', margin: 0}} copyable={{ text: `${base_url}${record.typename}/index.html#/index/${this.state.selectApp.kei_no}/${record.lang}` }}></Paragraph> |
| | | </div> |
| | | ) |
| | | }, |
| | |
| | | UNSAFE_componentWillMount() { |
| | | document.body.className = '' |
| | | this.getAppList() |
| | | this.getSmStemp() |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | return item |
| | | }) |
| | | |
| | | |
| | | this.setState({ |
| | | loading: false, |
| | | applist: applist, |
| | |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | getSmStemp = () => { |
| | | let _sql = `select ID,TemplateCode,SignName from (select * from bd_msn_sms_temp where deleted=0 and status=20 ) a |
| | | inner join (select openid from sapp where id='${window.GLOB.appkey}') b |
| | | on a.openid=b.openid` |
| | | |
| | | _sql = Utils.formatOptions(_sql) |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: _sql, |
| | | obj_name: 'data', |
| | | arr_field: 'ID,TemplateCode,SignName' |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 云端数据验证 |
| | | |
| | | Api.getSystemConfig(param).then(res => { |
| | | let msgs = [] |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } else if (res.data) { |
| | | msgs = res.data |
| | | } |
| | | sessionStorage.setItem('msgTemplate', JSON.stringify(msgs)) |
| | | }) |
| | | } |
| | | |
| | |
| | | let sublist = fromJS(selectApp.sublist).toJS() |
| | | sublist = sublist.filter(item => item.ID !== record.ID) |
| | | |
| | | param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','${item.login_types || 'true'}','${item.link_type || 'true'}','${item.role_type || 'true'}','${item.lang || 'zh-CN'}'`) |
| | | // param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','${item.login_types || 'true'}','${item.link_type || 'true'}','${item.role_type || 'true'}','${item.lang || 'zh-CN'}'`) |
| | | param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','${item.login_types || 'true'}','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || ''}','${item.sms_id || ''}'`) |
| | | param.LText = param.LText.join(' union all ') |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | |
| | |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | if (visible === 'edit') { |
| | | param.LText = selectApp.sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','${item.login_types || 'true'}','${item.link_type || 'true'}','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}'`) |
| | | // param.LText = selectApp.sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','${item.login_types || 'true'}','${item.link_type || 'true'}','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}'`) |
| | | param.LText = selectApp.sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','${item.login_types || 'true'}','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || ''}','${item.sms_id || ''}'`) |
| | | param.LText = param.LText.join(' union all ') |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','${item.login_types || 'true'}','${item.link_type || 'true'}','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}'`) |
| | | // param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','${item.login_types || 'true'}','${item.link_type || 'true'}','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}'`) |
| | | param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','${item.login_types || 'true'}','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || ''}','${item.sms_id || ''}'`) |
| | | param.LText = param.LText.join(' union all ') |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | |
| | |
| | | </Modal> |
| | | <Modal |
| | | title={'编辑子应用'} |
| | | width={'750px'} |
| | | width={'850px'} |
| | | maskClosable={false} |
| | | visible={!!subVisible} |
| | | onCancel={() => this.setState({subVisible: false})} |