Browse Source

08/26 14:33

mo 5 năm trước cách đây
mục cha
commit
d1a2f5c8ed

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
dist/index.html


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
dist/static/css/app.37e55093.css


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
dist/static/js/app.2a6ce2ed.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
dist/static/js/app.428302c9.js


+ 58 - 0
src/utils/scroll-to.js

@@ -0,0 +1,58 @@
+Math.easeInOutQuad = function(t, b, c, d) {
+  t /= d / 2
+  if (t < 1) {
+    return c / 2 * t * t + b
+  }
+  t--
+  return -c / 2 * (t * (t - 2) - 1) + b
+}
+
+// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts
+var requestAnimFrame = (function() {
+  return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) }
+})()
+
+/**
+ * Because it's so fucking difficult to detect the scrolling element, just move them all
+ * @param {number} amount
+ */
+function move(amount) {
+  document.documentElement.scrollTop = amount
+  document.body.parentNode.scrollTop = amount
+  document.body.scrollTop = amount
+}
+
+function position() {
+  return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop
+}
+
+/**
+ * @param {number} to
+ * @param {number} duration
+ * @param {Function} callback
+ */
+export function scrollTo(to, duration, callback) {
+  const start = position()
+  const change = to - start
+  const increment = 20
+  let currentTime = 0
+  duration = (typeof (duration) === 'undefined') ? 500 : duration
+  var animateScroll = function() {
+    // increment the time
+    currentTime += increment
+    // find the value with the quadratic in-out easing function
+    var val = Math.easeInOutQuad(currentTime, start, change, duration)
+    // move the document.body
+    move(val)
+    // do the animation unless its over
+    if (currentTime < duration) {
+      requestAnimFrame(animateScroll)
+    } else {
+      if (callback && typeof (callback) === 'function') {
+        // the animation is done so lets callback
+        callback()
+      }
+    }
+  }
+  animateScroll()
+}

+ 5 - 4
src/views/dashboard/index.vue

@@ -116,6 +116,7 @@
 <script>
 import qs from "qs";
 import { loading } from "element-ui";
+import { scrollTo } from '@/utils/scroll-to'
 import {
   getAllMajor,
   getMusicTeams,
@@ -164,7 +165,7 @@ export default {
       chioseList: [], // 所有调剂科目的集合
       sessionId: "",
       brancheList: [], // 所有分部集合
-      limit : 10,
+      limit : 20,
       total: 0,
       page: 1,
       studentId: "", // 学生id
@@ -314,9 +315,9 @@ export default {
       this.page = val;
       // this.limit = pageSize;
      this.getstudentList();
-      if (this.autoScroll) {
+      // if (this.autoScroll) {
         scrollTo(0, 800);
-      }
+      // }
     }
   },
    computed: {
@@ -399,7 +400,7 @@ export default {
 .joinBtn {
   position: fixed;
   right: 30px;
-  top: 800px;
+  top: 700px;
   z-index: 100;
 }
 .sectionForm {

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác