@@ -7,10 +7,10 @@ | |||
:key="index" | |||
class="bg-img" | |||
> | |||
<!-- {{item.id?CONFIG('webHost')+item.url:item.url}} --> | |||
<!-- :src="item.id?CONFIG('webHost')+item.url:item.url" --> | |||
<image | |||
v-if="showfile()" | |||
:src="item.id?CONFIG('webHost')+item.url:item.url" | |||
:src="item.url" | |||
mode="aspectFill" | |||
></image> | |||
<view v-if="!readonly" @tap.stop="delImg(index)" class="cu-tag bg-red" style="width: 18px; height: 18px; font-size: 24px"> | |||
@@ -40,6 +40,12 @@ export default { | |||
number: { default: 1 }, | |||
readonly: {}, | |||
value: { default: () => [] }, | |||
size:{ | |||
default: 20 | |||
},//MB | |||
type:{ | |||
default: "all" | |||
} | |||
}, | |||
data(){ | |||
@@ -116,34 +122,6 @@ export default { | |||
}) | |||
}, | |||
/** | |||
* @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) | |||
}, | |||
imgToBase64(url){ | |||
return new Promise((resolve,reject)=>{ | |||
if(!url){ | |||
@@ -167,18 +145,19 @@ 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 = this.type!="all"?array.every(item=>{ | |||
return this.type.split(",").includes(item.type) | |||
}):true | |||
if(!type){ | |||
this.TOAST('文件格式错误'); | |||
return false | |||
} | |||
console.log(array,this.size *1024 *1024) | |||
let size = array.every(item=>{ | |||
return item.size && item.size <= 100 * 1024 * 1024 | |||
return item.size && item.size <= this.size *1024 *1024 | |||
}) | |||
if(!size){ | |||
this.TOAST('文件大小不得超过100M'); | |||
this.TOAST('文件大小不能超过'+this.size+'M'); | |||
return false | |||
} | |||
return true | |||
@@ -186,8 +165,8 @@ export default { | |||
viewImg(index) { | |||
uni.previewImage({ | |||
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, | |||
urls: this.imgList.map(item=>item.url), | |||
current: this.imgList[index].url, | |||
}); | |||
}, | |||
@@ -219,7 +198,6 @@ export default { | |||
// }, | |||
}, | |||
created() { | |||
console.log(123) | |||
this.imgList = JSON.parse(JSON.stringify(this.value.map(item=>{ | |||
item.isUploaded = true | |||
return item | |||
@@ -132,71 +132,6 @@ | |||
}, | |||
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 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/" | |||
@@ -81,7 +81,7 @@ export default { | |||
scheme: { | |||
DutySchedule: { | |||
Date: { type: 'datetime', title: '时间', dateformat: '0' }, | |||
Person: { type: 'text', title: '值班人' }, | |||
Person: { type: 'text', title: '值班人',verify: 'NotNull', }, | |||
Remark: { type: 'textarea', title: '备注' }, | |||
}, | |||
@@ -1,8 +1,8 @@ | |||
<template> | |||
<view class="page"> | |||
<l-title>设置密码</l-title> | |||
<!-- <l-input v-model="oldPwd" title="旧密码" placeholder="请输入旧密码" password></l-input> --> | |||
<l-input v-model="newPwd" title="新的密码" placeholder="请输入新密码" password></l-input> | |||
<l-input v-model="oldPwd" title="旧密码" placeholder="请输入身份证后八位" password></l-input> | |||
<l-input v-model="newPwd" title="新密码" placeholder="请输入新密码" password></l-input> | |||
<l-input v-model="confirmPwd" title="确认输入" placeholder="请再次输入新密码" password></l-input> | |||
<view class="passwordDes"> | |||
<text>新密码必须8-20位同时包含1.[大小写字母]、2.[数字]、3.[特殊符号!@#$%^&*]</text> | |||
@@ -27,10 +27,10 @@ export default { | |||
// 提交修改 | |||
async submit() { | |||
const { auth, oldPwd, newPwd, confirmPwd } = this | |||
// if (oldPwd.length < 6) { | |||
// this.CONFIRM('操作失败', '旧密码输入不正确,请重新确认') | |||
// return | |||
// } | |||
if (oldPwd.length < 6) { | |||
this.CONFIRM('操作失败', '旧密码输入不正确,请重新确认') | |||
return | |||
} | |||
// if (newPwd.length < 6 || newPwd.length > 16) { | |||
// this.CONFIRM('操作失败', '新密码不符合要求,请修改后重试') | |||
// return | |||
@@ -46,20 +46,21 @@ export default { | |||
} | |||
const success = await this.HTTP_POST( | |||
'learun/adms/user/modifypw', | |||
'learun/adms/user/modifypwiden', | |||
{ | |||
newpassword: this.MD5(newPwd), | |||
// oldpassword: this.MD5(oldPwd) | |||
oldpassword: oldPwd | |||
}, | |||
'未能成功修改密码' | |||
) | |||
console.log(success) | |||
if (!success) { | |||
return | |||
} | |||
this.NAV_BACK() | |||
this.TOAST('密码修改成功') | |||
setTimeout(()=>{ | |||
this.TOAST('密码修改成功') | |||
},100) | |||
} | |||
} | |||
} | |||
@@ -183,22 +183,22 @@ export default { | |||
if(!success){ | |||
return | |||
} | |||
var logininfo = { | |||
account: this.username, | |||
token: success.baseinfo.token, | |||
date: moment().format('yyyy-MM-dd hh:mm:ss') | |||
}; | |||
// var logininfo = { | |||
// account: this.username, | |||
// token: success.baseinfo.token, | |||
// date: moment().format('yyyy-MM-dd hh:mm:ss') | |||
// }; | |||
this.SET_STORAGE("token",success.baseinfo.token) | |||
// this.SET_STORAGE('logininfo', logininfo); | |||
// this.SET_STORAGE('userinfo', success); | |||
this.username = "" | |||
this.password = "" | |||
if (success.pwd === true) { | |||
this.SET_STORAGE('pwd', true); | |||
this.TOAST("绑定失败!您的密码不满足强度要求,请您先修改密码后再执行系统其他操作"); | |||
} else { | |||
this.SET_STORAGE('pwd', false); | |||
} | |||
// this.username = "" | |||
// this.password = "" | |||
// if (success.pwd === true) { | |||
// this.SET_STORAGE('pwd', true); | |||
// this.TOAST("绑定失败!您的密码不满足强度要求,请您先修改密码后再执行系统其他操作"); | |||
// } else { | |||
// this.SET_STORAGE('pwd', false); | |||
// } | |||
location.href = "http://" + window.location.host + "/#/pages/my/newpassword"; | |||
}) | |||
}, | |||
@@ -13,7 +13,8 @@ | |||
<l-input title="班级" placeholder="请填写" :value="StuInfoFreshEntity.ClassNo" disabled right /> | |||
<l-input title="身份证号" placeholder="请填写" :value="StuInfoFreshEntity.IdentityCardNo" disabled right /> | |||
<l-input title="出生日期" placeholder="请填写" :value="StuInfoFreshEntity.Birthday" disabled right /> | |||
<l-input title="户口类别" placeholder="请填写" :value="StuInfoFreshEntity.ResidenceNo" disabled right /> | |||
<!-- <l-input title="户口类别" placeholder="请填写" :value="StuInfoFreshEntity.ResidenceNo" disabled right /> --> | |||
<l-select v-model="StuInfoFreshEntity.ResidenceNo" disabled :range="dataSource.ResidenceNo" title="户口类别" placeholder="请选择" /> | |||
<l-input title="政治面貌" placeholder="请填写" :value="displayListItem(StuInfoFreshEntity, 'PartyFaceNo')" disabled right /> | |||
</view> | |||
<view class="welT" style="padding-top: 10px;">采集照片信息</view> | |||
@@ -21,8 +22,13 @@ | |||
v-if="uploadVisiable" | |||
ref="upload" | |||
:number="1" | |||
:size="100" | |||
type="image/jpeg,image/jpg" | |||
:value.sync="photo" | |||
/> | |||
<view class="passwordDes"> | |||
<text>照片要求:1 . 单色背景,正面,免冠近期证件照 2 . 文件格式JPG 3 . 文件大小165320KB以下</text> | |||
</view> | |||
<view class="welLine"></view> | |||
<view class="welT" style="padding-top: 10px;">自然信息</view> | |||
<view class="welLine"></view> | |||
@@ -63,8 +69,8 @@ | |||
<view class="welDel" @click="del('StuInfoFreshEmergePeopleEntities', i)"><text class="text-xxl cuIcon cuIcon-move"></text></view> | |||
</view> | |||
</view> | |||
<view class="welT" style="padding-top: 10px;">附件</view> | |||
<uploadFile v-if="uploadVisiable" :number="10" :folderId="queryData.ID" :value="fileList"></uploadFile> | |||
<!-- <view class="welT" style="padding-top: 10px;">附件上传</view> | |||
<uploadFile v-if="uploadVisiable" :number="10" :folderId="queryData.ID" :value="fileList"></uploadFile> --> | |||
<view class="btn" @click="submit">保存</view> | |||
</view> | |||
</template> | |||
@@ -81,7 +87,7 @@ export default { | |||
data() { | |||
return { | |||
photo:[], | |||
fileList:[], | |||
// fileList:[], | |||
uploadVisiable:false, | |||
imgSrc: '', | |||
scheme: { | |||
@@ -99,7 +105,8 @@ export default { | |||
dataSource:{ | |||
GenderNo: Object.values(this.GET_GLOBAL('dataDictionary').usersex).map(t => ({ value: t.value, text: t.text })), | |||
FamilyRelation: Object.values(this.GET_GLOBAL('dataDictionary').FamilyRelation).map(t => ({ value: t.value, text: t.text })), | |||
PartyFaceNo:[] | |||
PartyFaceNo:[], | |||
ResidenceNo:Object.values(this.GET_GLOBAL('dataDictionary').ResidenceNo).map(t => ({ value: t.value, text: t.text })), | |||
}, | |||
StuInfoFreshFamilyEntities:{ | |||
Name: '', | |||
@@ -128,7 +135,7 @@ export default { | |||
}; | |||
}, | |||
methods: { | |||
init() { | |||
async init() { | |||
// console.log(this.API) | |||
let _this = this; | |||
Promise.all([ | |||
@@ -142,7 +149,7 @@ export default { | |||
() => {} | |||
]); | |||
_this.LOADING('加载数据…'); | |||
_this.HTTP_GET('StuInfoFresh/stuInfoFreshEntity', _this.userInfo.account, '加载数据时出错').then(res => { | |||
_this.HTTP_GET('StuInfoFresh/stuInfoFreshEntity', _this.userInfo.account, '加载数据时出错').then(async(res)=> { | |||
this.HIDE_LOADING(); | |||
_this.StuInfoFreshEntity = _this.COPY(res.StuInfoFreshEntity)||{}; | |||
_this.queryData.StuInfoFreshFamilyEntities = _this.COPY(res.StuInfoFreshFamilyList); | |||
@@ -150,8 +157,14 @@ export default { | |||
_this.queryData.ID = res.StuInfoFreshEntity.ID; | |||
_this.queryData.Photo = res.StuInfoFreshEntity.Photo; | |||
_this.photo = res.StuInfoFreshEntity.Photo?[{url:res.StuInfoFreshEntity.Url,id:res.StuInfoFreshEntity.Photo}]:[]; | |||
_this.fileList = res.StuInfoFreshEntity.FilesList||[] | |||
let resFile = await this.FETCH_FILEINFO(res.StuInfoFreshEntity.Photo) | |||
let url = "" | |||
if(resFile.F_FolderId){ | |||
url = this.API + '/learun/adms/annexes/wxdown?' + this.URL_QUERY(resFile.F_FolderId, true) | |||
} | |||
// id:res.StuInfoFreshEntity.Photo | |||
_this.photo = (res.StuInfoFreshEntity.Photo&&url)?[{url,id:res.StuInfoFreshEntity.Photo}]:[]; | |||
// _this.fileList = res.StuInfoFreshEntity.FilesList||[] | |||
_this.refreshComponent() | |||
_this.queryData.telephone = res.StuInfoFreshEntity.telephone; | |||
_this.queryData.FamilyAddress = res.StuInfoFreshEntity.FamilyAddress; | |||
@@ -160,6 +173,12 @@ export default { | |||
}); | |||
}, | |||
async submit() { | |||
let validateRes = this.validate() | |||
if(validateRes.length>0){ | |||
this.CONFIRM('表单验证失败', validateRes.join('\n')) | |||
return | |||
} | |||
this.LOADING('正在提交数据…'); | |||
let res = await this.$refs["upload"].uploadImage() | |||
if(res&&res.length){ | |||
@@ -170,8 +189,11 @@ export default { | |||
this.HTTP_GET('StuInfoFresh/saveStuInfoFresh', this.queryData).then(res => { | |||
this.HIDE_LOADING(); | |||
if (res) { | |||
this.NAV_TO("/pages/my/newpassword") | |||
this.TOAST('保存成功'); | |||
// this.NAV_TO("/pages/my/newpassword") | |||
setTimeout(()=>{ | |||
this.TOAST('保存成功'); | |||
},100) | |||
this.NAV_BACK() | |||
} | |||
}); | |||
}, | |||
@@ -183,7 +205,24 @@ export default { | |||
del(str, num) { | |||
this.queryData[str].splice(num, 1) | |||
}, | |||
validate(){ | |||
let array = [] | |||
if(!this.photo.length)array.push("[采集照片信息]:不能为空") | |||
// if(!this.queryData.RegionNo)array.push("[籍贯]:不能为空") | |||
// if(!this.queryData.FamilyAddress)array.push("[家庭住址]:不能为空") | |||
if(!this.queryData.telephone)array.push("[联系电话]:不能为空") | |||
if(!this.queryData.StuInfoFreshFamilyEntities.length|| | |||
!this.queryData.StuInfoFreshFamilyEntities.every((item)=>{ | |||
return item.Name&&(item.Relation||item.Relation===0)&&(item.Sex||item.Sex===0)&&(item.Age||item.Age===0)&&(item.Politicy||item.Politicy===0) | |||
}) | |||
)array.push("[家庭成员]:未完善") | |||
// if(!this.queryData.StuInfoFreshEmergePeopleEntities.length|| | |||
// !this.queryData.StuInfoFreshEmergePeopleEntities.every((item)=>{ | |||
// return item.Name&&(item.Relation||item.Relation===0)&&item.Telephone&&item.Mobile&&item.Address | |||
// }) | |||
// )array.push("[紧急联系人]:未完善") | |||
return array | |||
}, | |||
refreshComponent(){ | |||
// this.uploadVisiable = false | |||
this.$nextTick(()=>{ | |||
@@ -331,6 +370,13 @@ export default { | |||
line-height: 0; | |||
} | |||
.passwordDes{ | |||
color: #606266; | |||
font-size: 14px; | |||
padding: 8px; | |||
text-indent:2em; | |||
} | |||
#files { | |||
opacity: 0; | |||
-webkit-opacity: 0; | |||
@@ -183,23 +183,24 @@ export default { | |||
if(!success){ | |||
return | |||
} | |||
var logininfo = { | |||
account: this.username, | |||
token: success.baseinfo.token, | |||
date: moment().format('yyyy-MM-dd hh:mm:ss') | |||
}; | |||
// var logininfo = { | |||
// account: this.username, | |||
// token: success.baseinfo.token, | |||
// date: moment().format('yyyy-MM-dd hh:mm:ss') | |||
// }; | |||
this.SET_STORAGE("token",success.baseinfo.token) | |||
location.href = "http://" + window.location.host | |||
// this.SET_STORAGE('logininfo', logininfo); | |||
// this.SET_STORAGE('userinfo', success); | |||
this.username = "" | |||
this.password = "" | |||
if (success.pwd === true) { | |||
this.SET_STORAGE('pwd', true); | |||
this.TOAST("绑定失败!您的密码不满足强度要求,请您先修改密码后再执行系统其他操作"); | |||
} else { | |||
this.SET_STORAGE('pwd', false); | |||
} | |||
location.href = "http://" + window.location.host + "/#/pages/my/newpassword"; | |||
// this.username = "" | |||
// this.password = "" | |||
// if (success.pwd === true) { | |||
// this.SET_STORAGE('pwd', true); | |||
// this.TOAST("绑定失败!您的密码不满足强度要求,请您先修改密码后再执行系统其他操作"); | |||
// } else { | |||
// this.SET_STORAGE('pwd', false); | |||
// } | |||
// location.href = "http://" + window.location.host + "/#/pages/my/newpassword"; | |||
}) | |||
}, | |||