配合 amis 实现前端界面显示

This commit is contained in:
shikong 2023-05-31 22:16:24 +08:00
parent 8e186e19ad
commit 6c987e3c0e

View File

@ -45,6 +45,9 @@
},
"columnsCount": 1,
"card": {
"header": {
"title": "<h3>$question</h3>"
},
"body": [
{
"name": "id",
@ -61,18 +64,6 @@
"label": "关键字",
"hidden": true
},
{
"name": "answer",
"label": "答案",
"type": "tpl",
"tpl": "<span><%= data.answerMap.filter((_,index)=>{return (data.answer).toString(2).split('').reverse()[index] == '1'}) %></span>"
},
{
"name": "question",
"label": "题目"
},
{
"name": "media_content",
"label": "图片",
@ -83,44 +74,119 @@
"hiddenOn": "this.media_content == 'None'"
},
{
"name": "option_a",
"label": "A",
"hiddenOn": "this.option_a.length == 0"
"type": "wrapper",
"body": [
{
"type": "tag",
"hiddenOn": "this.option_a.length == 0",
"color": "active",
"displayMode": "rounded",
"style": {
"backgroundColor": "#2468f2",
"borderColor": "#2468f2",
"color": "#fff",
"font-size": "16px"
},
"label": "A. ${option_a}"
},
{
"type": "tag",
"hiddenOn": "this.option_b.length == 0",
"color": "active",
"displayMode": "rounded",
"style": {
"backgroundColor": "#2468f2",
"borderColor": "#2468f2",
"color": "#fff",
"font-size": "16px"
},
"label": "B. ${option_b}"
},
{
"type": "tag",
"hiddenOn": "this.option_c.length == 0",
"color": "active",
"displayMode": "rounded",
"style": {
"backgroundColor": "#2468f2",
"borderColor": "#2468f2",
"color": "#fff",
"font-size": "16px"
},
"label": "C. ${option_c}"
},
{
"type": "tag",
"hiddenOn": "this.option_d.length == 0",
"color": "active",
"displayMode": "rounded",
"style": {
"backgroundColor": "#2468f2",
"borderColor": "#2468f2",
"color": "#fff",
"font-size": "16px"
},
"label": "D. ${option_d}"
},
{
"type": "tag",
"hiddenOn": "this.option_e.length == 0",
"color": "active",
"displayMode": "rounded",
"style": {
"backgroundColor": "#2468f2",
"borderColor": "#2468f2",
"color": "#fff",
"font-size": "16px"
},
"label": "E. ${option_e}"
},
{
"type": "tag",
"hiddenOn": "this.option_f.length == 0",
"color": "active",
"displayMode": "rounded",
"style": {
"backgroundColor": "#2468f2",
"borderColor": "#2468f2",
"color": "#fff",
"font-size": "16px"
},
"label": "F. ${option_f}"
},
{
"type": "tag",
"hiddenOn": "this.option_g.length == 0",
"color": "active",
"displayMode": "rounded",
"style": {
"backgroundColor": "#2468f2",
"borderColor": "#2468f2",
"color": "#fff",
"font-size": "16px"
},
"label": "G. ${option_g}"
},
{
"type": "tag",
"hiddenOn": "this.option_h.length == 0",
"color": "active",
"displayMode": "rounded",
"style": {
"backgroundColor": "#2468f2",
"borderColor": "#2468f2",
"color": "#fff",
"font-size": "16px"
},
"label": "H. ${option_h}"
}
]
},
{
"name": "option_b",
"label": "B",
"hiddenOn": "this.option_b.length == 0"
},
{
"name": "option_c",
"label": "C",
"hiddenOn": "this.option_c.length == 0"
},
{
"name": "option_d",
"label": "D",
"hiddenOn": "this.option_d.length == 0"
},
{
"name": "option_e",
"label": "E",
"hiddenOn": "this.option_e.length == 0"
},
{
"name": "option_f",
"label": "F",
"hiddenOn": "this.option_f.length == 0"
},
{
"name": "option_g",
"label": "G",
"hiddenOn": "this.option_g.length == 0"
},
{
"name": "option_h",
"label": "H",
"hiddenOn": "this.option_h.length == 0"
"name": "answer",
"label": "答案",
"type": "tpl",
"tpl": "<span><%= data.answerMap.filter((_,index)=>{return (data.answer).toString(2).split('').reverse()[index] == '1'}) %></span>"
},
{
"name": "explain",
@ -134,7 +200,8 @@
},
{
"name": "knack",
"label": "窍门"
"label": "窍门",
"hiddenOn": "this.media_content == 'None' || this.media_content.length == 0"
},
{
"name": "concise_explain",