scanner: support start button customize
This commit is contained in:
parent
002e2a9f26
commit
811cb1715c
@ -17,6 +17,8 @@ Page({
|
|||||||
userInfo: {},
|
userInfo: {},
|
||||||
content: {},
|
content: {},
|
||||||
background_style: '',
|
background_style: '',
|
||||||
|
scan_button_text: '开启AI验证',
|
||||||
|
scan_button_style: '',
|
||||||
},
|
},
|
||||||
goto_link(e) {
|
goto_link(e) {
|
||||||
var link = e.currentTarget.dataset.link;
|
var link = e.currentTarget.dataset.link;
|
||||||
@ -42,6 +44,7 @@ Page({
|
|||||||
this.patch_url([c.video]);
|
this.patch_url([c.video]);
|
||||||
this.patch_url(c.icons);
|
this.patch_url(c.icons);
|
||||||
this.patch_url(c.static);
|
this.patch_url(c.static);
|
||||||
|
this.gen_scan_button_props(c);
|
||||||
return c;
|
return c;
|
||||||
},
|
},
|
||||||
load_content(tenant_id, code) {
|
load_content(tenant_id, code) {
|
||||||
@ -129,6 +132,32 @@ Page({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
gen_scan_button_props: function(content) {
|
||||||
|
var scan_button = content.scan_button;
|
||||||
|
var text = '开启AI验证';
|
||||||
|
var style = '';
|
||||||
|
|
||||||
|
if (scan_button) {
|
||||||
|
if (scan_button.text) {
|
||||||
|
text = scan_button.text;
|
||||||
|
}
|
||||||
|
|
||||||
|
var styles = [];
|
||||||
|
if (scan_button.color) {
|
||||||
|
styles.push('background-color: ' + scan_button.color);
|
||||||
|
}
|
||||||
|
if (scan_button.text_color) {
|
||||||
|
styles.push('color: ' + scan_button.text_color);
|
||||||
|
}
|
||||||
|
style = styles.join('; ');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setData({
|
||||||
|
scan_button_text: text,
|
||||||
|
scan_button_style: style,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
gen_background_style: function(content) {
|
gen_background_style: function(content) {
|
||||||
var bg = content.background;
|
var bg = content.background;
|
||||||
var ret = '';
|
var ret = '';
|
||||||
|
|||||||
@ -23,7 +23,7 @@ loading...
|
|||||||
<text>{{ item.title }}</text>
|
<text>{{ item.title }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<button bindtap="goto_camera" class="primary button">开启AI验证</button>
|
<button bindtap="goto_camera" class="primary button" style="{{ scan_button_style }}">{{ scan_button_text }}</button>
|
||||||
</view>
|
</view>
|
||||||
<view class="bottom">
|
<view class="bottom">
|
||||||
<image wx:for="{{ content.static }}" wx:key="index"
|
<image wx:for="{{ content.static }}" wx:key="index"
|
||||||
|
|||||||
@ -3,9 +3,9 @@
|
|||||||
"miniprogram": {
|
"miniprogram": {
|
||||||
"list": [
|
"list": [
|
||||||
{
|
{
|
||||||
"name": "index-with-q",
|
"name": "index-with-q-code-1279885739283",
|
||||||
"pathName": "pages/index/index",
|
"pathName": "pages/index/index",
|
||||||
"query": "q=https%3A%2F%2Fthemblem.com%2Fapi%2Fmini-prog-entry%2F%3Fcode%3D1292648384767%0A",
|
"query": "q=https%3A%2F%2Fthemblem.com%2Fapi%2Fmini-prog-entry%2F%3Fcode%3D1279885739283%0A",
|
||||||
"scene": null,
|
"scene": null,
|
||||||
"launchMode": "default"
|
"launchMode": "default"
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user