收藏
回答

真机调试可以,编译预览不行

框架类型 问题类型 操作系统 工具版本
小程序 Bug Windows 1.02.1904090

- 当前 Bug 的表现(可附上截图)



点击预览,生成二维码,扫描进去,页面不动,如下:



真机的可以


- 预期表现

编译应该要和真机一样啊,为啥真机可以,编译却不行呢?


- 复现路径


- 提供一个最简复现 Demo


回答关注问题邀请回答
收藏

2 个回答

  • 禾店科技
    禾店科技
    2021-05-12

    问题解决了吗?

    2021-05-12
    有用 1
    回复 1
    • sonam
      sonam
      2021-12-04
      知道怎么解决吗
      2021-12-04
      回复
  • 是小白啊
    是小白啊
    2019-06-24

    麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

    2019-06-24
    有用
    回复 7
    • Borago
      Borago
      2019-06-24

      你好:

      具体机型:苹果7

      微信版本号:7.0.4

      系统版本号:IOS 12.3.1

      // pages/face.js

      var strat_num = 1,

      end_num = 80;

      var sAngle = 1.5 * Math.PI,

      eAngle = 0;


      const API = require('../../utils/api.js')

      const Util = require('../../utils/util')

      let interval = null

      Page({


      /**

        * 页面的初始数据

        */

      data: {

      colors: ['gray', 'red', 'blue', 'yellow', 'green', 'orange', 'white'],

      curIdx: 0,

      token: '',

      showText: '请正脸看向屏幕',

      type: 'normal',

      showCamera: false

      },


      /**

        * 生命周期函数--监听页面加载

        */

      onLoad: async function (options) {

      console.log('face')

      strat_num = 1

      end_num = 80

      sAngle = 1.5 * Math.PI

      eAngle = 0

      wx.setScreenBrightness({

      value: 1,

      })

      if(options.type == 'light') {

      this.setData({

      type: 'light'

      })

      }

      this.context = wx.createCanvasContext('canvasid')

      let token = await API.getToken()

      this.setData({

      token: token.access_token

      })

      setTimeout(() => {

      this.takePhoto()

      this.setData({

      showCamera: true

      })

      },1000)

      },

      canvas() {

      if (strat_num <= end_num) {

      console.log('strat_num:', strat_num)

      eAngle = strat_num * 2 * Math.PI / end_num + 1.5 * Math.PI;

      setTimeout(() => {

      this.context.setStrokeStyle("#00ff00")

      this.context.setLineWidth(6)

      this.context.arc(100, 100, 97, sAngle, eAngle, false)

      this.context.stroke()

      this.context.draw()

      this.canvas()

      strat_num++

      }, 20)

      } else {

      console.log('strat_num_end:', strat_num)

      }

      },

      async takePhoto() {

      console.log(1)

      let showText = '请正脸看向屏幕'

      let over = false

      let ctx = wx.createCameraContext()

      try {

      let path = await Util.takePhoto(ctx)

      console.log(path)

      let base64 = await Util.readBase64(path)

      let faceRes = await API.detectFace(this.data.token, base64)

      if (faceRes.result) {

      over = true

      this.canvas()

      Util.startRecord(ctx)

      if (this.data.type == 'light') {

      showText = '即将闪光验证'

      setInterval(() => {

      let { curIdx, colors } = this.data

      this.setData({

      curIdx: curIdx == colors.length - 1 ? 0 : curIdx + 1

      })

      }, 1000)

      } else {

      showText = '请点点头'

      }

      setTimeout(async () => {

      wx.showToast({

      title: '正在保存视频',

      })

      let { tempVideoPath } = await Util.stopRecord(ctx)

      console.log(tempVideoPath)

      wx.showToast({

      title: '保存成功',

      })

      wx.navigateBack()

      }, 3000)

      }

      }catch(e) {

      console.log(e)

      }

      console.log(2)

      if(!over) {

      console.log(3)

      // setTimeout(this.takePhoto, 500);

      this.takePhoto()

      }

      this.setData({

      showText

      })


      // wx.showToast({

      //   title: faceRes.result.face_num + '个人脸',

      // })

      },

      /**

        * 生命周期函数--监听页面初次渲染完成

        */

      onReady: function () {


      },


      /**

        * 生命周期函数--监听页面显示

        */

      onShow: function () {


      },


      /**

        * 生命周期函数--监听页面隐藏

        */

      onHide: function () {


      },


      /**

        * 生命周期函数--监听页面卸载

        */

      onUnload: function () {


      },


      /**

        * 页面相关事件处理函数--监听用户下拉动作

        */

      onPullDownRefresh: function () {


      },


      /**

        * 页面上拉触底事件的处理函数

        */

      onReachBottom: function () {


      },


      /**

        * 用户点击右上角分享

        */

      onShareAppMessage: function () {


      }

      })



      2019-06-24
      回复
    • 是小白啊
      是小白啊
      2019-06-24回复Borago

      代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)这个代码片段

      2019-06-24
      回复
    • Borago
      Borago
      2019-06-24回复是小白啊

      https://developers.weixin.qq.com/s/D5IQZmmA7f9S,麻烦看下

      2019-06-24
      回复
    • 是小白啊
      是小白啊
      2019-06-24回复Borago

      开启右上角调试,域名配置好了吗?

      2019-06-24
      回复
    • Borago
      Borago
      2019-06-24回复是小白啊



      我现在是真机调试OK,出来二维码扫描进去一切OK,如上图。


      问题是:点击预览的二维码进入后没反应,你可以用我的分享那个测试,如下图:



      开启右上角调试,域名配置好了吗?------你说的这个我没懂啥意思,不是可以勾选不用域名的么?

      我刚配置了一个也不行



      2019-06-24
      回复
    查看更多(2)
登录 后发表内容