Explorar o código

Merge branch 'v4.7.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v4.7.0dev

吴昊天 %!s(int64=2) %!d(string=hai) anos
pai
achega
4b300464fe

+ 62 - 50
crmeb/app/common.php

@@ -22,6 +22,7 @@ use app\services\system\lang\LangTypeServices;
 use app\services\system\lang\LangCodeServices;
 use app\services\system\lang\LangCountryServices;
 use think\facade\Config;
+use think\facade\Log;
 
 if (!function_exists('getWorkerManUrl')) {
 
@@ -922,61 +923,72 @@ if (!function_exists('getLang')) {
      */
     function getLang($code, array $replace = [])
     {
-        /** @var LangCountryServices $langCountryServices */
-        $langCountryServices = app()->make(LangCountryServices::class);
-        /** @var LangTypeServices $langTypeServices */
-        $langTypeServices = app()->make(LangTypeServices::class);
-        /** @var LangCodeServices $langCodeServices */
-        $langCodeServices = app()->make(LangCodeServices::class);
-
-        $request = app()->request;
-        //获取接口传入的语言类型
-        if (!$range = $request->header('cb-lang')) {
-            //没有传入则使用系统默认语言显示
-            $range = $langTypeServices->cacheDriver()->remember('range_name', function () use ($langTypeServices) {
-                return $langTypeServices->value(['is_default' => 1], 'file_name');
-            });
-            if (!$range) {
-                //系统没有设置默认语言的话,根据浏览器语言显示,如果浏览器语言在库中找不到,则使用简体中文
-                if ($request->header('accept-language') !== null) {
-                    $range = explode(',', $request->header('accept-language'))[0];
-                } else {
-                    $range = 'zh-CN';
+        //确保获取语言的时候不会报错
+        try {
+
+            /** @var LangCountryServices $langCountryServices */
+            $langCountryServices = app()->make(LangCountryServices::class);
+            /** @var LangTypeServices $langTypeServices */
+            $langTypeServices = app()->make(LangTypeServices::class);
+            /** @var LangCodeServices $langCodeServices */
+            $langCodeServices = app()->make(LangCodeServices::class);
+
+            $request = app()->request;
+            //获取接口传入的语言类型
+            if (!$range = $request->header('cb-lang')) {
+                //没有传入则使用系统默认语言显示
+                $range = $langTypeServices->cacheDriver()->remember('range_name', function () use ($langTypeServices) {
+                    return $langTypeServices->value(['is_default' => 1], 'file_name');
+                });
+                if (!$range) {
+                    //系统没有设置默认语言的话,根据浏览器语言显示,如果浏览器语言在库中找不到,则使用简体中文
+                    if ($request->header('accept-language') !== null) {
+                        $range = explode(',', $request->header('accept-language'))[0];
+                    } else {
+                        $range = 'zh-CN';
+                    }
                 }
             }
-        }
 
-        // 获取type_id
-        $typeId = $langCountryServices->cacheDriver()->remember('type_id_' . $range, function () use ($langCountryServices, $range) {
-            return $langCountryServices->value(['code' => $range], 'type_id') ?: 1;
-        }, 3600);
-
-        // 获取类型
-        $langData = CacheService::remember('lang_type_data', function () use ($langTypeServices) {
-            return $langTypeServices->getColumn(['status' => 1, 'is_del' => 0], 'file_name', 'id');
-        }, 3600);
-
-        // 获取缓存key
-        $langStr = 'lang_' . str_replace('-', '_', $langData[$typeId]);
-
-        //读取当前语言的语言包
-        $lang = CacheService::remember($langStr, function () use ($typeId, $range, $langCodeServices) {
-            return $langCodeServices->getColumn(['type_id' => $typeId, 'is_admin' => 1], 'lang_explain', 'code');
-        }, 3600);
-        //获取返回文字
-        $message = (string)($lang[$code] ?? 'Code Error');
-
-        //替换变量
-        if (!empty($replace) && is_array($replace)) {
-            // 关联索引解析
-            $key = array_keys($replace);
-            foreach ($key as &$v) {
-                $v = "{:{$v}}";
+            // 获取type_id
+            $typeId = $langCountryServices->cacheDriver()->remember('type_id_' . $range, function () use ($langCountryServices, $range) {
+                return $langCountryServices->value(['code' => $range], 'type_id') ?: 1;
+            }, 3600);
+
+            // 获取类型
+            $langData = CacheService::remember('lang_type_data', function () use ($langTypeServices) {
+                return $langTypeServices->getColumn(['status' => 1, 'is_del' => 0], 'file_name', 'id');
+            }, 3600);
+
+            // 获取缓存key
+            $langStr = 'lang_' . str_replace('-', '_', $langData[$typeId]);
+
+            //读取当前语言的语言包
+            $lang = CacheService::remember($langStr, function () use ($typeId, $range, $langCodeServices) {
+                return $langCodeServices->getColumn(['type_id' => $typeId, 'is_admin' => 1], 'lang_explain', 'code');
+            }, 3600);
+            //获取返回文字
+            $message = (string)($lang[$code] ?? 'Code Error');
+
+            //替换变量
+            if (!empty($replace) && is_array($replace)) {
+                // 关联索引解析
+                $key = array_keys($replace);
+                foreach ($key as &$v) {
+                    $v = "{:{$v}}";
+                }
+                $message = str_replace($key, $replace, $message);
             }
-            $message = str_replace($key, $replace, $message);
-        }
 
-        return $message;
+            return $message;
+        } catch (\Throwable $e) {
+            Log::error('获取语言code:' . $code . '发成错误,错误原因是:' . json_encode([
+                    'file' => $e->getFile(),
+                    'message' => $e->getMessage(),
+                    'line' => $e->getLine()
+                ]));
+            return $code;
+        }
     }
 }
 

+ 17 - 0
template/admin/src/components/main/components/side-menu/side-menu.vue

@@ -315,6 +315,7 @@ export default {
       color: #fff !important;
       border-radius: 4px;
     }
+
     .ivu-menu-vertical .ivu-menu-item:hover {
       color: #1890ff !important;
       background-color: rgba(24, 144, 255, 0.1) !important;
@@ -323,6 +324,14 @@ export default {
         color: #1890ff !important;
       }
     }
+    .ivu-menu-item.ivu-menu-item-active:hover {
+      background-color: #1890ff !important;
+      color: #fff !important;
+      border-radius: 4px;
+      .ivu-icon {
+        color: #fff !important;
+      }
+    }
     .ivu-menu-vertical .ivu-menu-item {
       padding: 10px 10px;
       margin-bottom: 8px;
@@ -400,6 +409,14 @@ export default {
       color: #1890ff !important;
     }
   }
+  .drop-menu-a.on:hover {
+    background-color: #1890ff !important;
+    color: #fff !important;
+    border-radius: 4px;
+    .ivu-icon {
+      color: #fff !important;
+    }
+  }
   .drop-menu-a.on {
     background-color: #1890ff !important;
     color: #fff !important;

+ 22 - 3
template/admin/src/components/main/main.vue

@@ -41,7 +41,7 @@
           <!-- 需要放在菜单上面的内容,如Logo,写在side-menu标签内部,如下 -->
         </side-menu>
       </Sider>
-      <Content class="main-content-con">
+      <Content class="main-content-con" :class="{ 'all-desk': headMenuNoShow }">
         <Layout class="main-layout-con">
           <div class="tag-nav-wrapper" v-if="!headMenuNoShow">
             <tags-nav :value="$route" @input="handleClick" :list="tagNavList" @on-close="handleCloseTag" />
@@ -55,7 +55,13 @@
             </keep-alive>
             <router-view v-if="!$route.meta.keepAlive && reload" class="main-warper"></router-view>
             <!-- <router-view v-if="reload" style="min-height: 600px" /> -->
-            <ABackTop :height="100" :bottom="80" :right="50" container=".content-wrapper"></ABackTop>
+            <ABackTop
+              v-if="!headMenuNoShow"
+              :height="100"
+              :bottom="80"
+              :right="50"
+              container=".content-wrapper"
+            ></ABackTop>
             <i-copyright v-if="!headMenuNoShow" />
           </Content>
         </Layout>
@@ -285,7 +291,7 @@ export default {
 .main .tag-nav-wrapper {
   // height: 10px;
   background: unset;
-  padding:  0 15px;
+  padding: 0 15px;
 }
 .open-image {
   display: flex;
@@ -305,4 +311,17 @@ export default {
 .main-warper {
   min-height: calc(~'100vh - 166px');
 }
+.all-desk {
+  height: 100vh !important;
+  padding: 0 !important;
+  .main-content-con,
+  .main-warper,
+  .main-layout-con,
+  .content-wrapper {
+    height: 100vh !important;
+  }
+  .content-wrapper {
+    padding: 0;
+  }
+}
 </style>

+ 12 - 9
template/admin/src/pages/setting/devise/diyIndex.vue

@@ -18,8 +18,8 @@
       </div>
     </div>
 
-    <Card :bordered="false" dis-hover class="ivu-mt">
-      <div class="diy-wrapper" :style="'height:' + (clientHeight - 150) + 'px;'">
+    <Card :bordered="false" dis-hover class="ivu-mt" style="margin: 0 10px">
+      <div class="diy-wrapper">
         <!-- 左侧 -->
         <div class="left">
           <div class="title-bar">
@@ -33,7 +33,7 @@
               {{ item.title }}
             </div>
           </div>
-          <div class="wrapper" :style="'height:' + (clientHeight - 150) + 'px;'" v-if="tabCur == 0">
+          <div class="wrapper"  v-if="tabCur == 0">
             <div v-for="(item, index) in leftMenu" :key="index">
               <div class="tips" @click="item.isOpen = !item.isOpen">
                 {{ item.title }}
@@ -120,9 +120,7 @@
                       (colorTxt ? colorPickerTxt : '') +
                       ';background-image: url(' +
                       (picTxt ? picUrlTxt : '') +
-                      ');height:' +
-                      rollHeight +
-                      'px;'
+                      ');height:calc(100vh - 200px)'
                     "
                     ref="imgContainer"
                   >
@@ -903,7 +901,9 @@ export default {
 .wrapper-con {
   /* min-width 700px; */
 }
-
+.main .content-wrapper{
+  padding: 0 !important;
+}
 .defaultData {
   /* margin-left 20px; */
   cursor: pointer;
@@ -989,6 +989,7 @@ export default {
 .ivu-mt {
   display: flex;
   justify-content: space-between;
+  margin-bottom: 10px;
 }
 
 .iconfont-diy {
@@ -1001,7 +1002,7 @@ export default {
   min-width: 1100px;
   display: flex;
   justify-content: space-between;
-  /* height: 84.5vh; */
+  height: 100%;
   .left {
     min-width: 300px;
     max-width: 300px;
@@ -1362,7 +1363,9 @@ export default {
 
 /deep/ .ivu-card-body {
   width: 100%;
-  padding: 0px !important;
+  padding:0;
+  height: calc(100vh - 73px);
+
 }
 
 .rbtn {

+ 2 - 2
template/admin/src/pages/setting/storeService/speechcraft.vue

@@ -13,10 +13,10 @@
               @click.native="bindMenuItem(item, index)"
             >
               {{ item.name }}
-              <div class="icon-box" v-if="index != 0">
+              <div class="icon-box" v-if="item.id != 0">
                 <Icon type="ios-more" size="24" @click.stop="showMenu(item)" />
               </div>
-              <div class="right-menu ivu-poptip-inner" v-show="item.status" v-if="index != 0">
+              <div class="right-menu ivu-poptip-inner" v-show="item.status" v-if="item.id != 0">
                 <div class="ivu-poptip-body" @click="labelEdit(item)">
                   <div class="ivu-poptip-body-content"><div class="ivu-poptip-body-content-inner">编辑小组</div></div>
                 </div>