소스 검색

增加线上分支,调整时间显示格式,缺少主动授权功能

sunzhilei 6 년 전
부모
커밋
a54745c791
3개의 변경된 파일31개의 추가작업 그리고 23개의 파일을 삭제
  1. 1 0
      pages/index/index.js
  2. 7 1
      project.config.json
  3. 23 22
      utils/util.js

+ 1 - 0
pages/index/index.js

@@ -37,6 +37,7 @@ Page({
   },
 
   onLoad: function (options) {
+    debugger;
     //获取分享过来的值跳转页面
     const ind  = options.ind;
     const postsId = options.postId || '';

+ 7 - 1
project.config.json

@@ -29,7 +29,7 @@
 			"list": []
 		},
 		"miniprogram": {
-			"current": 5,
+			"current": 6,
 			"list": [
 				{
 					"id": 0,
@@ -72,6 +72,12 @@
 					"pathName": "pages/art/art",
 					"query": "ind=7",
 					"scene": "1011"
+				},
+				{
+					"id": -1,
+					"name": "义方快乐学堂",
+					"pathName": "pages/index/index",
+					"query": "grade=2"
 				}
 			]
 		}

+ 23 - 22
utils/util.js

@@ -23,29 +23,30 @@ const gradeUpper = grade => {
 //将秒转化为 X/XX 比如四小时三十六分 为4/36
 const day = msd => {
   //不到一分钟的情况;
-  let time = Math.floor(msd);//整数秒  
-  time = "0/00";
+  let time = Math.floor(msd) + '秒';//整数秒  
+  //time = "0/00";
   //超过一分钟的情况
-  if( Math.floor(msd )> 60){ 
-      let min = Math.floor(msd / 60); 
-      let hour = Math.floor(min / 60);
-      let minShow = min % 60;
-      time = hour + "/" + minShow ;  
-      // if( min > 60 ){  
-  //         min = Math.floor(msd / 60) % 60;  
-  //         let hour = Math.floor( msd / 3600 );  
-  //         // time = hour + "小时" + min + "分";
-  //         time = hour + "时";  
-  //         if( hour > 24 ){  
-  //             hour = Math.floor( msd / 3600 ) % 24;  
-  //             let day = Math.floor(msd / 3600 / 24);
-  //             // time = day + "天" + hour + "小时";
-  //             time = day + "天";  
-  //         }  
-      // }    
-  }   
-
-  return time;          
+  if (Math.floor(msd) > 60) {
+    let min = Math.floor(msd / 60);
+    time = min + "分";
+    // let hour = Math.floor(min / 60);
+    // let minShow = min % 60;
+    // time = hour + "/" + minShow ;  
+    if (min > 60) {
+      min = Math.floor(msd / 60) % 60;
+      let hour = Math.floor(msd / 3600);
+      time = hour + "时" + min + "分";
+      // time = hour + "时";  
+      if (hour > 24) {
+        hour = Math.floor(msd / 3600) % 24;
+        let day = Math.floor(msd / 3600 / 24);
+        time = day + "天" + hour + "时";
+        // time = day + "天";  
+      }
+    }
+  }
+
+  return time;
 }
 
 //计算首页学过了多长时间