liyongli 2 年之前
父節點
當前提交
4f43827320

+ 0 - 1
miniprogram/app.json

@@ -1,7 +1,6 @@
 {
   "pages": [
     "pages/home/index",
-    "pages/tool/index",
     "pages/faceRecognition/index",
     "pages/faceRecognitionVk/index",
     "pages/entry/index",

+ 1 - 5
miniprogram/app.ts

@@ -5,16 +5,12 @@ App<IAppOption>({
   onLaunch() {
     // 登录
     const nowTime = Date.now() - (wx.getStorageSync("tokenTime") || 0) >= 86400000 * 7;
-    console.log(nowTime);
     (!wx.getStorageSync("token") || nowTime) && this.wLogin();
     // 获取用户信息
     this.getUser({
       data: {},
       success: (res: any) => {
-        console.log(res);
-        if (!res.RESULT) return wx.showToast({
-          "title": "视频正在生成中,请耐心等待"
-        })
+        if(!res) return;
         if (res.UPLOAD_FACE && res.SAVE_USER_INFO) {
           // 已经录过脸并且用户信息已经上传,跳转视频下载页
           return wx.reLaunch({

+ 0 - 3
miniprogram/components/camera-face/index.ts

@@ -140,7 +140,6 @@ Component({
       }
       console.log('准备录制')
       this.setData({ topTips: topTips.ready })
-      console.log(this.data.topTips)
       // 视频帧回调节流函数
       let fn = throttle((frame: any) => {
         // 人脸识别
@@ -180,8 +179,6 @@ Component({
         const g = this.properties.faceCredibility
         const { pitch, yaw, roll } = res.angleArray
         const { p, y, r } = this.properties.faceAngle
-        console.log('res.confArray.global:', global)
-        console.log('res.angleArray:', pitch, yaw, roll)
         const isGlobal = global >= g
         const isPitch = Math.abs(pitch) <= p
         const isYaw = Math.abs(yaw) <= y

+ 1 - 1
miniprogram/config/index.ts

@@ -1,3 +1,3 @@
 export const base = {
   url: "https://malasong.smcic.net"
-}
+}

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

@@ -18,12 +18,11 @@
     border-top: 3rpx solid #26B4EC;
     border-right: 3rpx solid #26B4EC;
     background-color: #ffffff;
-    padding: 46rpx 46rpx 0 36rpx;
+    padding: 0 46rpx 0 36rpx;
 
     line-height: 40rpx;
     color: #666666;
     font-size: 28rpx;
-    line-height: 40rpx;
 
     .iconImage {
       width: 34rpx;
@@ -34,8 +33,8 @@
       color: #222222;
       font-size: 32rpx;
       font-weight: 500;
-      height: 44rpx;
-      line-height: 44rpx;
+      height: 124rpx;
+      line-height: 124rpx;
     }
 
     .btn {

+ 6 - 8
miniprogram/pages/downloadPage/index.ts

@@ -16,7 +16,6 @@ Page({
       app.getUser({
         data: {},
         success: (res: any) => {
-          console.log(res);
           if (!res.RESULT) return wx.showToast({
             "title": "视频正在生成中,请耐心等待"
           })
@@ -44,7 +43,6 @@ Page({
               wx.saveVideoToPhotosAlbum({
                 filePath: res.tempFilePath,
                 success: () => {
-                  console.log("--保存成功")
                   wx.showToast({
                     title: "保存成功",
                     icon: "none"
@@ -67,15 +65,15 @@ Page({
   toPAY() {
     app.createOrder({
       success: (res: any) => {
-        console.log('支付:', res);
-        apiPay = true;
         wx.requestPayment({
           timeStamp: res.timeStamp,
           nonceStr: res.nonceStr,
           package: res.package,
           paySign: res.paySign,
           signType: res.signType,
-          success() { },
+          success() {
+            apiPay = true;
+          },
           failL: () => {
             wx.showToast({
               icon: "none",
@@ -106,7 +104,6 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow() {
-    console.log("前台");
     // 如果支付成功则下载视频
     if (apiPay) this.downloadVideo();
   },
@@ -115,7 +112,6 @@ Page({
    * 生命周期函数--监听页面隐藏
    */
   onHide() {
-    console.log("后台");
   },
 
   /**
@@ -145,4 +141,6 @@ Page({
   onShareAppMessage() {
 
   }
-})
+})
+
+export {}

+ 3 - 2
miniprogram/pages/entry/index.ts

@@ -24,7 +24,6 @@ Page({
   },
 
   toFace(){
-    console.log(this.data.phoneNumber)
     if (!this.data.phoneNumber) {
       return wx.showToast({
         "icon": "none",
@@ -133,4 +132,6 @@ Page({
   onShareAppMessage() {
 
   }
-})
+})
+
+export {}

+ 6 - 6
miniprogram/pages/faceRecognition/index.ts

@@ -13,7 +13,7 @@ Page({
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad(opt) {
+  onLoad() {
   },
 
   /**
@@ -122,7 +122,6 @@ Page({
 
     // todo: 添加上传服务器的接口
     const uploadTask = wx.uploadFile({
-      // 仅为示例,非真实的接口地址,视频上传
       url: base.url + '/v3/upload',
       filePath: src,
       name: 'file', //服务器定义的Key值
@@ -130,8 +129,7 @@ Page({
       header: {
         Authorization: wx.getStorageSync("token")
       },
-      success: function (res) {
-        console.log(res)
+      success: function () {
         console.log('视频上传成功')
         wx.showToast({
           title: "人脸采集完成"
@@ -143,9 +141,11 @@ Page({
           })
         }, 2000)
       },
-      fail: function (res) {
-        console.log(res)
+      fail: function (err:any) {
         console.log('接口调用失败')
+        wx.showToast({
+          title: err.message || "人脸采集失败"
+        })
       }
     })
 

+ 5 - 3
miniprogram/pages/faceRecognitionVk/index.ts

@@ -24,7 +24,6 @@ Page({
     this.setData({
       isStartVideo: true
     })
-    let time = Date.now();
     wx.nextTick(() => {
       this.createVK();
       wx.showLoading({
@@ -70,7 +69,7 @@ Page({
     })
 
     createVKSession.on("updateAnchors", anchors => {
-      console.log("检测到人脸")
+      console.log("检测到人脸",anchors)
       if (!this.data.isTranscribe) {
         this.setData({
           isTranscribe: true
@@ -173,6 +172,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad(opt) {
+    console.log(opt)
     const SDKVersion: string = app.globalData.SystemInfo?.SDKVersion || "";
     compareVersion(SDKVersion, '1.9.6');
   },
@@ -224,4 +224,6 @@ Page({
   onShareAppMessage() {
 
   },
-})
+})
+
+export {}

+ 3 - 6
miniprogram/pages/home/index.ts

@@ -8,15 +8,10 @@ Page({
   data: {
   },
 
-  titleLoad(e: WechatMiniprogram.CustomEvent) {
-    console.log(e.detail);
-  },
-
   lvru() {
       app.getUser({
       data: {},
       success: (res: any) => {
-        console.log(res);
         if (!res.RESULT) return wx.showToast({
           "title": "视频正在生成中,请耐心等待"
         })
@@ -94,4 +89,6 @@ Page({
   onShareAppMessage() {
 
   }
-})
+})
+
+export {}

+ 1 - 1
miniprogram/pages/home/index.wxml

@@ -1,6 +1,6 @@
 <!--pages/home/index.wxml-->
 <view class="page">
-  <image class="title" src="../../assets/image/title.png" mode="scaleToFill" bindload="titleLoad"/>
+  <image class="title" src="../../assets/image/title.png" mode="scaleToFill"/>
 
   <view class="buttom"  bindtap="lvru">
     登记选手信息

+ 0 - 3
miniprogram/pages/tool/index.json

@@ -1,3 +0,0 @@
-{
-  "usingComponents": {}
-}

+ 0 - 8
miniprogram/pages/tool/index.scss

@@ -1,8 +0,0 @@
-/* pages/home/index.wxss */
-.home {
-  width: 750rpx;
-  .top{
-    width: 750rpx;
-    margin-bottom: 15rpx;
-  }
-}

+ 0 - 146
miniprogram/pages/tool/index.ts

@@ -1,146 +0,0 @@
-// pages/home/index.ts
-const app = getApp<IAppOption>();
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    height: 0,
-    videoSrc: ""
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad() {
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload() {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh() {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom() {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage() {
-
-  },
-
-
-  loadimage(e: WechatMiniprogram.CustomEvent) {
-    const width: number = e.detail.width;
-    const height: number = e.detail.height;
-    this.setData({
-      height: 750 * (height / width)
-    })
-  },
-
-  getPay() {
-    app.createOrder({
-      success: (res: any) => {
-        console.log('支付:', res);
-        wx.requestPayment({
-          timeStamp: res.timeStamp,
-          nonceStr: res.nonceStr,
-          package: res.package,
-          paySign: res.paySign,
-          signType: res.signType,
-          success(res) {
-            console.log("pay--->", res);
-          },
-          fail(err) {
-            console.log("err---> ", err);
-          }
-        })
-      },
-    })
-
-  },
-  getPhoneNumber(e: WechatMiniprogram.CustomEvent) {
-    console.log(e)
-    app.getPhone({
-      data: {
-        code: e.detail.code
-      },
-      header: {},
-      success: () => { }
-    })
-  },
-  face() {
-    wx.navigateTo({
-      url: "/pages/faceRecognition/index"
-    })
-  },
-  faceVK(){
-    wx.navigateTo({
-      url: "/pages/faceRecognitionVk/index"
-    })
-  },
-  tonamtve() {
-    wx.navigateTo({
-      url: "/pages/index/index"
-    })
-  },
-  getVideo() {
-    app.getVideo({
-      success: (res: any) => {
-        this.setData({
-          videoSrc: res.url
-        });
-        wx.downloadFile({
-          url: res.url,
-          success: (res) =>{
-            wx.saveVideoToPhotosAlbum({
-              filePath: res.tempFilePath,
-              success: () => {
-                wx.showToast({
-                  title: "保存成功",
-                  icon: "none"
-                })
-              }
-            })
-          }
-        })
-      }
-    })
-  },
-})

+ 0 - 12
miniprogram/pages/tool/index.wxml

@@ -1,12 +0,0 @@
-<!--pages/home/index.wxml-->
-<view class="home">
-  <image class="top" style="height:{{height}}rpx" bindload="loadimage" src="../../assets/image/0.jpg" mode="scaleToFill" />
-  <button bindtap="getPay" type="primary">支付</button> 
-  <button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">获取手机号</button>
-  <button bindtap="face" type="primary">人脸录制</button>
-  <button bindtap="faceVK" type="primary">人脸录制vk</button>
-  <button bindtap="getVideo">获得视频</button>
-  <button bindtap="tonamtve" type="primary">index</button>
-
-  <video src="{{videoSrc}}"/>
-</view>

+ 0 - 1
miniprogram/utils/request.ts

@@ -20,7 +20,6 @@ export default function request(params:WechatMiniprogram.requestParamsData) {
     },
     method: params.method || "GET",
     fail: err =>{
-      console.log(err);
       wx.showToast({
         title: err.errMsg || "请稍后再试",
         icon:"none"