liyongli 2 ani în urmă
părinte
comite
4f9993c0f1

+ 16 - 1
miniprogram/api/index.ts

@@ -90,11 +90,26 @@ function seaveUserData(params:WechatMiniprogram.requestParamsData) {
   })
 }
 
+function getdownloadPage(params:WechatMiniprogram.requestParamsData) {
+  return request({
+    url: "https://djweb.smcic.net/video/downloadPage.json",
+    data: params.data,
+    method: params.method,
+    baseUrlNone: true,
+    header:{
+      Authorization: wx.getStorageSync("token"),
+      ...params.header
+    },
+    success: params.success
+  })
+}
+
 export default {
   login,
   getPhone,
   createOrder,
   getUser,
   getVideo,
-  seaveUserData
+  seaveUserData,
+  getdownloadPage
 }

+ 1 - 0
miniprogram/app.ts

@@ -29,6 +29,7 @@ App<IAppOption>({
     });
     this.globalData.SystemInfo = wx.getSystemInfoSync();
     this.globalData.FileSystemManager = wx.getFileSystemManager();
+    console.log(this.globalData.SystemInfo.SDKVersion)
   },
   wLogin() {
     wx.login({

+ 1 - 18
miniprogram/components/camera-face/index.wxss → miniprogram/components/camera-face/index.scss

@@ -1,4 +1,4 @@
-/* components/camera-face/index.wxss */
+/* components/camera-face/index.scss */
 .page-body {
   width: 100%;
   height: 100%;
@@ -32,29 +32,12 @@
   justify-content: center;
   align-items: center;
   color: #ffffff;
-}
-
-.half-circle p {
   font-family: "Microsoft YaHei";
   font-size: 30rpx;
   color: white;
   line-height: 70rpx;
 }
 
-.img-view {
-  width: 750rpx;
-  height: 505rpx;
-  position: absolute;
-  top: 0;
-  left: 0;
-  z-index: 999;
-}
-
-.mask-img {
-  width: 750rpx;
-  height: 505rpx;
-}
-
 /* 底部按钮和提示文字 */
 .bottom-tips {
   text-align: center;

+ 19 - 4
miniprogram/pages/downloadPage/index.scss

@@ -2,10 +2,24 @@
 .page {
   position: relative;
 
-  .headImage {
-    width: 750rpx;
-    height: 558rpx;
-    background-color: #000;
+  .headHead {
+    position: relative;
+
+    .headImage,
+    .headVideo {
+      width: 750rpx;
+      height: 558rpx;
+      background-color: #000;
+    }
+
+    .headImage{
+      position: absolute;
+      top: 0;
+      right: 0;
+      bottom: 0;
+      left: 0;
+    }
+
   }
 
   .main {
@@ -48,6 +62,7 @@
       font-size: 34rpx;
       margin: 188rpx auto 0 auto;
     }
+
     .duanluo {
       text-indent: 2em;
       line-height: 1.8em;

+ 37 - 3
miniprogram/pages/downloadPage/index.ts

@@ -8,8 +8,16 @@ Page({
    * 页面的初始数据
    */
   data: {
+    videoSrc: "",
+    paragraphName: "马拉松简介",
+    showImage: true
+  },
+  autoplay() {
+    if (!this.data.showImage) return;
+    this.setData({
+      showImage: false,
+    })
   },
-
   toDownload() {
     if (t) t = clearTimeout(t);
     t = setTimeout(() => {
@@ -23,10 +31,8 @@ Page({
           })
           res.PAY ? this.downloadVideo() : this.toPAY();
         },
-
       })
     }, 200);
-
   },
 
   downloadVideo() {
@@ -101,6 +107,34 @@ Page({
    */
   onLoad() {
     wx.hideHomeButton({});
+
+    app.getdownloadPage({
+      success: (res: any) => {
+        app.getUser({
+          data: {},
+          success: (rule: any) => {
+            if (!rule.PAY || !rule.RESULT) {
+              this.setData({
+                videoSrc: res.videoSrc || "",
+                paragraph: res.paragraph || [],
+                paragraphName: res.paragraphName
+              })
+              return;
+            }
+            app.getVideo({
+              success: (r: any) => {
+                console.log(r);
+                this.setData({
+                  videoSrc: r.url,
+                  paragraph: res.paragraph || [],
+                  paragraphName: res.paragraphName
+                })
+              }
+            })
+          },
+        })
+      }
+    })
   },
 
   /**

+ 7 - 8
miniprogram/pages/downloadPage/index.wxml

@@ -1,18 +1,17 @@
 <!--pages/downloadPage/index.wxml-->
 <view class="page">
-  <image src="https://cxzx.smcic.net/topic/tool/img/miniprogram/download.png" mode="scaleToFill" class="headImage" />
+  <view class="headHead">
+    <video class="headVideo" bindplay="autoplay" src="{{videoSrc}}" autoplay="autoplay" loop autoplay muted show-center-play-btn controls="{{false}}" picture-in-picture-mode="{{[]}}" />
+    <image wx:if="{{showImage}}" src="https://cxzx.smcic.net/topic/tool/img/miniprogram/download.png" mode="scaleToFill" class="headImage" />
+  </view>
   <view class="main">
     <view class="main_title">
-      马拉松简介
-    </view>
-    <view class="duanluo">
-      荣耀·2023陕西大学生马拉松联赛是陕西省学生体育协会及西安曲江体育集团面向高校学子重磅打造的品牌路跑赛事IP,本次赛事将于3月——11月,以“一校一站”的形式,在陕西省众多高校相继举办。
+      {{paragraphName}}
     </view>
-    <view class="duanluo">
-      首场赛事荣耀·2023陕西大学生马拉松联赛-西安交通大学站将于3月25日在西安交通大学创新港校区举办,本次赛事将充分展示交大学子拼搏不息的体育精神通过赛事,让学子们重温西迁历史,感悟“西迁精神”!
+    <view class="duanluo" wx:for="{{paragraph}}" wx:key="index">
+      {{item.text}}
     </view>
 
-
     <view class="btn" bindtap="toDownload">
       <image class="iconImage" src="https://cxzx.smcic.net/topic/tool/img/miniprogram/video.png" mode="scaleToFill" />
       下载个人视频

+ 5 - 1
miniprogram/pages/entry/index.ts

@@ -1,5 +1,6 @@
 // pages/entry/index.ts
 const app = getApp<IAppOption>();
+// import { compareVersion } from "../../utils/util";
 Page({
 
   /**
@@ -39,8 +40,11 @@ Page({
       method: "POST",
       success: () =>{
         // 进入人脸识别
+        let url = "/pages/faceRecognition/index";
+        // const version:string = app.globalData.SystemInfo?.SDKVersion || "";
+        // if(compareVersion(version, "2.20.0")) url = "/pages/faceRecognitionVk/index"
         wx.navigateTo({
-          url: "/pages/faceRecognition/index"
+          url
         })
       }
     })

+ 2 - 0
miniprogram/pages/faceRecognitionVk/index.scss

@@ -1,4 +1,6 @@
 /* pages/faceRecognition/index.wxss */
+@import "../../components/camera-face/index.wxss";
+
 page {
   background: #ffffff;
   height: 100vh;

+ 14 - 5
miniprogram/pages/faceRecognitionVk/index.wxml

@@ -1,7 +1,16 @@
-<view class="page">
-  <camera class="camera" mode="normal" resolution="medium" device-position="front" flash="off" frame-size="medium" bindstop="improperStop" binderror="unauthorized" 	bindinitdone="initialization" >
-  </camera>
+<view class="page-body">
+  <view class="head">
+    <!-- 请拿起手机正对摄像头——请向左转——请向右转 -->
+    <view class="top-tips">{{topTips}}</view>
 
-  <button wx:if="{{!isStartVideo}}" bindtap="initCamera" >录制</button>
-  <button wx:if="{{isStartVideo}}" disabled >录制中...</button>
+    <camera class="camera" mode="normal" resolution="medium" device-position="front" flash="off" frame-size="medium" bindstop="improperStop" binderror="unauthorized" 	bindinitdone="initialization">
+      <view wx:if="{{seconds>0}}" class="half-circle">
+        {{seconds}}s
+      </view>
+    </camera>
+  </view>
+
+  <!-- 开始人脸验证——人脸验证中——人脸验证成功 -->
+  <view wx:if="{{!isStartVideo}}" class="faceBtn" bindtap="initCamera">开始人脸采集</view>
+  <view wx:if="{{isStartVideo}}" class="bottom-tips">{{bottomTips}}</view>
 </view>

+ 8 - 4
miniprogram/pages/home/index.ts

@@ -1,5 +1,6 @@
 // pages/home/index.ts
 const app = getApp<IAppOption>();
+// import { compareVersion } from "../../utils/util";
 Page({
 
   /**
@@ -9,7 +10,7 @@ Page({
   },
 
   lvru() {
-      app.getUser({
+    app.getUser({
       data: {},
       success: (res: any) => {
         if (!res.SAVE_USER_INFO) {
@@ -19,10 +20,13 @@ Page({
           })
           return;
         }
-        if (!res.UPLOAD_FACE){
+        if (!res.UPLOAD_FACE) {
           // 未上传人脸信息,跳转人脸采集页
+          let url = "/pages/faceRecognition/index";
+          // const version: string = app.globalData.SystemInfo?.SDKVersion || "";
+          // if (compareVersion(version, "2.20.0")) url = "/pages/faceRecognitionVk/index"
           wx.navigateTo({
-            url: "/pages/faceRecognition/index"
+            url
           })
           return;
         }
@@ -90,4 +94,4 @@ Page({
   }
 })
 
-export {}
+export { }

+ 2 - 1
miniprogram/utils/request.ts

@@ -5,8 +5,9 @@ export default function request(params: WechatMiniprogram.requestParamsData) {
   wx.showLoading({
     title: ""
   })
+  const url = params.baseUrlNone ? params.url : base.url + params.url
   return wx.request({
-    url: base.url + params.url,
+    url,
     data: params.data,
     header: params.header,
     dataType: params.dataType || 'json',

+ 3 - 2
typings/types/wx/lib.local.tool.d.ts

@@ -1,12 +1,13 @@
 
 declare namespace WechatMiniprogram {
   interface requestParamsData {
-    url?: string;
+    url: string;
     data?: Object;
     header?: {};
     method?:  "GET" | "OPTIONS" | "HEAD" | "POST" | "PUT" | "DELETE" | "TRACE" | "CONNECT" | undefined;
     dataType?: 'json' | '其他';
-    success:AccessCompleteCallback
+    success:AccessCompleteCallback;
+    baseUrlNone?: boolean;
   }
 }