qiushang 1 năm trước cách đây
mục cha
commit
5e368f0918
3 tập tin đã thay đổi với 53 bổ sung41 xóa
  1. 1 1
      package.json
  2. 0 0
      src/renderer/assets/image/a-build.png
  3. 52 40
      src/renderer/components/home.vue

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "XYRename",
-  "version": "2.0.2.0",
+  "version": "2.1.0.0",
   "author": "苏州星优办公软件有限公司",
   "description": "An electron-vue project",
   "license": "rename",

+ 0 - 0
src/renderer/assets/image/下载.png → src/renderer/assets/image/a-build.png


+ 52 - 40
src/renderer/components/home.vue

@@ -52,6 +52,12 @@
 									<p class="citem-name">批量创建文件</p>
 								</div>
 							</el-col>
+							<el-col :span="6">
+								<div class="citem-nav2">
+									<img src="../assets/image/a-build.png" class="citem-img" />
+									<p class="citem-name">敬请期待...</p>
+								</div>
+							</el-col>
 						</el-row>
 					</div>
 				</div>
@@ -95,10 +101,6 @@
 						</el-button-group>
 						
 						<div style="width: 366px; display: flex; justify-content: space-between;align-items: flex-end;">
-							<el-button size="mini" @click="sort()">打印</el-button>
-							<el-button size="mini" @click="setChange()">刷新</el-button>
-							<el-button size="mini" @click="sortAsc()">升序</el-button>
-							<el-button size="mini" @click="sortDesc()">降序</el-button>
 							<el-popover v-if="(menuIndex == '1' && fileList.length > 0) || (menuIndex == '2' && dirList.length > 0)" placement="bottom" popper-class="popper-open" trigger="hover" content="命名撤回一次">
 								<el-button slot="reference" type="info" size="mini" @click="back()" :disabled="(menuIndex == '1' && backFileList.length == 0) || (menuIndex == '2' && backDirList.length == 0)" >撤回</el-button>
 							</el-popover>
@@ -132,13 +134,13 @@
 							</div>
 							
 							<div v-else class="table-scroll" @dragover.prevent @drop="handleDrop">
-								<!-- 1、文件重命名 @sort-change="sortChange" sortMethod: customSortMethod-->
+								<!-- 1、文件重命名 -->
 								<vxe-table ref="xTable"
-									v-show="['1','5'].indexOf(menuIndex) > -1" :sort-config="{sortMethod: customSortMethod}"
+									v-show="['1','5'].indexOf(menuIndex) > -1"
 									show-overflow class="img-table" max-height="100%" empty-text="没有更多数据了!" :loading="tabLoading"
 									:loading-config="{icon: 'vxe-icon-indicator roll', text: '文件加载中...'}" :row-config="{isHover: true}"
 									:edit-config="{trigger: 'click', mode: 'cell'}" :data="fileList" :scroll-y="{enabled: true}">
-									<vxe-column field="name" :title="'原文件名'+'(' + fileList.length + ')'" sortable></vxe-column>
+									<vxe-column field="name" :title="'原文件名'+'(' + fileList.length + ')'"></vxe-column>
 									<vxe-column field="newName" title="新文件名" :edit-render="{}" v-if="menuIndex == '1'">
 										<template #edit="{ row, rowIndex }">
 											<div style="display: flex; justify-content: space-between;">
@@ -790,6 +792,7 @@ export default {
 			imgUrl: this.$api.imgUrl,
 			menuIndex: '', // 重命名类型 1 or 2
 	        fileList: [], // 文件列表
+			sortList: [], // 排序列表 
 			fileTimeList: [], // 文件的时间列表
 			backFileList: [], // 回撤文件列表
 			backDirList: [], // 回撤文件夹列表
@@ -908,10 +911,6 @@ export default {
 	    });
 	},
 	methods: {
-		// 测试排序
-		sort(){
-			console.log(this.fileList);
-		},
 		containsChinese(str) {  
 		    for (let i = 0; i < str.length; i++) {  
 		        const charCode = str.charCodeAt(i);  
@@ -922,42 +921,34 @@ export default {
 		    }  
 			return false;
 		},
-		contrastStr(str, str2) {
-			let length = str.length;
-			let length2 = str.length;
-			let rLength = length < length2 ? length : length2;
-			
-			let charCodeA = str.charCodeAt(0);
-			let charCodeB = str2.charCodeAt(0);
-			
-			for(let i = 0; i < rLength; i++){
-				if(str[i] == str2[i]){
-					continue;
-				}
-			}
-			
-		},
 		sortAsc(){
-			const collator = new Intl.Collator('zh-Hans-CN', { sensitivity: 'case', numeric: false });
-			// this.fileList.sort(collator.compare);
 			this.fileList.sort((a, b) => {
 				let charCodeA = a.name.charCodeAt(0);
 				let charCodeB = b.name.charCodeAt(0);
-				if(charCodeA >= 0x4e00 && charCodeA <= 0x9fff && charCodeB >= 0x4e00 && charCodeB <= 0x9fff){
-					console.log(a.name, '--->', b.name, '==cn==', a.name.localeCompare(b.name, 'zh-CN'));
+				if(charCodeA >= 0x4e00 && charCodeA <= 0x9fff && charCodeB >= 0x4e00 && charCodeB <= 0x9fff){ // 第一个字符都是中文对比
 					return a.name.localeCompare(b.name, 'zh-CN', {sensitivity: 'base'});
+				}else if(this.containsChinese(a.name) && this.containsChinese(b.name)){ // 文字里面都有中文,且第一个字符不是中文对比
+					let length = a.name.length < b.name.length ? a.name.length : b.name.length; // 去长度短的数量做比较
+					
+					let result = false;
+					for(let i = 0; i < length; i++){
+						let charA = a.name[i].charCodeAt(0);
+						let charB = b.name[i].charCodeAt(0);
+						if(a.name[i] == b.name[i]){
+							continue;
+						}else if(charA >= 0x4e00 && charA <= 0x9fff && charB >= 0x4e00 && charB <= 0x9fff){ // 相同位置含有中文则使用中文对比
+							result = true;
+							break;
+						}else{
+							break;
+						}
+					}
+					
+					if(result){ //中文对比法则
+						return a.name.localeCompare(b.name, 'zh-CN', {sensitivity: 'base'});
+					}
 				}
-				console.log(a.name, '--->', b.name, '==en==', a.name.localeCompare(b.name, 'en-US'));
 				return a.name.localeCompare(b.name, 'en-US', {sensitivity: 'base'});
-			})
-			
-			// this.fileList.sort((a, b) => {
-			// 	return collator.compare(a.name, b.name)
-			// })
-		},
-		sortDesc(){
-			this.fileList.sort((a, b) => {
-				return b.name.localeCompare(a.name)
 			});
 		},
 		// 选择导出目录 1、提取和文件生成
@@ -2520,6 +2511,27 @@ export default {
 				padding-bottom: 10px;
 			}
 		}
+		
+		.citem-nav2{
+			text-align: center;
+			border-radius: 10px;
+			min-height: 110px;
+			padding: 25px 0;
+			font-size: 15px;
+			box-shadow: 3px 3px 6px #ccc, -3px -3px 6px #ccc;
+			
+			.citem-img {
+				width: 55%;
+				margin-bottom: 20px;
+			}
+			
+			.citem-name{
+				font-size: 22px;
+				font-weight: 600;
+				color: #999;
+				padding-bottom: 10px;
+			}
+		}
 	}
 	
 	.popper-open{