| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- @using EasyTemplate.Service
- <div class="card-container">
- <div class="icon-section">
- <img src=@IconUrl alt="功能图标" />
- </div>
- <div class="text-section">
- <div class="bottom-text">@BottomText</div>
- </div>
- <div class="right-section">
- <div class="right-line-one">@NozNo 号枪</div>
- <div class="right-line-two">@VLR</div>
- <div class="right-line-three">@OilName</div>
- </div>
- </div>
- @code {
- public string IconUrl { get; set; } = "img/nozzle.png";
- //[Parameter] public string IconAltText { get; set; } = "功能图标";
- //[Parameter] public string TopText { get; set; } = "默认标题";
- [Parameter] public int warnstate { get; set; } = 0;
- [Parameter] public int nozzlestate { get; set; } = 0;
- [Parameter] public string BottomText { get; set; } = "";
- [Parameter] public string NozNo { get; set; } = "行1";
- [Parameter] public string VLR { get; set; } = "行2";
- [Parameter] public string OilName { get; set; } = "行3";
- protected override void OnParametersSet()
- {
- RecalculateInternalValues();
- }
- private void RecalculateInternalValues()
- {
- if (nozzlestate == Tool.NozzleState_Offline)
- {
- IconUrl = "img/nozzle-offline.png";
- }
- else if (nozzlestate == Tool.NozzleState_Idle)
- {
- IconUrl = "img/nozzle-idle.png";
- }
- else if (nozzlestate == Tool.NozzleState_Filling)
- {
- IconUrl = "img/nozzle-filling.png";
- }
- else
- {
- IconUrl = "img/nozzle-offline.png";
- }
- }
- }
- <style>
- .card-container {
- width: 90px;
- height: 65px;
- position: relative;
- /* border: 1px solid #e0e0e0; */
- border-radius: 6px;
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
- font-family: Arial, sans-serif;
- }
- .icon-section {
- position: absolute;
- top: 0;
- left: 0;
- width: 54px;
- height: 54px;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .icon-section img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- border-top-left-radius: 6px;
- }
- .text-section {
- position: absolute;
- bottom: 0;
- left: 0;
- padding: 4px;
- }
- .bottom-text {
- font-size: 10px;
- color: #666;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .right-section {
- position: absolute;
- top: 0;
- right: 0;
- padding: 2px 4px;
- text-align: right;
- width: calc(100% - 32px);
- }
- .right-line-one,
- .right-line-two,
- .right-line-three {
- font-size: 10px;
- color: #444;
- line-height: 1.3;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- </style>
|