This commit is contained in:
强 杨 2023-06-15 14:11:37 +08:00
parent bcb5bfb711
commit f4e622d70c
26 changed files with 7992 additions and 0 deletions

63
.gitattributes vendored Normal file
View File

@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

363
.gitignore vendored Normal file
View File

@ -0,0 +1,363 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"liveServer.settings.port": 6601
}

1494
App_Code/CommonUse.cs Normal file

File diff suppressed because it is too large Load Diff

40
Marking.Template.sln Normal file
View File

@ -0,0 +1,40 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33424.131
MinimumVisualStudioVersion = 10.0.40219.1
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Marking.Template", ".", "{518C91BB-5B56-4710-A01C-589243B25125}"
ProjectSection(WebsiteProperties) = preProject
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.8"
Debug.AspNetCompiler.VirtualPath = "/localhost_6056"
Debug.AspNetCompiler.PhysicalPath = "F:\Marking.Program.Code\Marking.Template\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_6056\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/localhost_6056"
Release.AspNetCompiler.PhysicalPath = "F:\Marking.Program.Code\Marking.Template\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_6056\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
VWDPort = "6056"
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{518C91BB-5B56-4710-A01C-589243B25125}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{518C91BB-5B56-4710-A01C-589243B25125}.Debug|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2B0FC6C2-1D25-430E-998C-BFE706262D4D}
EndGlobalSection
EndGlobal

263
Temp/Default.aspx Normal file
View File

@ -0,0 +1,263 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="外部答题卡_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>导入外部答题卡制作模板</title>
<script src="../js/jquery-1.10.2.min.js"></script>
<link href="../css/default.css" rel="stylesheet" />
</head>
<body>
<div class="divBG backgroundGo" style=" display:none;"></div>
<div class="divbgbox backgroundGo" style=" display:none;">
<input type="hidden" value="" id="TiMU_num" />
<input type="hidden" value="" id="TiMU_Type" />
<h3 id="divbig_title">单选题15题</h3>
<div style="width:100%;margin-top:10px; font-size:14px; display:none;" id="scoreShow">
分数设置:
<select style="font-size:14px; padding:5PX; padding-left:10px; padding-right:10px;" id="git_fix">
<option></option>
</select>
</div>
<div style="width:100%;margin-top:10px; font-size:14px; display:none;" id="dfxShow">
打分项设定:
<select style="font-size:14px; padding:5PX; padding-left:10px; padding-right:10px;" id="git_sd_fix">
<option value="5">5</option>
<option value="4.5">4.5</option>
<option value="4">4</option>
<option value="3.5">3.5</option>
<option value="3">3</option>
<option value="2.5">2.5</option>
<option value="2">2</option>
<option value="1.5">1.5</option>
<option value="1">1</option>
<option value=".5">.5</option>
</select>
</div>
<div style="width:100%;margin-top:10px; font-size:14px;">
<input type="button" style="width:100px; height:30px;" value="确定" onclick="GoChange()" />
<input type="button" style="width:100px; height:30px;" onclick="DeleteUpdateBaseData()" value="取消" />
</div>
</div>
<input type="text" style=" display:none;" value="<%=isHand %>" id="hd_isHand" />
<input type="text" style=" display:none;" value="<%=Bindlist %>" id="Bindlist" />
<input type="text" style=" display:none;" value="<%=TempID %>" id="TempID" />
<input type="text" style=" display:none;" value="<%=isLocked %>" id="isLocked" />
<input type="text" style=" display:none;" value="<%=tenant %>" id="tenant" />
<input type="text" style=" display:none;" value="<%=PageIndex %>" id="PageIndex" />
<input type="text" style=" display:none;" value="<%=MainTempId %>" id="MainTempId" />
<textarea id="HideAreaText" style=" display:none;"><%=HideAreaText %></textarea>
<input id="IsPostionValue" type="text" style="display:none;" value="<%=IsPostionValue %>" />
<input type="hidden" id="pager_A" value="<%=pager %>" />
<div class="main">
<div class="main_tool">
<table>
<tr>
<th class="lockHide" >选定锚点</th>
<td class="lockHide" valign="middle">
<div class="maodian" id="point_0" >左上锚点</div>
<div class="maodian" id="point_1">右上锚点</div>
<div class="maodian" id="point_2">左下锚点</div>
<div class="maodian" id="point_3">右下锚点</div>
</td>
<td class="lockHide">
<span>版面:</span>
<select id="selectPageSize" disabled onchange="ChangePageSize(this)" style="font-size:14px; padding-left:10px; padding-right:20px; width:100px;">
<option value="1200">A4</option>
<option value="1570">A3</option>
</select>
</td>
<th valign="middle" class="lockHide">
<div class="main_select_one">
<span>学号:</span>
<select id="xuehaonum" style="font-size:14px; ">
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option selected="selected" value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
<span class="main_select_set" id="main_select_set" onclick="SetXuehao(this)">设置学号</span>
</div>
</th>
<td style=" padding:0;" valign="top" class="lockHide">
<div class="tiaomasz" onclick="SetTiaoMa(this)">设置条码</div>
</td>
<td class="lockHide">
<div class="quelapsz" onclick="SetWenziQuyu(this)">设置缺考</div>
</td>
<td class="lockHide">
<div class="biaozhundian" onclick="SetBiaoZhunDian(this)">标准涂点</div>
</td>
<td class="lockHide">
<div class="pingbi" onclick="SetHideArea()" >增加屏蔽</div>
</td>
<td>
<input type="button" id="noButton" style="padding:5px;font-size:14px; padding-left:10px; padding-right:10px; height:40px; " onclick="GetDataTotal(-1,'<%=tenant %>')" value="保存数据" />
</td>
<td>
<input type="button" id="ansyButton" style="padding:5px;font-size:14px; padding-left:10px; padding-right:10px;height:40px; " onclick="GetDataTotal(1,'<%=tenant %>')" value="锁定模板" />
</td>
</tr>
</table>
</div>
<div style="width:1570px; overflow:hidden;">
<div class="main_papermain">
<img id="SelectImg" src="<%=imgage %>" style=" width:100%; float:left; z-index:0; " />
</div>
</div>
</div>
<div onclick="HideRight(this)" style=" position:fixed;right:0;top:0; z-index:333; height:40px; width:40px; background:#000000; color:#fff; text-align:center; line-height:40px; font-size:12px;">折叠</div>
<script>
function HideRight(obj) {
if ($(obj).html() == "折叠") {
$(obj).html("展开");
$(obj).css("background", "#ff3300");
$(".right_list").fadeOut();
}
else {
$(obj).html("折叠");
$(obj).css("background", "#000000");
$(".right_list").fadeIn();
}
}
</script>
<div class="right_list">
<ul class="ul lockHide" >
<li class="hover">客观题设置</li>
<li>
<div style=" text-align:left; padding-left:20px;">
<br /><br />
题号:<input type="text" id="tihao" placeholder="例:16或者16M1" style="font-size:14px; width:100px;"/>-<input type="text" id="tihao_end" placeholder="例:16或者16M1" value=""style="font-size:14px; width:100px;" />
<br /> <br />
<label style=" width:80%; margin-left:35px; text-align:left; float:none; color:#f00; margin-top:5px; padding:5px; margin-bottom:5px;">如果以大题下面有小题类型用16M1-16M5表示</label>
<br /><br /><br />
选项:<select id="selectNum" style="font-size:14px; padding:4px; padding-right:10px;">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option selected="selected" value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
</select>
<label style="padding:6px; border-radius:2px;">横向<input checked="checked" type="radio" name="listtype" value="0" style="margin-top:3px;" /></label>
<label style="padding:6px; border-radius:2px;">竖向<input name="listtype" type="radio" value="1" /></label>
<br /><br /><br />
类型:<select id="questiontype" style="font-size:12px; width:100px;">
<option value="0">单选</option>
<option value="1">多选</option>
<option value="2">判断</option>
</select>
分数:
<select id="questionscroe" style="font-size:12px; width:80px; text-align:center;">
<option value="">无分</option><option value="0.5">0.5</option>
</select>
<br /><br />
<div class="goPeizhi" onclick="SetKeguanTi()">开始配置</div>
</div>
</li>
</ul>
<ul class="ul" style="display:none;">
<li class="hover" >准考证号识别</li>
<li>
题号:<input id="zhunkaozhenghao" type="text" value="6" />
<div class="goPeizhi" onclick="SetZunkaoZheng()">开始配置</div>
</li>
</ul>
<ul class="ul lockHide">
<li class="hover">主观题设置</li>
<li>
<span style="float:left; width:100%; display:block; padding-top:1px; border:0; border:1px solid #ffd800; margin-top:10px; color:#f00">切割成两半 如11题 如 第一半11X1 第二半11X2</span>
<div style=" margin-top:15px;padding-left:20px; text-align:left;margin-bottom:10px;">
题号:<input id="zhuguan_tihao" style="font-size:14px; width:60px;" type="text" value="" />小题:<input id="zhuguan_xiaoti" style=" width:40px;font-size:14px; " type="text" value="0" />
分数:
<select id="zgquestionscroe" style="font-size:14px; width:80px; text-align:center;">
<option value="">无分</option><option value="0.5">0.5</option>
</select>
<br /><br />
阅卷分值间隔:
<select id="questionscroetype" style="font-size:14px; width:80px; margin-top:5px; text-align:center;">
<option value="5">5分</option>
<option value="4.5">4.5分</option>
<option value="4">4分</option>
<option value="3.5">3.5分</option>
<option value="3">3分</option>
<option value="2.5">2.5分</option>
<option value="2">2分</option>
<option value="1.5">1.5分</option>
<option value="1" selected="selected">1分</option>
<option value=".5">0.5分</option>
</select>
类型:
<select id="questiontype_zg" style="font-size:14px; width:80px; margin-top:5px; text-align:center;">
<option value="1">大题</option>
<option value="2">填空题</option>
</select>
</div>
<br /><br /><br />
<div style="margin-left:45px;" class="goPeizhi" onclick="SetZhuguanTi()">开始配置</div>
<div id="isHand_Py" style="float:left; width:100%; text-align:left; margin-top:10px; border-bottom:1px solid #ddd; padding-bottom:5px;">
先批后阅题号:
<select id="py_tihao"></select>
<input type="button" value="题目配置" id="pytimups" onclick="SetPYPostion(0)" style="width:90px;margin-right:10px;" />
<%-- <input onclick="SetPYPostion(1)" style="width:100px;margin-right:10px;" type="button" value="常规题" />--%>
</div>
</li>
</ul>
<div style=" width:100%; text-align:center; float:left; padding-bottom:10px; font-size:14px; padding-top:10px; background:#044775; border-top:2px solid #000000; color:#fff;">模板删减区</div>
<ul id="NowSelect" class="lineul" style="overflow-y:scroll; height:240px; ">
</ul>
</div>
<script>
function SelectValueList() {
var html = "";
var score = 0.5;
var git_fix = document.getElementById("git_fix");
var git = document.getElementById("zgquestionscroe");
var git00 = document.getElementById("questionscroe");
git.options[0] = new Option("0分", "0");
git00.options[0] = new Option("0分", "0");
git_fix.options[0] = new Option("0分", "0");
for (var i = 1; i <= 121; i++) {
score = parseFloat(score) + parseFloat(0.5);
git.options[i] = new Option(score, score);
git00.options[i] = new Option(score, score);
git_fix.options[i] = new Option(score, score);
}
}
SelectValueList();
</script>
<script src="../js/index.js"></script>
</body>
</html>

1043
Temp/Default.aspx.cs Normal file

File diff suppressed because it is too large Load Diff

33
Temp/GetUseImageMap.aspx Normal file
View File

@ -0,0 +1,33 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GetUseImageMap.aspx.cs" Inherits="Temp_GetUseImageMap" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="../js/jquery-1.10.2.min.js"></script>
</head>
<body>
<input type="hidden" value="<%=TempID %>" id="TempID" />
<input type="hidden" value="<%=UserID %>" id="UserID" />
<input type="hidden" value="<%=tenant %>" id="tenant" />
<input type="hidden" value="<%=url %>" id="ImgUrl" />
<div style=" width:1920px; height:auto; text-align:center; overflow:hidden; margin:0 auto;">
<img id="loading" src="../img/111.gif" />
<img id="SelectImg" src="" style="width:100%;" />
</div>
<script>
$.post("TempDraw.aspx", { action: 1, rd: Math.random(), TempID: $("#TempID").val(), UserID: $("#UserID").val(), imgUrl: $("#ImgUrl").val(),tenant:$("#tenant").val() }, function (res) {
if (res == "-1") {
alert("无法定位");
}
else {
$("#loading").remove();
$("#SelectImg").attr("src", "data:image/jpg;base64," + res);
}
})
</script>
</body>
</html>

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Temp_GetUseImageMap : System.Web.UI.Page
{
public string TempID = "";
public long tenant = 0;
public string UserID = "";
public string url = "";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) {
TempID = Lucee.WebBase.Utils.Globals.Request("TempID");
UserID = Lucee.WebBase.Utils.Globals.Request("UserID");
tenant = Lucee.WebBase.Utils.Globals.Request("tenant") == "" ? 0 : Convert.ToInt64(Lucee.WebBase.Utils.Globals.Request("tenant"));
url = Server.UrlDecode(Lucee.WebBase.Utils.Globals.Request("ImgURL"));
}
}
}

321
Temp/SplitQuestion.aspx Normal file
View File

@ -0,0 +1,321 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SplitQuestion.aspx.cs" Inherits="Temp_SplitQuestion" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>题目拆分</title>
<link href="../css/default.css" rel="stylesheet" />
<script src="../js/jquery-1.10.2.min.js"></script>
<script src="../js/jquery.cookie.js"></script>
<link href="../css/SplitQuestion.css" rel="stylesheet" />
</head>
<body>
<input type="hidden" id="QuestionTempValue" value="<%=QuestionTempValue %>" />
<input type="hidden" id="PaperType" value="<%=PaperType %>" />
<input type="hidden" id="ystihaoList" value="<%=ystihaoList %>" />
<input type="hidden" id="TemDataID" value="<%=TempID %>" />
<input type="hidden" id="tenant" value="<%=tenant %>" />
<input type="hidden" id="questionNum" value="<%=questionNum %>" />
<input type="hidden" id="exam_subject_id" value="<%=exam_subject_id %>" />
<input type="hidden" id="subjective" value="<%=subjective %>" />
<input type="hidden" id="TempMainID" value="<%=TempMainID %>" />
<div style="width: 1600px; height: auto; overflow: hidden; margin: 10px 200px 0 0; border: 1px solid #999; padding: 10px; box-shadow: 5px 5px 5px #000;">
<h1 style="text-align: center; font-size: 16px; width: 100%; border-bottom: 1px solid #999; padding-bottom: 10px; margin-bottom: 10px;">题目拆分</h1>
<div class="leftControl" style="width: 1200px; border: 4px solid #666; float: left; position: relative;">
<div class="main_papermain">
<img src="<%=TempPicture64_nvarchar %>" />
</div>
</div>
<div class="rigthtControl">
<h3 style="border-bottom: 1px solid #999;">题目拆分</h3>
<div>
<ul class="xul">
<li style="font-size: 18px; border: 1px solid #ddd;">序号:
<label style="font-weight: bold; color: #f00; font-size: 30px;"><%=xuhao %></label>
小题:<label><%=xiaoti %></label><br />
分数:<label style="font-weight: bold; color: #f00; font-size: 30px;" id="oldScore"><%=fenshu %></label>
阅卷跳分:<label><%=yuejuanfen %></label></li>
</ul>
</div>
<h3 style="border-bottom: 1px solid #999; float: left; width: 100%; text-align: center; margin-top: 10px;">重新布置</h3>
<div style="float: left; margin-top: 10px;">
题号:<input type="text" id="zhuguan_tihao" style="width: 200px; font-size: 14px; height: 30px;" value="" placeholder="题号不能与原题号一致建议13.1" /><br />
<br />
小题:<input type="text" id="zhuguan_xiaoti" style="width: 80px; font-size: 14px; height: 30px;" value="0" placeholder="" />
分数:
<select id="zgquestionscroe" style="font-size: 14px; width: 80px; height: 30px; text-align: center;">
<option value="">无分</option>
<option value="0.5">0.5</option>
</select>
<br />
<br />
间隔:
<select id="questionscroetype" style="font-size: 14px; width: 80px; height: 30px; margin-top: 5px; text-align: center;">
<option value="5">5分</option>
<option value="4.5">4.5分</option>
<option value="4">4分</option>
<option value="3.5">3.5分</option>
<option value="3">3分</option>
<option value="2.5">2.5分</option>
<option value="2">2分</option>
<option value="1.5">1.5分</option>
<option value="1" selected="selected">1分</option>
<option value=".5">0.5分</option>
</select>
类型:
<select id="questiontype_zg" style="font-size: 14px; height: 30px; width: 80px; margin-top: 5px; text-align: center;">
<option value="1">大题</option>
<option value="2">填空题</option>
</select>
<br />
<br />
<div style="margin-left: 45px;" class="goPeizhi" onclick="SetZhuguanTi()">开始配置</div>
</div>
<div style="float: left; width: 100%;" id="chaiBox">
<h3 style="border-bottom: 1px solid #999; padding-bottom: 10px; float: left; width: 100%; text-align: center; margin-top: 10px;">拆题数据</h3>
</div>
<div style="float: left; width: 100%; margin-top: 20px;">
<div style="float: left; width: 85%; background: #000; box-shadow: 5px 5px 5px #444; color: #fff; padding: 5%;">
总分数:<label id="totalScorew">0</label>
拆分题数:<label id="totalChatiNum">0</label>
</div>
</div>
<div style="float: left; width: 100%; margin-top: 20px;">
<input type="button" id="submit" onclick="SubmitChai()" value="确认保存(保存后无法修改)" style="float: left; width: 70%; margin-left: 15%; background: #f00; border-radius: 3px; box-shadow: 5px 5px 5px #444; color: #fff; text-align: center; padding: 5%;" />
</div>
</div>
</div>
<script>
//获取主观题
function GetZhuguanPostion() {
var xy = "";
if ($(".zhuguanti").length == 0) {
return "";
}
$(".zhuguanti").each(function () {
xy += parseFloat($(this).position().left) + ","
+ parseFloat($(this).position().top) + ","
+ parseFloat($(this).width()) + "," +
parseFloat($(this).height()) + "," +
$(this).attr("tihaovalue") + "," +
$(this).attr("zhuguan_xiaoti") + "," +
$(this).attr("score") + "," +
$(this).attr("scoretype") + "," +
$(this).attr("questiontype_zg") + "^";
})
return xy.trim('^');
}
function SubmitChai() {
if ($(".scoreTotal").length == 0) {
alert("你还未进行拆题");
return false;
}
if (confirm("拆题后,之前的数据将无法恢复,请谨慎使用")) {
var totalScorew = $("#totalScorew").html();
var oldScore = $("#oldScore").html();
if (totalScorew != oldScore) {
if (confirm("原始分数与拆解后分数不一致,是否继续?")) {
}
else {
return false;
}
}
var zhuguantiList = GetZhuguanPostion();
console.log(zhuguantiList);
var tenant = $("#tenant").val();
var TemDataID = $("#TemDataID").val();
var questionNum = $("#questionNum").val();
var exam_subject_id = $("#exam_subject_id").val();
var subjective = $("#subjective").val();
var token = localStorage.getItem("token");
var TempMainID = $("#TempMainID").val();
var exam_subject_id = $("#exam_subject_id").val();
$("#submit").attr("disabled", "disabled");
$.post("SplitQuestion.aspx", { action: 1, rd: Math.random(), exam_subject_id: exam_subject_id, TempMainID: TempMainID, zhuguantiList: encodeURIComponent(zhuguantiList), TemDataID, TemDataID, tenant: tenant, questionNum: questionNum, exam_subject_id: exam_subject_id, subjective: subjective, token: token }, function (res) {
if (res == "1") {
alert("操作成功,窗口即将关闭!");
window.close();
document.location.href = 'SuccessCut.aspx';
}
else {
alert(res);
}
$("#submit").removeAttr("disabled");
})
}
}
function SelectValueList() {
var html = "";
var score = 0.5;
var git = document.getElementById("zgquestionscroe");
git.options[0] = new Option("0分", "0");
for (var i = 1; i <= 121; i++) {
score = parseFloat(score) + parseFloat(0.5);
git.options[i] = new Option(score, score);
}
}
SelectValueList();
function SetZhuguanTi() {
var zhuguan_tihao = $("#zhuguan_tihao").val().toUpperCase().replace(".", "·").replace("(", "").replace(")", "").replace(")", "").replace("=", "").replace("@", "");
if (!CheckTihao(zhuguan_tihao)) {
alert("该题号原试卷已经存在");
return;
}
if (zhuguan_tihao == "") {
alert("主观题 题号不能为空");
return;
}
var score = $("#zgquestionscroe").val();
var scoretype = $("#questionscroetype").val();
var questiontype_zg = $("#questiontype_zg").val();
//var scoretypeText = scoretype == "1" ? "全分" : "半分";
var scoretypeText = scoretype;
if (document.getElementById("keguan_" + zhuguan_tihao) != undefined) {
alert("0题目配置重复:" + zhuguan_tihao);
return;
}
var zhuguan_xiaoti = $("#zhuguan_xiaoti").val();
if (zhuguan_xiaoti == "") {
zhuguan_xiaoti = "0";
}
var lineWh = "width:800px;height:200px;";
var lineWhTx = "大题";
if (questiontype_zg == "2") {
var lineWh = "width:200px;height:90px;";
lineWhTx = "填空"
}
$(".main_papermain").append("<div id=\"keguan_" + zhuguan_tihao + "\" class='main_tabletop zhuguanti' questiontype_zg='" + questiontype_zg + "' tihaovalue='" + zhuguan_tihao + "' zhuguan_xiaoti='" + zhuguan_xiaoti + "' score='" + score + "' scoretype='" + scoretype + "' style='" + lineWh + ";background:none; left:100px; top:" + (100 + $(document).scrollTop()) + "px;'><div style=\" float:left; width:auto;text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">" + lineWhTx + "" + zhuguan_tihao + "</div><div style='width:100%;height:100%;background:#fff;border:1px solid red;'></div></div>");
$("#keguan_" + zhuguan_tihao).draggable({ containment: ".main_papermain" });
$("#keguan_" + zhuguan_tihao).resizable({ containment: ".main_papermain", handles: 'all' });
var html = "<div class=\"boxscore\" id='box_" + zhuguan_tihao + "'>";
html += "";
html += "<label><b>号:" + zhuguan_tihao + "</b></label>";
html += "<label>小题:" + zhuguan_xiaoti + "</label>";
html += "<label>分数:<b class='scoreTotal'>" + score + "</b></label>";
html += "<label>间隔:" + scoretype + "</label>";
html += "<label>" + lineWhTx + "</label>";
html += "<span onclick=\"BoxClose('" + zhuguan_tihao + "')\">";
html += " X";
html += " </span>";
html += "</div>";
$("#chaiBox").append(html);
scoreTotal();
}
function BoxClose(id) {
$("#box_" + id).remove();
$("#keguan_" + id).remove();
scoreTotal();
}
//
function scoreTotal() {
var totalNum = 0;
var count = 0;
$(".scoreTotal").each(function () {
count++;
totalNum += parseFloat($(this).html());
})
$("#totalScorew").html(totalNum);
$("#totalChatiNum").html(count);
}
/////////////////设置主观题//////////////////////
function SetZhuguanTiPostion(PostionData) {
if (PostionData == "" || PostionData == undefined) {
return;
}
//左边距,右边距,长,高,题号,小题数量
var listdata = PostionData.split('^');
for (var i = 0; i < listdata.length; i++) {
var zhuguanList = listdata[i].split(',');
var zhuguan_tihao = zhuguanList[4].toUpperCase().replace(".", "·").replace("(", "").replace(")", "").replace(")", "").replace("=", "").replace("@", "");
var score = zhuguanList[6] == undefined ? "" : zhuguanList[6];
var scoretype = zhuguanList[7] == undefined ? "1" : zhuguanList[7];
//var scoretypetext = scoretype;
var scoretypetext = scoretype;
var questiontype_zg = zhuguanList[8] == undefined ? "1" : zhuguanList[8];
if (document.getElementById("keguan_" + zhuguan_tihao) != undefined && document.getElementById("keguan_" + zhuguan_tihao) != null) {
alert("2题目配置重复:" + zhuguan_tihao);
return;
}
var lineWhTx = "原始大题";
if (questiontype_zg == "2") {
lineWhTx = "原始填空"
}
var zhuguan_xiaoti = zhuguanList[5];
$(".main_papermain").append("<div id=\"keguan_" + zhuguan_tihao + "\" class='main_tabletop' questiontype_zg='" + questiontype_zg + "' tihaovalue='" + zhuguan_tihao + "' zhuguan_xiaoti='" + zhuguan_xiaoti + "' score='" + score + "' scoretype='" + scoretype + "' style=' left:" + zhuguanList[0] + "px; top:" + zhuguanList[1] + "px;width:" + zhuguanList[2] + "px;height:" + zhuguanList[3] + "px; background:none; '><div style=\" float:left; width:auto; text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">" + lineWhTx + ":" + zhuguan_tihao + "</div><div style='width:100%;border:5px solid blue;height:100%;background:#fff;'></div></div>");
$("#keguan_" + zhuguan_tihao).draggable({ containment: ".main_papermain" });
$("#keguan_" + zhuguan_tihao).resizable({ containment: ".main_papermain", handles: 'all' });
//$("#NowSelect").append("<li style='background:#fff;' id='selectNow_" + zhuguan_tihao + "'><div class='sp'><div class='go'>主观题</div></div><div class='sf'>" + zhuguan_tihao + "</div><div class='sm'>" + zhuguan_xiaoti + "</div><div class='ss' id='ss_" + zhuguan_tihao + "' idAtt='keguan_" + zhuguan_tihao + "' onclick=\"UpdateBaseData(1,'" + score + "','" + zhuguan_tihao + "','主观题')\">" + score + "</div><div class='ssd' id='ssd_" + zhuguan_tihao + "' onclick=\"UpdateBaseData(2,'" + scoretype + "','" + zhuguan_tihao + "','主观题')\">" + scoretypetext + "</div><div class='sd' onclick=\"DeleteKeguanti('" + zhuguan_tihao + "')\">x</div></li>");
}
}
////////////////设置主观题//////////////////////
$(document).ready(function () {
var PaperType = $("#PaperType").val();
if (PaperType == "1") {
$(".main_papermain").width("1570px");
$(".leftControl").width("1570px");
}
else {
$(".main_papermain").width("1200px");
$(".leftControl").width("1200px");
}
SetZhuguanTiPostion($("#QuestionTempValue").val())
})
function CheckTihao(t) {
var ystihaoList = $("#ystihaoList").val().split(',');
for (var i = 0; i < ystihaoList.length; i++) {
if (t == ystihaoList[i]) {
return; false;
}
}
return true;
}
String.prototype.trim = function (char, type) {
if (char) {
if (type == 'left') {
return this.replace(new RegExp('^\\' + char + '+', 'g'), '');
} else if (type == 'right') {
return this.replace(new RegExp('\\' + char + '+$', 'g'), '');
}
return this.replace(new RegExp('^\\' + char + '+|\\' + char + '+$', 'g'), '');
}
return this.replace(/^\s+|\s+$/g, '');
};
</script>
</body>
</html>

406
Temp/SplitQuestion.aspx.cs Normal file
View File

@ -0,0 +1,406 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Lucee.WebBase.Data;
using Lucee.WebBase.Utils;
using System.Data;
using System.Data.SqlClient;
using ZXing.Client.Result;
using MySql.Data.MySqlClient;
using System.IO;
using System.Net;
using System.Text;
using Newtonsoft;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;
using Emgu.CV.UI.GLView;
using System.Net.Http;
using System.Net.Http.Json;
public partial class Temp_SplitQuestion : System.Web.UI.Page
{
public long tenant = 0;
public string QuestionTempValue = "";
public string PaperType = "";
public string TempPicture64_nvarchar = "";
public string ystihaoList = "";
public string TempID = "";
public string TempMainID = "";
public string questionNum = "";
public string xuhao, xiaoti, fenshu, yuejuanfen;
public long exam_subject_id = 0;
public long subjective = 0;
public string token = "";
private void UpdateData()
{
long TemDataID = Convert.ToInt64(Globals.Request("TemDataID"));
string tempMainID = Globals.Request("TempMainID");
string zhuguantiList = Server.UrlDecode(Globals.Request("zhuguantiList"));
string questionNum = Globals.Request("questionNum");
tenant = Convert.ToInt64(Globals.Request("tenant"));
string sql = "SELECT TempValue_nvarchar FROM MK_TempleteData WHERE ID_bigint=" + TemDataID;
string TempValue = new MysqlDBHelper(tenant).ExecuteScalar(sql).ToString();
if (TempValue != "")
{
string[] list = TempValue.Split('$');//拿模板
string zhuguanti = list[3];//拿主观题
bool isP = false;
if (zhuguanti != "")
{
string[] quList = zhuguanti.Split('^');//切题
for (int i = 0; i < quList.Length; i++)
{
if (questionNum == quList[i].Split(',')[4])//匹配哪道题
{
quList[i] = zhuguantiList;
isP = true;
break;
}
}
if (!isP)
{
Response.Write("该题数据不存在,请刷新后重试!");
}
else
{//重新组装题
long exam_subject_id = Convert.ToInt64(Globals.Request("exam_subject_id"));
if (!CheckStatus(exam_subject_id))
{
return;
}
string[] newQuestionList = zhuguantiList.Split('^');
long subjective = Convert.ToInt64(Globals.Request("subjective"));
List<CutList> lt = new List<CutList>();
//写入拆分题目
foreach (string x in newQuestionList)
{
string[] questionList = x.Split(',');
string mkscoretype = "";
if (string.IsNullOrEmpty(questionList[7]))
{
mkscoretype = "1";
}
else
{
mkscoretype = questionList[7];
}
CutList cl = new CutList();
cl.questionNum = Server.UrlEncode(questionList[4]);
cl.subQuestionCount = Convert.ToInt32(questionList[5]);
cl.scoreInterval = mkscoretype;
cl.score = questionList[6];
lt.Add(cl);
}
//调用接口
result r = (result)JavaScriptConvert.DeserializeObject(RequestPost(subjective.ToString(), lt.ToJsonString()), typeof(result));
if (r.code == "200" && r.data.ToLower() == "true")
{
string zhuguanlistString = "";
foreach (string x in quList)
{
zhuguanlistString += x + "^";
}
list[3] = zhuguanlistString.Trim('^');
string allData = "";
foreach (string x in list)
{
allData += x + "$";
}
allData = allData.Trim('$');
//更新原始模板
sql = "UPDATE MK_TempleteData SET TempValue_nvarchar=@TempValue_nvarchar WHERE ID_bigint=" + TemDataID;
MySqlParameter[] sp = new MySqlParameter[] {
new MySqlParameter("@TempValue_nvarchar",allData)
};
new MysqlDBHelper(tenant).ExecuteNoQuery(sql, sp);
//删除原始记录表
sql = "DELETE FROM MK_TempQuestionData WHERE QuestionIndex_int='" + questionNum + "' AND TempID_bigint='" + TemDataID + "'";
new MysqlDBHelper(tenant).ExecuteNoQuery(sql, sp);
string ids = "";//获取返回值,拆分后ID值
string questionNumList = "";
//写入拆分题目
foreach (string x in newQuestionList)
{
string[] questionList = x.Split(',');
string mkscoretype = "";
if (string.IsNullOrEmpty(questionList[7]))
{
mkscoretype = "1";
}
else
{
mkscoretype = questionList[7];
}
questionNumList += questionList[4] + "$";
sql = string.Format(@"INSERT INTO MK_TempQuestionData(
TempID_bigint,
QuestionIndex_int,
SmallQuestionDetail_nvarchar,
Score_float,
smallQuestionNum_int,
questiontype_int,
mkscoretype_float) VALUES
({0},{1},{2},{3},{4},1,{5});select @@IDENTITY",
TemDataID,
"'" + questionList[4] + "'",
"''",
questionList[6] == "" ? "0" : questionList[6],
questionList[5],
mkscoretype
);
ids += new MysqlDBHelper(tenant).ExecuteScalar(sql).ToString() + ",";
}
questionNumList = questionNumList.Trim('$');
//写入任务表
sql = "Insert Into mk_subjective_cut_record(temp_main_id,temp_detail_id,temp_question_num,is_cutout,exam_subject_id,temp_question_Newdata_ids,subjective_questions_data,cutted_question_num) VALUES(" + tempMainID + "," + TemDataID + ",'" + questionNum + "',0," + exam_subject_id + ",'" + ids.Trim(',') + "','" + zhuguantiList + "','" + questionNumList + "')";
new MysqlDBHelper(tenant).ExecuteNoQuery(sql, sp);
Response.Write("1");
}
else
{
Response.Write(r.message);
}
}
}
else
{
Response.Write("找不到该题");
}
}
else
{
Response.Write("无模板数据");
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
int action = Globals.Request("action") == "" ? 0 : Convert.ToInt32(Globals.Request("action"));
tenant = Globals.Request("tenant") == "" ? 0 : Convert.ToInt64(Globals.Request("tenant"));
subjective = Convert.ToInt64(Globals.Request("subjective"));
token = Globals.Request("token");
if (action == 0)
{
string sql = "SELECT exam_subject_id,question_num FROM marking_setting_subjective WHERE id=" + subjective;
DataTable dt = new MysqlDBHelper(tenant).ExecuteQuery(sql);
if (dt.Rows.Count == 0)
{
Response.Write("<script>alert('无模板数据');window.close();</script>");
return;
}
exam_subject_id = Convert.ToInt64(dt.Rows[0]["exam_subject_id"]);
questionNum = dt.Rows[0]["question_num"].ToString();
sql = "SELECT template_id FROM exam_subject WHERE id=" + exam_subject_id;
long template_id_main = Convert.ToInt64(new MysqlDBHelper(tenant).ExecuteScalar(sql));
sql = "SELECT PaperType FROM MK_TempleteMain WHERE ID_bigint=" + template_id_main;
PaperType = new MysqlDBHelper(tenant).ExecuteScalar(sql).ToString();
TempMainID = template_id_main.ToString();
sql = "SELECT ID_bigint,TempValue_nvarchar,TempPicture64_nvarchar FROM MK_TempleteData WHERE MainID_bigint=" + template_id_main;
dt = new MysqlDBHelper(tenant).ExecuteQuery(sql);
bool isHave = false;
TempID = "";
foreach (DataRow dr in dt.Rows)
{
string data = dr["TempValue_nvarchar"].ToString();
if (data != "")
{
string[] list = data.Split('$');
string zhuguanti = list[3];
if (zhuguanti != "")
{
string[] quList = zhuguanti.Split('^');
foreach (string q in quList)
{
if (questionNum == q.Split(',')[4])
{
TempID = dr["ID_bigint"].ToString();
TempPicture64_nvarchar = dr["TempPicture64_nvarchar"].ToString();
QuestionTempValue = q;
xuhao = questionNum;
xiaoti = q.Split(',')[5];
fenshu = q.Split(',')[6];
yuejuanfen = q.Split(',')[8];
isHave = true;
break;
}
}
}
}
}
foreach (DataRow dr in dt.Rows)
{
string data = dr["TempValue_nvarchar"].ToString();
if (data != "")
{
string[] list = data.Split('$');
string zhuguanti = list[3];
if (zhuguanti != "")
{
string[] quList = zhuguanti.Split('^');
foreach (string q in quList)
{
ystihaoList += q.Split(',')[4] + ",";
}
}
}
}
ystihaoList = ystihaoList.Trim(',');
if (TempID == "")
{
Response.Write("<script>alert('无模板数据')</script>");
}
else
{
// Response.Write(TempID);
}
// Response.Write(TempID+"*"+ QuestionTempValue);
}
if (action == 1)
{
Response.Clear();
try
{
UpdateData();
}
catch
{
Response.Write("拆题失败");
}
Response.End();
}
}
}
private bool CheckStatus(long exam_subject_id)
{
if (exam_subject_id <= 0)
{
Response.Write("考试id有误保存失败");
return false;
}
string sql = "SELECT `status` FROM exam_subject WHERE id=" + exam_subject_id;
var examStatus = Convert.ToInt32(new MysqlDBHelper(tenant).ExecuteScalar(sql));
if (examStatus != 1 && examStatus != 2)
{
Response.Write("当前考试状态无法执行该操作!");
return false;
}
sql = "SELECT COUNT(1) FROM ScanResult WHERE IsMarking=0 AND IsDeleted=0 AND ExamSubjectId=" + exam_subject_id;
var unScanCount = Convert.ToInt32(new MysqlDBHelper(tenant).ExecuteScalar(sql));
if (unScanCount > 0)
{
Response.Write("系统正在识别试卷,请全部识别完成后再保存!");
return false;
}
sql = "SELECT COUNT(1) FROM MK_ExamResult WHERE ExamSubjectId=" + exam_subject_id + " AND IsSync=0 AND IsObjectiveQuestions_bit=0 " +
" and GroupNO_nvarchar not in (SELECT GroupNo FROM ScanResult WHERE ExamSubjectId=" + exam_subject_id + " and IsDeleted=1)";
var unSyncCount = Convert.ToInt32(new MysqlDBHelper(tenant).ExecuteScalar(sql));
if (unSyncCount > 0 && examStatus == 2)
{
Response.Write("系统正在识别分配试题请等待1分钟后重试");
return false;
}
return true;
}
private string RequestPost(string id, string body)
{
// 测试地址
string url = "http://192.168.2.9:6500/";
string bearer = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI5OGQxOGRjNC1lZDAzLTRiNzMtYTczZS1iMTIxZTRhYzliNWUiLCJpYXQiOiIwNS8yOS8yMDIzIDA5OjM3OjU0IiwidXNlciI6IjIiLCJyb2xlIjoiNSIsInRlbmFudCI6IjEwMDc4IiwibmJmIjoxNjg1MzI0Mjc0LCJleHAiOjE2ODU5MjkwNzQsImlzcyI6Im1rLWFkIiwiYXVkIjoiRXhhbU1hcmtpbmdBZG1pbkNsaWVudCJ9.lVYA6Z2RRhQFYYdj1DgxA7kB6eaYWqvB1wHmaQDBr3Y";
if (Request.Url.Host.ToLower().Contains("23544.com"))
{
// 正式地址
url = "https://mk-api.23544.com/ad/";
bearer = token;
}
else if (Request.Url.Host.ToLower().Contains("localhost"))
{
// 开发地址
url = "https://192.168.2.8:6500/";
}
url += "api/marking-setting/sub/" + id + "/cut";
WebRequest request = WebRequest.Create(url);
request.Method = "POST";
//post传参数
byte[] bytes = Encoding.ASCII.GetBytes(body);
request.Headers.Add("Authorization", bearer);
request.ContentType = "application/json";
request.ContentLength = body.Length;
Stream sendStream = request.GetRequestStream();
sendStream.Write(bytes, 0, bytes.Length);
sendStream.Close();
//得到返回值
WebResponse response = request.GetResponse();
string OrderQuantity = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("UTF-8")).ReadToEnd();
return OrderQuantity;
}
//private string RequestPost(string id, List<CutList> body)
//{
// string url = "http://tx.486255.com:6505/api/marking-setting/sub/" + id + "/cut";
// HttpClient httpClient = new HttpClient();
// var requestContent = JsonContent.Create(body);
// var response= httpClient.PostAsync(url, requestContent).Result;
// if (!response.IsSuccessStatusCode)
// {
// return string.Empty;
// }
// return response.Content.ReadAsStringAsync().Result;
//}
public class CutList
{
public string questionNum { get; set; }
public int subQuestionCount { get; set; }
public string score { get; set; }
public string scoreInterval { get; set; }
}
public class result
{
public string message { get; set; }
public string code { get; set; }
public string data { get; set; }
}
}

13
Temp/SuccessCut.aspx Normal file
View File

@ -0,0 +1,13 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SuccessCut.aspx.cs" Inherits="Temp_SuccessCut" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<div style="margin:20px auto; border:1px solid #666; width:300px; height:100px; line-height:100px; text-align:center;">拆题成功</div>
</body>
</html>

14
Temp/SuccessCut.aspx.cs Normal file
View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Temp_SuccessCut : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}

1
Temp/TempDraw.aspx Normal file
View File

@ -0,0 +1 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TempDraw.aspx.cs" Inherits="Temp_TempDraw" %>

881
Temp/TempDraw.aspx.cs Normal file
View File

@ -0,0 +1,881 @@
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
using Emgu.CV.Util;
using Lucee.WebBase.Data;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Lucee.WebBase.Utils;
using System.Net;
public partial class Temp_TempDraw : System.Web.UI.Page
{
public static BoxType bt = null;
public long tenant = 0;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
int action = Convert.ToInt32(Globals.Request("action")==""?0:Convert.ToInt32(Globals.Request("action")));
if (action == 1) {
Response.Clear();
DrawGo();
Response.End();
}
}
}
private void DrawGo()
{
long TempID = Convert.ToInt64(Globals.Request("TempID"));
long UserID = Convert.ToInt64(Globals.Request("UserID"));
tenant = Globals.Request("tenant") == "" ? 0 : Convert.ToInt64(Globals.Request("tenant"));
//开始阅卷
//获取主模板ID
DataTable dt = MK_Data.GetMainTempData(TempID);
if (dt.Rows.Count > 0)
{
//获取机阅基础数据
bt = MK_Data.GetBoxType(MK_Data.GetMainTempDataMainBoxType(Convert.ToInt32(dt.Rows[0]["MainID_bigint"])));
string[] GetData = dt.Rows[0]["TempValue_nvarchar"].ToString().Split('$');
int width = Convert.ToInt32(GetData[6].Split(',')[0]);
int height = Convert.ToInt32(GetData[6].Split(',')[1]);
dt = MK_Data.GetMinTempDataUser(TempID, UserID);
string imgUrl = Globals.Request("imgUrl");
Bitmap bmp;
if (imgUrl == "")
{
bmp = new Bitmap(UrlToImage(dt.Rows[0]["TempPicture64_nvarchar"].ToString()));
}
else
{
bmp = new Bitmap(UrlToImage(imgUrl));
}
//还原图片大小,这里可能有逻辑错误
bmp = MK_Operater.ScaleToSize(bmp, width, height);
//获取旋转偏移量
string[] PXGetData = dt.Rows[0]["TempValue_nvarchar"].ToString().Split('$');
bmp = MK_Operater.ImageRotates(bmp, (float)Convert.ToDouble(dt.Rows[0]["Rotate_float"])).Bitmap;
//切换模板数据
dt = MK_Data.GetMainTempData(TempID);
string[] FinleGetData = dt.Rows[0]["TempValue_nvarchar"].ToString().Split('$');
FinleGetData[0] = PXGetData[0];
//斜率
double xielv = Convert.ToDouble(dt.Rows[0]["XieLv_float"]);
//原始宽度
int oldWidth = Convert.ToInt32(dt.Rows[0]["CutWidth_int"]);
//原始高度
int oldHeight = Convert.ToInt32(dt.Rows[0]["CutHeight_int"]);
//原始坐标
string PYPostionList = dt.Rows[0]["PyPPostion_nvarchar"].ToString();
//切换执行数组,如果没得定位点就不要覆盖原始数据
Mat color_mat;
Mat mat_dilate;
VectorOfVectorOfPoint selected_contours;
CommonUse commonUse = new CommonUse();
string[] PYPostion;
if (GetData[0] != "")
{
string[] postionc = GetData[0].Split('^');
//pb_image.Image = bmp;
for (int i = 0; i < postionc.Length; i++)
{
string[] postCutList = postionc[i].Split(',');
int X = Convert.ToInt32(Convert.ToDouble(postCutList[0]));
int Y = Convert.ToInt32(Convert.ToDouble(postCutList[1]));
int W = Convert.ToInt32(Convert.ToDouble(postCutList[2]));
int H = Convert.ToInt32(Convert.ToDouble(postCutList[3]));
//bmp = commonUse.DrawGridByXYDraw(bmp, X, W, 1, Y, H, 1);
}
GetData = FinleGetData;
//换算未灰度图片 并选取点
Image<Gray, byte> EmguImagex = new Image<Gray, byte>(bmp);
Mat mat_threshold = new Mat();
CvInvoke.Threshold(EmguImagex, mat_threshold, 120, 253, Emgu.CV.CvEnum.ThresholdType.BinaryInv);
mat_dilate = commonUse.MyDilate(mat_threshold);
selected_contours = commonUse.GetUsefulContours(mat_dilate, 1);
//color_mat = commonUse.DrawContours(mat_dilate, selected_contours);
//Response.Write(ImgToBase64String(color_mat.Bitmap));
//bmp.Dispose();
//return;
//获取当前斜率
float myXielv = MK_Operater.GetPostionXYByFindRoteBmp(EmguImagex.Mat, selected_contours, GetData[0]);
if (myXielv == -100||myXielv==0)
{
Response.Write("-1");
return;
}
//同步主图斜率
float flagxie = ((90 - myXielv) - (90 - (float)xielv));
//更新图片
EmguImagex.Bitmap = MK_Operater.ImageRotates(bmp, flagxie).Bitmap;
//重新查找点阵
CvInvoke.Threshold(EmguImagex, mat_threshold, bt.Threshold, 254, Emgu.CV.CvEnum.ThresholdType.BinaryInv);
Mat mat_dilate6 = commonUse.MyDilate(mat_threshold);
VectorOfVectorOfPoint selected_contours6;
selected_contours6 = commonUse.GetUsefulContours(mat_dilate6, 1);
//color_mat = EmguImagex.Mat;
//color_mat = commonUse.DrawContours(color_mat, selected_contours6);
//Response.Write(ImgToBase64String(color_mat.Bitmap));
//bmp.Dispose();
//return;
//根据定位点重新裁剪图片
EmguImagex = MK_Operater.GetPostionXYByFind(EmguImagex.Mat, selected_contours6, GetData[0]);
if (EmguImagex == null)
{
return;
}
//等比例同步
EmguImagex.Bitmap = MK_Operater.ScaleToSize(EmguImagex.Bitmap, oldWidth, oldHeight);
//下列操作项定位点数据
PYPostion = PYPostionList.Split(',');
//最终选取图形
CvInvoke.Threshold(EmguImagex, mat_threshold, bt.Threshold, 254, Emgu.CV.CvEnum.ThresholdType.BinaryInv);
mat_dilate = commonUse.MyDilate(mat_threshold);
selected_contours = commonUse.GetUsefulContoursYueJuan(mat_dilate, 1);
color_mat = EmguImagex.Mat;
color_mat = commonUse.DrawContours(color_mat, selected_contours);
bmp = color_mat.Bitmap;
}
else
{
PYPostion = "0,0".Split(',');
Image<Gray, byte> EmguImagex = new Image<Gray, byte>(bmp);
Mat mat_threshold = new Mat();
CvInvoke.Threshold(EmguImagex, mat_threshold, bt.Threshold, 254, Emgu.CV.CvEnum.ThresholdType.BinaryInv);
mat_dilate = commonUse.MyDilate(mat_threshold);
selected_contours = commonUse.GetUsefulContoursYueJuan(mat_dilate, 1);
color_mat = EmguImagex.Mat;
color_mat = commonUse.DrawContours(color_mat, selected_contours);
bmp = color_mat.Bitmap;
}
//如果要取条码
if (GetData[5] != "")
{
string[] tiaomaData = GetData[5].Split(',');
int X = Convert.ToInt32(Convert.ToDouble(tiaomaData[0])) - Convert.ToInt32(PYPostion[0]);
int Y = Convert.ToInt32(Convert.ToDouble(tiaomaData[1])) - Convert.ToInt32(PYPostion[1]); ;
int W = Convert.ToInt32(Convert.ToDouble(tiaomaData[2]));
int H = Convert.ToInt32(Convert.ToDouble(tiaomaData[3]));
bmp= commonUse.DrawGridByXYDraw(bmp, X, W, 1, Y, H, 1);
}
//如果要取填涂
if (GetData[1] != "")
{
string[] XuehaoData = GetData[1].Split(',');
int X = Convert.ToInt32(Convert.ToDouble(XuehaoData[0])) - Convert.ToInt32(PYPostion[0]);
int Y = Convert.ToInt32(Convert.ToDouble(XuehaoData[1])) - Convert.ToInt32(PYPostion[1]); ;
int W = Convert.ToInt32(Convert.ToDouble(XuehaoData[2]));
int H = Convert.ToInt32(Convert.ToDouble(XuehaoData[3]));
int num = Convert.ToInt32(Convert.ToDouble(XuehaoData[4]));
int wL = Convert.ToInt32(W / num);
int hL = Convert.ToInt32(H / 10);
bmp = commonUse.DrawGridByXYDraw(bmp, X, wL, num, Y, hL, 10);
}
//缺考
if (GetData[4] != "")
{
string[] quekao = GetData[4].Split(',');
int X = Convert.ToInt32(Convert.ToDouble(quekao[0])) - Convert.ToInt32(PYPostion[0]);
int Y = Convert.ToInt32(Convert.ToDouble(quekao[1])) - Convert.ToInt32(PYPostion[1]); ;
int W = Convert.ToInt32(Convert.ToDouble(quekao[2]));
int H = Convert.ToInt32(Convert.ToDouble(quekao[3]));
bmp = commonUse.DrawGridByXYDraw(bmp, X, W, 1, Y, H, 1);
}
if (GetData[2] != "")
{
string[] keguantiList = GetData[2].Split('^');
for (int i = 0; i < keguantiList.Length; i++)
{
string[] keguanPos = keguantiList[i].Split(',');
int X = Convert.ToInt32(Convert.ToDouble(keguanPos[0])) - Convert.ToInt32(PYPostion[0]);
int Y = Convert.ToInt32(Convert.ToDouble(keguanPos[1])) - Convert.ToInt32(PYPostion[1]); ;
int W = Convert.ToInt32(Convert.ToDouble(keguanPos[2]));
int H = Convert.ToInt32(Convert.ToDouble(keguanPos[3]));
int xuanXiang = Convert.ToInt32(keguanPos[6]);//选项数量
string bigTihao = "";
if (keguanPos[5].ToUpper().Contains("M")) // 如果存在客观题
{
bigTihao = keguanPos[5].ToUpper().Split('M')[0] + "M";
keguanPos[5] = keguanPos[5].ToUpper().Split('M')[1];
keguanPos[4] = keguanPos[4].ToUpper().Split('M')[1];
}
int tiliang = Convert.ToInt32(keguanPos[5]) - Convert.ToInt32(keguanPos[4]) + 1;//题量
if (keguanPos[7].ToString() == "0")//横向取值
{
int wL = Convert.ToInt32(W / xuanXiang);
int hL = Convert.ToInt32(H / tiliang);
bmp = commonUse.DrawGridByXYDraw(bmp, X, wL, xuanXiang, Y, hL, tiliang);
}
else
{
int wL = Convert.ToInt32(W / tiliang);
int hL = Convert.ToInt32(H / xuanXiang);
bmp = commonUse.DrawGridByXYDraw(bmp, X, wL, tiliang, Y, hL, xuanXiang);
}
}
}
if (GetData[3] != "")
{
string[] Datalist = GetData[3].Split('^');
foreach (string postiontiaoma in Datalist)
{
string[] tiaomaData = postiontiaoma.Split(',');
int X = Convert.ToInt32(Convert.ToDouble(tiaomaData[0])) - Convert.ToInt32(PYPostion[0]);
int Y = Convert.ToInt32(Convert.ToDouble(tiaomaData[1])) - Convert.ToInt32(PYPostion[1]); ;
int W = Convert.ToInt32(Convert.ToDouble(tiaomaData[2]));
int H = Convert.ToInt32(Convert.ToDouble(tiaomaData[3]));
bmp = commonUse.DrawGridByXYDraw(bmp, X, W, 1, Y, H, 1);
}
}
Response.Write(ImgToBase64String(bmp));
bmp.Dispose();
}
}
public static Bitmap UrlToImage(string url)
{
WebRequest imgRequest = WebRequest.Create(url);
HttpWebResponse res=null;
try
{
res = (HttpWebResponse)imgRequest.GetResponse();
imgRequest.Timeout = 50000;
if (res.StatusCode.ToString() == "OK")
{
return new Bitmap(imgRequest.GetResponse().GetResponseStream());
}
else
{
return null;
}
}
catch (WebException ex)
{
res = (HttpWebResponse)ex.Response;
return null;
}
finally
{
if (res != null) {
res.Dispose();
res.Close();
}
imgRequest.Abort();
}
}
/// <summary>
/// 检查图片是否空白图片
/// </summary>
/// <param name="img">Image</param>
/// <returns>是否空白图片</returns>
public static bool CheckTransparentImg(System.Drawing.Image img)
{
bool blnIsTransparent = false;
//加载位图
Bitmap bitMap = new Bitmap(img);
//图片总像素
int intAll = img.Height * img.Width;
int intCount = 0;
//按像素遍历
for (int intY = 0; intY < img.Height; intY++)
{
for (int intX = 0; intX < img.Width; intX++)
{
if (bitMap.GetPixel(intX, intY).GetBrightness() == 1)
{
intCount += 1;
}
}
}
float a = (float)intCount / (float)intAll;
Console.WriteLine(a.ToString());
Console.WriteLine(intCount.ToString() + "---" + intAll.ToString());
//释放资源
bitMap.Dispose();
int al = intAll - 1000;
if (intCount > al)
{
blnIsTransparent = true;
}
return blnIsTransparent;
}
public static Bitmap Base64StringToImage(string strbase64)
{
try
{
byte[] arr = Convert.FromBase64String(strbase64);
MemoryStream ms = new MemoryStream(arr);
Bitmap bmp = new Bitmap(ms);
ms.Close();
return bmp;
}
catch (Exception ex)
{
return null;
}
}
public static string ImgToBase64String(Bitmap bmp)
{
try
{
MemoryStream ms = new MemoryStream();
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] arr = new byte[ms.Length];
ms.Position = 0;
ms.Read(arr, 0, (int)ms.Length);
ms.Dispose();
ms.Close();
return Convert.ToBase64String(arr);
}
catch (Exception ex)
{
return null;
}
}
}
public class MK_Data
{
public static long tenant = 0;
public static void GetTenant(){
tenant = Globals.Request("tenant") == "" ? 0 : Convert.ToInt64(Globals.Request("tenant"));
}
/// <summary>
/// 获取我需要扫描的试卷
/// </summary>
/// <returns></returns>
public static DataTable GetScanResult()
{
GetTenant();
string sql = "SELECT top 1 * FROM ScanResult WHERE IsMarking=0 order by GroupNo ASC";
DataTable dt = new MysqlDBHelper(tenant).ExecuteQuery(sql);
if (dt.Rows.Count > 0)
{
return dt;
}
else
{
return null;
}
}
/// <summary>
/// 获取我需要扫描的试卷
/// </summary>
/// <returns></returns>
public static DataTable GetScanResultDetail(int GroupNo)
{
GetTenant();
string sql = "SELECT * FROM ScanResult WHERE GroupNo=" + GroupNo + " AND IsMarking=0 order by pageindex ASC";
DataTable dt = new MysqlDBHelper(tenant).ExecuteQuery(sql);
if (dt.Rows.Count > 0)
{
return dt;
}
else
{
return null;
}
}
/// <summary>
/// 获取主模板数据
/// </summary>
/// <param name="temID"></param>
/// <returns></returns>
public static DataTable GetMainTempData(long temID)
{
GetTenant();
string sql = "select detaID_bigint from MK_TempleteDataUser where ID_bigint=" + temID;
long detaID_bigint = Convert.ToInt64(new MysqlDBHelper(tenant).ExecuteScalar(sql));
sql = "SELECT * FROM MK_TempleteData WHERE ID_bigint = " + detaID_bigint + " ORDER BY PageIndex_int ASC";
return new MysqlDBHelper(tenant).ExecuteQuery(sql);
}
/// <summary>
/// 获取主模板数据
/// </summary>
/// <param name="temID"></param>
/// <returns></returns>
public static int GetMainTempDataMainBoxType(long temID)
{
GetTenant();
string sql = "SELECT BoxType FROM MK_TempleteMain WHERE ID_bigint=" + temID;
return Convert.ToInt32(new MysqlDBHelper(tenant).ExecuteScalar(sql));
}
/// <summary>
/// 获取用户模板数据
/// </summary>
/// <param name="tempID"></param>
/// <param name="userID"></param>
/// <returns></returns>
public static DataTable GetMinTempDataUser(long tempID, long userID)
{
GetTenant();
string sql = "SELECT * FROM MK_TempleteDataUser WHERE UserID_bigint=" + userID + " AND ID_bigint=" + tempID;
return new MysqlDBHelper(tenant).ExecuteQuery(sql);
}
/// <summary>
/// 判断是否有重复试卷扫入
/// </summary>
/// <param name="ksNum"></param>
/// <param name="StudentNO"></param>
/// <returns></returns>
public static bool CheckRepeatMKFlag(string ksNum, string StudentNO)
{
GetTenant();
string sql = "SELECT COUNT(1) FROM ScanResult WHERE ExamSubjectSchoolId='" + ksNum + "' AND OCRStudentExamNum='" + StudentNO + "' AND ismarking=1";
int count = Convert.ToInt32(new MysqlDBHelper(tenant).ExecuteScalar(sql));
if (count > 0)
{
return false;
}
return true;
}
/// <summary>
/// 清理所有该用户数据
/// </summary>
public static void DeleteAllMKSTData(string GroupNo, string StudentNO)
{
GetTenant();
string sql = string.Format("DELETE MK_ExamResult WHERE GroupNO_nvarchar = {0} AND StudentNo_nvarchar = '{1}'", GroupNo, StudentNO);
new MysqlDBHelper(tenant).ExecuteNoQuery(sql);
}
/// <summary>
/// 删除已有考号数据
/// </summary>
/// <param name="ksNum"></param>
/// <param name="StudentNO"></param>
public static void DeleteStudentExamResultData(string ksNum, string StudentNO)
{
GetTenant();
//删除原始表中的数据
string sql = string.Format("DELETE MK_ExamResult WHERE ExamID_bigint = {0} AND StudentNo_nvarchar = '{1}'", ksNum, StudentNO);
new MysqlDBHelper(tenant).ExecuteNoQuery(sql);
}
/// <summary>
/// 新增一条错误数据
/// </summary>
/// <param name="et"></param>
/// <param name="pictureUrl"></param>
/// <param name="examID"></param>
/// <param name="studentNO"></param>
/// <param name="ErroMessage"></param>
/// <param name="groupID"></param>
public static void UpdateMkGo(string groupID, string orcStudentNum)
{
GetTenant();
string sql = string.Format("UPDATE ScanResult SET IsMarking=1,OCRStudentExamNum='" + orcStudentNum + "' WHERE GroupNo=" + groupID);
new MysqlDBHelper(tenant).ExecuteNoQuery(sql);
}
/// <summary>
/// 新增一条错误数据
/// </summary>
/// <param name="et"></param>
/// <param name="pictureUrl"></param>
/// <param name="examID"></param>
/// <param name="studentNO"></param>
/// <param name="ErroMessage"></param>
/// <param name="groupID"></param>
public static void UpdateMkGoNoOrcStudentNum(string groupID)
{
GetTenant();
string sql = string.Format("UPDATE ScanResult SET IsMarking=1 WHERE GroupNo=" + groupID);
new MysqlDBHelper(tenant).ExecuteNoQuery(sql);
}
/// <summary>
/// 获取扫描类型
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public static BoxType GetBoxType(int type)
{
BoxType b = new BoxType();
//红框
if (type == 1)
{
b.fillRate = 30;
b.Threshold = 50;
}
if (type == 2)
{
b.fillRate = 60;
b.Threshold = 60;
}
if (type == 3)
{
b.fillRate = 45;
b.Threshold = 18;
}
return b;
}
}
public class BoxType
{
public int fillRate { get; set; }
public int Threshold { get; set; }
}
public class MK_Operater
{
// <summary>
/// 缩放图片
/// </summary>
/// <param name="bitmap">原图片</param>
/// <param name="width">新图片宽度</param>
/// <param name="height">新图片高度</param>
/// <returns>新图片</returns>
public static Bitmap ScaleToSize(Bitmap bitmap, int width, int height)
{
try
{
if (bitmap == null)
{
return null;
}
if (bitmap.Width == width && bitmap.Height == height)
{
return bitmap;
}
var scaledBitmap = new Bitmap(width, height);
using (var g = Graphics.FromImage(scaledBitmap))
{
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.DrawImage(bitmap, 0, 0, width, height);
}
return scaledBitmap;
}
catch
{
return null;
}
}
public static Image<Bgra, byte> ImageRotates(Bitmap Map, double Dou, bool Bol = true)
{
try
{
Image<Bgra, byte> Imga1 = new Image<Bgra, byte>(Map);
//Image<Bgra, byte> Imga2 = Imga1.Rotate(Dou, new Bgra(0, 0, 0, 0), Bol);
// Image<Bgra, byte> Imga2 = Imga1.Rotate(Dou, new Bgra(0, 0, 0, 0), Bol) 等同于
Image<Bgra, byte> Imga2 = Imga1.Rotate(Dou, new PointF(Imga1.Width / 2, Imga1.Height / 2), Inter.Cubic, new Bgra(255, 255, 255, 255), Bol);
return Imga2;
}
catch
{
return null;
}
}
/// <summary>
/// 获取偏移量 通过矩形查找
/// </summary>
/// <param name="bmp"></param>
/// <param name="PointPath"></param>
/// <param name="PostionXY"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <returns></returns>
public static float GetPostionXYByFindRoteBmp(Mat color_mat, VectorOfVectorOfPoint selected_contours, string postionCut)
{
try
{
CommonUse commonUse = new CommonUse();
string[] postionc = postionCut.Split('^');
Point GrXY;
int Y2 = 0, Y1 = 0, X2 = 0, X1 = 0;
for (int i = 0; i < postionc.Length; i++)
{
string[] postCutList = postionc[i].Split(',');
int X = Convert.ToInt32(Convert.ToDouble(postCutList[0]));
int Y = Convert.ToInt32(Convert.ToDouble(postCutList[1]));
int W = Convert.ToInt32(Convert.ToDouble(postCutList[2]));
int H = Convert.ToInt32(Convert.ToDouble(postCutList[3]));
//commonUse.DrawGridByXY(测试查找坐标.myFrom.PB_guodu, X, W, 1, Y, H, 1);Response.Write(ImgToBase64String(bmp));
string mx = "";
try
{
mx = commonUse.GetValueAndDrawGrid_Find(color_mat.Bitmap, selected_contours, X, W, 1, Y, H, 1, "", out GrXY);
}
catch
{
mx = "null";
GrXY = new Point(0, 0);
}
if (mx.Trim() != "A")
{
break;
}
Point Mx = GrXY;
if (i == 0)//左上角
{
Y1 = GrXY.Y;
X1 = GrXY.X;
}
if (i == 2)//左下角
{
X2 = GrXY.X;
Y2 = GrXY.Y;
}
}
return (float)(Math.Atan2((Y2 - Y1), (X2 - X1)) * (180 / Math.PI));
}
catch
{
return -100;
}
}
/// <summary>
/// 获取偏移量 通过矩形查找
/// </summary>
/// <param name="bmp"></param>
/// <param name="PointPath"></param>
/// <param name="PostionXY"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <returns></returns>
public static Image<Gray, byte> GetPostionXYByFind(Mat color_mat, VectorOfVectorOfPoint selected_contours, string postionCut)
{
try
{
CommonUse commonUse = new CommonUse();
string[] postionc = postionCut.Split('^');
string PYPostion = "";
Point GrXY;
int PostionWW = 0;
int PostionHH = 0;
int Y2 = 0, Y1 = 0, X2 = 0, X1 = 0;
for (int i = 0; i < postionc.Length; i++)
{
string[] postCutList = postionc[i].Split(',');
int X = Convert.ToInt32(Convert.ToDouble(postCutList[0]));
int Y = Convert.ToInt32(Convert.ToDouble(postCutList[1]));
int W = Convert.ToInt32(Convert.ToDouble(postCutList[2]));
int H = Convert.ToInt32(Convert.ToDouble(postCutList[3]));
string mx = "";
try
{
mx = commonUse.GetValueAndDrawGrid_Find(color_mat.Bitmap, selected_contours, X, W, 1, Y, H, 1, "", out GrXY);
}
catch
{
mx = "null";
GrXY = new Point(0, 0);
}
if (mx.Trim() != "A")
{
break;
}
Point Mx = GrXY;
if (i == 0)//左上角
{
PYPostion = GrXY.X + "," + GrXY.Y;
Y1 = GrXY.Y;
X1 = GrXY.X;
}
if (i == 1)//右上角
{
PostionWW = GrXY.X;
}
if (i == 2)//左下角
{
PostionHH = GrXY.Y;
X2 = GrXY.X;
Y2 = GrXY.Y;
}
}
string[] posList = PYPostion.Split(',');
int PostionX = Convert.ToInt32(posList[0]);
int PostionY = Convert.ToInt32(posList[1]);
int PostionW = PostionWW - PostionX;
int PostionH = PostionHH - PostionY;
//裁剪
Rectangle rectangle = new Rectangle(PostionX, PostionY, PostionW, PostionH);
Image<Gray, byte> Sub = new Image<Gray, byte>(color_mat.Bitmap).GetSubRect(rectangle);
Image<Gray, byte> CropImage = new Image<Gray, byte>(Sub.Size);
CvInvoke.cvCopy(Sub, CropImage, IntPtr.Zero);
//获取偏移量
return CropImage;
}
catch
{
return null;
}
}
/// <summary>
/// 获取裁剪 L T W H
/// </summary>
/// <param name="PointPath"></param>
public static Image<Gray, byte> GetMatCutImg(Bitmap bmp, int sX, int sT, int sW, int sH)
{
List<Image<Gray, byte>> postionimageCut = new List<Image<Gray, byte>>();
int L = sX;
int T = sT;
int W = sW;
int H = sH;
Rectangle rectangle = new Rectangle(L, T, W, H);
Image<Gray, byte> Sub = new Image<Gray, byte>(bmp).GetSubRect(rectangle);
Image<Gray, byte> CropImage = new Image<Gray, byte>(Sub.Size);
CvInvoke.cvCopy(Sub, CropImage, IntPtr.Zero);
return CropImage;
}
/// <summary>
/// 获取主观题
/// </summary>
/// <param name="color_mat"></param>
/// <param name="PYPostion"></param>
/// <param name="postiontiaomaX"></param>
/// <returns></returns>
public static List<ZhuguantiList> GetZhuguantiText(Mat color_mat, string[] PYPostion, string postiontiaomaX, int pageIndex)
{
string[] Datalist = postiontiaomaX.Split('^');
List<ZhuguantiList> lt = new List<ZhuguantiList>();
CommonUse commonUse = new CommonUse();
foreach (string postiontiaoma in Datalist)
{
ZhuguantiList zd = new ZhuguantiList();
string[] tiaomaData = postiontiaoma.Split(',');
int X = Convert.ToInt32(Convert.ToDouble(tiaomaData[0])) - Convert.ToInt32(PYPostion[0]);
int Y = Convert.ToInt32(Convert.ToDouble(tiaomaData[1])) - Convert.ToInt32(PYPostion[1]); ;
int W = Convert.ToInt32(Convert.ToDouble(tiaomaData[2]));
int H = Convert.ToInt32(Convert.ToDouble(tiaomaData[3]));
Image<Gray, byte> bytimg = GetMatCutImg(color_mat.Bitmap, X, Y, W, H);
zd.btm = new Bitmap(bytimg.Bitmap);
zd.num = tiaomaData[4];
zd.QuestionSmallNum = Convert.ToInt32(tiaomaData[5]);
lt.Add(zd);
bytimg.Bitmap.Dispose();
}
return lt;
}
public static Bitmap GetDrawRectangleWhite(Bitmap bit)
{
Bitmap bmp = new Bitmap(bit);
float w = (float)(2);//边框的宽度,可取任意值
using (Graphics g = Graphics.FromImage(bmp))
{
// g.CopyFromScreen(0, 0, 0, 0, Screen.AllScreens[0].Bounds.Size);//抓取背景图
using (Pen pen = new Pen(Color.White, w))
{
g.DrawRectangle(pen, new Rectangle(0, 0, Math.Abs(bmp.Width), Math.Abs(bmp.Height)));//加边框
g.Dispose();
}
}
return bmp;
}
}

170
Temp/UserTemp.aspx Normal file
View File

@ -0,0 +1,170 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserTemp.aspx.cs" Inherits="Temp_UserTemp" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>导入外部答题卡制作模板</title>
<script src="../js/jquery-1.10.2.min.js"></script>
<link href="../css/index.css" rel="stylesheet" />
</head>
<body>
<input type="text" style=" display:none;" value="<%=Bindlist %>" id="Bindlist" />
<input type="text" style=" display:none;" value="<%=TempID %>" id="TempID" />
<input type="text" style=" display:none;" value="<%=UserID %>" id="UserID" />
<input type="text" style=" display:none;" value="<%=tenant %>" id="tenant" />
<input type="text" style=" display:none;" value="<%=ID_bigint %>" id="ID_bigint" />
<input type="text" style=" display:none;" value="<%=islocked %>" id="islocked" />
<input type="hidden" id="pager_A" value="<%=pager %>" />
<div class="main">
<div class="main_tool" style="display:none;" >
<table>
<tr>
<th width="70px">选定锚点</th>
<td style=" position:relative; width:480px;">
<div class="maodian" id="point_0" onclick="SetMao(this,0)">左上锚点</div>
<div style="left:125px;" onclick="SetMao(this,1)" class="maodian" id="point_1">右上锚点</div>
<div style="left:245px;" onclick="SetMao(this,2)" class="maodian" id="point_2">左下锚点</div>
<div style="left:365px;" onclick="SetMao(this,3)" class="maodian" id="point_3">右下锚点</div>
</td>
<th width="270px" valign="middle">
<div class="main_select_one">
<span>学号:</span>
<select id="xuehaonum">
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option selected="selected" value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
<span class="main_select_set" id="main_select_set" onclick="SetXuehao(this)">设置学号</span>
</div>
</th>
<td width="150px">
<span >版面:</span>
<select id="selectPageSize" onchange="ChangePageSize(this)">
<option value="1200">A4</option>
<option value="1570">A3</option>
</select>
</td>
<td>
<input type="button" style="padding:3px; " onclick="GetDataTotal(-1,'<%=tenant %>')" value="保存数据" />
</td>
</tr>
</table>
</div>
<div class="main_papermain" style=" margin:0 auto; position:relative;">
<div style=" height:auto; margin:0 auto; border:1px solid #ff0000; padding:1%; color:#999; position:absolute;width:120px; margin-left:-160px; margin-top:200px; box-shadow:10px 10px 10px #666; border:1px solid #999; z-index:999; ">
<p style="font-size:14px; color:#ff6a00">
1.如果图片倾斜,请调整倾斜角度,让他水平,如果倾斜角度过大,影响阅卷
</p>
<p style="font-size:14px; color:#ff6a00">
2.请保证定位点在黑框内,且黑框框选处减少干扰,例如线条文字等。
</p>
</div>
<div id="kaochi_Line" style="position:absolute; background:#ff0000;opacity:0.5; height:10px; z-index:333; width:100%; left:0; top:200px;"></div>
<img id="SelectImg" src="<%=imgage %>" style="width:100%; float:left; z-index:0; " />
</div>
<div style=" width:100%; height:auto; margin:0 auto;">
<input type="button" class="btn_XY" value="左倾斜" onclick="PicRotate(0)" style="float:left; padding:10px; padding-left:30px; padding-right:30px; font-size:14px; margin-right:10px;margin-top:15px; margin-right:50px;"/>
<input type="button" class="btn_XY" value="右倾斜" onclick="PicRotate(1)" style="float:left;padding:10px; padding-left:30px; padding-right:30px; font-size:14px;margin-right:10px;margin-top:15px;margin-right:50px;" />
<input type="button" class="btn_XY" id="YLData_btn" value="预览识别" onclick="YLSB(this)" style="float:left;padding:10px; padding-left:30px; padding-right:30px; font-size:14px;margin-right:10px;margin-top:15px;margin-right:50px;" />
<input type="button" class="btn_XY" id="saveData_btn" value="保存数据" onclick="GetDataTotal('1','<%=tenant %>')" style="float:left;padding:10px; padding-left:30px; padding-right:30px; font-size:14px;margin-right:10px;margin-top:15px;margin-right:50px;" />
<input type="button" class="btn_XY" id="saveData_Locked" value="锁定模板" onclick="GetDataTotalAnsy('<%=tenant %>')" style="float:left;padding:10px; padding-left:30px; padding-right:30px; font-size:14px;margin-right:10px;margin-top:15px;margin-right:50px;" />
</div>
</div>
<script src="../js/indexuser.js"></script>
<script>
function bodyScale() {
var devicewidth = document.documentElement.clientWidth;
var scale = devicewidth / 8000; // 分母——设计稿的尺寸
document.body.style.zoom = scale;
}
window.onload = window.onresize = function () {
//bodyScale();
};
var rote = 0;
function PicRotate(flag) {
if ($("#SelectImg").css("-webkit-transform") == "none") {
rote = .2;
}
else {
if (flag == 1) {
rote +=parseFloat(.2);
}
else {
rote -=parseFloat(.2);
}
}
var value = $("#SelectImg").css("-webkit-transform").replace("matrix(", "").replace(");", "").replace(")", "");
if (flag == 0) {
document.getElementById("SelectImg").style.transform = 'rotate(' + rote + 'deg)';
}
else {
document.getElementById("SelectImg").style.transform = 'rotate(' + rote + 'deg)';
}
//GetDataTotal();
}
var roteBind = parseFloat("<%=Rotate%>");
rote = roteBind;
document.getElementById("SelectImg").style.transform = 'rotate(' + roteBind + 'deg)';
$(".hideinfo").hide();
function GetImageUrl() {
$.post("TempDraw.aspx", { action: 1, rd: Math.random(), TempID: $("#ID_bigint").val(), UserID: $("#UserID").val(),tenant:$("#tenant").val() }, function (res) {
$("#SelectImg").attr("src", "data:image/jpg;base64,"+res);
})
}
if (islocked == 1) {
$("#SelectImg").attr("src", "");
GetImageUrl();
}
function YLSB(obj) {
if ($(obj).attr("value") == "预览识别") {
$(obj).attr("value", "取消预览");
$.post("TempDraw.aspx", { action: 1, rd: Math.random(), TempID: $("#ID_bigint").val(), UserID: $("#UserID").val() ,tenant:$("#tenant").val()}, function (res) {
if (res == "-1" || res=="") {
alert("定位点出错,请重新设置");
document.location.href = document.location.href;
}
else {
//GetDataTotal('1');
$("#SelectImg").attr("src", "data:image/jpg;base64," + res);
$("#draggable_0").hide();
$("#draggable_1").hide();
$("#draggable_2").hide();
$("#draggable_3").hide();
$(".btn_XY").attr("disabled", "disabled");
$("#kaochi_Line").hide();
}
$(obj).show();
$(obj).removeAttr("disabled");
})
}
else {
document.location.href = document.location.href;
$(obj).attr("value", "预览识别");
}
}
</script>
</body>
</html>

263
Temp/UserTemp.aspx.cs Normal file
View File

@ -0,0 +1,263 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using Lucee.WebBase.Utils;
using Lucee.WebBase.Data;
using System.Drawing;
using Emgu.CV;
using Emgu.CV.Util;
using Emgu.CV.Structure;
using System.Drawing.Drawing2D;
using System.Net;
using MySql.Data.MySqlClient;
public partial class Temp_UserTemp : System.Web.UI.Page
{
public long TempID = 0;
public string Bindlist = "";
public string imgage = "";
public string UserID = "";
public string Rotate = "";
public string ID_bigint = "";
public string islocked = "";
public string pager = "";
public long tenant = 0;
protected void Page_Load(object sender, EventArgs e)
{
int action = Globals.Request("action") == "" ? 0 : Convert.ToInt32(Globals.Request("action"));
tenant = Globals.Request("tenant") == "" ? 0 : Convert.ToInt64(Globals.Request("tenant"));
if (action != 0)
{
Response.Clear();
switch (action)
{
case 1:
UpdateTempData();
break;
case 2:
AnsyTemplete();
break;
}
Response.End();
}
else
{
UserID = Globals.Decrypt(Globals.Request("UserID"));
pager = Globals.Request("pager");
if (string.IsNullOrEmpty(UserID))
{
Response.Write("<script>alert('数据有误,请检查');</script>");
return;
}
else
{
long UID = Convert.ToInt64(UserID);
TempID = Globals.Request("TempID") == "" ? 0 : Convert.ToInt32(Globals.Request("TempID"));//获取小模板ID
string sql = "select * from MK_TempleteDataUser where DetaID_bigint=" + TempID + " AND UserID_bigint=" + UID;
//string sql = "select * from MK_TempleteDataUser where DetaID_bigint=" + TempID ;
DataTable dtx = new MysqlDBHelper(tenant).ExecuteQuery(sql);
if (dtx.Rows.Count > 0)
{
ID_bigint = dtx.Rows[0]["ID_bigint"].ToString();
Bindlist = dtx.Rows[0]["TempValue_nvarchar"].ToString();
imgage = dtx.Rows[0]["TempPicture64_nvarchar"].ToString();
Rotate = dtx.Rows[0]["Rotate_float"].ToString();
islocked = dtx.Rows[0]["islocked_int"].ToString();
}
else
{
Response.Write("<script>alert('无有效数据');</script>");
}
}
}
}
public void AnsyTemplete()
{
UserID = Globals.Request("UserID");
TempID = Globals.Request("TempID") == "" ? 0 : Convert.ToInt32(Globals.Request("TempID"));//获取小模板ID
string totalHtml = Server.UrlDecode(Globals.Request("totalHtml"));
string Rotate_float = Globals.Request("roteDY");
string sql = "Update MK_TempleteDataUser SET islocked_int=1 where DetaID_bigint=" + TempID + " AND UserID_bigint=" + Convert.ToInt64(UserID);
MySqlParameter[] sp = new MySqlParameter[] {
new MySqlParameter("@TempValue_nvarchar",totalHtml),
new MySqlParameter("@Rotate_float",Rotate_float),
};
if (new MysqlDBHelper(tenant).ExecuteNoQuery(sql, sp) == 1)
{
AnsyTemp(Convert.ToInt64(UserID), TempID);
}
}
private void UpdateTempData()
{
UserID = Globals.Request("UserID");
TempID = Globals.Request("TempID") == "" ? 0 : Convert.ToInt32(Globals.Request("TempID"));//获取小模板ID
string totalHtml = Server.UrlDecode(Globals.Request("totalHtml"));
string Rotate_float = Globals.Request("roteDY");
string sql = "Update MK_TempleteDataUser SET TempValue_nvarchar=@TempValue_nvarchar,Rotate_float=@Rotate_float where DetaID_bigint=" + TempID + " AND UserID_bigint="+ Convert.ToInt64(UserID);
MySqlParameter[] sp = new MySqlParameter[] {
new MySqlParameter("@TempValue_nvarchar",totalHtml),
new MySqlParameter("@Rotate_float",Rotate_float),
};
if (new MysqlDBHelper(tenant).ExecuteNoQuery(sql, sp) == 1) {
AnsyTemp(Convert.ToInt64(UserID), TempID);
}
}
/// <summary>
/// 获取主模板数据
/// </summary>
/// <param name="temID"></param>
/// <returns></returns>
public int GetMainTempDataMainBoxType(long temID)
{
string sql = "SELECT BoxType FROM MK_TempleteMain WHERE ID_bigint=" + temID;
return Convert.ToInt32(new MysqlDBHelper(tenant).ExecuteScalar(sql));
}
/// <summary>
/// 锁定模板数据
/// </summary>
public void AnsyTemp(long userID, long TempID)
{
try
{
string sql = "SELECT * FROM MK_TempleteDataUser WHERE detaID_bigint=" + TempID + " AND UserID_bigint=" + UserID;
DataTable dt = new MysqlDBHelper(tenant).ExecuteQuery(sql);
if (dt.Rows.Count <= 0)
{
Response.Write("NODATA");
return;
}
Bitmap PictureBoxBitMap = ImgGet(dt.Rows[0]["TempPicture64_nvarchar"].ToString());
if (PictureBoxBitMap == null)
{
Response.Write("NOPICTURE");
}
string[] GetData = dt.Rows[0]["TempValue_nvarchar"].ToString().Split('$');
string PYPostionList = "";
//BoxType bt = null;
//bt = GetBoxType(GetMainTempDataMainBoxType(Convert.ToInt32(dt.Rows[0]["MainID_bigint"])));
if (GetData[0] != "")
{
//计算模板图片参数
double xielv = 0;
int width = Convert.ToInt32(GetData[6].Split(',')[0]);
int height = Convert.ToInt32(GetData[6].Split(',')[1]);
PictureBoxBitMap = ScaleToSize(PictureBoxBitMap, width, height);
Image<Gray, byte> imagex = new Image<Gray, byte>(PictureBoxBitMap);
CommonUse commonUse = new CommonUse();
Mat mat_threshold1 = new Mat();
CvInvoke.Threshold(imagex, mat_threshold1, 254, 255, Emgu.CV.CvEnum.ThresholdType.BinaryInv);
Mat mat_dilate1 = commonUse.MyDilate(mat_threshold1);
VectorOfVectorOfPoint selected_contours1;
selected_contours1 = commonUse.GetUsefulContoursDingWei(mat_dilate1, 1);
Image<Gray, byte> currentFramext = new Image<Gray, byte>(PictureBoxBitMap);
Mat color_mxxx = commonUse.GetPostionXYByFindPostionAndXieLv(imagex.Mat, selected_contours1, GetData[0], out PYPostionList, currentFramext, out xielv);
if (xielv == -100)
{
Response.Write("TEMPERRO");
return;
}
imagex.Dispose();
color_mxxx.Dispose();
PictureBoxBitMap.Dispose();
Response.Write("ok");
return;
}
Response.Write("ok");
}
catch (Exception ex)
{
Response.Write("TEMPERRO");
}
}
private Bitmap ScaleToSize(Bitmap bitmap, int width, int height)
{
if (bitmap == null)
{
return null;
}
if (bitmap.Width == width && bitmap.Height == height)
{
return bitmap;
}
var scaledBitmap = new Bitmap(width, height);
using (var g = Graphics.FromImage(scaledBitmap))
{
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.DrawImage(bitmap, 0, 0, width, height);
}
return scaledBitmap;
}
// <summary>
/// 图片另存为
/// </summary>
/// <param name="url">路径</param>
public Bitmap ImgGet(string url)
{
WebRequest imgRequest = WebRequest.Create(url);
HttpWebResponse res=null;
try
{
res = (HttpWebResponse)imgRequest.GetResponse();
if (res.StatusCode.ToString() == "OK")
{
return new Bitmap(imgRequest.GetResponse().GetResponseStream());
}
else
{
return null;
}
}
catch (WebException ex)
{
return null;
}
finally {
res.Dispose();
imgRequest.Abort();
res.Close();
}
GC.Collect();
}
}

32
Web.Debug.config Normal file
View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 有关使用 web.config 转换的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
在下例中“SetAttributes”转换将更改
“connectionString”的值以仅在“Match”定位器
找到值为“MyDB”的特性“name”时使用“ReleaseSQLServer”。
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<!--
在下例中“Replace”转换将替换
web.config 文件的整个 <customErrors> 节。
请注意,由于
在 <system.web> 节点下仅有一个 customErrors 节因此不需要使用“xdt:Locator”特性。
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>

31
Web.config Normal file
View File

@ -0,0 +1,31 @@
<?xml version="1.0"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<!--
有关 web.config 更改的说明,请参见 http://go.microsoft.com/fwlink/?LinkId=235367。
可在 <httpRuntime> 标记上设置以下特性。
<system.Web>
<httpRuntime targetFramework="4.8" />
</system.Web>
-->
<system.web>
<compilation targetFramework="4.8" debug="true"/>
<httpRuntime executionTimeout="600" maxRequestLength="419430400" targetFramework="4.5.2"/>
<customErrors mode="Off"/>
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="419430400"/>
</requestFiltering>
</security>
<directoryBrowse enabled="true"/>
<modules>
<remove name="WebDAVModule"/>
</modules>
</system.webServer>
</configuration>

70
css/SplitQuestion.css Normal file
View File

@ -0,0 +1,70 @@
.rigthtControl {
float:right;width:300px; border-left:1px solid #ddd;border-left:1px solid #999; padding-left:10px; min-height:1200px; background:#fff; height:100%; position:fixed; right:0; top:0;
}
.leftControl {
width:auto; overflow:hidden; float:left;
}
.leftControl img {
width:100%; float:left;
}
.rigthtControl .xul {
width: 100%;
margin: 0;
padding: 0;
margin-top: 10px;
float: left;
}
.rigthtControl .xul li {
float: left;
width: 90%;
padding: 5%;
font-size: 14px;
border-top: 1px solid #ff3300;
}
.rigthtControl ul li label {
margin-right:10px;
}
.goPeizhi {
cursor: pointer;
width: 120px;
border-radius: 5px;
float: left;
border: 1px solid #ddd;
overflow: hidden;
color: #666;
text-align: center;
font-size: 12px;
margin-left: 38px;
height: 30px;
background: #cd0a0a;
color: #fff;
line-height: 30px;
}
.goPeizhi:hover {
background: #999;
color: #fff;
border-radius: 5px;
}
.boxscore {
width: 130px; margin-right:5px;
font-size: 12px;
border: 1px solid #ddd;
height: 80px;
float: left;
margin-top: 10px; padding:10px;
position: relative; border-radius:3px; box-shadow:3px 3px 3px #333;
}
.boxscore label {
float: left;
width: 50%;
font-size: 14px;
margin-bottom: 5px;
margin-top: 5px;
}
.boxscore label.row {
width:100%;
}
.boxscore span {
position:absolute; right:0; bottom:0; border-radius:10px; width:30px; height:20px; line-height:20px; text-align:center; background:#ff3300; color:#fff;
}

322
css/default.css Normal file

File diff suppressed because one or more lines are too long

85
css/index.css Normal file

File diff suppressed because one or more lines are too long

1168
js/index.js Normal file

File diff suppressed because it is too large Load Diff

707
js/indexuser.js Normal file
View File

@ -0,0 +1,707 @@

var islocked = $("#islocked").val();
if (islocked == "" || islocked == "null") {
islocked = 0;
}
//设置页面大小
function ChangePageSize(obj) {
$(".main_papermain").width(obj.value);
$(".main").width(obj.value);
}
///设置锚点
function SetMao(obj, index) {
if ($(obj).attr("class") == "maodian_hover") {
$("#draggable_" + index).remove();
$(obj).attr("class", "maodian");
return;
}
var style = "";
if (index == 0) {
style = "left:100px; top 10px;"
}
if (index == 1) {
style = "left:200px; top 10px;"
}
if (index == 2) {
style = "left:300px; top 10px;"
}
if (index == 3) {
style = "left:400px; top 10px;"
}
$(obj).attr("class", "maodian_hover");
$(".main_papermain").append("<div class='main_tabletop' style='" + style + "' id='draggable_" + index + "'>" + $(obj).html() + "</div>");
$("#draggable_" + index).draggable({ containment: ".main_papermain" });
$("#draggable_" + index).resizable({ containment: ".main_papermain" });//设置缩放
}
///设置锚点
///设置学号
function SetXuehao(obj) {
if ($(obj).attr("class") == "main_select_set_hover") {
$("#xuehaoTable").remove();
$(obj).attr("class", "main_select_set");
return;
}
$(obj).attr("class", "main_select_set_hover");
var num = $("#xuehaonum").val();
var html = "<table class='xuehaotable_list' listNum='" + num + "' cellpadding=\"0\" cellspacing=\"0\">";
for (var i = 0; i < 10; i++) {
html += "<tr>";
for (var j = 0; j < num; j++) {
html += "<td></td>";
}
html += "</tr>";
}
html += "</table>";
$(".main_papermain").append("<div id=\"xuehaoTable\" listNum='" + num + "' class='main_tabletop' style='width:300px; height:200px'>" + html + "</div>");
$("#xuehaoTable").draggable({ containment: ".main_papermain" });
$("#xuehaoTable").resizable({ containment: ".main_papermain" });//设置缩放
}
//设置学号
/////////设置客观题//////////////////
function SetKeguanTi() {
var tihao = $("#tihao").val();//题号
var tihaoList = tihao.split('-');
if (tihaoList.length != 2) {
alert("题号规则错误,请重新输入");
return;
}
if (document.getElementById("keguan_" + tihao) != undefined) {
alert("题目配置重复");
return;
}
var rd_listtype = document.getElementsByName("listtype");//题目横竖向
var listtype = 0;
var selectNum = $("#selectNum").val();
for (var i = 0; i < rd_listtype.length; i++) {
if (rd_listtype[i].checked) {
listtype = rd_listtype[i].value;
}
}
var questiontype = $("#questiontype").val();
var tihaolist = tihao.split('-');
var startnum = parseInt(tihaolist[0]);
var endnum = parseInt(tihaolist[1]);
if (endnum == undefined)
{
endnum = startnum;
}
var html = "<table class='keguan_list' cellpadding=\"0\" style='background:#ff3300;' cellspacing=\"0\">";
var BigTihao = "";
if (tihao.indexOf('M') > -1) {
BigTihao = tihaolist[0].split('M')[0] + "M";
startnum = tihaolist[0].split('M')[1];
endnum = tihaolist[1].split('M')[1];
}
if (listtype == 0)//横向
{
for (var i = parseInt(startnum); i <=parseInt(endnum); i++)
{
html += "<tr>";
for (var j = 0; j < selectNum; j++)
{
html += "<td></td>";
}
html += "</tr>";
}
}
else {//竖向
for (var i = 0; i < selectNum; i++) {
html += "<tr>";
for (var j = startnum; j <= endnum; j++) {
html += "<td></td>";
}
html += "</tr>";
}
}
html += "</table>";
var selectMore = 0;
var questionHtml = "单选题";
if (questiontype == 1) {
questionHtml = "多选题";
}
if (questiontype == 2) {
questionHtml = "判断";
}
$(".main_papermain").append("<div id=\"keguan_" + tihao + "\" class='main_tabletop keguanti' questiontype='" + questiontype + "' tihaovalue='" + tihao + "' startnum='" + BigTihao + "" + startnum + "' endNum='" + BigTihao+"" + endnum + "' selectNum='" + selectNum + "' listtype='" + listtype + "' style='width:300px;background:none; left:100px; top:200px; height:200px'><div style=\" float:left; width:60px; text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">" + tihao + "</div>" + html + "</div>");
$("#keguan_" + tihao).draggable({ containment: ".main_papermain" });
$("#keguan_" + tihao).resizable({ containment: ".main_papermain" });//设置缩放
var listtypeText = listtype == 0 ? "横向" : "竖向";
$("#NowSelect").append("<li id='selectNow_" + tihao + "'>客观题:<a>" + questionHtml + "" + tihao + " 选项:" + selectNum + " 排列:" + listtypeText + "</a> <span onclick=\"DeleteKeguanti('" + tihao + "')\">删除</span></li>");
}
function DeleteKeguanti(tihao) {
$("#keguan_" + tihao).remove();
$("#selectNow_" + tihao).remove();
}
/////////设置客观题/////////////
/////////////////设置主观题//////////////////////
function SetZhuguanTi() {
var zhuguan_tihao = $("#zhuguan_tihao").val();
if (document.getElementById("keguan_" + zhuguan_tihao) != undefined) {
alert("题目配置重复");
return;
}
var zhuguan_xiaoti = $("#zhuguan_xiaoti").val();
if (zhuguan_xiaoti == "") {
zhuguan_xiaoti = "0";
}
$(".main_papermain").append("<div id=\"keguan_" + zhuguan_tihao + "\" class='main_tabletop zhuguanti' tihaovalue='" + zhuguan_tihao + "' zhuguan_xiaoti='" + zhuguan_xiaoti + "' style='width:300px;background:none; left:100px; top:200px; height:200px'><div style=\" float:left; width:60px; text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">" + zhuguan_tihao + "</div><div style='width:100%;height:100%;background:#fff;border:1px solid red;'></div></div>");
$("#keguan_" + zhuguan_tihao).draggable({ containment: ".main_papermain" });
$("#keguan_" + zhuguan_tihao).resizable({ containment: ".main_papermain" });
$("#NowSelect").append("<li id='selectNow_" + zhuguan_tihao + "' >题号:" + zhuguan_tihao + "<span onclick=\"DeleteKeguanti('" + zhuguan_tihao + "')\">删除</span></li>");
}
////////////////设置主观题//////////////////////
/////////////////设置条码识别区//////////////////////
function SetTiaoMa() {
if (document.getElementById("keguan_tiaomashibie") != undefined) {
alert("条码配置重复");
return;
}
$(".main_papermain").append("<div id=\"keguan_tiaomashibie\" class='main_tabletop' style='width:300px;background:none; left:100px; top:200px; height:200px'><div style=\" float:left; width:60px; text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">条码</div><div style='width:100%;height:100%;background:#fff;border:1px solid red;'></div></div>");
$("#keguan_tiaomashibie").draggable({ containment: ".main_papermain" });
$("#keguan_tiaomashibie").resizable({ containment: ".main_papermain" });
$("#NowSelect").append("<li id='selectNow_tiaomashibie' >条码<span onclick=\"DeleteKeguanti('tiaomashibie')\">删除</span></li>");
}
////////////////设置条码识别区//////////////////////
/////////////////准考证号识别区//////////////////////
function SetZunkaoZheng() {
if (document.getElementById("zhunkaozhenghaoshibie") != undefined) {
alert("准考证号配置重复");
return;
}
$(".main_papermain").append("<div id=\"keguan_zhunkaozhenghaoshibie\" class='main_tabletop' style='width:300px;background:none; left:100px; top:200px; height:200px'><div style=\" float:left; width:60px; text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">准考证号</div><div style='width:100%;height:100%;background:#fff;border:1px solid red;'></div></div>");
$("#keguan_zhunkaozhenghaoshibie").draggable({ containment: ".main_papermain" });
$("#keguan_zhunkaozhenghaoshibie").resizable({ containment: ".main_papermain" });
$("#NowSelect").append("<li id='selectNow_zhunkaozhenghaoshibie' >准考证号<span onclick=\"DeleteKeguanti('zhunkaozhenghaoshibie')\">删除</span></li>");
}
////////////////准考证号识别区//////////////////////
/////////////////设置缺考标记//////////////////////
function SetWenziQuyu() {
var zhuguan_tihao = $("#wenzi_tihao").val();
if (document.getElementById("selectNow_" + zhuguan_tihao) != undefined) {
alert("缺考已标记");
return;
}
$(".main_papermain").append("<div id=\"keguan_" + zhuguan_tihao + "\" class='main_tabletop wenzimiaoshu' wenzimiaoshu='" + zhuguan_tihao + "' style='width:300px;background:none; left:100px; top:200px; height:200px'><div style=\" float:left; width:60px; text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">" + zhuguan_tihao + "</div><div style='width:100%;height:100%;background:#fff;border:1px solid red;'></div></div>");
$("#keguan_" + zhuguan_tihao).draggable({ containment: ".main_papermain" });
$("#keguan_" + zhuguan_tihao).resizable({ containment: ".main_papermain" });
$("#NowSelect").append("<li id='selectNow_" + zhuguan_tihao + "'>文字描述:" + zhuguan_tihao + "<span onclick=\"DeleteKeguanti('" + zhuguan_tihao + "')\">删除</span></li>");
}
////////////////设置文字区域//////////////////////
///////////////////统计数据//////////////////////////
//获取锚点位置
function GetMaoPostion() {
if ($(".maodian_hover").length == 0) {
return "";
}
var xy = "";
if ($(".maodian_hover").length == 4) {
for (var i = 0; i < 4; i++) {
xy += parseInt($("#draggable_" + i).position().left) + "," + parseInt($("#draggable_" + i).position().top) + "," + parseInt($("#draggable_" + i).width()) + "," + parseInt($("#draggable_" + i).height()) + "^";
}
}
else {
alert("锚点未设置完成");
return "";
}
return xy.trim('^');;
}
//获取学号数据
function GetXuehaoPostion() {
if (document.getElementById("xuehaoTable") == undefined) {
return "";
}
var xy = "";
xy = parseInt($("#xuehaoTable").position().left) + "," + parseInt($("#xuehaoTable").position().top) + "," + parseInt($("#xuehaoTable").width()) + "," + parseInt($("#xuehaoTable").height()) + "," + $("#xuehaoTable").attr("listNum") ;
return xy;
}
//获取客观题
function GetKeguanPostion() {
if ($(".keguanti").length == 0) {
return "";
}
var xy = "";
$(".keguanti").each(function () {
xy += parseInt($(this).position().left) + "," + parseInt($(this).position().top) + "," + parseInt($(this).width()) + "," + parseInt($(this).height()) + "," + $(this).attr("startnum") + "," + $(this).attr("endNum") + "," + $(this).attr("selectNum") + "," + $(this).attr("listtype") + "," + $(this).attr("questiontype") + "^";
})
return xy.trim('^');
}
//获取主观题
function GetZhuguanPostion() {
var xy = "";
if ($(".zhuguanti").length == 0) {
return "";
}
$(".zhuguanti").each(function () {
xy += parseInt($(this).position().left) + "," + parseInt($(this).position().top) + "," + parseInt($(this).width()) + "," + parseInt($(this).height()) + "," + $(this).attr("tihaovalue") + "," + $(this).attr("zhuguan_xiaoti") + "^";
})
return xy.trim('^');
}
//获取条码
function GettiaomaPostion() {
var xy = "";
if (document.getElementById("keguan_tiaomashibie") == undefined) {
return "";
}
xy += parseInt($("#keguan_tiaomashibie").position().left) + "," + parseInt($("#keguan_tiaomashibie").position().top) + "," + parseInt($("#keguan_tiaomashibie").width()) + "," + parseInt($("#keguan_tiaomashibie").height());
return xy.trim('^');
}
//获取准考证号
function GetZKZHPostion() {
var xy = "";
if (document.getElementById("keguan_zhunkaozhenghaoshibie") == undefined) {
return "";
}
xy += parseInt($("#keguan_zhunkaozhenghaoshibie").position().left) + "," + parseInt($("#keguan_zhunkaozhenghaoshibie").position().top) + "," + parseInt($("#keguan_zhunkaozhenghaoshibie").width()) + "," + parseInt($("#keguan_zhunkaozhenghaoshibie").height());
return xy.trim('^');
}
//获取文字截获
function GetWenziPostion() {
var xy = "";
if ($(".wenzimiaoshu").length == 0) {
return "";
}
$(".wenzimiaoshu").each(function () {
xy += parseInt($(this).position().left) + "," + parseInt($(this).position().top) + "," + parseInt($(this).width()) + "," + parseInt($(this).height()) + "," + $(this).attr("wenzimiaoshu") + "^";
})
return xy.trim('^');
}
///////////////////统计数据//////////////////////////
function GetDataTotal(flag,tenant) {
var maodian = GetMaoPostion();//左边距,右边距,长,高
var xuehao = GetXuehaoPostion();//左边距,右边距,长,高,学号数量
var keguanti = GetKeguanPostion(); //左边距,右边距,长,高,题号开始,题号结束,选择几项,横排还是竖排,单选多选或者判断
var zhuguanti = GetZhuguanPostion();//左边距,右边距,长,高,题号,小题数量
var wenzimiaoshu = GetWenziPostion();//左边距,右边距,长,高,文字描述
var tiaoma = GettiaomaPostion();////左边距,右边距,长,高
var zhunkaozhenghao = GetZKZHPostion();///获取准考证号识别区域
var WandH = $("#SelectImg").width() + "," + $("#SelectImg").height();
var totalHtml = maodian + "$" + xuehao + "$" + keguanti + "$" + zhuguanti + "$" + wenzimiaoshu + "$" + tiaoma + "$" + WandH + "$" + zhunkaozhenghao;
//if (maodian == "") {
// alert("必须设置4个锚点");
// return;
//}
var roteDY = rote;//获取定义
$("#saveData_btn").attr("value", "正在保存数据");
$("#saveData_btn").attr("disabled", "disabled");
$.post("UserTemp.aspx", { action: "1", tenant:tenant,rd: Math.round(), totalHtml: encodeURIComponent(totalHtml), TempID: $("#TempID").val(), UserID: $("#UserID").val(), roteDY: roteDY }, function (res) {
if (res == "ok") {
if (flag == "1") {
alert("更新成功");
}
}
else {
alert("无法定位,请调整定位模块");
}
$("#saveData_btn").attr("value", "保存数据");
$("#saveData_btn").removeAttr("disabled");
})
}
function GetDataTotalAnsy(tenant) {
if (!confirm("锁定后开始阅卷,无法修改定位数据,请谨慎操作")) {
return;
}
var maodian = GetMaoPostion();//左边距,右边距,长,高
var xuehao = GetXuehaoPostion();//左边距,右边距,长,高,学号数量
var keguanti = GetKeguanPostion(); //左边距,右边距,长,高,题号开始,题号结束,选择几项,横排还是竖排,单选多选或者判断
var zhuguanti = GetZhuguanPostion();//左边距,右边距,长,高,题号,小题数量
var wenzimiaoshu = GetWenziPostion();//左边距,右边距,长,高,文字描述
var tiaoma = GettiaomaPostion();////左边距,右边距,长,高
var zhunkaozhenghao = GetZKZHPostion();///获取准考证号识别区域
var WandH = $("#SelectImg").width() + "," + $("#SelectImg").height();
var totalHtml = maodian + "$" + xuehao + "$" + keguanti + "$" + zhuguanti + "$" + wenzimiaoshu + "$" + tiaoma + "$" + WandH + "$" + zhunkaozhenghao;
//if (maodian == "") {
// alert("必须设置4个锚点");
// return;
//}
var roteDY = rote;//获取定义
$.post("TempDraw.aspx", { action: 1, rd: Math.random(), TempID: $("#ID_bigint").val(), UserID: $("#UserID").val(), tenant:tenant}, function (res) {
if (res == "-100" || res == "") {
alert("无法锁定模板,无法获取定位点");
}
else {
$.post("UserTemp.aspx", { action: "2", tenant:tenant, rd: Math.round(), totalHtml: encodeURIComponent(totalHtml), TempID: $("#TempID").val(), UserID: $("#UserID").val(), roteDY: roteDY }, function (res) {
if (res == "ok") {
alert("锁定成功");
document.location.href = document.location.href;
}
else {
alert("无法定位,请调整定位模块");
}
})
$("#SelectImg").attr("src", "data:image/jpg;base64," + res);
}
})
}
///////////////////统计数据//////////////////////////
//初始化绑定数据
function BaseDataBind() {
var Bindlist = $("#Bindlist").val()
var list = Bindlist.split('$');
var maodian = "";//左边距,右边距,长,高
var xuehao = "";//左边距,右边距,长,高,学号数量
var keguanti = ""; //左边距,右边距,长,高,题号开始,题号结束,横排还是竖排
var zhuguanti = "";//左边距,右边距,长,高,题号,小题数量
var wenzimiaoshu = "";//左边距,右边距,长,高,文字描述
var tiaoma = "";//左边距,右边距,长,高,文字描述
var pageWidth = "";
var pageHeight="";
var zhunkaozhenghao = "";
if (Bindlist != "") {
maodian = list[0].trim('^');//左边距,右边距,长,高
xuehao = list[1].trim('^');//左边距,右边距,长,高,学号数量
keguanti = list[2].trim('^'); //左边距,右边距,长,高,题号开始,题号结束,横排还是竖排
zhuguanti = list[3].trim('^');//左边距,右边距,长,高,题号,小题数量
wenzimiaoshu = list[4].trim('^');//左边距,右边距,长,高,文字描述
tiaoma = list[5].toString().trim('^');//左边距,右边距,长,高,文字描述
pageWidth = list[6].toString().trim('^').split(',')[0];
pageHeight=list[6].toString().trim('^').split(',')[1];
if (list[7] != undefined) {
zhunkaozhenghao = list[7].toString().trim('^');
}
}
if (pageWidth == 1200 || pageWidth == 1199 || pageWidth == 1198 || pageWidth == 1201) {
pageWidth = 1200;
}
if (pageWidth == 1570 || pageWidth == 1569 || pageWidth == 1571 || pageWidth == 1572 || pageWidth == 1573) {
pageWidth = 1570;
}
//if(pageWidth==""){
var pageType = $("#pager_A").val().toLowerCase();
if (pageType == "a3") {
pageWidth = 1570;
}
else {
pageWidth = 1200;
}
$("#kaochi_Line").draggable({ containment: ".main_papermain" });
$("#kaochi_Line").css("top", (pageHeight / 2) + "px");
$("#selectPageSize").val(pageWidth);
$("#selectPageSize").change();
SetMaoPostion(maodian);
SetXuehaoPostion(xuehao);
SetKeguanTiPostion(keguanti);
SetZhuguanTiPostion(zhuguanti);
SetWenziQuyuPostion(wenzimiaoshu);
SetTiaomaPostion(tiaoma);
SetZhunkaozhengPostion(zhunkaozhenghao);
if (islocked == 1) {
$("#draggable_0").hide();
$("#draggable_1").hide();
$("#draggable_2").hide();
$("#draggable_3").hide();
$(".btn_XY").attr("disabled", "disabled");
$("#kaochi_Line").hide();
}
}
///设置锚点
function SetMaoPostion(postiondata) {
if (postiondata == "") {
return;
}
var list = postiondata.split('^');
for (var i = 0; i < list.length; i++)
{
var obj = document.getElementById("point_" + i);
//左边距,右边距,长,高
if ($(obj).attr("class") == "maodian_hover") {
$("#draggable_" + i).remove();
$(obj).attr("class", "maodian");
return;
}
var postionList = list[i].split(',');
var style = "";
style = "left:" + postionList[0] + "px; top: " + postionList[1] + "px; width:" + postionList[2] + "px;height:" + postionList[3] + "px;";
$(obj).attr("class", "maodian_hover");
$(".main_papermain").append("<div class='main_tabletop' style='font-size:12px;color:#fff;" + style + "' id='draggable_" + i + "'>" + $(obj).html() + "</div>");
$("#draggable_" + i).draggable({ containment: ".main_papermain" });
$("#draggable_" + i).resizable({ containment: ".main_papermain" });
}
}
///设置学号
function SetXuehaoPostion(postionData) {
if (postionData == "") {
return;
}
var obj = document.getElementById("main_select_set");
var postionList = postionData.split(',');
if ($(obj).attr("class") == "main_select_set_hover") {
$("#xuehaoTable").remove();
$(obj).attr("class", "main_select_set");
return;
}
//左边距,右边距,长,高,学号数量
$(obj).attr("class", "main_select_set_hover");
var num = postionList[4];
$("#xuehaonum").val(num);
var html = "<table class='xuehaotable_list' listNum='" + postionList[4] + "' cellpadding=\"0\" cellspacing=\"0\">";
for (var i = 0; i < 10; i++) {
html += "<tr>";
for (var j = 0; j < num; j++) {
html += "<td></td>";
}
html += "</tr>";
}
html += "</table>";
$(".main_papermain").append("<div id=\"xuehaoTable\" listNum='" + num + "' class='main_tabletop hideinfo' style='top:" + postionList[1] + "px; left:" + postionList[0] + "px;width:" + postionList[2] + "px; height:" + postionList[3] + "px'>" + html + "</div>");
}
//设置学号
/////////设置客观题//////////////////
function SetKeguanTiPostion(PostionData) {
if (PostionData == "") {
return;
}
//左边距,右边距,长,高,题号开始,题号结束,横排还是竖排
var listOption = PostionData.split('^')
for (var jt = 0; jt < listOption.length; jt++)
{
var listpostion = listOption[jt].split(',');
var tihao = listpostion[4] + "-" + listpostion[5];//题号
if (document.getElementById("keguan_" + tihao) != undefined) {
alert("题目配置重复");
return;
}
var rd_listtype = document.getElementsByName("listtype");//题目横竖向
var listtype = listpostion[7];
var selectNum = listpostion[6];
var questiontype = listpostion[8];
for (var i = 0; i < rd_listtype.length; i++) {
if (rd_listtype[i].value == listtype) {
rd_listtype[i].checked
}
}
var tihaolist = tihao.split('-');
var startnum = tihaolist[0];
var endnum = tihaolist[1];
if (endnum == undefined) {
endnum = startnum;
}
var BigTihao = "";
if (tihao.indexOf('M') > -1) {
BigTihao = tihaolist[0].split('M')[0] + "M";
startnum = tihaolist[0].split('M')[1];
endnum = tihaolist[1].split('M')[1];
}
var html = "<table class='keguan_list' cellpadding=\"0\" style='background:#ff3300;' cellspacing=\"0\">";
if (listtype == 0)//横向
{
for (var i = parseInt(startnum) ; i <= parseInt(endnum) ; i++) {
html += "<tr>";
for (var j = 0; j < selectNum; j++) {
html += "<td></td>";
}
html += "</tr>";
}
}
else {//竖向
for (var i = 0; i < selectNum; i++) {
html += "<tr>";
for (var j = parseInt(startnum); j <= parseInt(endnum); j++) {
html += "<td></td>";
}
html += "</tr>";
}
}
html += "</table>";
var questionHtml = "单选题";
if (questiontype == 1) {
questionHtml = "多选题";
}
if (questiontype == 2) {
questionHtml = "判断";
}
$(".main_papermain").append("<div id=\"keguan_" + tihao + "\" questiontype=\"" + questiontype + "\" class='main_tabletop keguanti hideinfo' tihaovalue='" + tihao + "' startnum='" + BigTihao + "" + startnum + "' endNum='" + BigTihao + "" + endnum + "' selectNum='" + selectNum + "' listtype='" + listtype + "' style='background:none; left:" + listpostion[0] + "px; top:" + listpostion[1] + "px;width:" + listpostion[2] + "px; height:" + listpostion[3] + "px'><div style=\" float:left; width:60px; text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">" + tihao + "</div>" + html + "</div>");
var listtypeText = listtype == 0 ? "横向" : "竖向";
$("#NowSelect").append("<li id='selectNow_" + tihao + "'><a>" + questionHtml + "" + tihao + "</a> <a>选项:" + selectNum + " 排列:" + listtypeText + "</a> <span onclick=\"DeleteKeguanti('" + tihao + "')\">删除</span></li>");
}
}
/////////////////设置主观题//////////////////////
function SetZhuguanTiPostion(PostionData) {
if (PostionData == "" || PostionData == undefined)
{
return;
}
//左边距,右边距,长,高,题号,小题数量
var listdata = PostionData.split('^');
for (var i = 0; i < listdata.length; i++)
{
var zhuguanList = listdata[i].split(',');
var zhuguan_tihao = zhuguanList[4];
if (document.getElementById("keguan_" + zhuguan_tihao) != undefined) {
alert("题目配置重复");
return;
}
var zhuguan_xiaoti = zhuguanList[5];
$(".main_papermain").append("<div id=\"keguan_" + zhuguan_tihao + "\" class='main_tabletop zhuguanti hideinfo' tihaovalue='" + zhuguan_tihao + "' zhuguan_xiaoti='" + zhuguan_xiaoti + "' style='left:" + zhuguanList[0] + "px; top:" + zhuguanList[1] + "px;width:" + zhuguanList[2] + "px;height:" + zhuguanList[3] + "px; background:none; '><div style=\" float:left; width:60px; text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">" + zhuguan_tihao + "</div><div style='width:100%;height:100%;background:#fff;border:1px solid red;'></div></div>");
$("#NowSelect").append("<li id='selectNow_" + zhuguan_tihao + "'><a>题号:" + zhuguan_tihao + "</a><span onclick=\"DeleteKeguanti('" + zhuguan_tihao + "')\">删除</span></li>");
}
}
////////////////设置主观题//////////////////////
/////////////////设置文字区域//////////////////////
function SetWenziQuyuPostion(PostionData) {
if (PostionData == "" || PostionData == undefined) {
return;
}
//左边距,右边距,长,高,题号,小题数量
var listdata = PostionData.split('^');
for (var i = 0; i < listdata.length; i++) {
var zhuguanList = listdata[i].split(',');
var zhuguan_tihao = zhuguanList[4];
if (document.getElementById("keguan_缺考") != undefined) {
alert("题目配置重复");
return;
}
$(".main_papermain").append("<div id=\"keguan_" + zhuguan_tihao + "\" class='main_tabletop wenzimiaoshu hideinfo' wenzimiaoshu='" + zhuguan_tihao + "' style='left:" + zhuguanList[0] + "px; top:" + zhuguanList[1] + "px;width:" + zhuguanList[2] + "px;height:" + zhuguanList[3] + "px; background:none; '><div style=\" float:left; width:auto; text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">" + zhuguan_tihao + "</div><div style='width:100%;height:100%;background:#fff;border:1px solid red;'></div></div>");
$(".quelapsz").attr("class", "quelapsz_hover");
}
}
////////////////设置文字区域//////////////////////
/////////////////设置条码//////////////////////
function SetTiaomaPostion(PostionData) {
if (PostionData == "") {
return;
}
var zhuguanList = PostionData.split(',');
$(".main_papermain").append("<div id=\"keguan_tiaomashibie hideinfo\" class='main_tabletop hideinfo' style='left:" + zhuguanList[0] + "px; top:" + zhuguanList[1] + "px;width:" + zhuguanList[2] + "px;height:" + zhuguanList[3] + "px; background:none; '><div style=\" float:left; width:60px; text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">条码</div><div style='width:100%;height:100%;background:#fff;border:1px solid red;'></div></div>");
$("#NowSelect").append("<li id='selectNow_tiaomashibie'>条码<span onclick=\"DeleteKeguanti('tiaomashibie')\">删除</span></li>");
}
/////////////////设置准考证号//////////////////////
function SetZhunkaozhengPostion(PostionData) {
if (PostionData == "") {
return;
}
var zhuguanList = PostionData.split(',');
$(".main_papermain").append("<div id=\"keguan_zhunkaozhenghaoshibie hideinfo\" class='main_tabletop' style='left:" + zhuguanList[0] + "px; top:" + zhuguanList[1] + "px;width:" + zhuguanList[2] + "px;height:" + zhuguanList[3] + "px; background:none; '><div style=\" float:left; width:60px; text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">准考证号</div><div style='width:100%;height:100%;background:#fff;border:1px solid red;'></div></div>");
$("#NowSelect").append("<li id='selectNow_zhunkaozhenghaoshibie'>准考证号<span onclick=\"DeleteKeguanti('zhunkaozhenghaoshibie')\">删除</span></li>");
}
////////////////设置文字区域//////////////////////
//初始化绑定数据
BaseDataBind();
//扩展方法
String.prototype.trim = function (char, type) {
if (char) {
if (type == 'left') {
return this.replace(new RegExp('^\\' + char + '+', 'g'), '');
} else if (type == 'right') {
return this.replace(new RegExp('\\' + char + '+$', 'g'), '');
}
return this.replace(new RegExp('^\\' + char + '+|\\' + char + '+$', 'g'), '');
}
return this.replace(/^\s+|\s+$/g, '');
};

66
js/jquery-1.10.2.min.js vendored Normal file

File diff suppressed because one or more lines are too long

117
js/jquery.cookie.js Normal file
View File

@ -0,0 +1,117 @@
/*!
* jQuery Cookie Plugin v1.4.1
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2013 Klaus Hartl
* Released under the MIT license
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// CommonJS
factory(require('jquery'));
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
var pluses = /\+/g;
function encode(s) {
return config.raw ? s : encodeURIComponent(s);
}
function decode(s) {
return config.raw ? s : decodeURIComponent(s);
}
function stringifyCookieValue(value) {
return encode(config.json ? JSON.stringify(value) : String(value));
}
function parseCookieValue(s) {
if (s.indexOf('"') === 0) {
// This is a quoted cookie as according to RFC2068, unescape...
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}
try {
// Replace server-side written pluses with spaces.
// If we can't decode the cookie, ignore it, it's unusable.
// If we can't parse the cookie, ignore it, it's unusable.
s = decodeURIComponent(s.replace(pluses, ' '));
return config.json ? JSON.parse(s) : s;
} catch(e) {}
}
function read(s, converter) {
var value = config.raw ? s : parseCookieValue(s);
return $.isFunction(converter) ? converter(value) : value;
}
var config = $.cookie = function (key, value, options) {
// Write
if (value !== undefined && !$.isFunction(value)) {
options = $.extend({}, config.defaults, options);
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setTime(+t + days * 864e+5);
}
return (document.cookie = [
encode(key), '=', stringifyCookieValue(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// Read
var result = key ? undefined : {};
// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling $.cookie().
var cookies = document.cookie ? document.cookie.split('; ') : [];
for (var i = 0, l = cookies.length; i < l; i++) {
var parts = cookies[i].split('=');
var name = decode(parts.shift());
var cookie = parts.join('=');
if (key && key === name) {
// If second argument (value) is a function it's a converter...
result = read(cookie, value);
break;
}
// Prevent storing a cookie that we couldn't decode.
if (!key && (cookie = read(cookie)) !== undefined) {
result[name] = cookie;
}
}
return result;
};
config.defaults = {};
$.removeCookie = function (key, options) {
if ($.cookie(key) === undefined) {
return false;
}
// Must not alter options, thus extending a fresh object...
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
return !$.cookie(key);
};
}));