chengjie 6 months ago
parent
commit
b9b08fc511

+ 1 - 0
.cloudbase/container/debug.json

@@ -0,0 +1 @@
1
+{"containers":[],"config":{}}

+ 1 - 1
app.js

@@ -1,6 +1,6 @@
1
 App({
1
 App({
2
   globalData: {
2
   globalData: {
3
-    Version: "2.5.1",
3
+    Version: "2.5.2",
4
     IsProduction: true,
4
     IsProduction: true,
5
     ShareTitle: "高效学习从秒过开始",
5
     ShareTitle: "高效学习从秒过开始",
6
     SharePath: "pages/index/index",
6
     SharePath: "pages/index/index",

+ 6 - 6
pages/main/addInfomationDetail.js

@@ -78,7 +78,7 @@ Page({
78
       }
78
       }
79
     }
79
     }
80
 
80
 
81
-    if (data.ENG && data.ENG.Paraphrase && common.checkIsArray(data.ENG.Paraphrase)) {
81
+    if (data.ENG && data.ENG.Paraphrase && Array.isArray(data.ENG.Paraphrase)) {
82
 
82
 
83
       for (var i = 0; i < data.ENG.Paraphrase.length; i++) {
83
       for (var i = 0; i < data.ENG.Paraphrase.length; i++) {
84
         var item = data.ENG.Paraphrase[i];
84
         var item = data.ENG.Paraphrase[i];
@@ -249,19 +249,19 @@ Page({
249
               }
249
               }
250
             } else {
250
             } else {
251
               if (item.Tag == "诗词" || item.Tag == "译文") {
251
               if (item.Tag == "诗词" || item.Tag == "译文") {
252
-                if (common.checkIsArray(item.Content) &&
253
-                  common.checkIsArray(item.Content[0])) {
252
+                if (Array.isArray(item.Content) &&
253
+                  Array.isArray(item.Content[0])) {
254
                   for (var j = 0; j < item.Content.length; j++) {
254
                   for (var j = 0; j < item.Content.length; j++) {
255
-                    if (common.checkIsArray(item.Content[j])) {
255
+                    if (Array.isArray(item.Content[j])) {
256
                       item.Content[j] = item.Content[j].join("");
256
                       item.Content[j] = item.Content[j].join("");
257
                     }
257
                     }
258
                   }
258
                   }
259
-                  if (common.checkIsArray(item.Content))
259
+                  if (Array.isArray(item.Content))
260
                     str = item.Content.join("\n");
260
                     str = item.Content.join("\n");
261
                   else
261
                   else
262
                     str = item.Content;
262
                     str = item.Content;
263
                 } else {
263
                 } else {
264
-                  if (common.checkIsArray(item.Content))
264
+                  if (Array.isArray(item.Content))
265
                     str = item.Content.join("");
265
                     str = item.Content.join("");
266
                   else
266
                   else
267
                     str = item.Content;
267
                     str = item.Content;

+ 11 - 3
pages/main/latex.js

@@ -14,17 +14,19 @@ Page({
14
     InputHeight1: 157,
14
     InputHeight1: 157,
15
     InputHeight2: 157,
15
     InputHeight2: 157,
16
     BtnArray:[
16
     BtnArray:[
17
+      {Name:"分数",Content:"\\frac{a}{b} ",FontSize:"24"},
18
+      {Name:"平方根",Content:"\\sqrt{a} ",FontSize:"24"},
17
       {Name:"换行",Content:"\\\\",FontSize:"24"},
19
       {Name:"换行",Content:"\\\\",FontSize:"24"},
18
       {Name:"空格",Content:"\\, ",FontSize:"24"},
20
       {Name:"空格",Content:"\\, ",FontSize:"24"},
19
       {Name:"等距空格",Content:"\\quad ",FontSize:"24"},
21
       {Name:"等距空格",Content:"\\quad ",FontSize:"24"},
20
-      {Name:"分数",Content:"\\frac{a}{b} ",FontSize:"24"},
21
-      {Name:"平方根",Content:"\\sqrt{a} ",FontSize:"24"},
22
       {Name:"∵",Content:"∵",FontSize:"36"},
22
       {Name:"∵",Content:"∵",FontSize:"36"},
23
       {Name:"∴",Content:"∴",FontSize:"36"},
23
       {Name:"∴",Content:"∴",FontSize:"36"},
24
       {Name:"∠",Content:"∠",FontSize:"36"},
24
       {Name:"∠",Content:"∠",FontSize:"36"},
25
       {Name:"∥",Content:"∥",FontSize:"36"},
25
       {Name:"∥",Content:"∥",FontSize:"36"},
26
       {Name:"⟂",Content:"⟂",FontSize:"36"},
26
       {Name:"⟂",Content:"⟂",FontSize:"36"},
27
       {Name:"▵",Content:"▵",FontSize:"36"},
27
       {Name:"▵",Content:"▵",FontSize:"36"},
28
+      {Name:"▱",Content:"▱",FontSize:"36"},
29
+      {Name:"⊙",Content:"⊙",FontSize:"36"},
28
       {Name:"∼",Content:"∼",FontSize:"36"},
30
       {Name:"∼",Content:"∼",FontSize:"36"},
29
       {Name:"≅",Content:"≅",FontSize:"36"},
31
       {Name:"≅",Content:"≅",FontSize:"36"},
30
       {Name:"×",Content:"×",FontSize:"36"},
32
       {Name:"×",Content:"×",FontSize:"36"},
@@ -38,7 +40,7 @@ Page({
38
       {Name:"°",Content:"°",FontSize:"36"},
40
       {Name:"°",Content:"°",FontSize:"36"},
39
       {Name:"⇒",Content:"⇒",FontSize:"36"},
41
       {Name:"⇒",Content:"⇒",FontSize:"36"},
40
       {Name:"⇔",Content:"⇔",FontSize:"36"},
42
       {Name:"⇔",Content:"⇔",FontSize:"36"},
41
-      {Name:"∞",Content:"∞",FontSize:"36"},
43
+      {Name:"+∞",Content:"+∞",FontSize:"36"},
42
       {Name:"²",Content:"²",FontSize:"36"},
44
       {Name:"²",Content:"²",FontSize:"36"},
43
       {Name:"³",Content:"³",FontSize:"36"},
45
       {Name:"³",Content:"³",FontSize:"36"},
44
       {Name:"N次方",Content:"x^{n} ",FontSize:"24"},
46
       {Name:"N次方",Content:"x^{n} ",FontSize:"24"},
@@ -46,6 +48,12 @@ Page({
46
       {Name:"x₁",Content:"x₁",FontSize:"36"},
48
       {Name:"x₁",Content:"x₁",FontSize:"36"},
47
       {Name:"x₂",Content:"x₂",FontSize:"36"},
49
       {Name:"x₂",Content:"x₂",FontSize:"36"},
48
       {Name:"下标n",Content:"x_{n} ",FontSize:"24"},
50
       {Name:"下标n",Content:"x_{n} ",FontSize:"24"},
51
+      {Name:"α",Content:"α",FontSize:"36"},
52
+      {Name:"β",Content:"β",FontSize:"36"},
53
+      {Name:"γ",Content:"γ",FontSize:"36"},
54
+      {Name:"θ",Content:"θ",FontSize:"36"},
55
+      {Name:"圆弧AB",Content:"\\widehat{AB}",FontSize:"24"},
56
+      {Name:"向量a",Content:"\\overrightarrow{a}",FontSize:"24"},
49
     ],
57
     ],
50
   },
58
   },
51
   onLoad: function (options) {
59
   onLoad: function (options) {

+ 1 - 0
pages/main/preview.js

@@ -252,6 +252,7 @@ Page({
252
     }
252
     }
253
 
253
 
254
     var TagWidth = 0;
254
     var TagWidth = 0;
255
+    //debugger;
255
     if (card.Tags && card.Tags.length > 0) {
256
     if (card.Tags && card.Tags.length > 0) {
256
       TagWidth = 92 + (card.Tags.length - 1) * 122;
257
       TagWidth = 92 + (card.Tags.length - 1) * 122;
257
       for (var j = 0; j < card.Tags.length; j++) {
258
       for (var j = 0; j < card.Tags.length; j++) {

+ 5 - 5
pages_test/test/report.js

@@ -186,7 +186,7 @@ Page({
186
           else
186
           else
187
             obj.Field3="";
187
             obj.Field3="";
188
           obj.Tags = item.Content[0].Content;
188
           obj.Tags = item.Content[0].Content;
189
-          if (!common.checkIsArray(obj.Tags))
189
+          if (!Array.isArray(obj.Tags))
190
             obj.Tags = obj.Tags.split(",");
190
             obj.Tags = obj.Tags.split(",");
191
           
191
           
192
           obj.ID = 0;
192
           obj.ID = 0;
@@ -274,23 +274,23 @@ Page({
274
     }
274
     }
275
     if (TestTask.TestRightStr)
275
     if (TestTask.TestRightStr)
276
       param1.TestRightStr = TestTask.TestRightStr.join(symbol);
276
       param1.TestRightStr = TestTask.TestRightStr.join(symbol);
277
-    if (common.checkIsArray(param1.TestRightStr))
277
+    if (Array.isArray(param1.TestRightStr))
278
       param1.TestRightStr=param1.TestRightStr.join(symbol);
278
       param1.TestRightStr=param1.TestRightStr.join(symbol);
279
 
279
 
280
     if (TestTask.TestWrongStr)
280
     if (TestTask.TestWrongStr)
281
       param1.TestWrongStr = TestTask.TestWrongStr.join(symbol);
281
       param1.TestWrongStr = TestTask.TestWrongStr.join(symbol);
282
-    if (common.checkIsArray(param1.TestWrongStr))
282
+    if (Array.isArray(param1.TestWrongStr))
283
       param1.TestWrongStr=param1.TestWrongStr.join(symbol);
283
       param1.TestWrongStr=param1.TestWrongStr.join(symbol);
284
     
284
     
285
     if (TestTask.TestSkipStr)
285
     if (TestTask.TestSkipStr)
286
       param1.TestSkipStr = TestTask.TestSkipStr.join(symbol);
286
       param1.TestSkipStr = TestTask.TestSkipStr.join(symbol);
287
-    if (common.checkIsArray(param1.TestSkipStr))
287
+    if (Array.isArray(param1.TestSkipStr))
288
       param1.TestSkipStr=param1.TestSkipStr.join(symbol);
288
       param1.TestSkipStr=param1.TestSkipStr.join(symbol);
289
     
289
     
290
       
290
       
291
     if (TestTask.TestExistStr)
291
     if (TestTask.TestExistStr)
292
       param1.TestExistStr = TestTask.TestExistStr.join(symbol);
292
       param1.TestExistStr = TestTask.TestExistStr.join(symbol);
293
-    if (common.checkIsArray(param1.TestExistStr))
293
+    if (Array.isArray(param1.TestExistStr))
294
       param1.TestExistStr=param1.TestExistStr.join(symbol);
294
       param1.TestExistStr=param1.TestExistStr.join(symbol);
295
     
295
     
296
     if (TestReportID)
296
     if (TestReportID)

+ 1 - 1
project.config.json

@@ -14,7 +14,7 @@
14
     "newFeature": true,
14
     "newFeature": true,
15
     "autoAudits": true,
15
     "autoAudits": true,
16
     "scopeDataCheck": false,
16
     "scopeDataCheck": false,
17
-    "uglifyFileName": false,
17
+    "uglifyFileName": true,
18
     "checkInvalidKey": true,
18
     "checkInvalidKey": true,
19
     "checkSiteMap": true,
19
     "checkSiteMap": true,
20
     "uploadWithSourceMap": true,
20
     "uploadWithSourceMap": true,

+ 2 - 5
utils/cryptojs.js

@@ -1,8 +1,5 @@
1
 import BlockModes from '../utils/lib/BlockModes';
1
 import BlockModes from '../utils/lib/BlockModes';
2
 import AES from '../utils/lib/AES';
2
 import AES from '../utils/lib/AES';
3
+import { Crypto } from './lib/Crypto';
3
 
4
 
4
-var Crypto = exports.Crypto = require('./lib/Crypto').Crypto;
5
-
6
-['BlockModes', 'AES'].forEach(function (path) {
7
-	require('./lib/' + path);
8
-});
5
+export { Crypto };

+ 2 - 1
utils/main.js

@@ -9,6 +9,7 @@ function getData(url, callback) {
9
     console.log("加密前的结果为===", url);
9
     console.log("加密前的结果为===", url);
10
   var url = common.Encrypt(url);
10
   var url = common.Encrypt(url);
11
   //console.log("加密后的结果为===",url);
11
   //console.log("加密后的结果为===",url);
12
+  console.log("加密后的结果为===",app.globalData.serverUrl + url);
12
   wx.request({
13
   wx.request({
13
     url: app.globalData.serverUrl + url,
14
     url: app.globalData.serverUrl + url,
14
     success: function (res) {
15
     success: function (res) {
@@ -1580,7 +1581,7 @@ function searchInfomation(search, searchtype, author, shiciurl, callback) {
1580
           if (data.ENG.Soundmark && data.ENG.Soundmark.Eng)
1581
           if (data.ENG.Soundmark && data.ENG.Soundmark.Eng)
1581
             obj.Remark = data.ENG.Soundmark.Eng;
1582
             obj.Remark = data.ENG.Soundmark.Eng;
1582
           if (data.ENG.Paraphrase.length > 0) {
1583
           if (data.ENG.Paraphrase.length > 0) {
1583
-            if (common.checkIsArray(data.ENG.Paraphrase) && data.ENG.Paraphrase[0].ParaphraseList)
1584
+            if (Array.isArray(data.ENG.Paraphrase) && data.ENG.Paraphrase[0].ParaphraseList)
1584
               obj.Content = data.ENG.Paraphrase[0].ParaphraseList.join("; ").substr(0, WORD_LENGTH);
1585
               obj.Content = data.ENG.Paraphrase[0].ParaphraseList.join("; ").substr(0, WORD_LENGTH);
1585
             else
1586
             else
1586
               obj.Content = data.ENG.Paraphrase.substr(0, WORD_LENGTH) + "...";
1587
               obj.Content = data.ENG.Paraphrase.substr(0, WORD_LENGTH) + "...";

+ 85 - 36
utils/util.js

@@ -2,30 +2,60 @@ var Crypto = require('cryptojs.js').Crypto;
2
 var app = getApp();
2
 var app = getApp();
3
 
3
 
4
 function formatTime(date, format, isShort) {
4
 function formatTime(date, format, isShort) {
5
-  if (date) {
6
-    date = new Date(ReplaceAllString(date.toString(),"-","/"));
7
-    var year = date.getFullYear()
8
-    var month = date.getMonth() + 1
9
-    var day = date.getDate()
5
+  if (!date) return "";
6
+  
7
+  let dateObj;
8
+  if (date instanceof Date) {
9
+    dateObj = date;
10
+  } else {
11
+    // 统一处理日期字符串格式
12
+    let dateStr = date.toString();
13
+    
14
+    // 处理包含GMT的格式
15
+    if (dateStr.includes('GMT')) {
16
+      // 提取日期部分,转换为 yyyy/MM/dd HH:mm:ss 格式
17
+      let parts = dateStr.match(/(\w+)\s+(\w+)\s+(\d+)\s+(\d+)\s+(\d+):(\d+):(\d+)/);
18
+      if (parts) {
19
+        let months = {'Jan':1,'Feb':2,'Mar':3,'Apr':4,'May':5,'Jun':6,
20
+                     'Jul':7,'Aug':8,'Sep':9,'Oct':10,'Nov':11,'Dec':12};
21
+        let month = months[parts[2]];
22
+        dateStr = `${parts[4]}/${formatNumber(month)}/${formatNumber(parts[3])} ${parts[5]}:${parts[6]}:${parts[7]}`;
23
+      }
24
+    }
25
+    
26
+    // 统一将-转换为/
27
+    dateStr = dateStr.replace(/-/g, '/');
28
+    
29
+    // 确保日期格式为 yyyy/MM/dd HH:mm:ss
30
+    if (!/^\d{4}\/\d{1,2}\/\d{1,2}/.test(dateStr)) {
31
+      return "";
32
+    }
33
+    
34
+    dateObj = new Date(dateStr);
35
+  }
10
 
36
 
11
-    var hour = date.getHours()
12
-    var minute = date.getMinutes()
13
-    var second = date.getSeconds()
37
+  // 检查日期是否有效
38
+  if (isNaN(dateObj.getTime())) {
39
+    return "";
40
+  }
14
 
41
 
15
-    if (!format)
16
-      format = "/";
42
+  var year = dateObj.getFullYear();
43
+  var month = dateObj.getMonth() + 1;
44
+  var day = dateObj.getDate();
45
+  var hour = dateObj.getHours();
46
+  var minute = dateObj.getMinutes();
47
+  var second = dateObj.getSeconds();
17
 
48
 
18
-    if (isShort)
19
-      return [year, month, day].map(formatNumber).join(format);
20
-    else
21
-      return [year, month, day].map(formatNumber).join(format) + ' ' + [hour, minute, second].map(formatNumber).join(':');
49
+  if (!format) {
50
+    format = "/";
22
   }
51
   }
23
-  else
24
-    return "";
25
-}
26
 
52
 
27
-function checkIsArray(obj) {
28
-  return Object.prototype.toString.call(obj) === '[object Array]';
53
+  if (isShort) {
54
+    return [year, month, day].map(formatNumber).join(format);
55
+  } else {
56
+    return [year, month, day].map(formatNumber).join(format) + ' ' + 
57
+           [hour, minute, second].map(formatNumber).join(':');
58
+  }
29
 }
59
 }
30
 
60
 
31
 function formatDateCHS(date,isLong) {
61
 function formatDateCHS(date,isLong) {
@@ -311,26 +341,41 @@ function getStorageValue(obj, name, defaultStatus, callback) {
311
 }
341
 }
312
 
342
 
313
 function addDate(interval, number, date) {
343
 function addDate(interval, number, date) {
344
+  const newDate = new Date(date);
345
+  
314
   switch (interval.toLowerCase()) {
346
   switch (interval.toLowerCase()) {
315
     case "y":
347
     case "y":
316
-      return new Date(date.setFullYear(date.getFullYear() + number));
348
+      newDate.setFullYear(newDate.getFullYear() + number);
349
+      break;
317
     case "m":
350
     case "m":
318
-      return new Date(date.setMonth(date.getMonth() + number));
351
+      newDate.setMonth(newDate.getMonth() + number);
352
+      break;
319
     case "d":
353
     case "d":
320
-      return new Date(date.setDate(date.getDate() + number));
354
+      newDate.setDate(newDate.getDate() + number);
355
+      break;
321
     case "w":
356
     case "w":
322
-      return new Date(date.setDate(date.getDate() + 7 * number));
357
+      newDate.setDate(newDate.getDate() + 7 * number);
358
+      break;
323
     case "h":
359
     case "h":
324
-      return new Date(date.setHours(date.getHours() + number));
360
+      newDate.setHours(newDate.getHours() + number);
361
+      break;
325
     case "n":
362
     case "n":
326
-      return new Date(date.setMinutes(date.getMinutes() + number));
363
+      newDate.setMinutes(newDate.getMinutes() + number);
364
+      break;
327
     case "s":
365
     case "s":
328
-      return new Date(date.setSeconds(date.getSeconds() + number));
366
+      newDate.setSeconds(newDate.getSeconds() + number);
367
+      break;
329
     case "l":
368
     case "l":
330
-      return new Date(date.setMilliseconds(date.getMilliseconds() + number));
369
+      newDate.setMilliseconds(newDate.getMilliseconds() + number);
370
+      break;
371
+    default:
372
+      throw new Error(`不支持的间隔类型: ${interval}`);
331
   }
373
   }
374
+  
375
+  return newDate;
332
 }
376
 }
333
 
377
 
378
+
334
 function diffDate(interval, date1, date2) {
379
 function diffDate(interval, date1, date2) {
335
   var long = date2.getTime() - date1.getTime(); //相差毫秒
380
   var long = date2.getTime() - date1.getTime(); //相差毫秒
336
   switch (interval.toLowerCase()) {
381
   switch (interval.toLowerCase()) {
@@ -353,18 +398,23 @@ function diffDate(interval, date1, date2) {
353
   }
398
   }
354
 }
399
 }
355
 
400
 
356
-
357
-function ReplaceAllString(str, replaceStrFrom, replaceStrTo) {//替换
358
-  if (str && str.length > 0) {
359
-    var reg = new RegExp(replaceStrFrom, "g");
360
-    //console.log(str);
361
-    return str.toString().replace(reg, replaceStrTo);
401
+/**
402
+ * 替换字符串中的所有匹配项
403
+ * @param {string} str - 需要替换的字符串
404
+ * @param {string} replaceStrFrom - 需要被替换的子字符串
405
+ * @param {string} replaceStrTo - 替换后的子字符串
406
+ * @returns {string} 替换后的字符串
407
+ */
408
+function ReplaceAllString(str, replaceStrFrom, replaceStrTo) {
409
+  if (typeof str === 'string' && typeof replaceStrFrom === 'string' && typeof replaceStrTo === 'string' && str.length > 0) {
410
+    const reg = new RegExp(replaceStrFrom, 'g');
411
+    return str.replace(reg, replaceStrTo);
362
   }
412
   }
363
-  else
364
-    return str;
413
+  return str;
365
 }
414
 }
366
 
415
 
367
 
416
 
417
+
368
 function Trim(str) { //删除左右两端的空格
418
 function Trim(str) { //删除左右两端的空格
369
   return str.replace(/(^\s*)|(\s*$)/g, "");
419
   return str.replace(/(^\s*)|(\s*$)/g, "");
370
 }
420
 }
@@ -473,7 +523,6 @@ module.exports = {
473
   diffDate: diffDate,
523
   diffDate: diffDate,
474
   Trim: Trim,
524
   Trim: Trim,
475
   IsNumber:IsNumber,
525
   IsNumber:IsNumber,
476
-  checkIsArray: checkIsArray,
477
   formatDateENG: formatDateENG,
526
   formatDateENG: formatDateENG,
478
   formatMoney:formatMoney,
527
   formatMoney:formatMoney,
479
   initMonthCalendar:initMonthCalendar
528
   initMonthCalendar:initMonthCalendar