ソースを参照

禁止视频下载/禁止PC微信登录

guojy 1 年間 前
コミット
564887355c

+ 1 - 1
src/view/course/user/courseDeal.vue

@@ -196,7 +196,7 @@ export default {
           this.$toast.fail("您已经购买课程,无需再次购买");
         }else if(!res.enable){
           this.canGive2 = false;
-          this.$toast.fail("分享码已失效!");
+          this.$toast.fail("课程码已失效");
         }
       });
     }

+ 45 - 11
src/view/course/utils/index.js

@@ -5,19 +5,25 @@ import { getIsIdentity, supremeAuthority, getIsWx, getTypes, getTypesName, getUs
 //判断环境/登录状态
 export function isWxEnv(type,data) {
     return new Promise((resolve, reject) => {
-        if (getIsWx()) {
-            if (getWxToken()&&localStorage.getItem('wx_user_info')) {
-                // Toast("微信环境已授权");
-                resolve()
+        if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){
+            if (getIsWx()) {
+                if (getWxToken()&&localStorage.getItem('wx_user_info')) {
+                    // Toast("微信环境已授权");
+                    resolve()
+                } else {
+                    // Toast.fail("微信环境未授权");
+                    reject(1)
+                    doWeixinLogin(type,data);
+                }
             } else {
-                // Toast.fail("微信环境未授权");
-                reject(1)
-                //测试用,正式隐藏
-                doWeixinLogin(type,data);
+                if (getWxToken()&&localStorage.getItem('wx_user_info')) {
+                    resolve()
+                } else {
+                    Toast.fail("当前不在微信环境中,请在微信中打开浏览");
+                    reject(2)
+                }
             }
-        } else {
-            // Toast.fail("当前不在微信环境中,请在微信中打开浏览");
-            // reject(2)
+        }else{
             if (getWxToken()&&localStorage.getItem('wx_user_info')) {
                 resolve()
             } else {
@@ -27,6 +33,34 @@ export function isWxEnv(type,data) {
         }
     })
 }
+function isWeChat() {  
+    var ua = navigator.userAgent.toLowerCase();  
+    return /micromessenger/.test(ua);  
+}  
+  
+function isWeChatPC() {  
+    var ua = navigator.userAgent.toLowerCase();  
+    // 你可以根据PC版微信浏览器的特性来添加更多的判断条件  
+    // 例如,某些PC版微信浏览器可能包含特定的关键字或版本信息  
+    return /micromessenger/.test(ua) && /windows/.test(ua) && !/mobile/.test(ua);  
+}  
+  
+function isWeChatMobile() {  
+    var ua = navigator.userAgent.toLowerCase();  
+    return /micromessenger/.test(ua) && /mobile/.test(ua);  
+}  
+  
+// if (isWeChat()) {  
+//     if (isWeChatPC()) {  
+//         console.log('这是PC版微信');  
+//     } else if (isWeChatMobile()) {  
+//         console.log('这是手机版微信');  
+//     } else {  
+//         console.log('无法确定是PC版还是手机版微信');  
+//     }  
+// } else {  
+//     console.log('这不是微信浏览器');  
+// }
 //请求微信授权
 export function doWeixinLogin(type,data) {
     // let defaultUrl = 'https://3g954g5149.picp.vip/wx/mp/auth/wx65f4dde5ec7c31e7?marketing=1'

+ 1 - 1
src/view/course/video/video.vue

@@ -11,7 +11,7 @@
         <!-- <video controls autoplay name="media">
           <source :src="videoSrc" type="video/mp4">
         </video> -->
-        <video ref="vueMiniPlayer" :src="videoSrc" controls autoplay v-if="showVideo"></video>
+        <video ref="vueMiniPlayer" :src="videoSrc" controls autoplay v-if="showVideo" controlsList="nodownload"></video>
       </div>
       <div class="title">
         <p>{{ courseDetail.name }}</p>