From 29432c9167e3fcdf83f35d0bb9dbe9acb7c7ffbf Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 22 六月 2021 14:35:23 +0800
Subject: [PATCH] 2021-06-22

---
 src/views/appmanage/index.jsx |   86 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 76 insertions(+), 10 deletions(-)

diff --git a/src/views/appmanage/index.jsx b/src/views/appmanage/index.jsx
index 253a171..d2749f4 100644
--- a/src/views/appmanage/index.jsx
+++ b/src/views/appmanage/index.jsx
@@ -1,6 +1,6 @@
 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'
@@ -12,11 +12,21 @@
 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 = {
@@ -26,7 +36,7 @@
       { 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>),
@@ -49,8 +59,18 @@
         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',
@@ -90,13 +110,22 @@
         }
       },
       {
-        title: 'Action',
+        title: '鏍囬', dataIndex: 'title', key: 'title', align: 'center', width: '170px'
+      },
+      {
+        title: '鍥炬爣', dataIndex: 'favicon', key: 'favicon', align: 'center', width: '120px',
+        render: (text, record) => (text ? <img style={{width: '32px', height: '32px'}} src={text} alt="" /> : null)
+      },
+      {
+        title: '鎿嶄綔',
         key: 'action',
         align: 'center',
+        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>
         )
       },
@@ -112,6 +141,7 @@
   UNSAFE_componentWillMount() {
     document.body.className = ''
     this.getAppList()
+    this.getSmStemp()
   }
 
   /**
@@ -144,7 +174,7 @@
 
           return item
         })
-
+        
         this.setState({
           loading: false,
           applist: applist,
@@ -161,6 +191,39 @@
           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))
     })
   }
 
@@ -229,7 +292,8 @@
     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)
     
@@ -376,7 +440,8 @@
       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}'`)
+        // 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)
       }
@@ -462,7 +527,8 @@
         })
       }
 
-      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}'`)
+      // 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)
 
@@ -558,7 +624,7 @@
           </Modal>
           <Modal
             title={'缂栬緫瀛愬簲鐢�'}
-            width={'600px'}
+            width={'850px'}
             maskClosable={false}
             visible={!!subVisible}
             onCancel={() => this.setState({subVisible: false})}

--
Gitblit v1.8.0