浏览代码

feat: 优化Swiper图片

zhangyuhan 3 年之前
父节点
当前提交
6d96eb1dd1

+ 1 - 0
src/web/staticres/common-module/yearEndReport/css/index.css

@@ -380,6 +380,7 @@ body {
   transform: translate3d(0, 100%, 0);
   bottom: 0;
   width: 100%;
+  z-index: -10;
 }
 
 .page-1 .meteor-mini {

+ 2 - 1
src/web/staticres/common-module/yearEndReport/css/result.css

@@ -276,9 +276,10 @@ html,body{
 }
 
 /* 偏移的样式 */
-.mask-report-active{
+#create-img-box .mask-report-active{
   width : 375px;
   height: 728px;
+  background-color: transparent;
   overflow: hidden;
 }
 .mask-report-active .ball{

+ 11 - 5
src/web/staticres/common-module/yearEndReport/js/index.js

@@ -1,4 +1,8 @@
 function initSwiper() {
+    if (this.$swiper) {
+        this.$swiper.destroy()
+        this.$swiper = null
+    }
     var interleaveOffset = 0.5; //视差比值
 
     function playAnOfIndex(index, type = true, delay) {
@@ -28,8 +32,8 @@ function initSwiper() {
         direction: 'vertical',
         mousewheel: true,
         //设置宽度为全屏
-        width: window.innerWidth,
-        height: window.innerHeight,
+        width: $(window).width(),
+        height: $(window).height(),
         allowSlideNext: false,
         lazy: {
             loadPrevNext: true,
@@ -279,7 +283,9 @@ var vPage = new Vue({
     },
     mounted: function () {
         initPlayMusic()
-        initSwiper.bind(this)()
+        this.$nextTick(function () {
+            initSwiper.bind(this)()
+        }.bind(this))
     },
     methods: {
         goExp: function (type) {
@@ -323,7 +329,7 @@ var vPage = new Vue({
                         }
                         _this.pageInfo = res.data
                         _this.$nextTick(function () {
-                            initSwiper.bind(_this)()
+                            initSwiper.bind(_this)();
                         })
                     } else {
                         location.replace('/swordfish/about')
@@ -363,7 +369,7 @@ var vPage = new Vue({
                     if (res && res.error_msg === '' && res.data) {
                         _this.pageInfo = res.data
                         _this.$nextTick(function () {
-                            initSwiper.bind(_this)()
+                            initSwiper.bind(_this)();
                         })
                     }
                 }

+ 3 - 0
src/web/staticres/common-module/yearEndReport/js/result.js

@@ -176,6 +176,9 @@ var result = new Vue({
           try {
             var tempUrl = url.replace('data:image/png;base64,', '')
             window.JyObj.savePic(tempUrl)
+            if (!mySysIsIos()) {
+              _this.$toast('保存图片成功')
+            }
           } catch (err) {
             console.log(err);
           }