scanner/chat: Fix goto camera
This commit is contained in:
parent
25e5c40397
commit
d1f38e868b
@ -85,6 +85,7 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
console.log("camera page load", options);
|
||||||
this.setData({
|
this.setData({
|
||||||
ai_chat_mode: options.ai_chat_mode,
|
ai_chat_mode: options.ai_chat_mode,
|
||||||
});
|
});
|
||||||
@ -284,10 +285,8 @@ Page({
|
|||||||
show_result_page(serial_code) {
|
show_result_page(serial_code) {
|
||||||
this.busy = true;
|
this.busy = true;
|
||||||
if (this.data.ai_chat_mode) {
|
if (this.data.ai_chat_mode) {
|
||||||
// YYYY-MM-DD HH:MM:SS local time
|
|
||||||
var time = new Date().toLocaleString();
|
|
||||||
wx.redirectTo({
|
wx.redirectTo({
|
||||||
url: '/pages/chat/chat?serial_code=' + serial_code + '&time=' + time,
|
url: '/pages/chat/chat?serial_code=' + serial_code,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
wx.redirectTo({
|
wx.redirectTo({
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import {
|
|||||||
get_phone_model,
|
get_phone_model,
|
||||||
} from '../../utils.js'
|
} from '../../utils.js'
|
||||||
|
|
||||||
function make_query(zoom) {
|
function make_query(zoom, ai_chat_mode) {
|
||||||
var gd = getApp().globalData;
|
var gd = getApp().globalData;
|
||||||
var ret = "zoom=" + zoom;
|
var ret = "zoom=" + zoom;
|
||||||
var ui = wx.getStorageSync('userinfo');
|
var ui = wx.getStorageSync('userinfo');
|
||||||
@ -15,6 +15,9 @@ function make_query(zoom) {
|
|||||||
ret += "&nick_name=" + encodeURIComponent(ui.nickName || "");
|
ret += "&nick_name=" + encodeURIComponent(ui.nickName || "");
|
||||||
ret += "&tenant=" + (gd.tenant_id || "");
|
ret += "&tenant=" + (gd.tenant_id || "");
|
||||||
ret += "&tk=" + Date.now();
|
ret += "&tk=" + Date.now();
|
||||||
|
if (ai_chat_mode) {
|
||||||
|
ret += "&ai_chat_mode=" + ai_chat_mode;
|
||||||
|
}
|
||||||
console.log(ret);
|
console.log(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -32,11 +35,12 @@ Page({
|
|||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
var ai_chat_mode = options.ai_chat_mode;
|
||||||
get_camera_rule(null, (rule) => {
|
get_camera_rule(null, (rule) => {
|
||||||
// we should have rules loaded, so this is effectively sync, before instantiating Page
|
// we should have rules loaded, so this is effectively sync, before instantiating Page
|
||||||
var zoom = rule.zoom;
|
var zoom = rule.zoom;
|
||||||
this.setData({
|
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),
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,4 +1,8 @@
|
|||||||
// pages/chat/chat.js
|
// pages/chat/chat.js
|
||||||
|
import {
|
||||||
|
goto_camera,
|
||||||
|
} from '../../utils.js'
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -43,7 +47,7 @@ Page({
|
|||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.setData({
|
this.setData({
|
||||||
serial_code: options.serial_code,
|
serial_code: options.serial_code,
|
||||||
time: options.time,
|
verify_time: options.time || new Date().toLocaleString(),
|
||||||
});
|
});
|
||||||
if (options.serial_code) {
|
if (options.serial_code) {
|
||||||
this.show_verify_result(true);
|
this.show_verify_result(true);
|
||||||
@ -102,9 +106,7 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
goto_camera() {
|
goto_camera() {
|
||||||
wx.navigateTo({
|
goto_camera(true, "ai_chat_mode=1");
|
||||||
url: '/pages/camera/camera?ai_chat_mode=1',
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
show_service() {
|
show_service() {
|
||||||
@ -188,7 +190,6 @@ Page({
|
|||||||
},
|
},
|
||||||
show_verify_result(is_first_time) {
|
show_verify_result(is_first_time) {
|
||||||
var serial_code = this.data.serial_code || "";
|
var serial_code = this.data.serial_code || "";
|
||||||
var time = this.data.time || "2025-01-01 14:30";
|
|
||||||
var resp = [
|
var resp = [
|
||||||
{
|
{
|
||||||
type: 'text',
|
type: 'text',
|
||||||
@ -220,7 +221,7 @@ Page({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'text',
|
type: 'text',
|
||||||
content: '验证时间: ' + time,
|
content: '验证时间: ' + this.data.verify_time,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'splitline',
|
type: 'splitline',
|
||||||
|
|||||||
@ -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) => {
|
get_camera_rule(null, (rule) => {
|
||||||
console.log("camera rule:", rule);
|
console.log("camera rule:", rule);
|
||||||
var url = "/pages/camera/camera";
|
var url = "/pages/camera/camera?" + query;
|
||||||
if (rule.web_view || force_web_view) {
|
if (rule.web_view) {
|
||||||
var url = "/pages/camwebview/camwebview";
|
url = "/pages/camwebview/camwebview?" + query;
|
||||||
}
|
}
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
wx.redirectTo({ url });
|
wx.redirectTo({ url });
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user