@@ -461,4 +461,973 @@ FailMsg | |||||
调用方式: | |||||
标准http get请求 | |||||
返回数据类型: | |||||
标准json | |||||
返回数据结构 | |||||
主要关心code和data即可 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
code | |||||
200(int) | |||||
200成功 其余失败 | |||||
info | |||||
响应成功(string) | |||||
状态描述 | |||||
data | |||||
业务数据(object) | |||||
业务数据 | |||||
查看数据接口 | |||||
学院接口 | |||||
地址:http://部署地址/arrangelesson/schoolNotRecord | |||||
数据库表:LR_Base_Company (基础库) | |||||
所需参数:AcademicYearNo=19-20&Semester=1 | |||||
参数名称 | |||||
值 | |||||
备注 | |||||
AcademicYearNo | |||||
19-20 | |||||
代表学年19-20、18-19等 | |||||
Semester | |||||
1、2 | |||||
学期1、2 | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
F_CompanyId | |||||
GUID (string) | |||||
GUID学院ID | |||||
否 | |||||
F_Category | |||||
分类ID(INT) | |||||
F_ParentId | |||||
父级ID(string) | |||||
否 | |||||
F_EnCode | |||||
学院编号(string) | |||||
否 | |||||
F_FullName | |||||
学院全称(string) | |||||
否 | |||||
F_ShortName | |||||
学院简称(string) | |||||
F_Nature | |||||
学院性质(string) | |||||
F_OuterPhone | |||||
外线电话(string) | |||||
F_InnerPhone | |||||
内线电话(string) | |||||
F_Fax | |||||
传真(string) | |||||
F_Postalcode | |||||
邮编(string) | |||||
F_Email | |||||
电子信箱(string) | |||||
F_Manager | |||||
负责人(string) | |||||
F_Address | |||||
详细地址(string) | |||||
F_WebAddress | |||||
主页(string) | |||||
F_FoundedTime | |||||
成立时间(DateTime) | |||||
F_Description | |||||
备注(string) | |||||
系部接口 | |||||
地址:http://部署地址/arrangelesson/ deptNotRecord | |||||
表:CDDEPT (业务库) | |||||
所需参数:AcademicYearNo=19-20&Semester=1 | |||||
参数名称 | |||||
值 | |||||
备注 | |||||
AcademicYearNo | |||||
19-20 | |||||
代表学年19-20、18-19等 | |||||
Semester | |||||
1、2 | |||||
学期1、2 | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
DeptId | |||||
GUID (string) | |||||
GUID部门ID | |||||
否 | |||||
F_SchoolId | |||||
学校ID(string) | |||||
否 | |||||
DeptNo | |||||
部门编号(string) | |||||
否 | |||||
DeptName | |||||
部门全称(string) | |||||
否 | |||||
DeptShortName | |||||
部门简称(string) | |||||
DeptEnBrief | |||||
英文名称(string) | |||||
DeptEnShort | |||||
英文简称(string) | |||||
DeptOldName | |||||
曾用名(string) | |||||
专业接口 | |||||
地址:http://部署地址/arrangelesson/ majorNotRecord | |||||
表:CDMAJOR (业务库) | |||||
所需参数:AcademicYearNo=19-20&Semester=1 | |||||
参数名称 | |||||
值 | |||||
备注 | |||||
AcademicYearNo | |||||
19-20 | |||||
代表学年19-20、18-19等 | |||||
Semester | |||||
1、2 | |||||
学期1、2 | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
ID | |||||
GUID (string) | |||||
GUID专业ID | |||||
否 | |||||
MajorNo | |||||
专业编号(string) | |||||
否 | |||||
MajorName | |||||
专业名称(string) | |||||
否 | |||||
DeptNo | |||||
系部编号(string) | |||||
SubjectSpeciesNo | |||||
学科门类代码(string) | |||||
GovMajorName | |||||
教委专业名称(string) | |||||
教室接口 | |||||
地址:http://部署地址/arrangelesson/ classroomNotRecord | |||||
所需参数:AcademicYearNo=19-20&Semester=1 | |||||
参数名称 | |||||
值 | |||||
备注 | |||||
AcademicYearNo | |||||
19-20 | |||||
代表学年19-20、18-19等 | |||||
Semester | |||||
1、2 | |||||
学期1、2 | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
ClassroomId | |||||
GUID (string) | |||||
否 | |||||
ClassroomNo | |||||
编号(string) | |||||
否 | |||||
ClassroomName | |||||
名称(string) | |||||
否 | |||||
ClassroomTypeNo | |||||
教室类型 (string) | |||||
ClassroomFloor | |||||
教室楼层(string) | |||||
ClassroomBuildingNo | |||||
教学楼(string) | |||||
课程接口 | |||||
地址:http://部署地址/arrangelesson/ lessonNotRecord | |||||
所需参数:AcademicYearNo=19-20&Semester=1 | |||||
参数名称 | |||||
值 | |||||
备注 | |||||
AcademicYearNo | |||||
19-20 | |||||
代表学年19-20、18-19等 | |||||
Semester | |||||
1、2 | |||||
学期1、2 | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
LessonId | |||||
GUID (string) | |||||
GUI课程ID | |||||
否 | |||||
LessonNo | |||||
课程编号(string) | |||||
否 | |||||
LessonName | |||||
课程名称(string) | |||||
否 | |||||
LessonSortNo | |||||
课程类型(string) | |||||
1必修,2选修 | |||||
F_SchoolId | |||||
校区Id(string) | |||||
StudyScore | |||||
学分(decimal) | |||||
WeekStudyHour | |||||
周理论学时(decimal) | |||||
TotalHours | |||||
总学时(decimal) | |||||
WhoStudy | |||||
修读对象(string) | |||||
BriefIntro | |||||
简介(string) | |||||
教师接口 | |||||
地址:http://部署地址/arrangelesson/ teacherNotRecord | |||||
所需参数:AcademicYearNo=19-20&Semester=1 | |||||
参数名称 | |||||
值 | |||||
备注 | |||||
AcademicYearNo | |||||
19-20 | |||||
代表学年19-20、18-19等 | |||||
Semester | |||||
1、2 | |||||
学期1、2 | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
EmpId | |||||
GUID (string) | |||||
GUID教师ID | |||||
否 | |||||
EmpNo | |||||
教职工编号(string) | |||||
否 | |||||
EmpName | |||||
职工姓名(string) | |||||
否 | |||||
GenderNo | |||||
性别(bool) | |||||
true男false女 | |||||
Birthday | |||||
生日(datetime) | |||||
F_DepartmentId | |||||
部门ID(string) | |||||
mobile | |||||
电话(string) | |||||
EmpFullTimeNo | |||||
专兼职(string) | |||||
IsInActiveStatus | |||||
在职状态(string) | |||||
1在职0离职 | |||||
CultureDegreeNo | |||||
文化程序(string) | |||||
HighestRecord | |||||
最高学历(string) | |||||
resume | |||||
简介(string) | |||||
班级接口 | |||||
地址:http://部署地址/arrangelesson/ classNotRecord | |||||
所需参数:AcademicYearNo=19-20&Semester=1 | |||||
参数名称 | |||||
值 | |||||
备注 | |||||
AcademicYearNo | |||||
19-20 | |||||
代表学年19-20、18-19等 | |||||
Semester | |||||
1、2 | |||||
学期1、2 | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
ClassId | |||||
GUID (string) | |||||
GUI班级ID | |||||
否 | |||||
ClassNo | |||||
班级编号(string) | |||||
否 | |||||
ClassName | |||||
班级名称(string) | |||||
否 | |||||
DeptNo | |||||
系部编号(string) | |||||
MajorNo | |||||
专业编号(string) | |||||
Grade | |||||
级别(18代表2018级,19表示2019级)(string) | |||||
学生接口 | |||||
地址:http://部署地址/arrangelesson/ stuNotRecord | |||||
所需参数:AcademicYearNo=19-20&Semester=1 | |||||
参数名称 | |||||
值 | |||||
备注 | |||||
AcademicYearNo | |||||
19-20 | |||||
代表学年19-20、18-19等 | |||||
Semester | |||||
1、2 | |||||
学期1、2 | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
StuId | |||||
GUID (string) | |||||
GUID学生ID | |||||
否 | |||||
StuNo | |||||
学生编号(string) | |||||
否 | |||||
StuName | |||||
姓名(string) | |||||
否 | |||||
StuCode | |||||
学籍号(string) | |||||
ksh | |||||
考生号(string) | |||||
GenderNo | |||||
性别(bool) | |||||
true男false女 | |||||
Birthday | |||||
生日(datetime) | |||||
mobile | |||||
电话(string) | |||||
IdentityCardNo | |||||
身份证号(string) | |||||
DeptNo | |||||
系部编号(string) | |||||
MajorNo | |||||
专业编号(string) | |||||
Grade | |||||
级别(18代表2018级,19表示2019级)(string) | |||||
ClassNo | |||||
班级编号(string) | |||||
对接数据接口 | |||||
学院接口 | |||||
地址:http://部署地址/arrangelesson/ school | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
F_CompanyId | |||||
GUID (string) | |||||
GUID学院ID | |||||
否 | |||||
F_Category | |||||
分类ID(INT) | |||||
F_ParentId | |||||
父级ID(string) | |||||
否 | |||||
F_EnCode | |||||
学院编号(string) | |||||
否 | |||||
F_FullName | |||||
学院全称(string) | |||||
否 | |||||
F_ShortName | |||||
学院简称(string) | |||||
F_Nature | |||||
学院性质(string) | |||||
F_OuterPhone | |||||
外线电话(string) | |||||
F_InnerPhone | |||||
内线电话(string) | |||||
F_Fax | |||||
传真(string) | |||||
F_Postalcode | |||||
邮编(string) | |||||
F_Email | |||||
电子信箱(string) | |||||
F_Manager | |||||
负责人(string) | |||||
F_Address | |||||
详细地址(string) | |||||
F_WebAddress | |||||
主页(string) | |||||
F_FoundedTime | |||||
成立时间(DateTime) | |||||
F_Description | |||||
备注(string) | |||||
系部接口 | |||||
地址:http://部署地址/arrangelesson/ dept | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
DeptId | |||||
GUID (string) | |||||
GUID部门ID | |||||
否 | |||||
F_SchoolId | |||||
学校ID(string) | |||||
否 | |||||
DeptNo | |||||
部门编号(string) | |||||
否 | |||||
DeptName | |||||
部门全称(string) | |||||
否 | |||||
DeptShortName | |||||
部门简称(string) | |||||
DeptEnBrief | |||||
英文名称(string) | |||||
DeptEnShort | |||||
英文简称(string) | |||||
DeptOldName | |||||
曾用名(string) | |||||
专业接口 | |||||
地址:http://部署地址/arrangelesson/ major | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
ID | |||||
GUID (string) | |||||
GUID专业ID | |||||
否 | |||||
MajorNo | |||||
专业编号(string) | |||||
否 | |||||
MajorName | |||||
专业名称(string) | |||||
否 | |||||
DeptNo | |||||
系部编号(string) | |||||
SubjectSpeciesNo | |||||
学科门类代码(string) | |||||
GovMajorName | |||||
教委专业名称(string) | |||||
班级接口 | |||||
地址:http://部署地址/arrangelesson/ class | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
ClassId | |||||
GUID (string) | |||||
GUI班级ID | |||||
否 | |||||
ClassNo | |||||
班级编号(string) | |||||
否 | |||||
ClassName | |||||
班级名称(string) | |||||
否 | |||||
DeptNo | |||||
系部编号(string) | |||||
MajorNo | |||||
专业编号(string) | |||||
Grade | |||||
级别(18代表2018级,19表示2019级)(string) | |||||
教师接口 | |||||
地址:http://部署地址/arrangelesson/ teacher | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
EmpId | |||||
GUID (string) | |||||
GUID教师ID | |||||
否 | |||||
EmpNo | |||||
教职工编号(string) | |||||
否 | |||||
EmpName | |||||
职工姓名(string) | |||||
否 | |||||
GenderNo | |||||
性别(bool) | |||||
true男false女 | |||||
Birthday | |||||
生日(datetime) | |||||
F_DepartmentId | |||||
部门ID(string) | |||||
mobile | |||||
电话(string) | |||||
EmpFullTimeNo | |||||
专兼职(string) | |||||
IsInActiveStatus | |||||
在职状态(string) | |||||
1在职0离职 | |||||
CultureDegreeNo | |||||
文化程序(string) | |||||
HighestRecord | |||||
最高学历(string) | |||||
resume | |||||
简介(string) | |||||
教室接口 | |||||
地址:http://部署地址/arrangelesson/ classroom | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
ClassroomId | |||||
GUID (string) | |||||
否 | |||||
ClassroomNo | |||||
编号(string) | |||||
否 | |||||
ClassroomName | |||||
名称(string) | |||||
否 | |||||
ClassroomTypeNo | |||||
教室类型 (string) | |||||
ClassroomFloor | |||||
教室楼层(string) | |||||
ClassroomBuildingNo | |||||
教学楼(string) | |||||
教室类型接口 | |||||
地址:http://部署地址/arrangelesson/ classroomtype | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
ClassroomTypeId | |||||
GUID (string) | |||||
否 | |||||
ClassroomTypeNo | |||||
类型名称(string) | |||||
否 | |||||
ClassroomType | |||||
类型编号(string) | |||||
否 | |||||
课程接口 | |||||
地址:http://部署地址/arrangelesson/ lesson | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
LessonId | |||||
GUID (string) | |||||
GUI课程ID | |||||
否 | |||||
LessonNo | |||||
课程编号(string) | |||||
否 | |||||
LessonName | |||||
课程名称(string) | |||||
否 | |||||
LessonSortNo | |||||
课程类型(string) | |||||
1必修,2选修 | |||||
F_SchoolId | |||||
校区Id(string) | |||||
StudyScore | |||||
学分(decimal) | |||||
WeekStudyHour | |||||
周理论学时(decimal) | |||||
TotalHours | |||||
总学时(decimal) | |||||
WhoStudy | |||||
修读对象(string) | |||||
BriefIntro | |||||
简介(string) | |||||
课程类型接口 | |||||
地址:http://部署地址/arrangelesson/ lessontype | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
LTId | |||||
GUID (string) | |||||
否 | |||||
LessonTypeName | |||||
类型名称(string) | |||||
否 | |||||
LessonTypeCode | |||||
类型编号(string) | |||||
否 | |||||
学生接口 | |||||
地址:http://部署地址/arrangelesson/ stu | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
StuId | |||||
GUID (string) | |||||
GUID学生ID | |||||
否 | |||||
StuNo | |||||
学生编号(string) | |||||
否 | |||||
StuName | |||||
姓名(string) | |||||
否 | |||||
StuCode | |||||
学籍号(string) | |||||
ksh | |||||
考生号(string) | |||||
GenderNo | |||||
性别(bool) | |||||
true男false女 | |||||
Birthday | |||||
生日(datetime) | |||||
mobile | |||||
电话(string) | |||||
IdentityCardNo | |||||
身份证号(string) | |||||
DeptNo | |||||
系部编号(string) | |||||
MajorNo | |||||
专业编号(string) | |||||
Grade | |||||
级别(18代表2018级,19表示2019级)(string) | |||||
ClassNo | |||||
班级编号(string) | |||||
部门接口 | |||||
地址:http://部署地址/arrangelesson/ departments | |||||
主要业务数据 其余字段可忽略 | |||||
属性 | |||||
返回值 | |||||
备注 | |||||
可否为空 | |||||
F_DepartmentId | |||||
GUID (string) | |||||
GUID部门ID | |||||
否 | |||||
F_ParentId | |||||
上级部门ID(string) | |||||
-1和0均代表根 | |||||
否 | |||||
F_EnCode | |||||
部门编号(string) | |||||
部门编号 | |||||
否 | |||||
F_FullName | |||||
部门全称(string) | |||||
否 | |||||
F_ShortName | |||||
部门简称(string) | |||||
F_Manager | |||||
负责人(string) | |||||
F_OuterPhone | |||||
电话(string) | |||||
数校清空基础数据 | |||||
地址:http://部署地址/arrangelesson/ initbasicdata | |||||
所需参数:AcademicYearNo=19-20&Semester=1 | |||||
参数名称 | |||||
值 | |||||
备注 | |||||
AcademicYearNo | |||||
19-20 | |||||
代表学年19-20、18-19等 | |||||
Semester | |||||
1、2 | |||||
学期1、2 | |||||
BaseTable | |||||
基础表 | |||||
@@ -22,7 +22,7 @@ | |||||
<div id="Grade" type="lrselect" class="lr-select"></div> | <div id="Grade" type="lrselect" class="lr-select"></div> | ||||
</div> | </div> | ||||
<div class="lr-layout-tool-item"> | <div class="lr-layout-tool-item"> | ||||
<input id="StuNo" type="text" class="form-control" placeholder="请输入学号" /> | |||||
<input id="StuNo" type="text" class="form-control" placeholder="请输入学号或姓名" /> | |||||
</div> | </div> | ||||
<div class="lr-layout-tool-item"> | <div class="lr-layout-tool-item"> | ||||
<a id="btn_Search" class="btn btn-primary btn-sm"><i class="fa fa-search"></i> 查询</a> | <a id="btn_Search" class="btn btn-primary btn-sm"><i class="fa fa-search"></i> 查询</a> | ||||
@@ -39,10 +39,10 @@ var bootstrap = function ($, learun) { | |||||
var AcademicYearNo = $('#AcademicYearNo').lrselectGet(); | var AcademicYearNo = $('#AcademicYearNo').lrselectGet(); | ||||
var Semester = $('#Semester').lrselectGet(); | var Semester = $('#Semester').lrselectGet(); | ||||
var StuNo = $.trim($('#StuNo').val()); | var StuNo = $.trim($('#StuNo').val()); | ||||
if (StuNo == null || StuNo == "") { | |||||
learun.alert.warning("请输入学号!"); | |||||
return; | |||||
} | |||||
//if (StuNo == null || StuNo == "") { | |||||
// learun.alert.warning("请输入学号!"); | |||||
// return; | |||||
//} | |||||
var LessonNo = $('#LessonNo').lrselectGet(); | var LessonNo = $('#LessonNo').lrselectGet(); | ||||
var Grade = $('#Grade').lrselectGet(); | var Grade = $('#Grade').lrselectGet(); | ||||
learun.layerForm({ | learun.layerForm({ | ||||
@@ -9,11 +9,7 @@ $(document).ready(function () { | |||||
} | } | ||||
var qrCodeBox = $('.qrCodeBox'); | var qrCodeBox = $('.qrCodeBox'); | ||||
var loginForm = $('#loginForm'); | var loginForm = $('#loginForm'); | ||||
//var qrcode = new QRCode(document.getElementById("qrCode"), { | |||||
// width: 200, | |||||
// height: 200 | |||||
//}); | |||||
//makeCode('http://192.168.1.126:8081/Login/Index'); | |||||
// header search | // header search | ||||
$(document).on('click', function () { | $(document).on('click', function () { | ||||
$('.skinBox').removeClass('active'); | $('.skinBox').removeClass('active'); | ||||
@@ -896,6 +896,12 @@ namespace Learun.Application.Web.Controllers | |||||
/// <returns></returns> | /// <returns></returns> | ||||
public ActionResult NoLogin() | public ActionResult NoLogin() | ||||
{ | { | ||||
var refe = Request.UrlReferrer.ToString(); | |||||
var host = Request.Url.Host; | |||||
if (!refe.Contains(host)) return Content("请正确访问系统"); | |||||
//获取错误次数 | //获取错误次数 | ||||
ViewBag.errornum = OperatorHelper.Instance.GetCurrentErrorNum(); | ViewBag.errornum = OperatorHelper.Instance.GetCurrentErrorNum(); | ||||
//获取高职版跳转地址 | //获取高职版跳转地址 | ||||
@@ -914,6 +920,10 @@ namespace Learun.Application.Web.Controllers | |||||
var result4 = teachSwitchIBLL.FindFirst("wxloginforpc"); | var result4 = teachSwitchIBLL.FindFirst("wxloginforpc"); | ||||
ViewBag.WeixinLoginSwitch = result4; | ViewBag.WeixinLoginSwitch = result4; | ||||
HttpContext.Response.Headers.Add("Cache-Control", "no-cache"); | |||||
HttpContext.Response.Headers.Add("pragma", "no-cache"); | |||||
HttpContext.Response.Headers.Add("expires", "0"); | |||||
return View("DragNoLogin"); | return View("DragNoLogin"); | ||||
} | } | ||||
@@ -5,6 +5,9 @@ | |||||
<head> | <head> | ||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | ||||
<meta http-equiv="Cache-Control" content="no-cache,no-store" /> | |||||
<meta http-equiv="Pragma" content="no-cache" /> | |||||
<meta http-equiv="expires" content="0" /> | |||||
<meta name="renderer" content="webkit" /> | <meta name="renderer" content="webkit" /> | ||||
<meta name="viewport" | <meta name="viewport" | ||||
content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" /> | content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" /> | ||||
@@ -21,6 +21,7 @@ namespace Learun.Application.WebApi.Modules | |||||
Get["/classlesson"] = GetClassLessons; | Get["/classlesson"] = GetClassLessons; | ||||
Get["/bukaolist"] = GetBuKaoList; | Get["/bukaolist"] = GetBuKaoList; | ||||
//以下接口需要传值学年学期 | //以下接口需要传值学年学期 | ||||
//2024/6/27取消学年学期参数 | |||||
Get["/school"] = GetSchools; | Get["/school"] = GetSchools; | ||||
Get["/dept"] = GetDepts; | Get["/dept"] = GetDepts; | ||||
Get["/major"] = GetMajors; | Get["/major"] = GetMajors; | ||||
@@ -108,20 +109,20 @@ namespace Learun.Application.WebApi.Modules | |||||
} | } | ||||
private Response InitBasicData(dynamic _) | private Response InitBasicData(dynamic _) | ||||
{ | { | ||||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||||
string Semester = Request.Query["Semester"]; | |||||
//string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||||
//string Semester = Request.Query["Semester"]; | |||||
string BaseTable = Request.Query["BaseTable"]; | string BaseTable = Request.Query["BaseTable"]; | ||||
if (string.IsNullOrEmpty(AcademicYearNo) || string.IsNullOrEmpty(Semester)) | |||||
{ | |||||
return Fail("学年学期参数不能为空"); | |||||
} | |||||
if (string.IsNullOrEmpty(BaseTable)) | |||||
{ | |||||
return Fail("基础表参数不能为空"); | |||||
} | |||||
//if (string.IsNullOrEmpty(AcademicYearNo) || string.IsNullOrEmpty(Semester)) | |||||
//{ | |||||
// return Fail("学年学期参数不能为空"); | |||||
//} | |||||
//if (string.IsNullOrEmpty(BaseTable)) | |||||
//{ | |||||
// return Fail("基础表参数不能为空"); | |||||
//} | |||||
ArrangeLessonTermEntity arrangeLessonTermEntity = new ArrangeLessonTermEntity(); | ArrangeLessonTermEntity arrangeLessonTermEntity = new ArrangeLessonTermEntity(); | ||||
arrangeLessonTermEntity.AcademicYearNo = AcademicYearNo; | |||||
arrangeLessonTermEntity.Semester = Semester; | |||||
//arrangeLessonTermEntity.AcademicYearNo = AcademicYearNo; | |||||
//arrangeLessonTermEntity.Semester = Semester; | |||||
arrangeLessonTermEntity.SyncBasicTable = BaseTable; | arrangeLessonTermEntity.SyncBasicTable = BaseTable; | ||||
arrangeLessonTermIBLL.InitAsyncDataByCondition(arrangeLessonTermEntity); | arrangeLessonTermIBLL.InitAsyncDataByCondition(arrangeLessonTermEntity); | ||||
return Success("操作成功"); | return Success("操作成功"); | ||||
@@ -320,9 +321,9 @@ namespace Learun.Application.WebApi.Modules | |||||
public Response GetStus(dynamic _) | public Response GetStus(dynamic _) | ||||
{ | { | ||||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||||
string Semester = Request.Query["Semester"]; | |||||
var result = arrangeLessonTermIBLL.GetStus(AcademicYearNo, Semester); | |||||
//string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||||
//string Semester = Request.Query["Semester"]; | |||||
var result = arrangeLessonTermIBLL.GetStus(); | |||||
return Success(result); | return Success(result); | ||||
} | } | ||||
@@ -70,7 +70,7 @@ namespace Learun.Application.WebApi.Modules | |||||
ScoreOfNotPass = y.ScoreOfNotPass, | ScoreOfNotPass = y.ScoreOfNotPass, | ||||
ScoreOfNotPassTwo = y.ScoreOfNotPassTwo | ScoreOfNotPassTwo = y.ScoreOfNotPassTwo | ||||
}).OrderBy(a => a.LessonSortNo).ThenBy(a => a.LessonNo).ToList() | }).OrderBy(a => a.LessonSortNo).ThenBy(a => a.LessonNo).ToList() | ||||
}).ToList().OrderByDescending(x => x.AcademicYearNo).ThenByDescending(x => x.Semester); | |||||
}).ToList().OrderByDescending(x => x.AcademicYearNo).ThenBy(x => x.Semester); | |||||
result.ScoreList = dataTemp.ToList(); | result.ScoreList = dataTemp.ToList(); | ||||
return Success(result); | return Success(result); | ||||
@@ -418,9 +418,9 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
return data; | return data; | ||||
} | } | ||||
public IEnumerable<StuInfoBasicEntity> GetStus(string academicYearNo, string semester) | |||||
public IEnumerable<StuInfoBasicEntity> GetStus() | |||||
{ | { | ||||
var data = arrangeLessonTermService.GetStus(academicYearNo, semester); | |||||
var data = arrangeLessonTermService.GetStus(); | |||||
return data; | return data; | ||||
} | } | ||||
@@ -34,7 +34,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
IEnumerable<EmpInfoEntity> GetTeachersNotRecord(string academicYearNo, string semester); | IEnumerable<EmpInfoEntity> GetTeachersNotRecord(string academicYearNo, string semester); | ||||
IEnumerable<ClassInfoEntity> GetClasses(); | IEnumerable<ClassInfoEntity> GetClasses(); | ||||
IEnumerable<ClassInfoEntity> GetClassesNotRecord(string academicYearNo, string semester); | IEnumerable<ClassInfoEntity> GetClassesNotRecord(string academicYearNo, string semester); | ||||
IEnumerable<StuInfoBasicEntity> GetStus(string academicYearNo, string semester); | |||||
IEnumerable<StuInfoBasicEntity> GetStus(); | |||||
IEnumerable<StuInfoBasicEntity> GetStusNotRecord(string academicYearNo, string semester); | IEnumerable<StuInfoBasicEntity> GetStusNotRecord(string academicYearNo, string semester); | ||||
/// <summary> | /// <summary> | ||||
@@ -1701,14 +1701,14 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest | |||||
} | } | ||||
} | } | ||||
public IEnumerable<StuInfoBasicEntity> GetStus(string academicYearNo, string semester) | |||||
public IEnumerable<StuInfoBasicEntity> GetStus() | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
//var data = BaseRepository("CollegeMIS").FindList<StuInfoBasicEntity>(@"select a.StuId,a.StuNo,a.DeptNo,a.MajorNo,a.Grade,a.ClassNo,a.StuName,a.GenderNo,a.Birthday,b.F_Password,b.F_Secretkey from dbo.StuInfoBasic a left join adms7ultimate2.dbo.LR_Base_User b on a.StuNo=b.F_EnCode where a.CheckMark='1'"); | //var data = BaseRepository("CollegeMIS").FindList<StuInfoBasicEntity>(@"select a.StuId,a.StuNo,a.DeptNo,a.MajorNo,a.Grade,a.ClassNo,a.StuName,a.GenderNo,a.Birthday,b.F_Password,b.F_Secretkey from dbo.StuInfoBasic a left join adms7ultimate2.dbo.LR_Base_User b on a.StuNo=b.F_EnCode where a.CheckMark='1'"); | ||||
//根据学年学期判断排课同步数据表中是否有数据:若有,说明该学年学期同步过;若没有,修改基础表,false; | //根据学年学期判断排课同步数据表中是否有数据:若有,说明该学年学期同步过;若没有,修改基础表,false; | ||||
var aa = this.BaseRepository("CollegeMIS").FindEntity<ArrangeLessonSyncEntity>(x => x.AcademicYearNo == academicYearNo && x.Semester == semester && x.STypeId == "8"); | |||||
var aa = this.BaseRepository("CollegeMIS").FindEntity<ArrangeLessonSyncEntity>(x => x.STypeId == "8"); | |||||
if (aa == null) | if (aa == null) | ||||
{ | { | ||||
this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoBasic set SyncFlag='false' "); | this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoBasic set SyncFlag='false' "); | ||||
@@ -1718,14 +1718,12 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest | |||||
var db = BaseRepository("CollegeMIS"); | var db = BaseRepository("CollegeMIS"); | ||||
var dbbase = BaseRepository(); | var dbbase = BaseRepository(); | ||||
db.BeginTrans(); | db.BeginTrans(); | ||||
var data = db.FindList<StuInfoBasicEntity>("select a.*,b.F_Password,b.F_Secretkey from dbo.StuInfoBasic a left join " + dbbase.getDbConnection().Database + ".dbo.LR_Base_User b on a.StuNo=b.F_EnCode where a.CheckMark=1 and a.StuId not in (select STableId from ArrangeLessonSync where AcademicYearNo='" + academicYearNo + "' and Semester='" + semester + "' )"); | |||||
var data = db.FindList<StuInfoBasicEntity>("select a.*,b.F_Password,b.F_Secretkey from dbo.StuInfoBasic a left join " + dbbase.getDbConnection().Database + ".dbo.LR_Base_User b on a.StuNo=b.F_EnCode where a.CheckMark=1 and a.StuId not in (select STableId from ArrangeLessonSync )"); | |||||
DateTime syncdate = DateTime.Now; | DateTime syncdate = DateTime.Now; | ||||
foreach (var item in data.Select(m => m.StuId)) | foreach (var item in data.Select(m => m.StuId)) | ||||
{ | { | ||||
ArrangeLessonSyncEntity alsEntity = new ArrangeLessonSyncEntity(); | ArrangeLessonSyncEntity alsEntity = new ArrangeLessonSyncEntity(); | ||||
alsEntity.Create(); | alsEntity.Create(); | ||||
alsEntity.AcademicYearNo = academicYearNo; | |||||
alsEntity.Semester = semester; | |||||
alsEntity.STypeId = "8"; | alsEntity.STypeId = "8"; | ||||
alsEntity.SDate = syncdate; | alsEntity.SDate = syncdate; | ||||
alsEntity.STableId = item; | alsEntity.STableId = item; | ||||
@@ -2267,44 +2265,42 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les | |||||
if (tablename == "CdDept") | if (tablename == "CdDept") | ||||
{ | { | ||||
//清空同步记录表 | //清空同步记录表 | ||||
db.ExecuteBySql("delete from ArrangeLessonSync where AcademicYearNo='" + | |||||
entity.AcademicYearNo + "' and Semester='" + entity.Semester + | |||||
"' and STypeId='2'"); | |||||
db.ExecuteBySql("delete from ArrangeLessonSync where STypeId='2'"); | |||||
} | } | ||||
if (tablename == "CdMajor") | if (tablename == "CdMajor") | ||||
{ | { | ||||
//清空同步记录表 | //清空同步记录表 | ||||
db.ExecuteBySql("delete from ArrangeLessonSync where AcademicYearNo='" + | |||||
entity.AcademicYearNo + "' and Semester='" + entity.Semester + | |||||
"' and STypeId='3'"); | |||||
db.ExecuteBySql("delete from ArrangeLessonSync where STypeId='3'"); | |||||
} | } | ||||
if (tablename == "ClassInfo") | if (tablename == "ClassInfo") | ||||
{ | { | ||||
//清空同步记录表 | //清空同步记录表 | ||||
db.ExecuteBySql("delete from ArrangeLessonSync where AcademicYearNo='" + | |||||
entity.AcademicYearNo + "' and Semester='" + entity.Semester + | |||||
"' and STypeId='4'"); | |||||
db.ExecuteBySql("delete from ArrangeLessonSync where STypeId='4'"); | |||||
} | } | ||||
if (tablename == "ClassroomInfo") | if (tablename == "ClassroomInfo") | ||||
{ | { | ||||
//清空同步记录表 | //清空同步记录表 | ||||
db.ExecuteBySql("delete from ArrangeLessonSync where AcademicYearNo='" + | |||||
entity.AcademicYearNo + "' and Semester='" + entity.Semester + | |||||
"' and STypeId='6'"); | |||||
db.ExecuteBySql("delete from ArrangeLessonSync where STypeId='6'"); | |||||
} | } | ||||
if (tablename == "LessonInfo") | if (tablename == "LessonInfo") | ||||
{ | { | ||||
//清空同步记录表 | //清空同步记录表 | ||||
db.ExecuteBySql("delete from ArrangeLessonSync where AcademicYearNo='" + | |||||
entity.AcademicYearNo + "' and Semester='" + entity.Semester + | |||||
"' and STypeId='5'"); | |||||
db.ExecuteBySql("delete from ArrangeLessonSync where STypeId='5'"); | |||||
} | } | ||||
if (tablename == "EmpInfo") | if (tablename == "EmpInfo") | ||||
{ | { | ||||
//清空同步记录表 | //清空同步记录表 | ||||
db.ExecuteBySql("delete from ArrangeLessonSync where AcademicYearNo='" + | |||||
entity.AcademicYearNo + "' and Semester='" + entity.Semester + | |||||
"' and STypeId='7'"); | |||||
db.ExecuteBySql("delete from ArrangeLessonSync where STypeId='7'"); | |||||
} | |||||
if (tablename == "CdClassType") | |||||
{ | |||||
//清空同步记录表 | |||||
db.ExecuteBySql("delete from ArrangeLessonSync where STypeId='9'"); | |||||
} | |||||
if (tablename == "LR_Base_Department") | |||||
{ | |||||
//清空同步记录表 | |||||
db.ExecuteBySql("delete from ArrangeLessonSync where STypeId='10'"); | |||||
} | } | ||||
//重置基础数据表 | //重置基础数据表 | ||||
db.ExecuteBySql("update " + tablename + " set SyncFlag=0"); | db.ExecuteBySql("update " + tablename + " set SyncFlag=0"); | ||||
@@ -2350,7 +2346,7 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les | |||||
strSql.Append(" when b.jobrank in(1,2,3,4) then (case when ta.actcourses<=(" + weeks + "*b.weekcourses)/2 then ta.actcourses*b.feestandard else " + weeks + "*b.weekcourses*b.feestandard/2 end) "); | strSql.Append(" when b.jobrank in(1,2,3,4) then (case when ta.actcourses<=(" + weeks + "*b.weekcourses)/2 then ta.actcourses*b.feestandard else " + weeks + "*b.weekcourses*b.feestandard/2 end) "); | ||||
strSql.Append(" else 0 end as actfeestandard "); | strSql.Append(" else 0 end as actfeestandard "); | ||||
strSql.Append("from "); | strSql.Append("from "); | ||||
strSql.Append("(select count(*) as courses,a.empno,a.empname from ArrangeLessonTerm a where lessondate between '" + starttime + "' and '" + endtime + "' " + notimeSql + " group by a.empno,a.empname ) a "); | |||||
strSql.Append("(select count(*) as courses,a.empno,a.empname from ArrangeLessonTerm a where CheckMark=1 and lessondate between '" + starttime + "' and '" + endtime + "' " + notimeSql + " group by a.empno,a.empname ) a "); | |||||
strSql.Append("left join (select count(*) as actcourses,EmpNo from (select ff.EmpNo,ff.LessonDate,ff.LessonTime from (select aall.* from (select EmpNo,ALTId from Teach_attendance where LessonSortNo='1' and clocktime between '" + starttime + "' and '" + endtime + "' " + notimeSql2 + " group by EmpNo,ALTId) ee left join ArrangeLessonTerm aall on aall.ALTId=ee.ALTId) ff group by ff.EmpNo,ff.LessonDate,ff.LessonTime) gg group by gg.EmpNo ) ta on ta.empno=a.empno "); | strSql.Append("left join (select count(*) as actcourses,EmpNo from (select ff.EmpNo,ff.LessonDate,ff.LessonTime from (select aall.* from (select EmpNo,ALTId from Teach_attendance where LessonSortNo='1' and clocktime between '" + starttime + "' and '" + endtime + "' " + notimeSql2 + " group by EmpNo,ALTId) ee left join ArrangeLessonTerm aall on aall.ALTId=ee.ALTId) ff group by ff.EmpNo,ff.LessonDate,ff.LessonTime) gg group by gg.EmpNo ) ta on ta.empno=a.empno "); | ||||
strSql.Append("left join empinfo b on a.empno=b.empno "); | strSql.Append("left join empinfo b on a.empno=b.empno "); | ||||
strSql.Append("where a.empno is not null and (b.IsInActiveStatus=" + status + " or (0=" + status + " and b.IsInActiveStatus!=2)) "); | strSql.Append("where a.empno is not null and (b.IsInActiveStatus=" + status + " or (0=" + status + " and b.IsInActiveStatus!=2)) "); | ||||
@@ -2262,7 +2262,7 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad | |||||
if (!queryParam["StuNo"].IsEmpty()) | if (!queryParam["StuNo"].IsEmpty()) | ||||
{ | { | ||||
dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String); | dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String); | ||||
strSql.Append(" and s.StuNo=@StuNo "); | |||||
strSql.Append(" and (s.StuNo=@StuNo or s.StuName=@StuNo) "); | |||||
} | } | ||||
if (!queryParam["StuName"].IsEmpty()) | if (!queryParam["StuName"].IsEmpty()) | ||||
{ | { | ||||
@@ -2402,7 +2402,7 @@ group by c.StuNo) cc where cc.StuNo = bb.StuNo) as RankIndept "); | |||||
if (!queryParam["StuNo"].IsEmpty()) | if (!queryParam["StuNo"].IsEmpty()) | ||||
{ | { | ||||
dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String); | dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String); | ||||
strSql.Append(" and s.StuNo=@StuNo "); | |||||
strSql.Append(" and (s.StuNo=@StuNo OR s.StuName=@StuNo) "); | |||||
} | } | ||||
if (!queryParam["StuName"].IsEmpty()) | if (!queryParam["StuName"].IsEmpty()) | ||||
{ | { | ||||
@@ -6,20 +6,12 @@ | |||||
async onLaunch(param) { | async onLaunch(param) { | ||||
// 版本更新 | // 版本更新 | ||||
var newVer = '1.0.2'; | |||||
var newVer = '1.1.2'; | |||||
var oldVer = localStorage.getItem('version'); | var oldVer = localStorage.getItem('version'); | ||||
if (newVer != oldVer) { | if (newVer != oldVer) { | ||||
localStorage.setItem('version', newVer); | localStorage.setItem('version', newVer); | ||||
this.JUMP_TO("/") | this.JUMP_TO("/") | ||||
} | } | ||||
// 加载百度地图资源 | |||||
let ak = this.GET_AK() | |||||
var script = document.createElement('script'); | |||||
script.type = 'text/javascript'; | |||||
script.src = | |||||
'https://api.map.baidu.com/api?v=1.0&type=webgl&ak=' + ak + | |||||
'&callback=' + 'initMap'; | |||||
document.head.appendChild(script); | |||||
// 在App.vue文件中获取到页面到URL (初始化WXsdj) | // 在App.vue文件中获取到页面到URL (初始化WXsdj) | ||||
window.localStorage.setItem('scanUrl',location.href.split('#')[0]) | window.localStorage.setItem('scanUrl',location.href.split('#')[0]) | ||||
@@ -780,7 +780,7 @@ export default { | |||||
//获取百度地图ak | //获取百度地图ak | ||||
GET_AK() { | GET_AK() { | ||||
let ak = ['zdBn8ZVlAELEK3rsBsxin7cXaYxjT1uE','78iR1wqm8cER7Gjt4tT26HrGGtGuk9LI'] | |||||
let ak = ['mI6EMQ4uCYscEQ2DbnG8nMAhsm1OUwwT','mI6EMQ4uCYscEQ2DbnG8nMAhsm1OUwwT'] | |||||
let current = this.GET_STORAGE('baiduAK') | let current = this.GET_STORAGE('baiduAK') | ||||
if(!current){ | if(!current){ | ||||
let ri = Math.floor(Math.random()*2); | let ri = Math.floor(Math.random()*2); | ||||
@@ -1,12 +1,10 @@ | |||||
window.wx = null | |||||
window.wxInit = false | |||||
import wx from '@/common/js/weixin-js-sdk.js'; | import wx from '@/common/js/weixin-js-sdk.js'; | ||||
window.wx = wx | |||||
// 参考文档 https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html | // 参考文档 https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html | ||||
export default { | export default { | ||||
methods: { | methods: { | ||||
data(){ | |||||
return { | |||||
wxInit:false | |||||
} | |||||
}, | |||||
// 初始化wx | // 初始化wx | ||||
initWx(arr = ["getLocation"]) { | initWx(arr = ["getLocation"]) { | ||||
const promise = new Promise((resolve, reject) => { | const promise = new Promise((resolve, reject) => { | ||||
@@ -28,15 +26,28 @@ export default { | |||||
signature: success.certificate, // 必填,签名 | signature: success.certificate, // 必填,签名 | ||||
jsApiList: arr // 必填,需要使用的JS接口列表 | jsApiList: arr // 必填,需要使用的JS接口列表 | ||||
}); | }); | ||||
// 公众平台测试账号本地调试使用 | |||||
// console.log({nonceStr: success.noncestr,timestamp: success.timestamp,url}) | |||||
// wx.config({ | |||||
// debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 | |||||
// appId: 'wx2aa8dcf3603f77b5', // 必填,公众号的唯一标识 | |||||
// timestamp: '1719897639109', // 必填,生成签名的时间戳 | |||||
// nonceStr: "202407011704072775", // 必填,生成签名的随机串 | |||||
// signature: "af7666f9ed1355756b80561cf7b358fb603f7963", // 必填,签名 | |||||
// jsApiList: arr // 必填,需要使用的JS接口列表 | |||||
// }); | |||||
wx.ready(() => { | wx.ready(() => { | ||||
this.wxInit = true | |||||
// this.TOAST("wx初始化成功") | |||||
window.wxInit = true | |||||
resolve(true) | resolve(true) | ||||
}) | }) | ||||
wx.error(() => { | |||||
wx.error((error) => { | |||||
// alert(JSON.stringify(error)) | |||||
this.TOAST("wx初始化失败") | this.TOAST("wx初始化失败") | ||||
resolve(false) | resolve(false) | ||||
}) | }) | ||||
setTimeout(()=>{ | |||||
resolve("wx初始化超时") | |||||
},5000) | |||||
}) | }) | ||||
}) | }) | ||||
return promise | return promise | ||||
@@ -44,9 +55,10 @@ export default { | |||||
// 获取定位 | // 获取定位 | ||||
async getLocation() { | async getLocation() { | ||||
return new Promise(async (resolve) => { | return new Promise(async (resolve) => { | ||||
if (!this.wxInit) { | |||||
if (!window.wxInit) { | |||||
let res = await this.initWx(["getLocation"]) | let res = await this.initWx(["getLocation"]) | ||||
if(!res){ | |||||
if(!res||res=='wx初始化超时'){ | |||||
res&&this.TOAST(res) | |||||
resolve(false) | resolve(false) | ||||
return | return | ||||
} | } | ||||
@@ -54,6 +66,7 @@ export default { | |||||
if(!wx.getLocation){ | if(!wx.getLocation){ | ||||
this.TOAST("获取定位失败") | this.TOAST("获取定位失败") | ||||
resolve(false) | resolve(false) | ||||
return | |||||
} | } | ||||
wx.getLocation({ | wx.getLocation({ | ||||
type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02' | type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02' | ||||
@@ -68,6 +81,7 @@ export default { | |||||
}) | }) | ||||
}, | }, | ||||
fail: (error) => { | fail: (error) => { | ||||
// alert(JSON.stringify(error)) | |||||
this.TOAST("获取定位失败!") | this.TOAST("获取定位失败!") | ||||
resolve(false) | resolve(false) | ||||
} | } | ||||
@@ -77,7 +91,7 @@ export default { | |||||
// 拍照 | // 拍照 | ||||
async chooseImage() { | async chooseImage() { | ||||
return new Promise(async (resolve) => { | return new Promise(async (resolve) => { | ||||
if (!this.wxInit) { | |||||
if (!window.wxInit) { | |||||
let res = await this.initWx(["chooseImage"]) | let res = await this.initWx(["chooseImage"]) | ||||
if(!res){ | if(!res){ | ||||
resolve(false) | resolve(false) | ||||
@@ -106,7 +120,7 @@ export default { | |||||
// 预览图片 | // 预览图片 | ||||
async previewImage(url,urlArr) { | async previewImage(url,urlArr) { | ||||
return new Promise(async (resolve) => { | return new Promise(async (resolve) => { | ||||
if (!this.wxInit) { | |||||
if (!window.wxInit) { | |||||
let res = await this.initWx(["previewImage"]) | let res = await this.initWx(["previewImage"]) | ||||
if(!res){ | if(!res){ | ||||
resolve(false) | resolve(false) | ||||
@@ -2,7 +2,7 @@ export default { | |||||
// 登录页显示的公司名称 | // 登录页显示的公司名称 | ||||
"company": "数字化智慧校园", | "company": "数字化智慧校园", | ||||
// App 版本号 | // App 版本号 | ||||
"appVersion": "1.0.0", | |||||
"appVersion": "1.1.2", | |||||
// 是否允许用户注册 | // 是否允许用户注册 | ||||
"enableSignUp": true, | "enableSignUp": true, | ||||
//请求数据的接口地址;可以配置多个,开发环境下登录页会出现选择菜单供您选择 | //请求数据的接口地址;可以配置多个,开发环境下登录页会出现选择菜单供您选择 | ||||
@@ -2,7 +2,7 @@ | |||||
"name" : "智慧校园", | "name" : "智慧校园", | ||||
"appid" : "__UNI__7C24C09", | "appid" : "__UNI__7C24C09", | ||||
"description" : "智慧校园移动端", | "description" : "智慧校园移动端", | ||||
"versionName" : "2.2.0.240607", | |||||
"versionName" : "2.2.0.240705", | |||||
"versionCode" : 20202, | "versionCode" : 20202, | ||||
"transformPx" : false, | "transformPx" : false, | ||||
/* 5+App特有相关 */ | /* 5+App特有相关 */ | ||||
@@ -165,16 +165,24 @@ | |||||
} | } | ||||
}, | }, | ||||
"h5" : { | "h5" : { | ||||
// "devServer": { | |||||
// "proxy" : { | |||||
// "/api" : { | |||||
// "target" : "http://192.168.10.58:8011/", //自己项目接口域名 | |||||
// "changeOrigin" : true, //是否跨域 | |||||
// // "secure" : true, // 设置支持https协议的代理 | |||||
// "pathRewrite": {"^/api":""} //api路径重定向,根据具体情况调整,也可不写 | |||||
// } | |||||
// } | |||||
// }, | |||||
"devServer" : { | |||||
"proxy" : { | |||||
// "/api" : { | |||||
// "target" : "http://192.168.10.58:8011/", //自己项目接口域名 | |||||
// "changeOrigin" : true, //是否跨域 | |||||
// // "secure" : true, // 设置支持https协议的代理 | |||||
// "pathRewrite": {"^/api":""} //api路径重定向,根据具体情况调整,也可不写 | |||||
// }, | |||||
"/baiduapi" : { | |||||
"target" : "https://api.map.baidu.com/", | |||||
"changeOrigin" : true, | |||||
"secure" : true, // 设置支持https协议的代理 | |||||
"pathRewrite" : { | |||||
"^/baiduapi" : "" | |||||
} //api路径重定向,根据具体情况调整,也可不写 | |||||
} | |||||
} | |||||
}, | |||||
"uniStatistics" : { | "uniStatistics" : { | ||||
"enable" : false | "enable" : false | ||||
}, | }, | ||||
@@ -40,7 +40,6 @@ | |||||
<img src="../../common/images/2.png" alt="" width="100%"> | <img src="../../common/images/2.png" alt="" width="100%"> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
<view id='container'></view> | |||||
<!-- 弹层 --> | <!-- 弹层 --> | ||||
<!-- <l-modal v-model="modal" title="选择打卡类型"> | <!-- <l-modal v-model="modal" title="选择打卡类型"> | ||||
<l-button @click="toAttendanceCardTeacher" color="blue" class="block" block>授课打卡</l-button> | <l-button @click="toAttendanceCardTeacher" color="blue" class="block" block>授课打卡</l-button> | ||||
@@ -98,6 +97,7 @@ | |||||
// modal:false, | // modal:false, | ||||
isInternalNet:false, | isInternalNet:false, | ||||
baiduAK:'', | |||||
} | } | ||||
}, | }, | ||||
@@ -108,22 +108,24 @@ | |||||
methods: { | methods: { | ||||
// 页面初始化 | // 页面初始化 | ||||
async init() { | async init() { | ||||
await this.isInternalNetwork(false) | |||||
this.LOADING('加载数据中...') | |||||
// 获取随机ak | |||||
this.baiduAK = this.GET_AK() | |||||
// 开发环境使用 | |||||
// this.baiduAK = '7SGoYuwTC1UjJWZ6kVuo46RJL0wdvIkF' | |||||
// 判断是否校园网 | |||||
this.isInternalNetwork(false) | |||||
// 实时显示时间 | |||||
this.now = this.getCurrentTime() | this.now = this.getCurrentTime() | ||||
this.timer = setInterval(this.getCurrentTime, 1000) | this.timer = setInterval(this.getCurrentTime, 1000) | ||||
//判断教师是否授课,显示弹层 | //判断教师是否授课,显示弹层 | ||||
// let hasLesson = await this.judgeTeacherIsHasLesson() | // let hasLesson = await this.judgeTeacherIsHasLesson() | ||||
// this.modal = hasLesson | // this.modal = hasLesson | ||||
let res = await this.judgeIsDK() | |||||
// 获取打卡信息 | |||||
this.LOADING('加载数据中...') | |||||
let res = await this.getPageInfo() | |||||
this.ready = res ? true : false | this.ready = res ? true : false | ||||
this.HIDE_LOADING() | this.HIDE_LOADING() | ||||
}, | }, | ||||
// 点击 「打卡」按钮 | // 点击 「打卡」按钮 | ||||
async action(type) { | async action(type) { | ||||
switch (type) { | switch (type) { | ||||
@@ -140,79 +142,49 @@ | |||||
return | return | ||||
} | } | ||||
this.NAV_TO(`./single_zc`, this.postData,true) | this.NAV_TO(`./single_zc`, this.postData,true) | ||||
// this.LOADING() | |||||
// this.HTTP_POST('learun/adms/attendance/clockin', {}, '打卡失败').then(success => { | |||||
// this.HIDE_LOADING() | |||||
// if (!success) { | |||||
// this.TOAST('打卡失败') | |||||
// return | |||||
// } | |||||
// this.TOAST('打卡成功', 'success') | |||||
// setTimeout(this.back, 500) | |||||
// }) | |||||
return | |||||
default: | default: | ||||
break | break | ||||
} | } | ||||
}, | }, | ||||
//获取打卡信息 | |||||
async judgeIsDK() { | |||||
//获取打卡页面信息 | |||||
async getPageInfo() { | |||||
// 获取打卡时间范围等信息 | |||||
// 签到状态(1正常打卡,2迟到打卡,3早退打卡,4外勤打卡,5不在考勤时间范围) | |||||
let success = await this.HTTP_GET('learun/adms/attendance/IsAttendance', {}, '判断当前时间是否可以打卡失败') | let success = await this.HTTP_GET('learun/adms/attendance/IsAttendance', {}, '判断当前时间是否可以打卡失败') | ||||
if (!success) { | if (!success) { | ||||
return false | return false | ||||
} | } | ||||
this.info = success.data | this.info = success.data | ||||
this.imgsrc = dk; | this.imgsrc = dk; | ||||
// if ([1].includes(this.info.AttendanceType)) { | |||||
// this.imgsrc=dk; | |||||
// } else if ([2,3].includes(this.info.AttendanceType)) { | |||||
// this.imgsrc=dkyellow; | |||||
// }else { | |||||
// this.imgsrc=dkred; | |||||
// } | |||||
// 保存原打卡状态 | // 保存原打卡状态 | ||||
this.resInfo = { | this.resInfo = { | ||||
AttendanceType:this.info.AttendanceType, | AttendanceType:this.info.AttendanceType, | ||||
AttendanceTypeString:this.info.AttendanceTypeString, | AttendanceTypeString:this.info.AttendanceTypeString, | ||||
} | } | ||||
// 不在打卡时间范围 停止定位加载 | |||||
if ([5].includes(this.info.AttendanceType)) return true | if ([5].includes(this.info.AttendanceType)) return true | ||||
// 获取到定位前默认为外勤打卡 | |||||
this.$set(this.info, 'AttendanceType', 4) | this.$set(this.info, 'AttendanceType', 4) | ||||
this.$set(this.info, 'AttendanceTypeString', '外勤打卡') | this.$set(this.info, 'AttendanceTypeString', '外勤打卡') | ||||
this.$set(this.postData, 'AIsOut', 1) | this.$set(this.postData, 'AIsOut', 1) | ||||
// 获取定位,不是外勤时候改变状态 | |||||
// if (!window.BMapGL) await this.loadJScript() | |||||
if(!window.BMapGL || !BMapGL.Map){ | |||||
this.TOAST('获取定位资源失败!') | |||||
return false | |||||
} | |||||
this.map = new BMapGL.Map('container'); | |||||
await this.isFieldPersonnel() | |||||
// 更新定位信息 | |||||
await this.updatePageInfo() | |||||
// 获取定位信息失败,终止定时 | |||||
if(!this.postData.ClockPlace){ | if(!this.postData.ClockPlace){ | ||||
return true | return true | ||||
} | } | ||||
// 获取定位信息成功,开始定时 | |||||
this.timer1 = setInterval(async ()=>{ | this.timer1 = setInterval(async ()=>{ | ||||
if(this.isGetingLocal)return | if(this.isGetingLocal)return | ||||
if(!this.postData.ClockPlace){ | if(!this.postData.ClockPlace){ | ||||
clearInterval(this.timer1) | clearInterval(this.timer1) | ||||
} | } | ||||
this.isGetingLocal = true | this.isGetingLocal = true | ||||
await this.isFieldPersonnel() | |||||
// console.log(this.postData) | |||||
await this.updatePageInfo() | |||||
this.isGetingLocal = false | this.isGetingLocal = false | ||||
},3000) | },3000) | ||||
return true | return true | ||||
}, | }, | ||||
//返回 | |||||
back() { | |||||
this.NAV_BACK() | |||||
}, | |||||
//获取当前时间 | //获取当前时间 | ||||
getCurrentTime() { | getCurrentTime() { | ||||
let nowDate = new Date(); | let nowDate = new Date(); | ||||
@@ -221,46 +193,20 @@ | |||||
let ss = nowDate.getSeconds() < 10 ? '0' + nowDate.getSeconds() : nowDate.getSeconds(); | let ss = nowDate.getSeconds() < 10 ? '0' + nowDate.getSeconds() : nowDate.getSeconds(); | ||||
this.now = hh + ':' + mf + ':' + ss; | this.now = hh + ':' + mf + ':' + ss; | ||||
}, | }, | ||||
// 判断是否外勤打卡 | |||||
async isFieldPersonnel() { | |||||
let point = new BMapGL.Point(this.info.GPSLon, this.info.GPSLat) | |||||
await this.getDistance(point) | |||||
}, | |||||
//异步加载地图 | |||||
loadJScript() { | |||||
return new Promise((resolve, reject) => { | |||||
let ak = this.GET_AK() | |||||
window.initMap = function() { | |||||
resolve() | |||||
} | |||||
setTimeout(()=>{ | |||||
resolve() | |||||
},8000) | |||||
var script = document.createElement('script'); | |||||
script.type = 'text/javascript'; | |||||
script.src = | |||||
'https://api.map.baidu.com/api?v=1.0&type=webgl&ak=' + ak + | |||||
'&callback=' + 'initMap'; | |||||
script.onerror = reject; | |||||
script.id = 'baiduScript' | |||||
document.head.appendChild(script); | |||||
}) | |||||
}, | |||||
// 计算距离打卡点的距离 | |||||
// 签到状态(1正常打卡,2迟到打卡,3早退打卡,4外勤打卡,5不在考勤时间范围) | |||||
async getDistance(myP1) { | |||||
// new BMapGL.Point(116.404, 39.915) | |||||
// 更新定位信息 | |||||
async updatePageInfo() { | |||||
// 学校打卡范围中心坐标 | |||||
let myP1 = {lat:this.info.GPSLat,lng:this.info.GPSLon} | |||||
// 获取当前定位 | |||||
let myP2 = await this.local(); | let myP2 = await this.local(); | ||||
if (!myP2) { | if (!myP2) { | ||||
// this.TOAST('获取定位失败!') | |||||
this.$set(this.info, 'AttendanceType', 4) | this.$set(this.info, 'AttendanceType', 4) | ||||
this.$set(this.info, 'AttendanceTypeString', '外勤打卡') | this.$set(this.info, 'AttendanceTypeString', '外勤打卡') | ||||
this.$set(this.postData, 'AIsOut', 1) | this.$set(this.postData, 'AIsOut', 1) | ||||
return | return | ||||
} | } | ||||
let distance = this.map.getDistance(myP1, myP2).toFixed(2) | |||||
// alert('距离'+ distance) | |||||
// console.log('距离', distance, '打卡坐标:', myP1, '当前坐标:', myP2) | |||||
// 计算距离更新状态 | |||||
let distance = this.calculateDistance(myP1.lat,myP1.lng,myP2.lat,myP2.lng)*1000 | |||||
if (Number(distance) > Number(this.info.GPSRange)) { | if (Number(distance) > Number(this.info.GPSRange)) { | ||||
this.$set(this.info, 'AttendanceType', 4) | this.$set(this.info, 'AttendanceType', 4) | ||||
this.$set(this.info, 'AttendanceTypeString', '外勤打卡') | this.$set(this.info, 'AttendanceTypeString', '外勤打卡') | ||||
@@ -271,46 +217,74 @@ | |||||
this.$set(this.postData, 'AIsOut', 0) | this.$set(this.postData, 'AIsOut', 0) | ||||
} | } | ||||
}, | }, | ||||
// 计算距离 | |||||
calculateDistance(lat1, lng1, lat2, lng2) { | |||||
// 地球半径 | |||||
var R = 6371; // 单位为公里 | |||||
// 将角度转为弧度 | |||||
lat1 = lat1 * Math.PI / 180; | |||||
lng1 = lng1 * Math.PI / 180; | |||||
lat2 = lat2 * Math.PI / 180; | |||||
lng2 = lng2 * Math.PI / 180; | |||||
// 经纬度差值 | |||||
var dLat = lat2 - lat1; | |||||
var dLng = lng2 - lng1; | |||||
// Haversine公式 | |||||
var a = Math.pow(Math.sin(dLat / 2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dLng / 2), 2); | |||||
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); | |||||
var distance = R * c; | |||||
return distance; | |||||
}, | |||||
// 获取当前位置 | // 获取当前位置 | ||||
local() { | local() { | ||||
return new Promise(async (resolve) => { | return new Promise(async (resolve) => { | ||||
let res = await this.getLocation() | let res = await this.getLocation() | ||||
// 开发环境使用 | |||||
// let res = { | // let res = { | ||||
// lng: 112.57205562051, | |||||
// lat: 37.742374280962 | |||||
// lng: 112.55343965851368, | |||||
// lat: 37.80263075215858 | |||||
// } | // } | ||||
// let res = { | |||||
// lng: 112.55983599999995, | |||||
// lat: 37.80894902218693 | |||||
// } | |||||
// 瑞鼎国际中心: | |||||
// 腾讯系/国测局/火星/gcj02:37.80263075215858,112.55343965851368 | |||||
// 百度系/bd09ll:37.80894902218693,112.55983599999995 | |||||
if (!res) { | if (!res) { | ||||
this.$set(this.postData, 'ALon', '') | this.$set(this.postData, 'ALon', '') | ||||
this.$set(this.postData, 'ALat', '') | this.$set(this.postData, 'ALat', '') | ||||
this.$set(this.postData, 'ClockPlace', '') | this.$set(this.postData, 'ClockPlace', '') | ||||
resolve(false) | resolve(false) | ||||
return | |||||
} | } | ||||
new BMapGL.Convertor().translate([res], 3, 5, data => { | |||||
if (data&&data.status == 0) { | |||||
// alert(data.points[0].lng + '' + data.points[0].lat) | |||||
this.$set(this.postData, 'ALon', data.points[0].lng) | |||||
this.$set(this.postData, 'ALat', data.points[0].lat) | |||||
let geoc = new BMapGL.Geocoder(); | |||||
geoc.getLocation(data.points[0], (rs) => { | |||||
let addComp = rs.addressComponents; | |||||
let address = | |||||
addComp.province + | |||||
addComp.city + | |||||
addComp.district + | |||||
addComp.street + | |||||
addComp.streetNumber | |||||
this.$set(this.postData, 'ClockPlace', address) | |||||
resolve(data.points[0]) | |||||
}); | |||||
} else { | |||||
this.$set(this.postData, 'ALon', '') | |||||
this.$set(this.postData, 'ALat', '') | |||||
this.$set(this.postData, 'ClockPlace', '') | |||||
this.TOAST('定位获取失败!') | |||||
resolve(false) | |||||
} | |||||
let host = location.origin | |||||
let data = await uni.request({ | |||||
url: host+"/baiduapi/reverse_geocoding/v3/?ak=" | |||||
+this.baiduAK | |||||
+"&output=json&coordtype=gcj02ll" | |||||
+"&location=" + res.lat+ "," + res.lng | |||||
+"&ret_coordtype=bd09ll", | |||||
}) | }) | ||||
if(data&&data[1]&&data[1].data&&data[1].data.status == 0){ | |||||
let result = data[1].data.result | |||||
this.$set(this.postData, 'ALon', result.location.lng) | |||||
this.$set(this.postData, 'ALat', result.location.lat) | |||||
let address = result.formatted_address | |||||
this.$set(this.postData, 'ClockPlace', address) | |||||
resolve(result.location) | |||||
}else { | |||||
this.$set(this.postData, 'ALon', '') | |||||
this.$set(this.postData, 'ALat', '') | |||||
this.$set(this.postData, 'ClockPlace', '') | |||||
let toast = data&&data[1]&&data[1].data&&data[1].data.message?data[1].data.message:'定位转换失败!' | |||||
this.TOAST(toast) | |||||
resolve(false) | |||||
} | |||||
}); | }); | ||||
}, | }, | ||||
//判断教师是否授课 | //判断教师是否授课 | ||||
@@ -319,14 +293,14 @@ | |||||
return success.data; | return success.data; | ||||
}, | }, | ||||
//跳转进入教师授课打卡页面 | //跳转进入教师授课打卡页面 | ||||
toAttendanceCardTeacher() { | |||||
this.JUMP_TO('/pages/AttendanceCardTeacher/list', {},true) | |||||
}, | |||||
// toAttendanceCardTeacher() { | |||||
// this.JUMP_TO('/pages/AttendanceCardTeacher/list', {},true) | |||||
// }, | |||||
// 判断是否学校网络 | // 判断是否学校网络 | ||||
isInternalNetwork(TOAST=true){ | isInternalNetwork(TOAST=true){ | ||||
this.LOADING('加载数据中...') | |||||
TOAST&&this.LOADING('加载数据中...') | |||||
return this.requestBase("https://mp.weixin.qq.com/intp/getuserclientip").then(res=>{ | return this.requestBase("https://mp.weixin.qq.com/intp/getuserclientip").then(res=>{ | ||||
this.HIDE_LOADING() | |||||
TOAST&&this.HIDE_LOADING() | |||||
let res_ = res[1] | let res_ = res[1] | ||||
let client_ip_start = '1.190.222.' | let client_ip_start = '1.190.222.' | ||||
let arr = [] | let arr = [] | ||||
@@ -344,19 +318,6 @@ | |||||
}, | }, | ||||
}, | }, | ||||
destroyed() { | destroyed() { | ||||
// let scirpt = document.getElementById('baiduScript') | |||||
// if(scirpt){ | |||||
// scirpt.remove() | |||||
// } | |||||
// let scirpt1 = document.querySelectorAll('body script') | |||||
// if(scirpt1){ | |||||
// scirpt1.forEach(e=>{ | |||||
// if(e.src.includes('https://api.map.baidu.com')){ | |||||
// e.remove() | |||||
// } | |||||
// }) | |||||
// } | |||||
// window.BMapGL = null | |||||
clearInterval(this.timer) | clearInterval(this.timer) | ||||
clearInterval(this.timer1) | clearInterval(this.timer1) | ||||
} | } | ||||
@@ -50,7 +50,6 @@ | |||||
<img src="../../common/images/2.png" alt="" width="100%"> | <img src="../../common/images/2.png" alt="" width="100%"> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
<view id='container'></view> | |||||
</view> | </view> | ||||
</template> | </template> | ||||
@@ -102,6 +101,7 @@ | |||||
isGetingLocal:false, | isGetingLocal:false, | ||||
isInternalNet:false, | isInternalNet:false, | ||||
baiduAK:'', | |||||
} | } | ||||
}, | }, | ||||
@@ -112,17 +112,21 @@ | |||||
methods: { | methods: { | ||||
// 页面初始化 | // 页面初始化 | ||||
async init() { | async init() { | ||||
// 获取随机ak | |||||
this.baiduAK = this.GET_AK() | |||||
// 开发环境使用 | |||||
// this.baiduAK = '7SGoYuwTC1UjJWZ6kVuo46RJL0wdvIkF' | |||||
// 判断是否校园网 | |||||
this.isInternalNetwork(false) | this.isInternalNetwork(false) | ||||
this.LOADING('加载数据中...') | |||||
// 实时显示时间 | |||||
this.now = this.getCurrentTime() | this.now = this.getCurrentTime() | ||||
this.timer = setInterval(this.getCurrentTime, 1000) | this.timer = setInterval(this.getCurrentTime, 1000) | ||||
let res = await this.judgeIsDK() | |||||
// 获取打卡信息 | |||||
this.LOADING('加载数据中...') | |||||
let res = await this.getPageInfo() | |||||
this.ready = res ? true : false | this.ready = res ? true : false | ||||
this.HIDE_LOADING() | this.HIDE_LOADING() | ||||
}, | }, | ||||
// 点击 「打卡」按钮 | // 点击 「打卡」按钮 | ||||
async action(type) { | async action(type) { | ||||
switch (type) { | switch (type) { | ||||
@@ -143,26 +147,14 @@ | |||||
return | return | ||||
} | } | ||||
this.NAV_TO(`./single_zc`, this.postData,true) | this.NAV_TO(`./single_zc`, this.postData,true) | ||||
// this.LOADING() | |||||
// this.HTTP_POST('learun/adms/attendance/clockinTeacher', {}, '打卡失败').then(success => { | |||||
// this.HIDE_LOADING() | |||||
// if (!success) { | |||||
// this.TOAST('打卡失败') | |||||
// return | |||||
// } | |||||
// this.TOAST('打卡成功', 'success') | |||||
// setTimeout(this.back, 500) | |||||
// }) | |||||
return | |||||
default: | default: | ||||
break | break | ||||
} | } | ||||
}, | }, | ||||
//获取打卡信息 | |||||
async judgeIsDK() { | |||||
//获取打卡页面信息 | |||||
async getPageInfo() { | |||||
// 获取打卡时间范围等信息 | |||||
// 签到状态(1正常打卡,2迟到打卡,3早退打卡,4外勤打卡,5不在考勤时间范围) | |||||
let success = await this.HTTP_GET('learun/adms/attendance/IsAttendanceTeacher', {}, '判断当前时间是否可以打卡失败') | let success = await this.HTTP_GET('learun/adms/attendance/IsAttendanceTeacher', {}, '判断当前时间是否可以打卡失败') | ||||
if (!success) { | if (!success) { | ||||
return false | return false | ||||
@@ -174,47 +166,35 @@ | |||||
ALTId:this.info.ALTId||undefined, | ALTId:this.info.ALTId||undefined, | ||||
ALTOEId:this.info.ALTOEId||undefined | ALTOEId:this.info.ALTOEId||undefined | ||||
} | } | ||||
// if ([1].includes(this.info.AttendanceType)) { | |||||
// this.imgsrc=dk; | |||||
// } else if ([2,3].includes(this.info.AttendanceType)) { | |||||
// this.imgsrc=dkyellow; | |||||
// }else { | |||||
// this.imgsrc=dkred; | |||||
// } | |||||
// 保存原打卡状态 | // 保存原打卡状态 | ||||
this.resInfo = { | this.resInfo = { | ||||
AttendanceType:this.info.AttendanceType, | AttendanceType:this.info.AttendanceType, | ||||
AttendanceTypeString:this.info.AttendanceTypeString, | AttendanceTypeString:this.info.AttendanceTypeString, | ||||
} | } | ||||
if (![5].includes(this.info.AttendanceType)) { | |||||
this.$set(this.info, 'AttendanceType', 4) | |||||
this.$set(this.info, 'AttendanceTypeString', '外勤打卡') | |||||
this.$set(this.postData, 'AIsOut', 1) | |||||
// 获取定位,不是外勤时候改变状态 | |||||
if (!window.BMapGL) await this.loadJScript() | |||||
this.map = new BMapGL.Map('container'); | |||||
await this.isFieldPersonnel() | |||||
// 不在打卡时间范围 停止定位加载 | |||||
if ([5].includes(this.info.AttendanceType)) return true | |||||
// 获取到定位前默认为外勤打卡 | |||||
this.$set(this.info, 'AttendanceType', 4) | |||||
this.$set(this.info, 'AttendanceTypeString', '外勤打卡') | |||||
this.$set(this.postData, 'AIsOut', 1) | |||||
// 更新定位信息 | |||||
await this.updatePageInfo() | |||||
// 获取定位信息失败,终止定时 | |||||
if(!this.postData.ClockPlace){ | |||||
return true | |||||
} | |||||
// 获取定位信息成功,开始定时 | |||||
this.timer1 = setInterval(async ()=>{ | |||||
if(this.isGetingLocal)return | |||||
if(!this.postData.ClockPlace){ | if(!this.postData.ClockPlace){ | ||||
return true | |||||
clearInterval(this.timer1) | |||||
} | } | ||||
this.timer1 = setInterval(async ()=>{ | |||||
if(this.isGetingLocal)return | |||||
if(!this.postData.ClockPlace){ | |||||
clearInterval(this.timer1) | |||||
} | |||||
this.isGetingLocal = true | |||||
await this.isFieldPersonnel() | |||||
// console.log(this.postData) | |||||
this.isGetingLocal = false | |||||
},3000) | |||||
} | |||||
this.isGetingLocal = true | |||||
await this.updatePageInfo() | |||||
this.isGetingLocal = false | |||||
},3000) | |||||
return true | return true | ||||
}, | }, | ||||
//返回 | |||||
back() { | |||||
this.NAV_BACK() | |||||
}, | |||||
//获取当前时间 | //获取当前时间 | ||||
getCurrentTime() { | getCurrentTime() { | ||||
let nowDate = new Date(); | let nowDate = new Date(); | ||||
@@ -223,46 +203,20 @@ | |||||
let ss = nowDate.getSeconds() < 10 ? '0' + nowDate.getSeconds() : nowDate.getSeconds(); | let ss = nowDate.getSeconds() < 10 ? '0' + nowDate.getSeconds() : nowDate.getSeconds(); | ||||
this.now = hh + ':' + mf + ':' + ss; | this.now = hh + ':' + mf + ':' + ss; | ||||
}, | }, | ||||
// 判断是否外勤打卡 | |||||
async isFieldPersonnel() { | |||||
let point = new BMapGL.Point(this.info.GPSLon, this.info.GPSLat) | |||||
await this.getDistance(point) | |||||
}, | |||||
//异步加载地图 | |||||
loadJScript() { | |||||
return new Promise((resolve, reject) => { | |||||
let ak = this.GET_AK() | |||||
window.initMap = function() { | |||||
resolve(BMapGL) | |||||
} | |||||
setTimeout(()=>{ | |||||
resolve() | |||||
},8000) | |||||
var script = document.createElement('script'); | |||||
script.type = 'text/javascript'; | |||||
script.src = | |||||
'https://api.map.baidu.com/api?v=1.0&type=webgl&ak=' + ak + | |||||
'&callback=' + 'initMap'; | |||||
script.onerror = reject; | |||||
script.id = 'baiduScript' | |||||
document.head.appendChild(script); | |||||
}) | |||||
}, | |||||
// 计算距离打卡点的距离 | |||||
// 签到状态(1正常打卡,2迟到打卡,3早退打卡,4外勤打卡,5不在考勤时间范围) | |||||
async getDistance(myP1) { | |||||
// new BMapGL.Point(116.404, 39.915) | |||||
// 更新定位信息 | |||||
async updatePageInfo() { | |||||
// 学校打卡范围中心坐标 | |||||
let myP1 = {lat:this.info.GPSLat,lng:this.info.GPSLon} | |||||
// 获取当前定位 | |||||
let myP2 = await this.local(); | let myP2 = await this.local(); | ||||
if (!myP2) { | if (!myP2) { | ||||
// this.TOAST('获取定位失败!') | |||||
this.$set(this.info, 'AttendanceType', 4) | this.$set(this.info, 'AttendanceType', 4) | ||||
this.$set(this.info, 'AttendanceTypeString', '外勤打卡') | this.$set(this.info, 'AttendanceTypeString', '外勤打卡') | ||||
this.$set(this.postData, 'AIsOut', 1) | this.$set(this.postData, 'AIsOut', 1) | ||||
return | return | ||||
} | } | ||||
let distance = this.map.getDistance(myP1, myP2).toFixed(2) | |||||
// alert('距离'+ distance) | |||||
// console.log('距离', distance, '打卡坐标:', myP1, '当前坐标:', myP2) | |||||
// 计算距离更新状态 | |||||
let distance = this.calculateDistance(myP1.lat,myP1.lng,myP2.lat,myP2.lng)*1000 | |||||
if (Number(distance) > Number(this.info.GPSRange)) { | if (Number(distance) > Number(this.info.GPSRange)) { | ||||
this.$set(this.info, 'AttendanceType', 4) | this.$set(this.info, 'AttendanceType', 4) | ||||
this.$set(this.info, 'AttendanceTypeString', '外勤打卡') | this.$set(this.info, 'AttendanceTypeString', '外勤打卡') | ||||
@@ -273,57 +227,81 @@ | |||||
this.$set(this.postData, 'AIsOut', 0) | this.$set(this.postData, 'AIsOut', 0) | ||||
} | } | ||||
}, | }, | ||||
// 计算距离 | |||||
calculateDistance(lat1, lng1, lat2, lng2) { | |||||
// 地球半径 | |||||
var R = 6371; // 单位为公里 | |||||
// 将角度转为弧度 | |||||
lat1 = lat1 * Math.PI / 180; | |||||
lng1 = lng1 * Math.PI / 180; | |||||
lat2 = lat2 * Math.PI / 180; | |||||
lng2 = lng2 * Math.PI / 180; | |||||
// 经纬度差值 | |||||
var dLat = lat2 - lat1; | |||||
var dLng = lng2 - lng1; | |||||
// Haversine公式 | |||||
var a = Math.pow(Math.sin(dLat / 2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dLng / 2), 2); | |||||
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); | |||||
var distance = R * c; | |||||
return distance; | |||||
}, | |||||
// 获取当前位置 | // 获取当前位置 | ||||
local() { | local() { | ||||
return new Promise(async (resolve) => { | return new Promise(async (resolve) => { | ||||
let res = await this.getLocation() | |||||
let res = await this.getLocation() | |||||
// 开发环境使用 | |||||
// let res = { | // let res = { | ||||
// lng: 112.57205562051, | |||||
// lat: 37.742374280962 | |||||
// lng: 112.55343965851368, | |||||
// lat: 37.80263075215858 | |||||
// } | // } | ||||
// let res = { | |||||
// lng: 112.55981419, | |||||
// lat: 37.80890166 | |||||
// let res = { | |||||
// lng: 112.55983599999995, | |||||
// lat: 37.80894902218693 | |||||
// } | // } | ||||
// 瑞鼎国际中心: | |||||
// 腾讯系/国测局/火星/gcj02:37.80263075215858,112.55343965851368 | |||||
// 百度系/bd09ll:37.80894902218693,112.55983599999995 | |||||
if (!res) { | if (!res) { | ||||
this.$set(this.postData, 'ALon', '') | this.$set(this.postData, 'ALon', '') | ||||
this.$set(this.postData, 'ALat', '') | this.$set(this.postData, 'ALat', '') | ||||
this.$set(this.postData, 'ClockPlace', '') | this.$set(this.postData, 'ClockPlace', '') | ||||
resolve(false) | resolve(false) | ||||
return | |||||
} | } | ||||
new BMapGL.Convertor().translate([res], 3, 5, data => { | |||||
if (data.status == 0) { | |||||
// alert(data.points[0].lng + '' + data.points[0].lat) | |||||
this.$set(this.postData, 'ALon', data.points[0].lng) | |||||
this.$set(this.postData, 'ALat', data.points[0].lat) | |||||
let geoc = new BMapGL.Geocoder(); | |||||
geoc.getLocation(data.points[0], (rs) => { | |||||
let addComp = rs.addressComponents; | |||||
let address = | |||||
addComp.province + | |||||
addComp.city + | |||||
addComp.district + | |||||
addComp.street + | |||||
addComp.streetNumber | |||||
this.$set(this.postData, 'ClockPlace', address) | |||||
resolve(data.points[0]) | |||||
}); | |||||
} else { | |||||
this.$set(this.postData, 'ALon', '') | |||||
this.$set(this.postData, 'ALat', '') | |||||
this.$set(this.postData, 'ClockPlace', '') | |||||
this.TOAST('获取定位失败!') | |||||
resolve(false) | |||||
} | |||||
let host = location.origin | |||||
let data = await uni.request({ | |||||
url: host+"/baiduapi/reverse_geocoding/v3/?ak=" | |||||
+this.baiduAK | |||||
+"&output=json&coordtype=gcj02ll" | |||||
+"&location=" + res.lat+ "," + res.lng | |||||
+"&ret_coordtype=bd09ll", | |||||
}) | }) | ||||
if(data&&data[1]&&data[1].data&&data[1].data.status == 0){ | |||||
let result = data[1].data.result | |||||
this.$set(this.postData, 'ALon', result.location.lng) | |||||
this.$set(this.postData, 'ALat', result.location.lat) | |||||
let address = result.formatted_address | |||||
this.$set(this.postData, 'ClockPlace', address) | |||||
resolve(result.location) | |||||
}else { | |||||
this.$set(this.postData, 'ALon', '') | |||||
this.$set(this.postData, 'ALat', '') | |||||
this.$set(this.postData, 'ClockPlace', '') | |||||
let toast = data&&data[1]&&data[1].data&&data[1].data.message?data[1].data.message:'定位转换失败!' | |||||
this.TOAST(toast) | |||||
resolve(false) | |||||
} | |||||
}); | }); | ||||
}, | }, | ||||
// 判断是否学校网络 | // 判断是否学校网络 | ||||
isInternalNetwork(TOAST=true){ | isInternalNetwork(TOAST=true){ | ||||
this.LOADING() | |||||
this.requestBase("https://mp.weixin.qq.com/intp/getuserclientip").then(res=>{ | |||||
this.HIDE_LOADING() | |||||
TOAST&&this.LOADING('加载数据中...') | |||||
return this.requestBase("https://mp.weixin.qq.com/intp/getuserclientip").then(res=>{ | |||||
TOAST&&this.HIDE_LOADING() | |||||
let res_ = res[1] | let res_ = res[1] | ||||
let client_ip_start = '1.190.222.' | let client_ip_start = '1.190.222.' | ||||
let arr = [] | let arr = [] | ||||
@@ -341,19 +319,6 @@ | |||||
}, | }, | ||||
}, | }, | ||||
destroyed() { | destroyed() { | ||||
let scirpt = document.getElementById('baiduScript') | |||||
if(scirpt){ | |||||
scirpt.remove() | |||||
} | |||||
let scirpt1 = document.querySelectorAll('body script') | |||||
if(scirpt1){ | |||||
scirpt1.forEach(e=>{ | |||||
if(e.src.includes('https://api.map.baidu.com')){ | |||||
e.remove() | |||||
} | |||||
}) | |||||
} | |||||
window.BMapGL = null | |||||
clearInterval(this.timer) | clearInterval(this.timer) | ||||
clearInterval(this.timer1) | clearInterval(this.timer1) | ||||
} | } | ||||
@@ -14,7 +14,7 @@ module.exports = { | |||||
disableHostCheck: true | disableHostCheck: true | ||||
}, | }, | ||||
output: { // 输出重构 打包编译后的 文件目录 文件名称 【模块名称.时间戳】 | output: { // 输出重构 打包编译后的 文件目录 文件名称 【模块名称.时间戳】 | ||||
filename: `${filePath}[name]${Timestamp}.js?v=1.0.2`, | |||||
filename: `${filePath}[name]${Timestamp}.js?v=1.1.2`, | |||||
chunkFilename: `${filePath}[name]${Timestamp}.js` | chunkFilename: `${filePath}[name]${Timestamp}.js` | ||||
}, | }, | ||||
} | } | ||||