Переглянути джерело

Merge branch '长阳分支中职' of http://123.57.209.16:3000/bjquanjiang/DigitalScholl into 长阳分支中职

临城职教中职
dyy 2 роки тому
джерело
коміт
5f72cd6b86
10 змінених файлів з 295 додано та 287 видалено
  1. +6
    -5
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/customform.js
  2. +1
    -1
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/custompage.js
  3. +2
    -2
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/mixins.js
  4. +5
    -2
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-app/customform.vue
  5. +266
    -269
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/upload-file.vue
  6. +3
    -3
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js
  7. +2
    -1
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/nworkflow/myflow/single.vue
  8. +4
    -1
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/nworkflow/releasetask/single.vue
  9. +4
    -1
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/nworkflow/workflow.js
  10. +2
    -2
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/timeTable/list.vue

+ 6
- 5
Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/customform.js Переглянути файл

@@ -274,13 +274,14 @@ export default {

case 'upload':
const uploadUid = []
for (const { path, uid } of val) {
if (uid) {
uploadUid.push(uid)
for (const item of val) {
if (item.uid) {
uploadUid.push(item.uid)
continue
}
const fileId = await this.HTTP_UPLOAD(path)
const fileId = await this.HTTP_UPLOAD(item.path||item)
if (fileId) {
uploadUid.push(fileId)
}


+ 1
- 1
Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/custompage.js Переглянути файл

@@ -256,7 +256,7 @@ export default {
const fileType = fileInfo.F_FileType
const fileSize = fileInfo.F_FileSize

const path = this.API + '/annexes/wxdown?' + this.URL_QUERY(uid, true)
const path = this.API + '/learun/adms/annexes/wxdown?' + this.URL_QUERY(uid, true)

fileList.push({ path, type: fileType, uid, size: fileSize })
}


+ 2
- 2
Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/mixins.js Переглянути файл

@@ -259,7 +259,7 @@ export default {
// filePath 为临时文件的路径
// formData 为请求附带的提交数据
async HTTP_UPLOAD(filePath, formData) {
const [err, res] = await this.UPLOAD('/annexes/wxupload', filePath, formData)
const [err, res] = await this.UPLOAD('/learun/adms/annexes/wxupload', filePath, formData)

return this.handleResult(err, res)
},
@@ -276,7 +276,7 @@ export default {
// url 为请求地址
// formData 为请求附带的提交数据
async HTTP_DOWNLOAD(formData) {
const [err, res] = await this.DOWNLOAD('/annexes/wxdown', formData)
const [err, res] = await this.DOWNLOAD('/learun/adms/annexes/wxdown', formData)

return this.handleResult(err, res)
},


+ 5
- 2
Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-app/customform.vue Переглянути файл

@@ -194,12 +194,14 @@ export default {
// 依次验证表单项,返回一个所有错误提示的数组,如果为空数组则表示无错误
verifyValue() {
const errorList = []
console.log(this.scheme)
this.scheme
.filter(t => t.verify)
.forEach(schemeItem => {
if (schemeItem.table && schemeItem.field) {
console.log(schemeItem.verify,'hemeItem.verify')
const verifyFunc = this.verify[schemeItem.verify]
console.log(schemeItem.verify)
const verifyResult = verifyFunc(this.getValue(schemeItem.__valuePath__))
if (verifyResult !== true) {
errorList.push(`[${schemeItem.title}]: ${verifyResult}`)
@@ -304,7 +306,8 @@ export default {
MobileOrPhoneOrNull: t =>
t.length <= 0 || /^1[0-9]{10}$/.test(t) || /^[+0-9- ]*$/.test(t) || '须留空或符合手机/电话号码格式',
Uri: t => /^[a-zA-z]+:\/\/[^\s]*$/.test(t) || '须符合网址Url格式',
UriOrNull: t => t.length <= 0 || /^[a-zA-z]+:\/\/[^\s]*$/.test(t) || '须留空或符合网址Url格式'
UriOrNull: t => t.length <= 0 || /^[a-zA-z]+:\/\/[^\s]*$/.test(t) || '须留空或符合网址Url格式',
PositiveFloatint:t=> /^([1-9]\d*|(0|[1-9]\d*)\.\d*[1-9])$/.test(t) || '请输入正确的整数或小数(不能为零和负数)'
}
}
}


+ 266
- 269
Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/upload-file.vue Переглянути файл

@@ -1,296 +1,293 @@
<template>
<view class="cu-form-group">
<view class="grid col-4 grid-square flex-sub">
<view
v-for="(item, index) in imgList"
@tap="viewImg(item)"
:key="index"
class="bg-img"
>
<!-- {{API + '/user/img?data=' + (path.path ? path.path : path)}} -->
<image
v-if="showfile()&&isImage(item.type)"
:src="CONFIG('webHost') + item.url"
mode="aspectFill"
></image>
<l-icon v-if="showfile()&&!isImage(item.type)" type="text" />
<text class="file-name">{{item.name}}</text>
<view v-if="!readonly" @tap.stop="delImg(index)" class="cu-tag bg-red" style="width: 18px; height: 18px; font-size: 24px">
<l-icon
type="close"
style="width: 18px; height: 18px; font-size: 12px"
/>
</view>
</view>
<view class="cu-form-group">
<view class="grid col-4 grid-square flex-sub">
<view v-for="(item, index) in imgList" @tap="viewImg(item)" :key="index" class="bg-img">
<image v-if="showfile()&&isImage(item.type)" :src="CONFIG('webHost') + item.url" mode="aspectFill">
</image>
<l-icon v-if="showfile()&&!isImage(item.type)" type="text" />
<text class="file-name">{{item.name}}</text>
<view v-if="!readonly" @tap.stop="delImg(index)" class="cu-tag bg-red"
style="width: 18px; height: 18px; font-size: 24px">
<l-icon type="close" style="width: 18px; height: 18px; font-size: 12px" />
</view>
</view>

<view v-show="!readonly && imgList.length < Number(number)&&isShow" class="solids">
<!-- @tap="chooseImg" -->
<l-icon type="file" />
<lsj-upload ref="lsjUpload" height="80px" width="100%" :size="20" :option="{}" :count="1"
@change="chooseChange" style="opacity: 0;"></lsj-upload>
</view>

</view>
</view>

<view
v-show="!readonly && imgList.length < Number(number)&&isShow"
class="solids"
>
<!-- @tap="chooseImg" -->
<l-icon type="file" />
<lsj-upload
ref="lsjUpload"
height="80px"
width="100%"
:size="20"
:option="{}"
:count="1"
@change="chooseChange"
style="opacity: 0;"
></lsj-upload>
</view>
</view>
</view>
</template>

<script>
export default {
export default {

props: {
number: { default: 1 },
readonly: {},
value: { default: () => [] },
folderId:{},
},
data(){
return{
isShow:false,
imgList:[],
}
},
props: {
number: {
default: 1
},
readonly: {},
value: {
default: () => []
},
folderId: {},
},

methods: {
chooseChange(files){
let array = Array.from(files);
if(array.length){
this.$refs.lsjUpload.clear()
}
let tempFilePaths = [],tempFiles=[];
array.forEach(item=>{
tempFilePaths.push(item[1].path)
tempFiles.push(item[1].file)
})
this.chooseChangeback(tempFilePaths,tempFiles)
},
delImg(index) {
this.LOADING('正在删除…');
const newList = JSON.parse(JSON.stringify(this.imgList));
this.HTTP_POST('StuInfoFresh/deleteFiles', {id:this.imgList[index].id},"文件删除失败").then((data) => {
this.HIDE_LOADING();
if (data) {
newList.splice(index, 1);
this.imgList = newList
this.$emit("update:value", newList);
this.$emit("input", newList);
this.$emit("change");
this.$emit("del");
data() {
return {
isShow: false,
imgList: [],
}
})
},
showfile() {
return true;
},
async chooseChangeback(tempFilePaths,tempFiles) {
// let {tempFilePaths,tempFiles} = res
// if(!this.validate(tempFiles))return
let uploadImageRes = await this.uploadImage(tempFilePaths[0],tempFiles[0]?tempFiles[0].name:"")
let newList = this.imgList || []
if(uploadImageRes){
newList = JSON.parse(JSON.stringify(newList)).concat(uploadImageRes);
}
this.imgList = newList
this.$emit("update:value", newList);
this.$emit("input", newList);
this.$emit("change",newList);
this.$emit("add");
},
uploadImage(url,name){
if(!url)return
// 文件上传
return new Promise(async (reslove,reject)=>{
this.LOADING('正在上传…');
let params = name?{folderId:this.folderId,name}:{folderId:this.folderId}
this.HTTP_UPLOAD2('StuInfoFresh/upload', url,params).then((data) => {
this.HIDE_LOADING();
this.$refs.lsjUpload.show()
if (data) {
// this.HTTP_GET('StuInfoFresh/upload', {fileId:data})
reslove([{
id:data.F_Id,
name:data.F_FileName,
url:data.F_FilePath,
type:data.F_FileType,
}])
}else{
reject('上传失败!')
},

methods: {
chooseChange(files) {
let array = Array.from(files);
if (array.length) {
this.$refs.lsjUpload.clear()
}
})
})
},
ceshi(){
function apiFn(params){
return new Promise((resolve,reject)=>{
this.LOADING('正在上传…');
this.HTTP_UPLOAD2('StuInfoFresh/upload', params.url,{folderId:this.folderId}).then((data) => {
this.HIDE_LOADING();
if (data) {
// this.HTTP_GET('StuInfoFresh/upload', {fileId:data})
this.imgList[params.index] = [{
id:data.F_Id,
name:data.F_FileName,
url:data.F_FilePath,
type:data.F_FileType
}]
reslove(this.imgList[params.index])
}else{
reject('上传失败!')
let tempFilePaths = [],
tempFiles = [];
array.forEach(item => {
tempFilePaths.push(item[1].path)
tempFiles.push(item[1].file)
})
this.chooseChangeback(tempFilePaths, tempFiles)
},
delImg(index) {
this.CONFIRM("", "是否确认删除?", true).then(res => {
if(!res)return
this.LOADING('正在删除…');
const newList = JSON.parse(JSON.stringify(this.imgList));
this.HTTP_POST('StuInfoFresh/deleteFiles', {
id: this.imgList[index].id
}, "文件删除失败").then((data) => {
this.HIDE_LOADING();
if (data) {
newList.splice(index, 1);
this.imgList = newList

this.$emit("update:value", newList);
this.$emit("input", newList);
this.$emit("change");
this.$emit("del");
}
})
})

},
showfile() {
return true;
},

async chooseChangeback(tempFilePaths, tempFiles) {
// let {tempFilePaths,tempFiles} = res
// if(!this.validate(tempFiles))return
let uploadImageRes = await this.uploadImage(tempFilePaths[0], tempFiles[0] ? tempFiles[0].name : "")
let newList = this.imgList || []
if (uploadImageRes) {
newList = JSON.parse(JSON.stringify(newList)).concat(uploadImageRes);
}

this.imgList = newList

this.$emit("update:value", newList);
this.$emit("input", newList);
this.$emit("change", newList);
// this.$emit("add");
},

uploadImage(url, name) {
if (!url) return
// 文件上传
return new Promise(async (reslove, reject) => {
this.LOADING('正在上传…');
let params = name ? {
folderId: this.folderId,
name
} : {
folderId: this.folderId
}
this.HTTP_UPLOAD2('StuInfoFresh/upload', url, params).then((data) => {
this.HIDE_LOADING();
this.$refs.lsjUpload.show()
if (data) {
// this.HTTP_GET('StuInfoFresh/upload', {fileId:data})
reslove([{
id: data.F_Id,
name: data.F_FileName,
url: data.F_FilePath,
type: data.F_FileType,
}])
} else {
reject('上传失败!')
}
})
})
})
}
let array = this.imgList.map(item=>{
if(item.id){
return ""
}else{
return {
url:"learun/adms/annexes/upload"

},

ceshi() {
function apiFn(params) {
return new Promise((resolve, reject) => {
this.LOADING('正在上传…');
this.HTTP_UPLOAD2('StuInfoFresh/upload', params.url, {
folderId: this.folderId
}).then((data) => {
this.HIDE_LOADING();
if (data) {
// this.HTTP_GET('StuInfoFresh/upload', {fileId:data})
this.imgList[params.index] = [{
id: data.F_Id,
name: data.F_FileName,
url: data.F_FilePath,
type: data.F_FileType
}]
reslove(this.imgList[params.index])
} else {
reject('上传失败!')
}
})
})
}
}
})
this.promiseAllLimit(2,[1,2,3,4,5,6,7,8,9],a).then(res=>{
console.log(res)
})
},
/**
* @description 控制promise.all并发数量
* @param limit 并发数
* @param array 参数列表
* @param apiFn 执行函数
* @returns {Promise<Awaited<unknown>[]>}
*/
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)
let array = this.imgList.map(item => {
if (item.id) {
return ""
} else {
return {
url: "learun/adms/annexes/upload"
}
}
})
this.promiseAllLimit(2, [1, 2, 3, 4, 5, 6, 7, 8, 9], a).then(res => {
console.log(res)
})
},

/**
* @description 控制promise.all并发数量
* @param limit 并发数
* @param array 参数列表
* @param apiFn 执行函数
* @returns {Promise<Awaited<unknown>[]>}
*/
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)
},
validate(array){
// 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 <= 200 * 1024 * 1024
})
if(!size){
this.TOAST('文件大小不得超过200M');
return false
}
return true
},
isImage(type){
if(type&&type.length){
return ["png","jpg"].includes(type.substring(type.length-3,type.length))
}else{
return false
}
},
return Promise.all(ret)
},

viewImg(item) {
if(!this.isImage(item.type)){
window.location.href = this.CONFIG("webHost")+item.url
}else{
uni.previewImage({
urls: [this.CONFIG('webHost')+item.url],
current: this.CONFIG('webHost')+item.url
});
}
},
// previewFile() {
// var file = document.querySelector('input[type=file]').files[0];
// var reader = new FileReader();
// // fileReader.readAsDataURL(blob);
// // fileReader.onerror = () => {
// // reject(new Error('blobToBase64 error'));
// // };
// // var encodedData = window.btoa("Hello, world");
// reader.onloadend = function () {
// //$('#PhotoImg').attr('src', reader.result);
// var postData = {
// Base64Url: reader.result
// }
// this.HTTP_POST(config.webapi + "StuInfoFresh/savePhoto", postData, (data) => {
// if (data) {
// $('#Photo').val(data.AnnexesFileId);
// $('#PhotoImg').attr('src', config.web + data.Url);
// } else {
// learun.layer.toast('采集照片信息失败!');
// }
// });
// }
// if (file) {
// reader.readAsDataURL(file);
// }
// },
},
created() {
this.imgList = JSON.parse(JSON.stringify(this.value.map(item=>{
return {
id:item.F_Id,
name:item.F_FileName,
url:item.F_FilePath,
type:item.F_FileType
validate(array) {
// 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 <= 200 * 1024 * 1024
})
if (!size) {
this.TOAST('文件大小不得超过200M');
return false
}
return true
},

isImage(type) {
if (type && type.length) {
return ["png", "jpg"].includes(type.substring(type.length - 3, type.length))
} else {
return false
}
},

viewImg(item) {
if (!this.isImage(item.type)) {
window.location.href = this.CONFIG("webHost") + item.url
} else {
uni.previewImage({
urls: [this.CONFIG('webHost') + item.url],
current: this.CONFIG('webHost') + item.url
});
}
},

// previewFile() {
// var file = document.querySelector('input[type=file]').files[0];
// var reader = new FileReader();
// // fileReader.readAsDataURL(blob);
// // fileReader.onerror = () => {
// // reject(new Error('blobToBase64 error'));
// // };
// // var encodedData = window.btoa("Hello, world");
// reader.onloadend = function () {
// //$('#PhotoImg').attr('src', reader.result);
// var postData = {
// Base64Url: reader.result
// }
// this.HTTP_POST(config.webapi + "StuInfoFresh/savePhoto", postData, (data) => {
// if (data) {
// $('#Photo').val(data.AnnexesFileId);
// $('#PhotoImg').attr('src', config.web + data.Url);
// } else {
// learun.layer.toast('采集照片信息失败!');
// }
// });
// }
// if (file) {
// reader.readAsDataURL(file);
// }
// },
},
created() {
console.log(this.value)
this.imgList = JSON.parse(JSON.stringify(this.value.map(item => {
return {
id: item.F_Id,
name: item.F_FileName,
url: item.F_FilePath,
type: item.F_FileType
}
})))
this.$nextTick(() => {
this.isShow = true
})
}
})))
this.$nextTick(()=>{
this.isShow = true
})
}
};
};
</script>

<style scoped>
.file-name{
.file-name {
position: absolute;
bottom: 0;
width: 100%;
color: #606266;
font-size: 13px;
text-align: center;
background-color: rgba(255,255,255,0.6);
background-color: rgba(255, 255, 255, 0.6);
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;


+ 3
- 3
Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js Переглянути файл

@@ -21,10 +21,10 @@ export default {
// "http://192.168.2.98:8088/"
// ],
"apiHost": [
// "http://localhost:31173/"
"http://192.168.10.85:8088/"
"http://localhost:31173/"
// "http://192.168.10.85:8088/"
],
"webHost":"http://192.168.10.85:8087/",
"webHost":"http://localhost:20472/",
// 开发环境下自动填充登录账号密码,与接口地址一一对应,只在开发环境下显示
"devAccount": [
// 20201130230 21364200000400266 老师 420528196310072253 学生 420528200606205026 420528200507261428


+ 2
- 1
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/nworkflow/myflow/single.vue Переглянути файл

@@ -144,6 +144,7 @@ export default {
code: this.code,
useDefault: true
})
console.log("formValue",formValue,"scheme",scheme)
this.scheme = scheme
this.formValue = formValue
this.rel = rel
@@ -160,8 +161,8 @@ export default {
processId: this.processId,
code: null
})
console.log("formValue",formValue,"scheme",scheme)
this.scheme = scheme
console.log(scheme)
this.formValue = formValue
this.rel = rel
}


+ 4
- 1
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/nworkflow/releasetask/single.vue Переглянути файл

@@ -153,9 +153,10 @@ export default {
// 发起流程按钮
async submit() {
const isAgain = this.type === 'again'
// 先验证表单,验证不通过则提示
const verifyResult = this.verifyValue()
if (verifyResult.length > 0) {
this.CONFIRM('表单验证失败', verifyResult.join('\n'))
return
@@ -191,7 +192,9 @@ export default {

// 获取表单验证结果,是一个包含错误信息的数组,长度为 0 则没有错误
verifyValue() {
const errList = this.$refs.form.verifyValue()
console.log(errList,'errList')
if (this.needTitle && !this.title) {
errList.push(`流程的标题不能为空`)
}


+ 4
- 1
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/nworkflow/workflow.js Переглянути файл

@@ -57,7 +57,7 @@ export default {
*/
async getCustomForm(prop) {
const { schemeData, formData, currentNode, code, processId, useDefault } = prop
console.log(prop,'prop')
// 处理字段之间的级联、绑定关系
// 需要绑定 change 事件的:
// datetime: 修改后重新计算 datetimerange
@@ -78,6 +78,7 @@ export default {
// 遍历 schemeData 中所有的 scheme
const schemeList = Array.isArray(schemeData) ? schemeData : Object.values(schemeData)
for (let schemeIndex = 0; schemeIndex < schemeList.length; ++schemeIndex) {
const schemeItem = schemeList[schemeIndex]
schemeItem.F_Scheme = JSON.parse(schemeItem.F_Scheme)
// 已有表单值的时候,舍弃掉不存在表单值中的 scheme
@@ -228,6 +229,7 @@ export default {
// 不是表格的情况
const path = item.__valuePath__
const val = get(formValue, path)
console.log(val,'val=======')
const result = await this.convertToPostData(item, val, originFormValue, scheme)
set(formValue, path, result)

@@ -238,6 +240,7 @@ export default {
for (const schemeItem of item.fieldsData) {
const path = `${item.__valuePath__}.${valueIndex}.${schemeItem.field}`
const val = get(formValue, path)
const result = await this.convertToPostData(schemeItem, val, originFormValue, scheme)
set(formValue, path, result)
}


+ 2
- 2
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/timeTable/list.vue Переглянути файл

@@ -28,10 +28,10 @@
<view class="tSec2Box">
<view class="tSec2Con" v-for="(items, i) in weekArr" :key="items.num" v-show="i == num">
<view class="tSec2List">
<view v-if="dataArr[i+1].length <= 0" class="tSec2ListLi">
<view v-if="dataArr[i+1]&&dataArr[i+1].length <= 0" class="tSec2ListLi">
<view class="noHtml">该时间段没有课表</view>
</view>
<view v-if="dataArr[i+1].length > 0">
<view v-if="dataArr[i+1]&&dataArr[i+1].length > 0">
<view class="tSec2ListLi" v-for="(k, j) in dataArr[i+1]" :key="j" @click="classTap(k)">
<view class="tSec2ListL">第 {{ k.jc }} 节</view>
<view class="tSec2ListR">


Завантаження…
Відмінити
Зберегти