king
2025-05-08 400fee62fb40006a9839f1c3a8244b82566b5057
src/views/appmanage/index.jsx
@@ -1,7 +1,7 @@
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'
@@ -32,12 +32,12 @@
  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 {
@@ -377,7 +377,7 @@
  }
  deleteTran = (record) => {
    const _this = this
    const that = this
    let param = {
      func: 's_sVersion_del',
@@ -395,7 +395,7 @@
                message: '操作成功!',
                duration: 3
              })
              _this.getTransList()
              that.getTransList()
            } else {
              notification.warning({
                top: 92,
@@ -414,7 +414,7 @@
  }
  enableTran = (record) => {
    const _this = this
    const that = this
    let param = {
      func: 's_sVersion_sub',
@@ -432,7 +432,7 @@
                message: '操作成功!',
                duration: 3
              })
              _this.getTransList()
              that.getTransList()
            } else {
              Modal.error({
                title: result.message,
@@ -495,7 +495,6 @@
              }
              cell.userbind = _param.userbind || ''
              cell.instantMessage = _param.instantMessage || ''
            }
            if (cell.user_binding !== 'true') {
@@ -601,7 +600,7 @@
  }
  deleteApp = (record) => {
    const _this = this
    const that = this
    confirm({
      content: '确定删除《' + record.remark + '》吗?',
@@ -621,12 +620,12 @@
                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已被菜单使用,不可删除'
@@ -649,7 +648,7 @@
  
  deleteSubApp = (record) => {
    const { selectApp } = this.state
    const _this = this
    const that = this
    let param = {
      func: 's_kei_addupt',
@@ -670,7 +669,6 @@
    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
    })
@@ -679,7 +677,7 @@
    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')
@@ -696,11 +694,11 @@
                duration: 5
              })
      
              _this.setState({
              that.setState({
                selectSubApp: null,
                loading: true
              })
              _this.getAppList()
              that.getAppList()
            } else {
              notification.warning({
                top: 92,
@@ -748,7 +746,6 @@
      })
    }
    if (applangList.length) {
      applangList.unshift('zh-CN')
      applangList = JSON.stringify(applangList)
    } else {
      applangList = ''
@@ -771,7 +768,6 @@
      })
    }
    if (applangList.length) {
      applangList.unshift('zh-CN')
      applangList = JSON.stringify(applangList)
    } else {
      applangList = ''
@@ -821,7 +817,7 @@
      }
    })
    const _this = this
    const that = this
    confirm({
      content: '确定要执行吗?',
@@ -857,10 +853,10 @@
                message: '执行成功。',
                duration: 3
              })
              _this.setState({
              that.setState({
                scriptIndex: 1
              }, () => {
                _this.getScriptList()
                that.getScriptList()
              })
            }
            resolve()
@@ -951,7 +947,6 @@
        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
        })
@@ -959,7 +954,7 @@
        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')
@@ -1005,9 +1000,6 @@
    }
    if (item.userbind) {
      _par.userbind = item.userbind
    }
    if (item.instantMessage) {
      _par.instantMessage = item.instantMessage
    }
    if (item.apptype) {
      _par.apptype = item.apptype
@@ -1098,7 +1090,6 @@
      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
      })
@@ -1106,7 +1097,7 @@
      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')
@@ -1141,6 +1132,43 @@
          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() {}
    })
  }
@@ -1285,14 +1313,14 @@
                    </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>
@@ -1302,6 +1330,7 @@
                    <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>
@@ -1353,7 +1382,7 @@
        </Modal>
        <Modal
          title={subVisible === 'plus' ? '添加子应用' : '编辑子应用'}
          width={'850px'}
          width={'970px'}
          maskClosable={false}
          visible={subVisible !== false}
          onCancel={() => this.setState({subVisible: false, confirmloading: false})}
@@ -1363,7 +1392,7 @@
          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>
    )