| | |
| | | import React, {Component} from 'react' |
| | | import { fromJS } from 'immutable' |
| | | import { Spin, notification, Input, Button, Table, Modal, Typography, Row, Col, Tooltip } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | import { QuestionCircleOutlined, LinkOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | | |
| | |
| | | bg_black_style_yellow_green: {name: '黄绿色', color: '#a0d911'}, |
| | | bg_black_style_green: {name: '绿色', color: '#52c41a'}, |
| | | bg_black_style_cyan: {name: '青色', color: '#13c2c2'}, |
| | | bg_black_style_blue_purple: {name: '蓝紫色', color: '#2f54eb'}, |
| | | bg_black_style_blue_purple: {name: '蓝紫色', color: '#3860f4'}, |
| | | 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_blue: {name: '深红色', color: '#1d3661'} |
| | | bg_black_style_deep_blue: {name: '深蓝色', color: '#1d3661'} |
| | | } |
| | | |
| | | class AppManage extends Component { |
| | |
| | | } |
| | | |
| | | deleteTran = (record) => { |
| | | const _this = this |
| | | const that = this |
| | | |
| | | let param = { |
| | | func: 's_sVersion_del', |
| | |
| | | message: '操作成功!', |
| | | duration: 3 |
| | | }) |
| | | _this.getTransList() |
| | | that.getTransList() |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | } |
| | | |
| | | enableTran = (record) => { |
| | | const _this = this |
| | | const that = this |
| | | |
| | | let param = { |
| | | func: 's_sVersion_sub', |
| | |
| | | message: '操作成功!', |
| | | duration: 3 |
| | | }) |
| | | _this.getTransList() |
| | | that.getTransList() |
| | | } else { |
| | | Modal.error({ |
| | | title: result.message, |
| | |
| | | } |
| | | |
| | | cell.userbind = _param.userbind || '' |
| | | cell.instantMessage = _param.instantMessage || '' |
| | | } |
| | | |
| | | if (cell.user_binding !== 'true') { |
| | |
| | | } |
| | | |
| | | deleteApp = (record) => { |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | content: '确定删除《' + record.remark + '》吗?', |
| | |
| | | duration: 5 |
| | | }) |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | selectApp: null, |
| | | selectSubApp: null, |
| | | loading: true |
| | | }) |
| | | _this.getAppList() |
| | | that.getAppList() |
| | | } else { |
| | | if (result.message.indexOf('kei_no已被菜单使用,不可删除') > -1) { |
| | | result.message = 'kei_no已被菜单使用,不可删除' |
| | |
| | | |
| | | deleteSubApp = (record) => { |
| | | const { selectApp } = this.state |
| | | const _this = this |
| | | const that = this |
| | | |
| | | let param = { |
| | | func: 's_kei_addupt', |
| | |
| | | sublist = sublist.map(item => { |
| | | if (item.typename !== 'pc') { |
| | | item.userbind = md5(selectApp.kei_no + item.typename + item.lang).replace(/^.{8}/, 'userbind') |
| | | item.instantMessage = md5(selectApp.kei_no + item.typename + item.lang).replace(/^.{14}/, 'instantmessage') |
| | | } |
| | | return item |
| | | }) |
| | |
| | | param.LText = sublist.map(item => { |
| | | let _par = this.getCusParam(item) |
| | | |
| | | return `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || 'false'}','','${window.btoa(window.encodeURIComponent(JSON.stringify(_par)))}'` |
| | | return `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || 'false'}','','${window.btoa(window.encodeURIComponent(JSON.stringify(_par)))}','${item.app_name || selectApp.remark || ''}','${item.app_icon || ''}','${item.allow_subscribe || ''}','${item.link_remark || ''}'` |
| | | }) |
| | | param.LText = param.LText.join(' union all ') |
| | | param.LText = Utils.formatOptions(param.LText, 'x') |
| | |
| | | duration: 5 |
| | | }) |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | selectSubApp: null, |
| | | loading: true |
| | | }) |
| | | _this.getAppList() |
| | | that.getAppList() |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | }) |
| | | } |
| | | if (applangList.length) { |
| | | applangList.unshift('zh-CN') |
| | | applangList = JSON.stringify(applangList) |
| | | } else { |
| | | applangList = '' |
| | |
| | | }) |
| | | } |
| | | if (applangList.length) { |
| | | applangList.unshift('zh-CN') |
| | | applangList = JSON.stringify(applangList) |
| | | } else { |
| | | applangList = '' |
| | |
| | | } |
| | | }) |
| | | |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | content: '确定要执行吗?', |
| | |
| | | message: '执行成功。', |
| | | duration: 3 |
| | | }) |
| | | _this.setState({ |
| | | that.setState({ |
| | | scriptIndex: 1 |
| | | }, () => { |
| | | _this.getScriptList() |
| | | that.getScriptList() |
| | | }) |
| | | } |
| | | resolve() |
| | |
| | | selectApp.sublist = selectApp.sublist.map(item => { |
| | | if (item.typename !== 'pc') { |
| | | item.userbind = md5(selectApp.kei_no + item.typename + item.lang).replace(/^.{8}/, 'userbind') |
| | | item.instantMessage = md5(selectApp.kei_no + item.typename + item.lang).replace(/^.{14}/, 'instantmessage') |
| | | } |
| | | return item |
| | | }) |
| | |
| | | param.LText = selectApp.sublist.map(item => { |
| | | let _par = this.getCusParam(item) |
| | | |
| | | return `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || 'false'}','','${window.btoa(window.encodeURIComponent(JSON.stringify(_par)))}'` |
| | | return `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || 'false'}','','${window.btoa(window.encodeURIComponent(JSON.stringify(_par)))}','${item.app_name || selectApp.remark || ''}','${item.app_icon || ''}','${item.allow_subscribe || ''}','${item.link_remark || ''}'` |
| | | }) |
| | | param.LText = param.LText.join(' union all ') |
| | | param.LText = Utils.formatOptions(param.LText, 'x') |
| | |
| | | } |
| | | if (item.userbind) { |
| | | _par.userbind = item.userbind |
| | | } |
| | | if (item.instantMessage) { |
| | | _par.instantMessage = item.instantMessage |
| | | } |
| | | if (item.apptype) { |
| | | _par.apptype = item.apptype |
| | |
| | | sublist = sublist.map(item => { |
| | | if (item.typename !== 'pc') { |
| | | item.userbind = md5(selectApp.kei_no + item.typename + item.lang).replace(/^.{8}/, 'userbind') |
| | | item.instantMessage = md5(selectApp.kei_no + item.typename + item.lang).replace(/^.{14}/, 'instantmessage') |
| | | } |
| | | return item |
| | | }) |
| | |
| | | param.LText = sublist.map(item => { |
| | | let _par = this.getCusParam(item) |
| | | |
| | | return `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || 'false'}','','${window.btoa(window.encodeURIComponent(JSON.stringify(_par)))}'` |
| | | return `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || 'false'}','','${window.btoa(window.encodeURIComponent(JSON.stringify(_par)))}','${item.app_name || selectApp.remark || ''}','${item.app_icon || ''}','${item.allow_subscribe || ''}','${item.link_remark || ''}'` |
| | | }) |
| | | param.LText = param.LText.join(' union all ') |
| | | param.LText = Utils.formatOptions(param.LText, 'x') |
| | |
| | | confirmloading: false |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | updateLink = (item) => { |
| | | let link = `${window.GLOB.baseurl}${item.typename === 'pad' ? 'mob' : item.typename}/index.html#/index/${this.state.selectApp.kei_no}/${item.typename !== 'pc' ? item.typename + '/' : ''}${item.lang}` |
| | | |
| | | let param = { |
| | | func: 's_miniapp_kei_linkurl_upt', |
| | | id: item.ID, |
| | | linkurl: link |
| | | } |
| | | |
| | | confirm({ |
| | | content: '确定更新应用链接地址吗?', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | Api.getCloudConfig(param).then(result => { |
| | | if (result.status) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '操作成功!', |
| | | duration: 3 |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | resolve() |
| | | }, () => { |
| | | resolve() |
| | | }) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | |
| | | </Col> |
| | | <Col span={12}> |
| | | <div className="app-item"> |
| | | <div className="label">标题:</div> |
| | | <div className="content">{item.title || '无'}</div> |
| | | <div className="label">应用名称:</div> |
| | | <div className="content">{item.app_name || ''}</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', borderRadius: '4px'}} src={item.favicon} alt="" /> : '无'}</div> |
| | | <div className="label">LOGO:</div> |
| | | <div className="content">{item.app_icon ? <img style={{width: '18px', height: '18px', borderRadius: '4px'}} src={item.app_icon} alt="" /> : '无'}</div> |
| | | </div> |
| | | </Col> |
| | | </Row> |
| | |
| | | <Button type="link" onClick={() => this.setState({ selectSubApp: item, subVisible: 'edit' })} style={{color: '#8E44AD'}}>修改</Button> |
| | | <Button type="link" onClick={() => this.deleteSubApp(item)} style={{color: '#ff4d4f'}}>删除</Button> |
| | | <Button type="link" onClick={() => this.jumpApp(item)}>编辑应用</Button> |
| | | <Button type="link" onClick={() => this.updateLink(item)}><LinkOutlined style={{color: 'orange'}}/></Button> |
| | | <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> |
| | |
| | | </Modal> |
| | | <Modal |
| | | title={subVisible === 'plus' ? '添加子应用' : '编辑子应用'} |
| | | width={'850px'} |
| | | width={'970px'} |
| | | maskClosable={false} |
| | | visible={subVisible !== false} |
| | | onCancel={() => this.setState({subVisible: false, confirmloading: false})} |
| | |
| | | okText="确定" |
| | | destroyOnClose |
| | | > |
| | | <SubMutilForm type={subVisible} card={subVisible === 'edit' ? selectSubApp : ''} wrappedComponentRef={(inst) => this.submobcardRef = inst} inputSubmit={this.submitSubCard} /> |
| | | <SubMutilForm type={subVisible} selectApp={selectApp} card={subVisible === 'edit' ? selectSubApp : ''} wrappedComponentRef={(inst) => this.submobcardRef = inst} inputSubmit={this.submitSubCard} /> |
| | | </Modal> |
| | | </div> |
| | | ) |