起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

楼主: Masion

利用BeX5做随机抽取试题的考试系统

  [复制链接]

377

主题

2594

帖子

5117

积分

论坛元老

Rank: 8Rank: 8

积分
5117
QQ
 楼主| 发表于 2016-11-12 10:13:17 | 显示全部楼层
题库维护详细页的.w源码
  1. <?xml version="1.0" encoding="utf-8"?>

  2. <div xmlns="http://www.w3.org/1999/xhtml" xid="window" class="window" component="$UI/system/components/justep/window/window"
  3.   design="device:pc;">  
  4.   <div component="$UI/system/components/justep/model/model" xid="model" style="height:auto;top:24px;left:163px;" onParamsReceive="modelParamsReceive">
  5.     <div component="$UI/system/components/justep/data/bizData" xid="mainData"
  6.       directDelete="true" autoLoad="false" concept="YG_examBank" columns="" limit="20"
  7.       orderBy="fIndex asc,fType asc">
  8.       <reader action="/YGS/masion/logic/action/queryYG_examBankAction" xid="default1"/>  
  9.       <writer action="/YGS/masion/logic/action/saveYG_examBankAction" xid="default2"/>  
  10.       <creator action="/YGS/masion/logic/action/createYG_examBankAction" xid="default3"/>  
  11.       <calculateRelation relation="calcCheckBox" xid="calculateRelation1"/>  
  12.       <rule xid="rule1">
  13.         <col name="fType" xid="ruleCol1">
  14.           <required xid="required1">
  15.             <expr xid="default7">true</expr>
  16.           </required>
  17.         </col>
  18.       </rule>
  19.     </div>  
  20.     <div component="$UI/system/components/justep/data/bizData" autoLoad="true"
  21.       xid="typeData" concept="YG_BasicInfor">
  22.       <reader xid="default4" action="/YGS/masion/logic/action/queryYG_BasicInforAction"/>  
  23.       <writer xid="default6"/>  
  24.       <filter name="filter0" xid="filter1">fType='试题类型'</filter>
  25.     </div>  
  26.     <div component="$UI/system/components/justep/data/data" autoLoad="true"
  27.       xid="optionData" idColumn="fOption">
  28.       <column label="选项" name="fOption" type="String" xid="xid1"/>  
  29.       <data xid="default5">[{"fOption":"A"},{"fOption":"B"},{"fOption":"C"},{"fOption":"D"}]</data>
  30.     </div>
  31.   </div>  
  32.   <div component="$UI/system/components/justep/panel/panel" class="x-panel x-full"
  33.     xid="panel1">
  34.     <div class="x-panel-content" xid="content1">
  35.       <div component="$UI/system/components/justep/row/row" class="x-row" xid="row1">
  36.         <div class="x-col x-col-fixed" xid="col1" style="width:120px;">
  37.           <div class="x-gridSelect" component="$UI/system/components/justep/gridSelect/gridSelect"
  38.             xid="gridSelect1" bind-ref="$model.mainData.ref(&quot;fType&quot;)" bind-labelRef="$model.mainData.ref(&quot;fType&quot;)"
  39.             defaultLabel="'单选题'">
  40.             <option xid="option1" data="typeData" value="fName"/>
  41.           </div>
  42.         </div>  
  43.         <div class="x-col" xid="col3">
  44.           <input component="$UI/system/components/justep/input/input" class="form-control"
  45.             xid="input2" bind-ref="$model.mainData.ref(&quot;fQuestion&quot;)" placeHolder="题干内容"/>
  46.         </div>
  47.       </div>  
  48.       <div component="$UI/system/components/justep/row/row" class="x-row" xid="row2">
  49.         <div class="x-col" xid="col4">
  50.           <div component="$UI/system/components/justep/labelEdit/labelEdit"
  51.             class="x-label-edit" xid="labelEdit1">
  52.             <label class="x-label" xid="label1" style="width:120px;" bind-text="$model.mainData.label(&quot;fOPtionA&quot;)"/>  
  53.             <input component="$UI/system/components/justep/input/input" class="form-control x-edit"
  54.               xid="input7" bind-ref="$model.mainData.ref(&quot;fOPtionA&quot;)"/>
  55.           </div>  
  56.           <div component="$UI/system/components/justep/labelEdit/labelEdit"
  57.             class="x-label-edit" xid="labelEdit5">
  58.             <label class="x-label" xid="label5" style="width:120px;" bind-text="$model.mainData.label(&quot;fOptionB&quot;)"/>  
  59.             <input component="$UI/system/components/justep/input/input" class="form-control x-edit"
  60.               xid="input11" bind-ref="$model.mainData.ref(&quot;fOptionB&quot;)"/>
  61.           </div>  
  62.           <div component="$UI/system/components/justep/labelEdit/labelEdit"
  63.             class="x-label-edit" xid="labelEdit6">
  64.             <label class="x-label" xid="label6" style="width:120px;" bind-text="$model.mainData.label(&quot;fOptionC&quot;)"/>  
  65.             <input component="$UI/system/components/justep/input/input" class="form-control x-edit"
  66.               xid="input12" bind-ref="$model.mainData.ref(&quot;fOptionC&quot;)"/>
  67.           </div>  
  68.           <div component="$UI/system/components/justep/labelEdit/labelEdit"
  69.             class="x-label-edit" xid="labelEdit7">
  70.             <label class="x-label" xid="label7" style="width:120px;" bind-text="$model.mainData.label(&quot;fOptionD&quot;)"/>  
  71.             <input component="$UI/system/components/justep/input/input" class="form-control x-edit"
  72.               xid="input13" bind-ref="$model.mainData.ref(&quot;fOptionD&quot;)"/>
  73.           </div>  
  74.           <div component="$UI/system/components/justep/labelEdit/labelEdit" class="x-label-edit" xid="labelEdit12">
  75.    <label class="x-label" xid="label12" style="width:120px;" bind-text='$model.mainData.label("fPoints")'></label>
  76.    <input component="$UI/system/components/justep/input/input" class="form-control x-edit" xid="input15" bind-ref='$model.mainData.ref("fPoints")'></input></div><div component="$UI/system/components/justep/labelEdit/labelEdit" class="x-label-edit" xid="labelEdit11">
  77.    <label class="x-label" xid="label11" bind-text='$model.mainData.label("fCorrect")' style="width:120px;"></label>
  78.    <span component="$UI/system/components/justep/select/checkboxGroup" class="x-checkboxs x-edit" xid="checkboxGroup2" bind-ref='$model.mainData.ref("fCorrect")' bind-itemset="optionData" bind-itemsetValue='ref("fOption")' bind-itemsetLabel='ref("fOption")'></span></div>
  79.   </div>  
  80.         <div class="x-col x-col-33 x-col-offset-10" xid="col6">
  81.           <div xid="div1" style="text-align:center;margin-bottom:5px;border-style:solid solid solid solid;border-width:1px 1px 1px 1px;border-color:#C0C0C0 #C0C0C0 #C0C0C0 #C0C0C0;">
  82.             <img src="" alt="" xid="image1" style="height:200px;" bind-attr-src=' $model.mainData.val("fQuestionPic")'/>
  83.           </div>
  84.           <div xid="div3" class="upload-group">
  85.    <a component="$UI/system/components/justep/button/button" class="btn btn-default btn-block" label="上传图片" xid="button9">
  86.     <i xid="i9"></i>
  87.     <span xid="span11">上传图片</span></a>
  88.    <input class="form-control comment-pic-upd" xid="uploadFile" name="file" type="file" bind-change="uploadFileChange" accept="image/*"></input></div></div>
  89.       </div>
  90.     </div>  
  91.     <div class="x-panel-bottom" xid="bottom1">
  92.       <a component="$UI/system/components/justep/button/button" class="btn btn-link btn-only-label x-dialog-button"
  93.         label="取消" xid="cancelBtn" onClick="{&quot;operation&quot;:&quot;wReceiver.windowCancel&quot;}">
  94.         <i xid="i2"/>  
  95.         <span xid="span2">取消</span>
  96.       </a>  
  97.       <a component="$UI/system/components/justep/button/button" class="btn btn-primary x-dialog-button"
  98.         label="确定" xid="OKBtn" onClick="OKBtnClick">
  99.         <i xid="i1"/>  
  100.         <span xid="span1">确定</span>
  101.       </a>
  102.     </div>
  103.   </div>  
  104.   <span component="$UI/system/components/justep/windowReceiver/windowReceiver"
  105.     xid="wReceiver" style="left:443px;top:568px;"/>
  106. <resource xid="resource2">
  107.    <require xid="require1" url="$UI/YGS/masion/process/examBank/canvasResize-master/binaryajax"></require>
  108.    <require xid="require2" url="$UI/YGS/masion/process/examBank/canvasResize-master/canvasResize"></require>
  109.    <require xid="require3" url="$UI/YGS/masion/process/examBank/canvasResize-master/exif"></require></resource></div>
复制代码
长春鱼熊企业管理咨询有限公司



X5开发出入库培训视频
(出处: 起步论坛)
回复 支持 反对

使用道具 举报

377

主题

2594

帖子

5117

积分

论坛元老

Rank: 8Rank: 8

积分
5117
QQ
 楼主| 发表于 2016-11-12 10:13:50 | 显示全部楼层
题库维护详细页的.js源码

  1. define(function(require){
  2.         var $ = require("jquery");
  3.         var justep = require("$UI/system/lib/justep");
  4.        
  5.         var Model = function(){
  6.                 this.callParent();
  7.         };

  8.         Model.prototype.result = function(){
  9.                 //这里实现返回的逻辑       
  10.                 return this.comp("mainData").getCurrentRow();
  11.        
  12.         };

  13.         Model.prototype.OKBtnClick = function(event){
  14.                 this.comp('wReceiver').windowEnsure(this.result());
  15.         };

  16.         Model.prototype.uploadFileChange = function(event){

  17.                if(!event.target.files){    //如果客户没有选择相关文件,直接返回
  18.                         return;
  19.         }
  20.         
  21. /*                  var storeFileName=justep.UUID.createUUID();
  22.                   var rowID=this.comp("statusData").val("rowID");*/
  23.                   var self=this;
  24.                 var uploadFile = event.target.files[0];
  25.                
  26.                 canvasResize(uploadFile, {                        //压缩图片
  27.                         width: 400,
  28.                         height: 0,
  29.                         crop: false,
  30.                         quality: 80,
  31.                         callback: function(resizedPic, width, height) {        //压缩成功后的回调
  32.                         debugger;
  33.                                 self.comp("mainData").setValue("fQuestionPic",resizedPic);
  34.                        /*         justep.Baas.sendRequest({
  35.                                                         "url" : "/TianCheng/TianCheng",
  36.                                                         "action" : "uploadPic",
  37.                                                         "async" : false,
  38.                                                         "params" : {'resizedPic':resizedPic,'rowID':rowID,'storeFileName':storeFileName},
  39.                                                         "success" : function(data) {
  40.                                                
  41.                                                         if(data.success=="上传文件成功!"){
  42.                                                                 self.comp("statusData").setValue("picUrl",rowID+'/'+storeFileName);
  43.                                                                 justep.Util.hint(data.success);
  44.                                                                
  45.                                                         }
  46.                                                                
  47.                                                         }
  48.                                                 });*/
  49.                            
  50.                         }});
  51.        
  52.         };

  53.         Model.prototype.modelParamsReceive = function(event){
  54.                 if(event.params.actionType=="new"){
  55.                 this.comp("mainData").newData();
  56.                 }else if(event.params.actionType=='edit'){
  57.                         this.comp("mainData").loadData([event.params.data.currentRow],false);
  58.                         this.comp("mainData").first();
  59.                 }
  60.         };

  61.         return Model;
  62. });
复制代码
长春鱼熊企业管理咨询有限公司



X5开发出入库培训视频
(出处: 起步论坛)
回复 支持 反对

使用道具 举报

377

主题

2594

帖子

5117

积分

论坛元老

Rank: 8Rank: 8

积分
5117
QQ
 楼主| 发表于 2016-11-12 10:14:21 | 显示全部楼层
题库详细维护界面的.css代码


  1. .upload-group{
  2.         position: relative;

  3.         overflow: hidden; }


  4. .upload-group .comment-pic-upd{
  5.         position: absolute;
  6.         top: 0;
  7.         left: 0;
  8.          
  9.         z-index: 100;
  10.         width: 100%;
  11.         height: 100%;
  12.          
  13.         /* filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0); */
  14.         filter:alpha(opacity=0);
  15.         -moz-opacity:0;
  16.         -khtml-opacity: 0;
  17.         opacity:0;
  18.         background: none;
  19.         border: none;
  20.         cursor: pointer;
  21. }
复制代码
长春鱼熊企业管理咨询有限公司



X5开发出入库培训视频
(出处: 起步论坛)
回复 支持 反对

使用道具 举报

377

主题

2594

帖子

5117

积分

论坛元老

Rank: 8Rank: 8

积分
5117
QQ
 楼主| 发表于 2016-11-12 10:16:37 | 显示全部楼层
题库里面有图片,图片上传是在前端压缩的
相关的源码见附件

attendTest.zip

65.4 KB, 下载次数: 387

长春鱼熊企业管理咨询有限公司



X5开发出入库培训视频
(出处: 起步论坛)
回复 支持 反对

使用道具 举报

75

主题

486

帖子

862

积分

高级会员

Rank: 4

积分
862
QQ
发表于 2016-11-14 10:13:28 | 显示全部楼层
顶一两个`~~~
http://bbs.justep.com/thread-49855-1-1.html
回复 支持 反对

使用道具 举报

377

主题

2594

帖子

5117

积分

论坛元老

Rank: 8Rank: 8

积分
5117
QQ
 楼主| 发表于 2016-11-14 12:57:01 | 显示全部楼层
470772345 发表于 2016-11-14 10:13
顶一两个`~~~

这你都发现了?
长春鱼熊企业管理咨询有限公司



X5开发出入库培训视频
(出处: 起步论坛)
回复 支持 1 反对 0

使用道具 举报

75

主题

486

帖子

862

积分

高级会员

Rank: 4

积分
862
QQ
发表于 2016-11-15 12:12:39 | 显示全部楼层
Masion 发表于 2016-11-14 12:57
这你都发现了?

http://bbs.justep.com/thread-49855-1-1.html
回复 支持 反对

使用道具 举报

17

主题

104

帖子

277

积分

中级会员

Rank: 3Rank: 3

积分
277
QQ
发表于 2017-2-19 09:07:38 | 显示全部楼层
Masion 发表于 2016-3-19 17:13
客户要求关掉了

考试系统做完了么?有没有演示内容?合适的卖给我一份
回复 支持 反对

使用道具 举报

31

主题

138

帖子

584

积分

高级会员

Rank: 4

积分
584
QQ
发表于 2017-2-20 20:23:25 | 显示全部楼层
好东西,谢谢分享!
回复 支持 反对

使用道具 举报

1

主题

4

帖子

16

积分

新手上路

Rank: 1

积分
16
QQ
发表于 2018-6-14 10:39:33 | 显示全部楼层
大哥bex5的考试系统项目能不能打包一份发我
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2024-4-24 03:47 , Processed in 0.097092 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表