Browse Source

增加百度运营图

limengbo 5 years ago
parent
commit
dd7fa614e7

+ 66 - 7
component/hot/hot.js

@@ -23,14 +23,15 @@ export const hotInit = (that) => {
         unReadMessageNum: 0,
         myCourse: [],
         inputFocus: false,
-        inputValue: ''
+        inputValue: '',
+        baiduFlag: false
         // circular: true
       }
     })
   }
   // 搜索方法
   that.searchHandler = () => {
-      if (that.data.hotInput.lenght !== 0) {
+    if (that.data.hotInput.lenght !== 0) {
         wx.navigateTo({
           url: `../main/searchResult/searchResult?keyWords=${that.data.hotInput}`
         })
@@ -39,27 +40,85 @@ export const hotInit = (that) => {
       that.setData({
         [str]: ''
       })
-    },
+    };
     // 输入框获取焦点 放大镜消失
     that.searchIconDisappear = () => {
       const str = 'hotData.searchIcon'
       that.setData({
         [str]: false
       })
-    },
+    };
     that.searchIconCome = () => {
       const str = 'hotData.searchIcon'
       that.setData({
         [str]: true
       })
-    }
+    };
+    // 百度弹窗弹出
+    that.clickBaidu = () => {
+      const str = 'hotData.baiduFlag'
+      that.setData({
+        [str]: true
+      });
+    };
+    // 百度弹窗关闭
+    that.xiaoduClick = () => {
+      const str = 'hotData.baiduFlag'
+      that.setData({
+        [str]: false
+      });
+    };
+    // 百度保存图片
+    that.PreservationXiaodu =  () => {
+      wx.getImageInfo({
+        src: 'https://reader.image.lingjiao.cn/reader/resource/海报.png',
+        success (res) {
+          wx.saveImageToPhotosAlbum({
+            filePath: res.path,
+            success: (res) => {
+              wx.showModal({
+                title: '海报已保存至相册',
+                content: '快去分享给小伙伴吧',
+                confirmText: '我知道了',
+                showCancel: false,
+                success(res) {
+                  console.log('用户点击确定')
+                }
+              })
+              const str = 'hotData.baiduFlag'
+              that.setData({
+                [str]: false
+              });
+            },
+            fail: res => {
+              console.log(res)
+              wx.getSetting({
+                success(res) {
+                  if (!res.authSetting['scope.writePhotosAlbum']) {
+                    wx.showModal({
+                      title: '无法保存分享图片到相册',
+                      content: '点击右上角浮点按钮->设置,进行授权',
+                      confirmText: '我知道了',
+                      showCancel: false,
+                      success(res) {
+                        console.log('用户点击确定')
+                      }
+                    })
+                  }
+                }
+              })
+            }
+          })
+        }
+      })
 
+    };
   // 输入框输入
   that.inputHandler = (e) => {
       that.setData({
         hotInput: e.detail.value
       });
-    },
+    };
     // 输入框聚焦
     that.inputFocus = () => {
       const str = 'hotData.inputFocus'
@@ -67,7 +126,7 @@ export const hotInit = (that) => {
         [str]: true
       });
       console.log(that.data.hotData.inputFocus)
-    },
+    };
     // 打开全部课本
     that.openBooks = (e) => {
       wx.navigateTo({

+ 17 - 7
component/hot/hot.wxml

@@ -27,26 +27,29 @@
         <image class="messageIcon" src="../../static/image/message_icon.png" />
         <text class="messageText">{{hotData.unReadMessageContent}}</text>
     </view> -->
-    <!-- <view class="myCourseSection">
-        <view class="title">
+    <view class="myCourseSection" bindtap="clickBaidu">
+        <!-- <view class="title">
             <view class="title-regular">我的课程</view>
             <view class="right" bindtap="toMyCourse" wx:if="{{hotData.myCourse.length > 3}}">
                 更多
                 <image src="../../static/image/black_to.png" />
             </view>
-        </view>
-        <view class="myCoursePlaceHolder" wx:if="{{hotData.myCourse.length === 0}}" bindtap="goToBooks">
+        </view> -->
+        <!-- <view class="myCoursePlaceHolder" wx:if="{{hotData.myCourse.length === 0}}" bindtap="goToBooks">
             <image src="../../static/image/add_class.png" />
+        </view> -->
+        <view class="myCoursePlaceHolder">
+            <image src="https://reader.image.lingjiao.cn/reader/resource/baidu_img.png" />
         </view>
-        <view class="book-box" wx:if="{{hotData.myCourse.length !== 0}}">
+        <!-- <view class="book-box" wx:if="{{hotData.myCourse.length !== 0}}">
             <block wx:for="{{hotData.myCourse}}" wx:key="{{index}}">
                 <view class="book-item" data-id="{{item.productId}}" bindtap="goToBook" data-title="{{item.title}}">
                     <image class="book-img" src="{{item.iconImg}}"></image>
                     <view class="book-title">{{item.title}}</view>
                 </view>
             </block>
-        </view>
-    </view> -->
+        </view> -->
+    </view>
     <view class="searchSection">
         <input bindinput="inputHandler" value="{{hotData.inputValue}}" focus="{{hotData.inputFocus}}" bindfocus="searchIconDisappear" bindblur="searchIconCome" bindconfirm="searchHandler" placeholder="{{hotData.hotSearch}}" placeholder-style="text-indent:20rpx" confirm-type="search"></input>
         <view>{{searchIcon}}</view>
@@ -114,4 +117,11 @@
             </view>
         </view>
     </view>
+    <!--小度广告海报-->
+    <view class="xiaodu-dialog" bindtap="xiaoduClick"  wx:if="{{hotData.baiduFlag}}">
+        <image class="dialog-img" lazy-load="true" src="https://reader.image.lingjiao.cn/reader/resource/海报.png" />
+        <view class="dialog-circle" catchtap="PreservationXiaodu">
+            <text>点我保存到相册,识别二维码</text>
+        </view>
+    </view>
 </template>

+ 37 - 0
component/hot/hot.wxss

@@ -428,4 +428,41 @@ swiper {
     /* font-weight: 800; */
     line-height: 36rpx;
     margin-top: 16rpx;
+}
+
+.xiaodu-dialog {
+    position:fixed;
+    left:0;
+    top:0;
+    width:100%;
+    height:100%;
+    background:rgba(0, 0, 0, .6);
+    z-index:999999;
+}
+
+.dialog-img {
+    width: 510rpx;
+    height: 893rpx;
+    position: fixed;
+    top: 100rpx;
+    left: 50%;
+    transform: translate(-50%);
+    z-index: 9999999;
+}
+
+.dialog-circle {
+    color: #fff;
+    background: #ff6b00;
+    width: 512rpx;
+    height: 72rpx;
+    border-radius: 72rpx;
+    margin: 0 auto;
+    text-align: center;
+    line-height: 72rpx;
+    font-size: 34rpx;
+    position: fixed;
+    bottom: 120rpx;
+    left: 50%;
+    transform: translate(-50%);
+    z-index: 9999999;
 }

+ 1 - 1
pages/index/index.wxml

@@ -27,7 +27,7 @@
   </view> -->
 </view>
  <!-- <MyToast /> -->
-<view hidden="{{hide}}">
+<view hidden="false">
   <Dialog bindmyevent="jurisdiction" />
 </view>
 <!-- <view class="index-dialog" wx:if="{{indexSignDialog}}">

BIN
static/image/lego_icon.png


BIN
static/image/reader_logo.jpg