Quellcode durchsuchen

Merge branch 'v5.0.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v5.0.0dev

evoxwht vor 2 Jahren
Ursprung
Commit
475c8003a0

+ 12 - 4
crmeb/app/services/system/SystemCrudServices.php

@@ -320,7 +320,7 @@ class SystemCrudServices extends BaseServices
                 [
                     'path' => $routeName,
                     'method' => 'POST',
-                    'name' => $modelName . '保存数据接口',
+                    'name' => $modelName . '保存接口',
                     'app_name' => 'adminapi',
                     'cate_id' => $cateId,
                     'unique_auth' => '',
@@ -338,7 +338,7 @@ class SystemCrudServices extends BaseServices
                 [
                     'path' => $routeName . '/<id>',
                     'method' => 'PUT',
-                    'name' => $modelName . '修改数据接口',
+                    'name' => $modelName . '修改接口',
                     'app_name' => 'adminapi',
                     'cate_id' => $cateId,
                     'unique_auth' => '',
@@ -347,13 +347,19 @@ class SystemCrudServices extends BaseServices
                 [
                     'path' => $routeName . '/<id>',
                     'method' => 'DELETE',
-                    'name' => $modelName . '删除数据接口',
+                    'name' => $modelName . '删除接口',
                     'app_name' => 'adminapi',
                     'cate_id' => $cateId,
                     'unique_auth' => '',
                     'add_time' => date('Y-m-d H:i:s')
                 ],
             ];
+            $routeService = app()->make(SystemRouteServices::class);
+            foreach ($ruleData as $key => $item) {
+                if ($routeService->count(['method' => $item['method'], 'path' => $item['path']])) {
+                    unset($ruleData[$key]);
+                }
+            }
             app()->make(SystemRouteServices::class)->saveAll($ruleData);
             //记录权限加入菜单表
             $menuData = [];
@@ -538,7 +544,9 @@ class SystemCrudServices extends BaseServices
         ]);
         //生成验证器
         $validate = app()->make(Validate::class);
-        $validate->setFilePathName($filePath['validate'] ?? '')->setbasePath($basePath)->handle($tableName);
+        $validate->setFilePathName($filePath['validate'] ?? '')->setbasePath($basePath)->handle($tableName, [
+            'field' => $options['fromField'],
+        ]);
         //生成控制器
         $controller = app()->make(Controller::class);
         $controller->setFilePathName($filePath['controller'] ?? '')->setbasePath($basePath)->handle($tableName, [

+ 7 - 1
crmeb/app/services/system/SystemRouteServices.php

@@ -204,7 +204,13 @@ class SystemRouteServices extends BaseServices
                 $cateId = $commmonId;
             } else {
                 if (!isset($item['option']['cate_name'])) {
-                    $cateId = $id;
+                    if (strstr($item['rule'], '<MISS>') === false) {
+                        $rule = explode('/', $item['rule']);
+                        $cateId = $this->topCateId($app, $rule[0]);
+                    } else {
+                        //miss路由不写入
+                        continue;
+                    }
                 } else {
                     $cateId = $this->topCateId($app, $item['option']['cate_name']);
                 }

+ 2 - 0
crmeb/crmeb/services/crud/Service.php

@@ -148,6 +148,7 @@ class Service extends Make
      */
     protected function getframeImageOnePhpContent(string $field, string $name, bool $required = false, string $icon = 'ios-add', string $width = '950px', string $height = '505px')
     {
+        $name = addslashes($name);
         $requiredText = $required ? '->required()' : '';
         $content = <<<CONTENT
 \$rule[] = FormBuilder::frameImage('$field', '$name', url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => '$field']), \$info['$field'] ?? '')->icon('$icon')->width('$width')->height('$height')->modal(['footer-hide' => true])$requiredText
@@ -170,6 +171,7 @@ CONTENT;
      */
     protected function getframeImagesPhpContent(string $field, string $name, bool $required = false, string $icon = 'ios-images', int $maxLength = 10, string $width = '950px', string $height = '505px')
     {
+        $name = addslashes($name);
         $requiredText = $required ? '->required()' : '';
         $content = <<<CONTENT
 \$rule[] = FormBuilder::frameImages('$field', '$name', url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => '$field', 'type' => 'many', 'maxLength' => $maxLength]), \$info['$field'] ?? [])->maxLength($maxLength)->icon('$icon')->width('$width')->height('$height')->modal(['footer-hide' => true])$requiredText

+ 37 - 0
crmeb/crmeb/services/crud/Validate.php

@@ -38,6 +38,43 @@ class Validate extends Make
         return 'app' . DS . 'adminapi' . DS . 'validate' . DS . 'crud';
     }
 
+    /**
+     * @param string $name
+     * @param array $options
+     * @return Validate
+     * @author 等风来
+     * @email 136327134@qq.com
+     * @date 2023/4/23
+     */
+    public function handle(string $name, array $options = [])
+    {
+        [$rule, $message] = $this->getRuleContent($options['field']);
+        $this->value['rule-php'] = $rule;
+        $this->value['message-php'] = $message;
+        return parent::handle($name, $options); // TODO: Change the autogenerated stub
+    }
+
+    /**
+     * @param array $field
+     * @return array
+     * @author 等风来
+     * @email 136327134@qq.com
+     * @date 2023/4/23
+     */
+    protected function getRuleContent(array $field)
+    {
+        $content = [];
+        $message = [];
+        foreach ($field as $item) {
+            $item['name'] = addslashes($item['name']);
+            if ($item['required']) {
+                $content[] = $this->tab(2) . '\'' . $item['field'] . '\'=>\'require\'';
+                $message[] = $this->tab(2) . '\'' . $item['field'] . '.require\'=>\'' . $item['name'] . '必须填写\'';
+            }
+        }
+        return [implode("\n", $content), implode("\n", $message)];
+    }
+
     /**
      * 模板文件配置
      * @param string $type

+ 1 - 1
crmeb/crmeb/services/crud/stubs/route/delete.stub

@@ -1 +1 @@
-Route::delete('{%route%}/:id', 'crud.{%routePath%}{%controller%}/delete')->option(['real_name' => '{%menus%}删除数据接口']);
+Route::delete('{%route%}/:id', 'crud.{%routePath%}{%controller%}/delete')->option(['real_name' => '{%menus%}删除接口']);

+ 1 - 1
crmeb/crmeb/services/crud/stubs/route/save.stub

@@ -1 +1 @@
-Route::post('{%route%}', 'crud.{%routePath%}{%controller%}/save')->option(['real_name' => '{%menus%}保存数据接口']);
+Route::post('{%route%}', 'crud.{%routePath%}{%controller%}/save')->option(['real_name' => '{%menus%}保存接口']);

+ 1 - 1
crmeb/crmeb/services/crud/stubs/route/update.stub

@@ -1 +1 @@
-Route::put('{%route%}/:id', 'crud.{%routePath%}{%controller%}/update')->option(['real_name' => '{%menus%}修改数据接口']);
+Route::put('{%route%}/:id', 'crud.{%routePath%}{%controller%}/update')->option(['real_name' => '{%menus%}修改接口']);

+ 2 - 2
crmeb/crmeb/services/crud/stubs/validate/crudValidate.stub

@@ -33,14 +33,14 @@ class {%nameCamel%}Validate extends Validate
      * @var array
      */
     protected $rule = [
-
+{%rule-php%}
     ];
 
     /**
      * @var array
      */
     protected $message = [
-
+{%message-php%}
     ];
 
     /**

+ 6 - 5
template/admin/src/components/diyComponents/c_txt_list.vue

@@ -115,24 +115,25 @@ export default {
     },
     addHotTxt() {
       let val = {
-        children: [
+        chiild: [
           {
             max: 20,
             pla: '选填,不超过四个字',
             title: '标题',
-            val: 'CRMEB v4.2.2 正式发布',
+            val: '',
           },
           {
             max: 99,
             pla: '选填',
             title: '链接',
-            val: '链接',
+            val: '',
           },
         ],
       };
       if (this.name == 'newList') {
-        let obj = JSON.parse(JSON.stringify(this.datas[this.name].list[this.datas[this.name].list.length - 1]));
-        this.datas[this.name].list.push(obj);
+        let arrs = this.datas[this.name].list[this.datas[this.name].list.length - 1];
+        let obj = arrs ? JSON.parse(JSON.stringify(arrs)) : '';
+        this.datas[this.name].list.push(obj || val);
         return;
       }
       if (this.datas[this.name].list.length == 0) {

+ 3 - 2
template/admin/src/pages/setting/devise/diyIndex.vue

@@ -477,9 +477,10 @@ export default {
     log(evt) {
       // 中间拖拽排序
       if (evt.moved) {
-        if (evt.moved.element.name == 'search_box') {
+        if (evt.moved.element.name == 'search_box' || evt.moved.element.name == 'nav_bar') {
           return this.$Message.warning('该组件禁止拖拽');
         }
+        
         // if (evt.moved.element.name == "nav_bar") {
         //     return this.$Message.warning("该组件禁止拖拽");
         // }
@@ -542,7 +543,7 @@ export default {
           return;
         }
       }
-      if (item.name == 'search_box') {
+      if (item.name == 'search_box' || item.name == 'nav_bar') {
         return this.$Message.warning('该组件禁止移动');
       }
       // if (item.name == "nav_bar") {

+ 4 - 3
template/admin/src/pages/setting/devise/index.vue

@@ -207,7 +207,7 @@ export default {
   components: {
     footPage,
     html2canvas,
-    draggable: vuedraggable
+    draggable: vuedraggable,
   },
   filters: {
     filterTxt(val) {
@@ -402,7 +402,7 @@ export default {
     log(evt) {
       // 中间拖拽排序
       if (evt.moved) {
-        if (evt.moved.element.name == 'search_box') {
+        if (evt.moved.element.name == 'search_box' || evt.moved.element.name == 'nav_bar') {
           return this.$Message.warning('该组件禁止拖拽');
         }
         // if (evt.moved.element.name == "nav_bar") {
@@ -467,9 +467,10 @@ export default {
           return;
         }
       }
-      if (item.name == 'search_box') {
+      if (item.name == 'search_box' || item.name == 'nav_bar') {
         return this.$Message.warning('该组件禁止移动');
       }
+      console.log(item);
       // if (item.name == "nav_bar") {
       //     return this.$Message.warning("该组件禁止移动");
       // }

+ 2 - 0
template/admin/src/pages/setting/systemOutInterface/index.vue

@@ -1010,6 +1010,8 @@ export default {
 
     .text-area {
       white-space: pre-wrap;
+      word-break: break-word;
+
     }
   }
 

+ 1 - 5
template/admin/src/pages/system/backendRouting/debugging.vue

@@ -330,11 +330,7 @@ export default {
           ? this.jsonBody
           : this.filtersData((await this.$refs.yTable.getTableData().tableData) || []);
       let h = this.filtersData((await this.$refs.zTable.getTableData().tableData) || []);
-      let h1 = this.filtersData((await this.$refs.zaTable.getTableData().tableData) || []);
-      headers = {
-        ...h,
-        ...h1,
-      };
+      headers = h;
       console.log(url, method, params, body, headers);
       this.codes = '';
       requestMethod(url, method, params, body, headers)

+ 28 - 8
template/admin/src/pages/system/backendRouting/index.vue

@@ -9,11 +9,11 @@
           </template>
         </Tree> -->
       <!-- <Tree :data="treeData" :render="renderContent" class="demo-tree-render"></Tree> -->
-      <Card :bordered="false" dis-hover class="ivu-mt mr20 card-tree">
+      <div class="ivu-mt mr20 card-tree">
         <div class="tree">
           <div class="main-btn">
             <Button class="mb5 mr10" style="flex: 1" type="primary" @click="clickMenu(4)" long>新增分类</Button>
-            <Button type="success mr10" @click="syncRoute()">同步</Button>
+            <Button class="mr10" type="success" @click="syncRoute()">同步</Button>
             <Button type="info" @click="debugging()">调试</Button>
           </div>
 
@@ -24,7 +24,8 @@
             :model="treeData"
             default-tree-node-name="默认文件夹"
             default-leaf-node-name="默认接口名"
-            v-bind:default-expanded="true"
+            v-bind:default-expanded="false"
+            :expand-only-one="true"
           >
             <template v-slot:leafNameDisplay="slotProps">
               <div></div>
@@ -84,7 +85,7 @@
             </template>
           </vue-tree-list>
         </div>
-      </Card>
+      </div>
       <Card :bordered="false" dis-hover class="ivu-mt right-card">
         <div class="data">
           <div class="eidt-sub">
@@ -581,9 +582,15 @@ export default {
   },
   methods: {
     syncRoute() {
-      syncRoute(this.app_name).then((res) => {
-        this.getInterfaceList('one');
-        this.$Message.success(res.msg);
+      this.$Modal.warning({
+        title: '立即同步',
+        content: '您确认立即同步路由权限?',
+        onOk: () => {
+          syncRoute(this.app_name).then((res) => {
+            this.getInterfaceList('one');
+            this.$Message.success(res.msg);
+          });
+        },
       });
     },
     debugging() {
@@ -616,6 +623,9 @@ export default {
             if (res.data.length) {
               res.data[0].expand = false;
               this.treeData = new Tree(res.data);
+              this.$nextTick((e) => {
+                if (disk_type) document.querySelectorAll('.vtl-icon-caret-right')[0].click();
+              });
               if (res.data[0].children && res.data[0].children.length) {
                 this.onClick(res.data[0].children[0]);
               }
@@ -960,12 +970,14 @@ export default {
   margin-left: 10px;
 }
 .card-tree {
+   background: #fff;
    height: 72px;
    box-sizing: border-box;
    overflow-x: scroll; /* 设置溢出滚动 */
    white-space: nowrap;
    overflow-y: hidden;
    /* 隐藏滚动条 */
+   border-radius: 4px;
    scrollbar-width: none; /* firefox */
    -ms-overflow-style: none; /* IE 10+ */
 }
@@ -977,15 +989,23 @@ export default {
   display: flex;
   .main-btn {
     display:flex;
+    position: sticky;
+    padding: 15px 15px 0 15px;
+    width: 100%;
+    background: #fff;
+    top: 0px;
+    background-color: rgba(255, 255, 255, 0.6);
+    backdrop-filter: blur(4px);
   }
   .card-tree{
-    width: 270px;
+    width: 290px;
     height: calc(100vh - 115px);
     overflow-y: scroll;
   }
   >>> .tree {
     .tree-list{
       margin-left:10px;
+      padding: 0 15px;
 
     }
     .vtl-caret{

+ 9 - 1
template/admin/src/pages/system/codeGeneration/components/FoundationFor.vue

@@ -45,7 +45,12 @@
         <div class="tip">用于生成模块名称</div>
       </FormItem>
       <FormItem label="表名" prop="tableName">
-        <Input class="form-width" v-model="foundation.tableName" placeholder="请输入表名" @on-blur="initfield"></Input>
+        <Input
+          class="form-width"
+          v-model="foundation.tableName"
+          placeholder="请输入表名"
+          @on-blur="initTableName"
+        ></Input>
         <div class="tip">
           用于生成CRUD指定的表名,不需要携带表前缀;对于生成过的表将不能在进行生成;或者可以删除对应的文件重新生成!对应系统中重要的数据表将不允许生成!
         </div>
@@ -269,6 +274,9 @@ export default {
         this.addRow();
       }
     },
+    initTableName() {
+      this.tableField = [];
+    },
     addRow() {
       if (!this.foundation.tableName) return this.$Message.warning('请先填写表名');
       if (!this.tableField.length) {

+ 0 - 1
template/uni-app/App.vue

@@ -163,7 +163,6 @@
 			getLangVersion().then(res => {
 				let version = res.data.version
 				if (version != uni.getStorageSync('LANG_VERSION')) {
-					console.log('我变了')
 					getLangJson().then(res => {
 						let value = Object.keys(res.data)[0]
 						Cache.set('locale', Object.keys(res.data)[0])

+ 4 - 4
template/uni-app/components/productConSwiper/index.vue

@@ -6,14 +6,14 @@
 			<swiper-item v-if="videoline">
 				<view class="item">
 					<view v-show="!controls" style="width:100%;height:100% ">
-						<video id="myVideo" :src='videoline' objectFit="contain" controls style="width:100%;height:100%"
+						<video id="myVideo" :src='encodeURI(videoline)' objectFit="contain" controls style="width:100%;height:100%"
 							show-center-play-btn show-mute-btn="true" auto-pause-if-navigate :custom-cache="false"
 							:enable-progress-gesture="false" :poster="imgUrls[0]" @pause="videoPause"></video>
 					</view>
 					<view class="poster" v-show="controls">
 						<image class="image" :src="imgUrls[0]"></image>
 					</view>
-					<view class="stop" v-show="controls" @tap="bindPause">
+					<view class="stop" v-show="controls" @click.stop="bindPause">
 						<image class="image" src="../../static/images/stop.png"></image>
 					</view>
 				</view>
@@ -33,7 +33,7 @@
 			<!-- #endif -->
 			<block v-for="(item,index) in imgUrls" :key='index'>
 				<swiper-item v-if="videoline?index>=1:index>=0">
-					<image :src="item" class="slide-image" @click="openImage(index)" />
+					<image :src="item" class="slide-image" @click.stop="openImage(index)" />
 				</swiper-item>
 			</block>
 		</swiper>
@@ -95,8 +95,8 @@
 			},
 			bindPause: function() {
 				// #ifndef APP-PLUS
-				this.videoContext.play();
 				this.$set(this, 'controls', false)
+				this.videoContext.play();
 				this.autoplay = false
 				// #endif
 				// #ifdef APP-PLUS

+ 8 - 8
template/uni-app/pages/extension/customer_list/chat.vue

@@ -80,8 +80,7 @@
 								</view>
 							</view>
 							<!-- 订单 -->
-							<view class="order-box" v-if="item.msn_type == 6 && item.orderInfo"
-								@click="goOrder(item)">
+							<view class="order-box" v-if="item.msn_type == 6 && item.orderInfo" @click="goOrder(item)">
 								<view class="title">{{$t(`订单号`)}}: {{ item.orderInfo.order_id }}</view>
 								<view class="info">
 									<image :src="item.orderInfo.cartInfo[0].productInfo.image"></image>
@@ -639,18 +638,19 @@
 		.footer-box {
 			display: flex;
 			align-items: center;
-			padding: 0 30rpx;
 			color: rgba(0, 0, 0, 0.8);
 			background: #f7f7f7;
 			/* #ifdef APP-PLUS */
+			padding: 0 30rpx;
 			height: 70rpx;
 			height: (70rpx + constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
 			height: calc(70rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
-			/* #endif */
-			/* #ifndef APP-PLUS */
-			height: 100rpx;
-			height: calc(100rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
-			height: calc(100rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
+			/* #endif */
+
+			/* #ifndef APP-PLUS */
+			padding: 0 30rpx 15rpx 30rpx;
+			height: 115rpx;
+
 			/* #endif */
 			.words .icon-tupian {
 				font-size: 50rpx;