Browse Source

判断进入及提示加桌弹窗

bayi 2 years ago
parent
commit
7a59173ef1
6 changed files with 68 additions and 3 deletions
  1. 7 2
      app.js
  2. 1 1
      app.wxss
  3. 10 0
      pages/index/index.js
  4. 22 0
      pages/index/index.less
  5. 7 0
      pages/index/index.wxml
  6. 21 0
      pages/index/index.wxss

+ 7 - 2
app.js

@@ -14,8 +14,12 @@ App({
   onLaunch() {
     this.checkIsIos()
     this.getNavbarInfo()
-    let res = wx.getLaunchOptionsSync()
-    console.log(res, 'res');
+    let {
+      scene
+    } = wx.getLaunchOptionsSync()
+    console.log(scene, 'res');
+
+    this.globalData.scene = scene
   },
   async onShow(options) {
     this.storeBindings = createStoreBindings(this, {
@@ -78,6 +82,7 @@ App({
   globalData: {
     userInfo: null,
     isIOS: false, // 判断设备是否为苹果
+    scene: '', // 1023	安卓系统桌面图标,1104微信聊天主界面下拉,「我的小程序」栏(基础库2.2.4-2.29.0版本废弃,2.29.1版本起生效)
     navBarHeight: 0, // 导航栏高度
     menuRight: 0, // 胶囊距右方间距(方保持左、右间距一致)
     menuTop: 0, // 胶囊距底部间距(保持底部间距一致)

+ 1 - 1
app.wxss

@@ -56,7 +56,7 @@ text {
 
 .isFixed {
   position: fixed;
-  z-index: 999;
+  z-index: 998;
 }
 
 .isFixed2 {

+ 10 - 0
pages/index/index.js

@@ -23,6 +23,7 @@ Page({
     currentType: '1',
     // 控制一级分类是否固定
     isFixed: false,
+    desktopTips: false,
     categoryList: []
   },
   /**
@@ -38,6 +39,15 @@ Page({
       this.getLocUserInfo()
       this.resetData()
     }
+    // 1023	安卓系统桌面图标,1104微信聊天主界面下拉,「我的小程序」栏(基础库2.2.4-2.29.0版本废弃,2.29.1版本起生效)
+    let {
+      isIOS,
+      scene
+    } = app.globalData
+    this.setData({
+      desktopTips: isIOS ? scene != 1104 : scene != 1023
+    })
+    console.log(isIOS ? scene != 1104 : scene != 1023);
     let uid = wx.getStorageSync('uid')
     /*  if (uid) {
        this.getLocUserInfo()

+ 22 - 0
pages/index/index.less

@@ -1,4 +1,26 @@
 .recommend {
+  position: relative;
+
+  .desktopTips {
+    position: fixed;
+    z-index: 999;
+    right: 0rpx;
+
+    .triangle {
+      position: absolute;
+      right: 124rpx;
+      top: -26rpx;
+      border: 20rpx solid #F9F9FF;
+      border-top-color: transparent;
+      border-left-color: transparent;
+      border-right-color: transparent;
+    }
+
+    .tipsImg {
+      width: 530rpx;
+      height: 176rpx;
+    }
+  }
 
   .scrollBox {
     width: 100%;

+ 7 - 0
pages/index/index.wxml

@@ -1,6 +1,13 @@
 <navigationBar bind:reload='resetData'></navigationBar>
 <view class="recommend">
   <banner classify='1' />
+  <!-- 加桌提示 -->
+  <view class="desktopTips" style="top:{{navBarHeight+3}}px">
+    <view class="triangle"></view>
+    <image
+      src="{{app.globalData.isIOS?'http://reader-wx.ai160.com/images/reader/v3/desktop-ios.png':'http://reader-wx.ai160.com/images/reader/v3/desktop-android.png'}}"
+      class="tipsImg" />
+  </view>
   <!-- 滚动定位 -->
   <view class="scrollBox {{isFixed?'isFixed':''}}" style="top:{{navBarHeight}}px;">
     <!-- 一级分类区域 -->

+ 21 - 0
pages/index/index.wxss

@@ -1,3 +1,24 @@
+.recommend {
+  position: relative;
+}
+.recommend .desktopTips {
+  position: fixed;
+  z-index: 999;
+  right: 0rpx;
+}
+.recommend .desktopTips .triangle {
+  position: absolute;
+  right: 124rpx;
+  top: -26rpx;
+  border: 20rpx solid #F9F9FF;
+  border-top-color: transparent;
+  border-left-color: transparent;
+  border-right-color: transparent;
+}
+.recommend .desktopTips .tipsImg {
+  width: 530rpx;
+  height: 176rpx;
+}
 .recommend .scrollBox {
   width: 100%;
 }