// pages/chat/chat.js import { goto_camera, } from '../../utils.js' Page({ /** * Page initial data */ data: { show_modal: '', prompt: [], response: [], welcome_response: [ { type: 'text', content: '欢迎使用徵象AI,让每一次验证都成为与品牌的深度对话。' }, { type: 'text', content: '为保障您的权益,本系统采用多模态AI深度鉴真引擎,通过多重校验机制实现智能二维码防伪核验。' }, { type: 'text', content: '请将手机摄像头对准产品智能二维码,' }, { type: 'scanguidecss', }, { type: 'text', content: '保持画面完整覆盖定位点(图示区域), 系统将自动触发高精度图像分割算法完成验证。 ' }, ], prompt_message_verify_result: [ { type: 'text', content: '查看验证结果' }, ], }, /** * Lifecycle function--Called when page load */ onLoad(options) { this.setData({ serial_code: options.serial_code, verify_time: options.time || new Date().toLocaleString(), }); if (options.serial_code) { this.show_verify_result(true); } else { this.show_welcome_response(); } }, /** * Lifecycle function--Called when page is initially rendered */ onReady() { }, /** * Lifecycle function--Called when page show */ onShow() { }, /** * Lifecycle function--Called when page hide */ onHide() { }, /** * Lifecycle function--Called when page unload */ onUnload() { }, /** * Page event handler function--Called when user drop down */ onPullDownRefresh() { }, /** * Called when page reach bottom */ onReachBottom() { }, /** * Called when user click on the top right corner to share */ onShareAppMessage() { }, goto_camera() { goto_camera(true, "ai_chat_mode=1"); }, show_service() { this.setData({ show_modal: 'service', }) }, show_channel() { this.setData({ show_modal: 'channel', }) }, hide_modal() { console.log('hide_modal'); this.setData({ show_modal: '', }) }, show_verify_tech() { this.set_content({ prompt: [ { type: 'text', content: '这个验证结果可信吗?' }, ], response: [ { type: 'text', content: '本次验证使用「Al图像识别+微米级特征对比」T4.2.2模型', classes: 'margin-bottom-10', }, { type: 'text', content: '更新时间:2025年2月27日', classes: 'secondary', }, { type: 'text', content: '1.微观特征捕捉:系统以0.1mm精度扫描二维码的30+项微观特征' }, { type: 'text', content: '2.加密特征匹配:比对云端预存的特征图像代码,误差率万分之一' }, { type: 'text', content: '若对验证结果有疑虑,可通过人工客服通道咨询' }, { type: 'splitline', }, { type: 'text', content: '你可能会问:' }, { type: 'suggestion', title: '重看验证结果', onclick: () => { this.show_verify_result(false); } }, { type: 'suggestion', title: '这个产品怎么样?', onclick: () => { this.show_product_details(); } }, { type: 'suggestion', title: '有什么福利活动吗?', onclick: () => { this.show_promotions(); } } ] }) }, show_verify_result(is_first_time) { var serial_code = this.data.serial_code || ""; var resp = [ { type: 'text', content: '正在生成您的专属验真档案...' }, { type: 'text', content: '验真结论:', classes: 'margin-bottom-10', }, { type: 'text', content: '正品认证通过!', mark: 'tick', }, { type: 'text', content: '经系统比对,您扫描的【徵象AI体验码】产品二维码为官方认证正品,可放心使用。' }, { type: 'text', content: '验证编码: ' + serial_code, classes: 'margin-bottom-10 link', onclick: () => { wx.navigateTo({ url: '/pages/productinfo/productinfo?serial_code=' + serial_code, }); } }, { type: 'text', content: '验证时间: ' + this.data.verify_time, }, { type: 'splitline', }, { type: 'text', classes: 'secondary', content: '你可能会问:' }, { type: 'suggestion', title: '这个验证结果可信吗?', onclick: () => { this.show_verify_tech(); } }, { type: 'suggestion', title: '这个产品怎么样?', onclick: () => { this.show_product_details(); } }, { type: 'suggestion', title: '有什么福利活动吗?', onclick: () => { this.show_promotions(); } }, ] var prompt = is_first_time ? [] : [{ type: 'text', content: '查看验证结果' }]; this.set_content({ prompt: prompt, response: resp, }) }, show_welcome_response() { this.set_content({ prompt: [], response: this.data.welcome_response, }) }, show_product_details() { var resp = [ { type: 'text', content: '微象AI是由「广州市诚投科技有限公司」开发的AI驱动的智能防伪平台。' }, { type: 'text', content: '通过「多模态特征识别」构建新一代防伪验证体系,实现从物理防伪到数字认证的全链路保护。系统采用ISO 12931国际防伪标准,已获取国家发明专利(证书编号:CN 115222000 B)。' }, { type: 'text', content: '应用场景', classes: 'margin-bottom-10 bold', }, { type: 'text', content: '1.商品防伪', classes: 'margin-bottom-10 bold', }, { type: 'text', content: '2.证件安全验证', classes: 'margin-bottom-10 bold', }, { type: 'text', content: '3.工业品防伪', classes: 'bold', }, { type: 'splitline', }, { type: 'text', content: '你可能会问:', classes: 'secondary', }, { type: 'suggestion', title: '重看验证结果', onclick: () => { this.show_verify_result(false); } }, { type: 'suggestion', title: '这个验证结果可信吗?', onclick: () => { this.show_verify_tech(); } }, { type: 'suggestion', title: '有什么福利活动吗?', onclick: () => { this.show_promotions(); } } ] this.set_content({ prompt: [{ type: 'text', content: '这个产品怎么样' }], response: resp, }) }, show_promotions() { var resp = [ { type: 'text', content: '感谢您选择正品!为保障权益,建议:' }, { type: 'text', content: '·关注品牌公众号', classes: 'margin-bottom-10', }, { type: 'text', content: '·定期访问「会员中心」查看产品溯源信息', classes: 'margin-bottom-10', }, { type: 'text', content: '·参与【正品守护计划】赢取专属福利' }, { type: 'text', content: '若发现异常验证结果,请立即通过官方客服通道举报' }, { type: 'splitline', }, { type: 'text', content: '你可能会问:', classes: 'secondary', }, { type: 'suggestion', title: '重看验证结果', onclick: () => { this.show_verify_result(false); } }, { type: 'suggestion', title: '这个产品怎么样?', onclick: () => { this.show_product_details(); } }, { type: 'suggestion', title: '这个验证结果可信吗?', onclick: () => { this.show_verify_tech(); } } ] this.set_content({ prompt: [{ type: 'text', content: '有什么福利活动吗?' }], response: resp, }) }, set_content({prompt, response}) { this.setData({ prompt: prompt, response: response, }) this.selectComponent('#response').restart_content_output(); var x = this.selectComponent('#prompt'); if (x) { x.restart_content_output(); } } })