diff --git a/scanner/app.json b/scanner/app.json index f4592b1..a16941b 100644 --- a/scanner/app.json +++ b/scanner/app.json @@ -9,7 +9,8 @@ "pages/productinfo/productinfo", "pages/test/test", "pages/article/article", - "pages/nav/nav" + "pages/nav/nav", + "pages/chat/chat" ], "window": { "backgroundTextStyle": "light", diff --git a/scanner/components/contentstream/contentstream.js b/scanner/components/contentstream/contentstream.js new file mode 100644 index 0000000..f797d86 --- /dev/null +++ b/scanner/components/contentstream/contentstream.js @@ -0,0 +1,80 @@ +// components/contentstream/contentstream.js +Component({ + + /** + * Component properties + */ + properties: { + content: { + type: Array, + value: [] + } + }, + + /** + * Component initial data + */ + data: { + visible_content: [], + next_index: 0, + next_offset: 0, + }, + + /** + * Component methods + */ + methods: { + update_visible_content() { + if (this.data.next_index >= this.properties.content.length) { + clearInterval(this.update_interval); + return; + } + var next_entry = this.properties.content[this.data.next_index]; + if (next_entry.type != 'text') { + // just add the next entry to the visible content + this.setData({ + visible_content: this.data.visible_content.concat(next_entry), + next_index: this.data.next_index + 1, + next_offset: 0 + }); + return; + } + if (this.data.next_offset >= next_entry.content.length) { + // end of current entry, move to the next entry + this.setData({ + next_index: this.data.next_index + 1, + next_offset: 0, + }) + return; + } + // here we have some remaining text to add to the last visible content + if (this.data.next_offset == 0) { + this.setData({ + visible_content: this.data.visible_content.concat({ + type: 'text', + content: "", + }) + }); + } + var last_visible_entry = this.data.visible_content[this.data.visible_content.length - 1]; + var new_text = next_entry.content.slice(this.data.next_offset, this.data.next_offset + 1); + last_visible_entry.content = last_visible_entry.content + new_text; + this.setData({ + visible_content: this.data.visible_content.slice(0, this.data.visible_content.length - 1).concat(last_visible_entry), + next_offset: this.data.next_offset + 1, + }); + } + + }, + ready() { + console.log('onShow', this.data.next_index, this.data.next_offset); + setTimeout(() => { + this.update_interval = setInterval(() => { + this.update_visible_content(); + }, 50); + }, 500); + }, + detached() { + clearInterval(this.update_interval); + } +}) \ No newline at end of file diff --git a/scanner/components/contentstream/contentstream.json b/scanner/components/contentstream/contentstream.json new file mode 100644 index 0000000..cebc0b6 --- /dev/null +++ b/scanner/components/contentstream/contentstream.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "scanguidecss": "/components/scanguidecss/scanguidecss" + } +} \ No newline at end of file diff --git a/scanner/components/contentstream/contentstream.wxml b/scanner/components/contentstream/contentstream.wxml new file mode 100644 index 0000000..22b77a2 --- /dev/null +++ b/scanner/components/contentstream/contentstream.wxml @@ -0,0 +1,13 @@ + + + + + + + {{ item.content }} + + + + + + \ No newline at end of file diff --git a/scanner/components/contentstream/contentstream.wxss b/scanner/components/contentstream/contentstream.wxss new file mode 100644 index 0000000..1698589 --- /dev/null +++ b/scanner/components/contentstream/contentstream.wxss @@ -0,0 +1,31 @@ + +.item { + display: flex; + margin: 30rpx; +} + +.item .icon { + display: inline-block; + margin-right: 30rpx; +} + +.icon image { + width: 80rpx; + height: 80rpx; +} + +.item .content { + display: inline-block; + min-height: 80rpx; +} + +.content text { + display: block; + margin-bottom: 40rpx; + font-size: 35rpx; + margin-right: 20rpx; +} + +.content view.media { + margin-bottom: 40rpx; +} \ No newline at end of file diff --git a/scanner/components/scanguidecss/scanguidecss.js b/scanner/components/scanguidecss/scanguidecss.js index 6ad2e47..12cf6c7 100644 --- a/scanner/components/scanguidecss/scanguidecss.js +++ b/scanner/components/scanguidecss/scanguidecss.js @@ -5,7 +5,10 @@ Component({ * Component properties */ properties: { - + hide_title: { + type: Boolean, + value: false + } }, /** diff --git a/scanner/components/scanguidecss/scanguidecss.wxml b/scanner/components/scanguidecss/scanguidecss.wxml index af54f53..946d61a 100644 --- a/scanner/components/scanguidecss/scanguidecss.wxml +++ b/scanner/components/scanguidecss/scanguidecss.wxml @@ -1,5 +1,5 @@ - + 移近一点 @@ -13,7 +13,7 @@ 采集完成 - + diff --git a/scanner/components/scanguidecss/scanguidecss.wxss b/scanner/components/scanguidecss/scanguidecss.wxss index 6af64c1..0fd0021 100644 --- a/scanner/components/scanguidecss/scanguidecss.wxss +++ b/scanner/components/scanguidecss/scanguidecss.wxss @@ -66,6 +66,9 @@ width: 100%; box-sizing: border-box; height: 400rpx; +} + +.scan.with-title { top: 80rpx; } diff --git a/scanner/pages/chat/chat.js b/scanner/pages/chat/chat.js new file mode 100644 index 0000000..1712ebb --- /dev/null +++ b/scanner/pages/chat/chat.js @@ -0,0 +1,92 @@ +// pages/chat/chat.js +Page({ + + /** + * Page initial data + */ + data: { + initial_message: [ + { + type: 'text', + content: '欢迎使用徵象AI,让每一次验证都成为与品牌的深度对话。' + }, + { + type: 'text', + content: '为保障您的权益,本系统采用多模态AI深度鉴真引擎,通过多重校验机制实现智能二维码防伪核验。' + }, + { + type: 'text', + content: '请将手机摄像头对准产品智能二维码,' + }, + { + type: 'scanguidecss', + }, + { + type: 'text', + content: '保持画面完整覆盖定位点(图示区域), 系统将自动触发高精度图像分割算法完成验证。 ' + }, + ] + }, + + /** + * Lifecycle function--Called when page load + */ + onLoad(options) { + + }, + + /** + * 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() { + wx.navigateTo({ + url: '/pages/camera/camera', + }) + } +}) \ No newline at end of file diff --git a/scanner/pages/chat/chat.json b/scanner/pages/chat/chat.json new file mode 100644 index 0000000..a197071 --- /dev/null +++ b/scanner/pages/chat/chat.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "contentstream": "/components/contentstream/contentstream" + }, + "navigationBarTitleText": "徵象AI" +} \ No newline at end of file diff --git a/scanner/pages/chat/chat.wxml b/scanner/pages/chat/chat.wxml new file mode 100644 index 0000000..27971d2 --- /dev/null +++ b/scanner/pages/chat/chat.wxml @@ -0,0 +1,13 @@ + + + + + + + 开启AI验证 + + + + + + \ No newline at end of file diff --git a/scanner/pages/chat/chat.wxss b/scanner/pages/chat/chat.wxss new file mode 100644 index 0000000..5798a97 --- /dev/null +++ b/scanner/pages/chat/chat.wxss @@ -0,0 +1,45 @@ +.chatlog { + width: 750rpx; + height: calc(100vh - 200rpx); + margin-top: 40rpx; +} + +.chatinput { + position: fixed; + bottom: 0; + width: 750rpx; + height: 200rpx; +} + +.chatinput .inputbox { + display: flex; + margin: 30rpx; + height: 120rpx; + border-radius: 60rpx; + background: #eee; + flex-direction: row; + align-items: center; + justify-content: space-between; + padding: 0 20rpx; +} + +.chatinput .placeholder { + font-size: 38rpx; + flex: 1; + display: flex; + align-items: center; + padding-left: 30rpx; +} + +.chatinput .icon { + width: 100rpx; + height: 100rpx; + display: flex; + align-items: center; + justify-content: center; +} + +.chatinput .icon .up { + width: 80rpx; + height: 80rpx; +} \ No newline at end of file diff --git a/scanner/project.private.config.json b/scanner/project.private.config.json index 67f8ad4..b14be75 100644 --- a/scanner/project.private.config.json +++ b/scanner/project.private.config.json @@ -2,6 +2,13 @@ "condition": { "miniprogram": { "list": [ + { + "name": "chat", + "pathName": "pages/chat/chat", + "query": "", + "launchMode": "default", + "scene": null + }, { "name": "camera (dev)", "pathName": "pages/camera/camera", diff --git a/scanner/static/up-button.png b/scanner/static/up-button.png new file mode 100644 index 0000000..06f078e Binary files /dev/null and b/scanner/static/up-button.png differ