浏览代码

fix: 删除重名版本号比较方法、修改三级页版本号比较

zhangxinlei1996 2 年之前
父节点
当前提交
ffd0ed03d9

+ 0 - 37
src/jfw/modules/app/src/web/staticres/jyapp/js/common.js

@@ -1830,40 +1830,3 @@ function echoRequiredValues (target, now, keys) {
     return {}
   }
 }
-
-
-/**
- * 比较两个版本号的大小
- * @param {string} v1
- * @param {string} v2
- * @returns {0|1|-1} 0 表示v1 = v2,1 表示v1 > v2,-1表示v1 < v2
- * compareVersion('1.1.0', '1.1.0');      // => 0
- * compareVersion('1.20.0', '1.2.20');    // => 1
- * compareVersion('v2.0.30', 'v1.9.10');  // => 1
- * compareVersion('v1.1.40', 'v1.2.0');   // => -1
- */
-function compareVersion (v1, v2) {
-  v1 = v1.split('.')
-  v2 = v2.split('.')
-  const len = Math.max(v1.length, v2.length)
-
-  while (v1.length < len) {
-    v1.push('0')
-  }
-  while (v2.length < len) {
-    v2.push('0')
-  }
-
-  for (let i = 0; i < len; i++) {
-    const num1 = parseInt(v1[i])
-    const num2 = parseInt(v2[i])
-
-    if (num1 > num2) {
-      return 1
-    } else if (num1 < num2) {
-      return -1
-    }
-  }
-
-  return 0
-}

+ 1 - 1
src/jfw/modules/app/src/web/templates/weixin/wxinfocontent.html

@@ -1746,7 +1746,7 @@
     //isfree 是否是免费
     function iosShow(url,fileName,size,isfree){
       var version = JyObj.getVersion()
-      if(version && compareVersion(version,'3.0.4')>0){
+      if(version && compareVersion('3.0.4',version)){
         //切割名称获取格式
           var name = fileName ? fileName.substring(0, fileName.lastIndexOf('.')) : '' 
           var types = fileName ? fileName.substring(fileName.lastIndexOf('.') + 1) : ''