From 972f277c5920d9d38749d675912b47b2b120320e Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 25 五月 2023 10:17:41 +0800
Subject: [PATCH] 2023-05-25

---
 src/menu/components/card/cardcellcomponent/formconfig.jsx |   83 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 76 insertions(+), 7 deletions(-)

diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx
index 47866cd..603aeaf 100644
--- a/src/menu/components/card/cardcellcomponent/formconfig.jsx
+++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx
@@ -56,6 +56,58 @@
     width = +width.replace(/x/, '.5')
   }
 
+  let linkTypes = [
+    { value: 'tel', text: '鐢佃瘽' },
+    { value: 'email', text: '閭' },
+    { value: 'other', text: '鍏朵粬' }
+  ]
+
+  if (appType === 'mob') {
+    linkTypes = [
+      { value: 'tel', text: '鐢佃瘽' },
+      { value: 'email', text: '閭' },
+      { value: 'qywx', text: '浼佷笟寰俊' },
+      { value: 'linkmenu', text: '鍏宠仈鑿滃崟' },
+      { value: 'other', text: '鍏朵粬' }
+    ]
+  } else if (appType === 'pc') {
+    linkTypes = [
+      { value: 'tel', text: '鐢佃瘽' },
+      { value: 'email', text: '閭' },
+      { value: 'linkmenu', text: '鍏宠仈鑿滃崟' },
+      { value: 'other', text: '鍏朵粬' }
+    ]
+  }
+
+  if (card.linkType === 'qywx') {
+    if (appType !== 'mob') {
+      card.link = ''
+      card.linkType = ''
+      card.linkurl = ''
+    }
+  } else if (card.linkType === 'linkmenu') {
+    if (appType !== 'mob' && appType !== 'pc') {
+      card.link = ''
+      card.linkType = ''
+      card.linkurl = ''
+      card.linkmenu = ''
+    }
+  }
+
+  let appMenus = sessionStorage.getItem('appMenus')
+  if (['pc', 'mob'].includes(appType)) {
+    if (appMenus) {
+      try {
+        appMenus = JSON.parse(appMenus)
+      } catch (e) {
+        appMenus = []
+      }
+    } else {
+      appMenus = []
+    }
+    appMenus.push({value: 'goback', text: '杩斿洖锛堜笂涓�椤碉級'})
+  }
+
   let forms = [
     {
       type: 'select',
@@ -519,17 +571,12 @@
       forbid: isHeader
     },
     {
-      type: 'radio',
+      type: linkTypes.length > 4 ? 'select' : 'radio',
       key: 'linkType',
       label: '閾炬帴绫诲瀷',
       initVal: card.linkType || 'other',
       required: false,
-      options: [
-        { value: 'tel', text: '鐢佃瘽' },
-        { value: 'email', text: '閭' },
-        { value: 'qywx', text: '浼佷笟寰俊' },
-        { value: 'other', text: '鍏朵粬' }
-      ]
+      options: linkTypes
     },
     {
       type: 'radio',
@@ -544,6 +591,15 @@
     },
     {
       type: 'select',
+      key: 'linkmenu',
+      label: '鍏宠仈鑿滃崟',
+      initVal: card.linkmenu || '',
+      required: true,
+      options: appMenus || [],
+      forbid: !['pc', 'mob'].includes(appType)
+    },
+    {
+      type: 'select',
       key: 'linkurl',
       label: '閾炬帴鍦板潃',
       initVal: card.linkurl || '',
@@ -552,6 +608,19 @@
     },
     {
       type: 'radio',
+      key: 'open',
+      label: '鎵撳紑鏂瑰紡',
+      initVal: card.open || 'blank',
+      tooltip: '鑿滃崟鎵撳紑鏂瑰紡銆�',
+      required: true,
+      forbid: !['pc', 'mob'].includes(appType),
+      options: [
+        {value: 'blank', text: appType !== 'mob' ? '鏂扮獥鍙�' : '鏂伴〉闈�'},
+        {value: 'self', text: appType !== 'mob' ? '褰撳墠绐楀彛' : '褰撳墠椤甸潰'},
+      ]
+    },
+    {
+      type: 'radio',
       key: 'joint',
       label: '鎷兼帴鍙傛暟',
       initVal: card.joint || 'true',

--
Gitblit v1.8.0