Browse Source

添加新的关注模式

JXDS18FUJT 2 years ago
parent
commit
19d9018897
2 changed files with 89 additions and 23 deletions
  1. 13 8
      src/App.vue
  2. 76 15
      src/pages/teacherVideo/index.vue

+ 13 - 8
src/App.vue

@@ -1,6 +1,8 @@
 <script>
 export default {
-  onLaunch: function () {
+  onLaunch: function (option) {
+    uni.setStorageSync("hot_startup_option", option);
+    console.log(option);
     let updateManager = uni.getUpdateManager();
     if (!updateManager) {
       return;
@@ -45,6 +47,10 @@ export default {
       }
     }
   },
+  onShow(option) {
+    uni.setStorageSync("cold_startup_option", option);
+    console.log(option);
+  },
 };
 </script>
 
@@ -89,23 +95,22 @@ html {
   height: 100%;
   background-color: rgba(0, 0, 0, 0.65);
 }
-.uni-app-fontsize-paragraph{
+.uni-app-fontsize-paragraph {
   font-size: $uni-app-fontsize-paragraph;
 }
-.wxad{
+.wxad {
   padding-bottom: 20rpx;
   padding-top: 20rpx;
   border-top: 2rpx dashed #a8a8a8;
   width: 100%;
-  
 }
-.pl0{
-    padding-left: 0 !important;
+.pl0 {
+  padding-left: 0 !important;
 }
-.mt40{
+.mt40 {
   margin-top: 40rpx;
 }
-.no-bg{
+.no-bg {
   background: transparent !important;
 }
 </style>

+ 76 - 15
src/pages/teacherVideo/index.vue

@@ -52,7 +52,15 @@
         </view>
       </view>
     </view>
-    <official-account></official-account>
+    <view class="care" :style="careVisible ? '' : 'display:none'">
+      <view class="dialog">
+        <official-account></official-account>
+        <view @click="()=>{
+          careVisible=false
+          }" class="confirm"> 关闭</view>
+      </view>
+    </view>
+
     <view class="wxad">
       <ad
         ad-type="video"
@@ -69,6 +77,7 @@ import api from "@/api";
 export default {
   data() {
     return {
+      careVisible: false,
       bottom_arrrow,
       query: {},
       kemu: ["一", "二", "三", "四"],
@@ -76,6 +85,7 @@ export default {
   },
   methods: {
     goPath(url) {
+      let that = this;
       let userInfo = uni.getStorageSync("userInfo");
       let gzhOpenid = userInfo.gzhOpenid;
       console.log(userInfo);
@@ -84,32 +94,83 @@ export default {
           url,
         });
       } else {
-        uni.showModal({
-          title: "请关注公众号",
-          content: "关注后回到这里观看相关视频",
-          success(res) {
-            if (res.confirm) {
-              uni.navigateTo({ url: "/otherPages/careGzh/index" });
-            } else if (res.cancel) {
-            }
-          },
-        });
+        let hotStartupOption = uni.getStorageSync("hot_startup_option");
+        let coldStartupOption = uni.getStorageSync("cold_startup_option");
+        console.log(hotStartupOption.scene);
+        console.log(coldStartupOption.scene);
+        switch (coldStartupOption.scene) {
+          case 1011:
+          case 1017:
+          case 1038:
+          case 1047:
+          case 1124:
+            that.careVisible = true;
+            break;
+          default:
+            uni.showModal({
+              title: "请关注公众号",
+              content: "关注后回到这里观看相关视频",
+              success(res) {
+                if (res.confirm) {
+                  uni.navigateTo({ url: "/otherPages/careGzh/index" });
+                } else if (res.cancel) {
+                }
+              },
+            });
+            break;
+        }
+        // switch (){
+        //   case :
+        //   break;
+
+        // }
       }
     },
     onLoad(query) {
+    
       this.query = query;
     },
   },
   onShow() {
-    // api.user.getInfo().then((res) => {
-    //   uni.setStorageSync("userInfo", res.data);
-    //   this.$store.commit("SET_USERINFO", res.data);
-    // });
+    api.user.getInfo().then((res) => {
+      uni.setStorageSync("userInfo", res.data);
+      this.$store.commit("SET_USERINFO", res.data);
+    });
   },
 };
 </script>
 
 <style lang="scss" scoped>
+.care {
+  width: 100vw;
+  height: 100vh;
+  background-color: rgba(0, 0, 0, 0.35);
+  position: fixed;
+  z-index: 10;
+  top: 0;
+  left: 0;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  align-content: center;
+  .dialog {
+    width: 300px;
+    height: calc(84px + 72rpx);
+    background: #fff;
+    border-radius: 16rpx;
+    overflow: hidden;
+  }
+  .confirm {
+    width: 100%;
+    height: 72rpx;
+    text-align: center;
+    font-size: 40rpx;
+    line-height: 72rpx;
+    color: #ee0a24;
+    background: #fff;
+    letter-spacing:15px;
+  }
+}
 .road {
   width: 690rpx;
   margin: 0 auto;