Files
陈誉午 994b267f5c feat: 电子药箱小程序 - 4Tab药品管理
- 电子药箱: 药品库存管理 + 手动录入 + 今日用药打卡
- 药品百科: 搜索 + 分类筛选 + 20种药品静态数据
- 惠教中心: 4条药品使用指南课程
- 我的: 家庭成员信息管理
- 自定义TabBar + navigation-bar组件
- SVG药品分类插图
2026-07-29 11:20:52 +08:00

101 lines
5.1 KiB
Plaintext

<wxs module="m1">
var getMax = function(array, str) {
return array ? array.indexOf(str) > -1 : false;
}
module.exports.getMax = getMax;
</wxs>
<Drawer id='quiz-drawer' custom-drawer="quiz-drawer" needCancel="{{false}}" bind:myCancel="myCancel">
<view class="quiz-drawer-wrap {{useDarkTheme ? 'quiz-drawer-wrap-dark' : ''}}">
<!-- <mp-loading show="{{loading}}" class="quiz-loading" /> -->
<view class="quiz-content-wrap">
<!-- 标题 -->
<view class="quiz-title-wrap" wx:if="{{data}}">
<view class="quiz-sub-title">
[{{data.QuizTitleType === 0 ? '单选' : '多选'}}]
<mp-icon bindtap="closeQuizDrawer" icon="close" color="#939aa3" size="{{20}}" class="close drawer-close-shadow" />
</view>
<view class="quiz-title">
{{data.QuizTitle}}
</view>
</view>
<view class="quiz-content">
<!-- 答题结果 -->
<view wx:if="{{isShowResult && data}}" class="quiz-result-wrapper {{data.IsRight ? 'quiz-is-right' : ''}}">
<view >
正确答案:<view class="quiz-right-answer">{{data.RightOptions}}</view>
</view>
<view >你的答案:
<view class="quiz-answer">{{data.SubmitOptions}}</view>
</view>
<view wx:if="{{data.QuizAnalysis}}" className="quiz-explain">答案解析:{{data.QuizAnalysis}}</view>
</view>
<scroll-view scroll-y class="quiz-options-scroll">
<!-- 答题表单 -->
<form>
<!-- 单选 -->
<view wx:if="{{data && data.QuizTitleType === 0}}" class="page-section page-section-gap">
<radio-group bindchange="valueChange" >
<label class="quiz-option-wrapper" wx:for="{{data.QuizOptions || []}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<radio class="quiz-option-radio" disabled="{{isDisableForm}}" value="{{item.OptionSite}}" checked="{{formValue[0] === item.OptionSite}}" color="#3370ff"/>
<view class="quiz-option-text">
{{item.OptionSite}}. {{item.OptionName}}
<view wx:if="{{isShowResult}}" class="quiz-progress-container">
<view class="quiz-progress-container-text">
<view>{{item.OptionCount || 0}}人</view>
<view>{{item.OptionPercent || 0}}%</view>
</view>
<progress percent="{{item.OptionPercent || 0}}" border-radius="6" backgroundColor="{{useDarkTheme ? '#37383a' : '#f0f1f2'}}" activeColor="#3370ff" stroke-width="6" />
</view>
</view>
</label>
</radio-group>
</view>
<!-- 多选 -->
<view wx:if="{{data && data.QuizTitleType === 1}}" class="page-section page-section-gap">
<checkbox-group bindchange="valueChange">
<label class="quiz-option-wrapper {{m1.getMax(formValue, item.OptionSite) ? 'quiz-option-wrapper-checked' : ''}}" wx:for="{{data.QuizOptions || []}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<checkbox disabled="{{isDisableForm}}" value="{{item.OptionSite}}" checked="{{m1.getMax(formValue, item.OptionSite)}}" color="#3370ff"/>
<view class="quiz-option-text">
{{item.OptionSite}}. {{item.OptionName}}
<view wx:if="{{isShowResult}}" class="quiz-progress-container">
<view class="quiz-progress-container-text">
<view>{{item.OptionCount || 0}}人</view>
<view>{{item.OptionPercent || 0}}%</view>
</view>
<progress percent="{{item.OptionPercent || 0}}" border-radius="6" backgroundColor="{{useDarkTheme ? '#37383a' : '#f0f1f2'}}" activeColor="#3370ff" stroke-width="6" />
</view>
</view>
</label>
</checkbox-group>
</view>
</form>
</scroll-view>
</view>
</view>
<!-- footer -->
<view class="quiz-footer">
<view class="quiz-footer-tip" wx:if="{{!isShowResult && data.QuizResultType === 2 && isSubmitted}}">
<view class="quiz-footer-wait-tip">等待公布答案</view>
</view>
<view class="quiz-footer-tip {{isDownWarn ? 'quiz-footer-tip-warn' : ''}}" wx:if="{{!isShowResult && data.QuizResultType !== 2}}">
<image src="{{isDownWarn ? '../../../assets/alarmWarn.svg' : '../../../assets/alarm.svg'}}" />
距答题截止
<count-down
type="quiz"
wx:if="{{data.SendTime}}"
sendTime="{{data.SendTime}}"
deadLine="{{data.Deadline / 60}}"
isDownWarn="{{isDownWarn}}"
bind:onCountDown="onCountDown" bind:onCountDownWarn="onCountDownWarn"/>
</view>
<button
loading="{{isSubmitting}}"
disabled="{{statusDisabled}}"
class="quiz-footer-button {{statusDisabled ? 'quiz-footer-button-disabled' : ''}}"
type="primary"
bindtap="formSubmit"
>{{statusText}}</button>
</view>
</view>
</Drawer>