diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/config/config.js b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/config/config.js
index 60eeacebf..356c54ea0 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/config/config.js
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/config/config.js
@@ -7,8 +7,8 @@
// web:"http://112.230.201.53/:8081/"//web地址,用于配置logo
//};
var config = {
- webapi: 'http://localhost:31173/',
- web: "http://localhost:20472/"//web地址,用于配置logo
+ webapi: 'http://localhost:8088/',
+ web: "http://localhost:8087/"//web地址,用于配置logo
};
// var config = {
// webapi: 'http://123.57.209.16:31173/',
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs
index 2fb9f24e3..11d6ed1ed 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs
@@ -316,6 +316,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
public ActionResult GetFormData(string keyValue)
{
var StuInfoFreshData = stuInfoFreshIBLL.GetStuInfoFreshEntity(keyValue);
+ StuInfoFreshData.Files = StuInfoFreshData.ID;
//获取头像地址
var url = Config.GetValue("defaultheadimg");
if (StuInfoFreshData.IsPhoto == true && !string.IsNullOrEmpty(StuInfoFreshData.Photo))
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/Form.cshtml
index 9ca74af75..74fbe8dd9 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/Form.cshtml
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/Form.cshtml
@@ -61,9 +61,9 @@
@**@
+ 考生类型
+
+ *@
+ @**@
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/Form.js
index 32a3553ca..878a59462 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/Form.js
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/Form.js
@@ -25,6 +25,8 @@ var bootstrap = function ($, learun) {
$("#MatriculateSort").lrDataItemSelect({ code: 'enrollType' });
$('#ResidenceNo').lrDataItemSelect({ code: 'ResidenceNo' });
$('#IsPoor').lrDataItemSelect({ code: 'YesOrNoInt' });
+ //附件
+ //$('#Files').lrUploader();
$('#StuInfoFreshFamily').jfGrid({
headData: [
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuInfoFreshApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuInfoFreshApi.cs
index f090e2650..3d066f66a 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuInfoFreshApi.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuInfoFreshApi.cs
@@ -26,6 +26,8 @@ namespace Learun.Application.WebApi.Modules
Get["/pageList"] = GetPageList;
Get["/form"] = GetForm;
Post["/save"] = SaveForm;
+ Post["/upload"] = Upload;
+ Post["/deleteFiles"] = DeleteFiles;
}
@@ -99,8 +101,20 @@ namespace Learun.Application.WebApi.Modules
if (annexesFileEntity != null)
{
url = annexesFileEntity.F_FilePath.Substring(annexesFileEntity.F_FilePath.IndexOf("Resource"));
+ StuInfoFreshEntity.Url = url;
}
}
+ //获取附件列表
+ var annexesFileList = annexesFileIBLL.GetList(StuInfoFreshEntity.ID);
+ if (annexesFileList.Any())
+ {
+ foreach (var item in annexesFileList)
+ {
+ item.F_FilePath = item.F_FilePath.Substring(item.F_FilePath.IndexOf("Resource"));
+ }
+ StuInfoFreshEntity.FilesList = annexesFileList.ToList();
+ }
+
StuInfoFreshEntity.DormitoryName = accdormitoryIBLL.GetDormitoryInfoByPlanStuNo(StuInfoFreshEntity.ID);
if (StuInfoFreshEntity.IsPoor != "1")
{
@@ -335,6 +349,87 @@ namespace Learun.Application.WebApi.Modules
return Success("保存成功!");
}
+ ///
+ /// 上传附件图片文件
+ ///
+ ///
+ public Response Upload(dynamic _)
+ {
+ var files = (List)this.Context.Request.Files;
+ var folderId = this.GetReq().folderId;//文件夹id=新生id
+
+ string filePath = Config.GetValue("AnnexesFile");
+ string uploadDate = DateTime.Now.ToString("yyyyMMdd");
+ string FileEextension = Path.GetExtension(files[0].Name);
+ string fileGuid = Guid.NewGuid().ToString();
+
+ string virtualPath = string.Format("{0}/{1}/{2}/{3}{4}", filePath, userInfo.userId, uploadDate, fileGuid, FileEextension);
+
+ //创建文件夹
+ string path = Path.GetDirectoryName(virtualPath);
+ Directory.CreateDirectory(path);
+ AnnexesFileEntity fileAnnexesEntity = new AnnexesFileEntity();
+ if (!System.IO.File.Exists(virtualPath))
+ {
+ byte[] bytes = new byte[files[0].Value.Length];
+ files[0].Value.Read(bytes, 0, bytes.Length);
+ FileInfo file = new FileInfo(virtualPath);
+ FileStream fs = file.Create();
+ fs.Write(bytes, 0, bytes.Length);
+ fs.Close();
+
+ //文件信息写入数据库
+ fileAnnexesEntity.F_Id = fileGuid;
+ fileAnnexesEntity.F_FolderId = folderId;
+ fileAnnexesEntity.F_FileName = files[0].Name;
+ fileAnnexesEntity.F_FilePath = virtualPath;
+ fileAnnexesEntity.F_FileSize = files[0].Value.Length.ToString();
+ fileAnnexesEntity.F_FileExtensions = FileEextension;
+ fileAnnexesEntity.F_FileType = FileEextension.Replace(".", "");
+ fileAnnexesEntity.F_CreateUserId = userInfo.userId;
+ fileAnnexesEntity.F_CreateUserName = userInfo.realName;
+
+ annexesFileIBLL.SaveEntity(folderId, fileAnnexesEntity);
+ }
+
+ //文件地址截取到resource后
+ fileAnnexesEntity.F_FilePath = fileAnnexesEntity.F_FilePath.Substring(fileAnnexesEntity.F_FilePath.IndexOf("Resource"));
+
+ return Success(fileAnnexesEntity);
+ }
+
+ ///
+ /// 删除附件
+ ///
+ ///
+ ///
+ public Response DeleteFiles(dynamic _)
+ {
+ var fileId = this.GetReqData().id;
+
+ AnnexesFileEntity fileInfoEntity = annexesFileIBLL.GetEntity(fileId);
+ if (fileInfoEntity != null)
+ {
+ //删除附件表
+ annexesFileIBLL.DeleteEntity(fileId);
+ //删除文件
+ if (System.IO.File.Exists(fileInfoEntity.F_FilePath))
+ {
+ System.IO.File.Delete(fileInfoEntity.F_FilePath);
+ }
+
+
+ //下载
+ //if (FileDownHelper.FileExists(fileInfoEntity.F_FilePath))
+ //{
+ // FileDownHelper.DownLoadnew(fileInfoEntity.F_FilePath);
+ //}
+ }
+
+ return Success("删除成功");
+ }
+
+
#region 私有类
///
@@ -389,6 +484,7 @@ namespace Learun.Application.WebApi.Modules
///
public List StuInfoFreshEmergePeopleEntities { get; set; }
+
}
public class PhotoModel
@@ -397,5 +493,10 @@ namespace Learun.Application.WebApi.Modules
public string account { get; set; }
}
+ public class FileModel
+ {
+ public string folderId { get; set; }
+ public string id { get; set; }
+ }
}
}
\ No newline at end of file
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config
index 9f5e1c6ec..a1e3c4b29 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config
+++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config
@@ -65,7 +65,7 @@
-
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/Annexes/AnnexesFileService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/Annexes/AnnexesFileService.cs
index 8c4039d9f..c4a8579cc 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/Annexes/AnnexesFileService.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/Annexes/AnnexesFileService.cs
@@ -13,7 +13,7 @@ namespace Learun.Application.Base.SystemModule
/// 日 期:2017.03.08
/// 描 述:附件管理
///
- public class AnnexesFileService:RepositoryFactory
+ public class AnnexesFileService : RepositoryFactory
{
#region 属性 构造函数
private string fieldSql;
@@ -188,7 +188,7 @@ namespace Learun.Application.Base.SystemModule
{
try
{
- this.BaseRepository().Delete(new AnnexesFileEntity() { F_Id = fileId });
+ this.BaseRepository().Delete(x => x.F_Id == fileId);
}
catch (Exception ex)
{
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshEntity.cs
index b7a16a27b..a503d3216 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshEntity.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshEntity.cs
@@ -1,5 +1,7 @@
-using Learun.Util;
+using Learun.Application.Base.SystemModule;
+using Learun.Util;
using System;
+using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace Learun.Application.TwoDevelopment.EducationalAdministration
@@ -716,6 +718,23 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
[NotMapped]
public bool? IsStudentEdit { get; set; }
+ ///
+ /// 图片显示地址
+ ///
+ [NotMapped]
+ public string Url { get; set; }
+
+ ///
+ /// 附件(文件夹id)
+ ///
+ [NotMapped]
+ public string Files { get; set; }
+ ///
+ /// 附件列表
+ ///
+ [NotMapped]
+ public List FilesList { get; set; }
+
#endregion
}
}
diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/mixins.js b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/mixins.js
index 403dc9c31..8fe797283 100644
--- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/mixins.js
+++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/mixins.js
@@ -263,6 +263,12 @@ export default {
return this.handleResult(err, res)
},
+
+ async HTTP_UPLOAD2(url,filePath, formData) {
+ const [err, res] = await this.UPLOAD(url, filePath, formData)
+
+ return this.handleResult(err, res)
+ },
// 封装的文件下载,集成了验证信息
// 返回临时文件路径或 null
@@ -654,6 +660,7 @@ export default {
title: '登录状态无效,正在跳转到登录页…',
icon: 'none'
})
+ return null
this.CLEAR_GLOBAL()
uni.reLaunch({
url: '/pages/login'
@@ -673,6 +680,14 @@ export default {
return null
}
+ if(result.data.code != 200){
+ uni.hideLoading()
+ uni.showToast({
+ title: result.data.info,
+ icon: 'none'
+ })
+ return null
+ }
return result.data.data
},
diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-mpui/learun-ui-mp/upload.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-mpui/learun-ui-mp/upload.vue
index d5c17cdb0..16224c6e1 100644
--- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-mpui/learun-ui-mp/upload.vue
+++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-mpui/learun-ui-mp/upload.vue
@@ -3,14 +3,13 @@
-
@@ -90,8 +89,26 @@ export default {
},
uploadImage(){
- // 单图上传 多图没写
+ // let array =
+ // function apiFn(item){
+ // return this.HTTP_POST('StuInfoFresh/savePhoto', postData, '图片上传失败!').then((data) => {
+ // if (data) {
+ // reslove([{
+ // url:data.Url,
+ // id:data.AnnexesFileId
+ // }])
+ // }else{
+ // reject('图片上传失败!')
+ // }
+ // })
+ // }
+ // return this.promiseAllLimit(5,array,apiFn)
+ // 单图上传
return new Promise(async (reslove,reject)=>{
+ let hasNotUpdatedList = this.imgList.every(item=>item.id)
+ if(hasNotUpdatedList){
+ reslove(this.imgList)
+ }
if(this.imgList.length){
var postData = {
Base64Url: await this.imgToBase64(this.imgList[0].url)
@@ -110,11 +127,41 @@ export default {
reslove("")
}
})
-
+ },
+
+ /**
+ * @description 控制promise.all并发数量
+ * @param limit 并发数
+ * @param array 参数列表
+ * @param apiFn 执行函数
+ * @returns {Promise[]>}
+ */
+ async promiseAllLimit(limit, array, apiFn) {
+ const ret = [] // 用于存放所有的promise实例
+ const executing = [] // 用于存放目前正在执行的promise
+ for (const item of array) {
+ const p = apiFn(item)
+ ret.push(p)
+ if (limit <= array.length) {
+ // then回调中,当这个promise状态变为fulfilled后,将其从正在执行的promise列表executing中删除
+ const e = p.then(() => executing.splice(executing.indexOf(e), 1))
+ executing.push(e)
+ if (executing.length >= limit) {
+ // 一旦正在执行的promise列表数量等于限制数,就使用Promise.race等待某一个promise状态发生变更,
+ // 状态变更后,就会执行上面then的回调,将该promise从executing中删除,
+ // 然后再进入到下一次for循环,生成新的promise进行补充
+ await Promise.race(executing)
+ }
+ }
+ }
+ return Promise.all(ret)
},
imgToBase64(url){
return new Promise((resolve,reject)=>{
+ if(!url){
+ resolve("")
+ }
var canvas = document.createElement('canvas'),
ctx = canvas.getContext('2d'),
img = new Image;
@@ -133,18 +180,18 @@ export default {
},
validate(array){
- let type = array.every(item=>{
- return item.type && item.type.substring(0,6) == "image/"
- })
- if(!type){
- this.TOAST('文件类型错误');
- return false
- }
+ // let type = array.every(item=>{
+ // return item.type && item.type.substring(0,6) == "image/"
+ // })
+ // if(!type){
+ // this.TOAST('文件类型错误');
+ // return false
+ // }
let size = array.every(item=>{
- return item.size && item.size <= 2 * 1024 * 1024
+ return item.size && item.size <= 100 * 1024 * 1024
})
if(!size){
- this.TOAST('文件大小不得超过2M');
+ this.TOAST('文件大小不得超过100M');
return false
}
return true
@@ -152,8 +199,8 @@ export default {
viewImg(index) {
uni.previewImage({
- urls: this.imgList,
- current: this.imgList[index],
+ urls: this.imgList.map(item=>item.id?this.CONFIG('webHost')+item.url:item.url),
+ current: this.imgList[index].id?this.CONFIG('webHost')+this.imgList[index].url:this.imgList[index].url,
});
},
diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/upload-file.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/upload-file.vue
new file mode 100644
index 000000000..7cc779f0f
--- /dev/null
+++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/upload-file.vue
@@ -0,0 +1,300 @@
+
+
+
+
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js
index 6b208c6b5..e55579246 100644
--- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js
+++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js
@@ -22,12 +22,13 @@ export default {
// ],
"apiHost": [
// "http://localhost:31173/"
- "http://192.168.10.58:8012/"
+ "http://192.168.10.85:8088/"
],
+ "webHost":"http://192.168.10.85:8087/",
// 开发环境下自动填充登录账号密码,与接口地址一一对应,只在开发环境下显示
"devAccount": [
- // 20201130230
- { username: "420528200606205026", password: "www.qj.com" }
+ // 20201130230 21364200000400266 老师 420528196310072253 学生 420528200606205026 420528200507261428
+ { username: "21364200000400558", password: "www.qj.com" }
],
//是否分布式部署 指WebApi与Web不在一台服务器
"isDistributed":true,
diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/MealCardRunTab/list.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/MealCardRunTab/list.vue
index 4a7742b8e..bafee7915 100644
--- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/MealCardRunTab/list.vue
+++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/MealCardRunTab/list.vue
@@ -14,7 +14,7 @@
- {{item.bigGroup}}
+ {{item.bigGroup}}{{item.smallGroup?"-"+item.smallGroup:""}}
餐次:{{item.seg||"--"}}
@@ -231,7 +231,8 @@
this.multipleData.StartTime = this.dateRange.start
this.multipleData.EndTime = this.dateRange.end
} else{
-
+ this.multipleData.StartTime = ""
+ this.multipleData.EndTime = ""
}
// console.log(this.dateRange,"==========")
diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/welcome/list.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/welcome/list.vue
index c0ef8e316..9721ec248 100644
--- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/welcome/list.vue
+++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/welcome/list.vue
@@ -63,7 +63,9 @@
- 保存
+ 附件
+
+ 保存
@@ -71,11 +73,16 @@
import moment from 'moment';
import get from 'lodash/get';
import set from 'lodash/set';
+import uploadFile from '@/components/upload-file.vue'
export default {
+ components:{
+ uploadFile,
+ },
data() {
return {
photo:[],
- uploadVisiable:true,
+ fileList:[],
+ uploadVisiable:false,
imgSrc: '',
scheme: {
PartyFaceNo: {
@@ -141,8 +148,10 @@ export default {
_this.queryData.StuInfoFreshFamilyEntities = _this.COPY(res.StuInfoFreshFamilyList);
_this.queryData.StuInfoFreshEmergePeopleEntities = _this.COPY(res.StuInfoFreshEmergePeopleList);
_this.queryData.ID = res.StuInfoFreshEntity.ID;
+
_this.queryData.Photo = res.StuInfoFreshEntity.Photo;
- _this.photo = [{url:res.StuInfoFreshEntity.Photo}];
+ _this.photo = res.StuInfoFreshEntity.Photo?[{url:res.StuInfoFreshEntity.Url,id:res.StuInfoFreshEntity.Photo}]:[];
+ _this.fileList = res.StuInfoFreshEntity.FilesList||[]
_this.refreshComponent()
_this.queryData.telephone = res.StuInfoFreshEntity.telephone;
_this.queryData.FamilyAddress = res.StuInfoFreshEntity.FamilyAddress;
@@ -150,16 +159,16 @@ export default {
// _this.imgSrc = this.API.slice(0,-1) + res.Url;
});
},
- async tapBtn() {
+ async submit() {
this.LOADING('正在提交数据…');
let res = await this.$refs["upload"].uploadImage()
- if(res){
- this.queryData.Photo = res[0]["AnnexesFileId"];
+ if(res&&res.length){
+ this.queryData.Photo = res[0]["id"];
+ }else{
+ this.queryData.Photo = ""
}
- console.log(this.queryData)
- this.HTTP_GET('StuInfoFresh/saveStuInfoFresh', this.queryData, '加载数据时出错').then(res => {
+ this.HTTP_GET('StuInfoFresh/saveStuInfoFresh', this.queryData).then(res => {
this.HIDE_LOADING();
- // console.log(res);
if (res) {
this.TOAST('保存成功');
}