diff --git a/scanner/pages/camera/camera.js b/scanner/pages/camera/camera.js index 77293d7..6757923 100644 --- a/scanner/pages/camera/camera.js +++ b/scanner/pages/camera/camera.js @@ -85,6 +85,7 @@ Page({ }, onLoad(options) { + console.log("camera page load", options); this.setData({ ai_chat_mode: options.ai_chat_mode, }); @@ -284,10 +285,8 @@ Page({ show_result_page(serial_code) { this.busy = true; if (this.data.ai_chat_mode) { - // YYYY-MM-DD HH:MM:SS local time - var time = new Date().toLocaleString(); wx.redirectTo({ - url: '/pages/chat/chat?serial_code=' + serial_code + '&time=' + time, + url: '/pages/chat/chat?serial_code=' + serial_code, }); } else { wx.redirectTo({ diff --git a/scanner/pages/camwebview/camwebview.js b/scanner/pages/camwebview/camwebview.js index 7ff6d8f..9f2acfb 100644 --- a/scanner/pages/camwebview/camwebview.js +++ b/scanner/pages/camwebview/camwebview.js @@ -5,7 +5,7 @@ import { get_phone_model, } from '../../utils.js' -function make_query(zoom) { +function make_query(zoom, ai_chat_mode) { var gd = getApp().globalData; var ret = "zoom=" + zoom; var ui = wx.getStorageSync('userinfo'); @@ -15,6 +15,9 @@ function make_query(zoom) { ret += "&nick_name=" + encodeURIComponent(ui.nickName || ""); ret += "&tenant=" + (gd.tenant_id || ""); ret += "&tk=" + Date.now(); + if (ai_chat_mode) { + ret += "&ai_chat_mode=" + ai_chat_mode; + } console.log(ret); return ret; } @@ -32,11 +35,12 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad(options) { + var ai_chat_mode = options.ai_chat_mode; get_camera_rule(null, (rule) => { // we should have rules loaded, so this is effectively sync, before instantiating Page var zoom = rule.zoom; this.setData({ - emblem_camera_url: "https://themblem.com/camera-4.0/?" + make_query(zoom), + emblem_camera_url: "https://themblem.com/camera-4.0/?" + make_query(zoom, ai_chat_mode), }); }) }, diff --git a/scanner/pages/chat/chat.js b/scanner/pages/chat/chat.js index 6e55412..8972766 100644 --- a/scanner/pages/chat/chat.js +++ b/scanner/pages/chat/chat.js @@ -1,4 +1,8 @@ // pages/chat/chat.js +import { + goto_camera, +} from '../../utils.js' + Page({ /** @@ -43,7 +47,7 @@ Page({ onLoad(options) { this.setData({ serial_code: options.serial_code, - time: options.time, + verify_time: options.time || new Date().toLocaleString(), }); if (options.serial_code) { this.show_verify_result(true); @@ -102,9 +106,7 @@ Page({ }, goto_camera() { - wx.navigateTo({ - url: '/pages/camera/camera?ai_chat_mode=1', - }) + goto_camera(true, "ai_chat_mode=1"); }, show_service() { @@ -188,7 +190,6 @@ Page({ }, show_verify_result(is_first_time) { var serial_code = this.data.serial_code || ""; - var time = this.data.time || "2025-01-01 14:30"; var resp = [ { type: 'text', @@ -220,7 +221,7 @@ Page({ }, { type: 'text', - content: '验证时间: ' + time, + content: '验证时间: ' + this.data.verify_time, }, { type: 'splitline', diff --git a/scanner/utils.js b/scanner/utils.js index 66283e0..74bb1ee 100644 --- a/scanner/utils.js +++ b/scanner/utils.js @@ -75,12 +75,13 @@ function get_camera_rule(max_zoom, cb) { } } -function goto_camera(redirect, force_web_view) { +function goto_camera(redirect, opts) { + var query = opts || ""; get_camera_rule(null, (rule) => { console.log("camera rule:", rule); - var url = "/pages/camera/camera"; - if (rule.web_view || force_web_view) { - var url = "/pages/camwebview/camwebview"; + var url = "/pages/camera/camera?" + query; + if (rule.web_view) { + url = "/pages/camwebview/camwebview?" + query; } if (redirect) { wx.redirectTo({ url });