@@ -2,7 +2,7 @@ | |||||
<view class="cu-form-group"> | <view class="cu-form-group"> | ||||
<view class="grid col-4 grid-square flex-sub"> | <view class="grid col-4 grid-square flex-sub"> | ||||
<view | <view | ||||
v-for="(path, index) in value" | |||||
v-for="(path, index) in imgList" | |||||
@tap="viewImg" | @tap="viewImg" | ||||
:key="index" | :key="index" | ||||
class="bg-img" | class="bg-img" | ||||
@@ -12,16 +12,16 @@ | |||||
:src="path.path ? path.path : path" | :src="path.path ? path.path : path" | ||||
mode="aspectFill" | mode="aspectFill" | ||||
></image> | ></image> | ||||
<view v-if="!readonly" @tap.stop="delImg(index)" class="cu-tag bg-red"> | |||||
<view v-if="!readonly" @tap.stop="delImg(index)" class="cu-tag bg-red" style="width: 18px; height: 18px; font-size: 24px"> | |||||
<l-icon | <l-icon | ||||
type="close" | type="close" | ||||
style="width: 18px; height: 24px; font-size: 24px" | |||||
style="width: 18px; height: 18px; font-size: 12px" | |||||
/> | /> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
<view | <view | ||||
v-if="!readonly && value.length < Number(number)" | |||||
v-if="!readonly && imgList.length < Number(number)" | |||||
@tap="chooseImg" | @tap="chooseImg" | ||||
class="solids" | class="solids" | ||||
> | > | ||||
@@ -40,44 +40,76 @@ export default { | |||||
readonly: {}, | readonly: {}, | ||||
value: { default: () => [] }, | value: { default: () => [] }, | ||||
}, | }, | ||||
data(){ | |||||
return{ | |||||
imgList:[], | |||||
} | |||||
}, | |||||
methods: { | methods: { | ||||
delImg(index) { | delImg(index) { | ||||
const newList = JSON.parse(JSON.stringify(this.value)); | |||||
const newList = JSON.parse(JSON.stringify(this.imgList)); | |||||
newList.splice(index, 1); | newList.splice(index, 1); | ||||
this.imgList = newList | |||||
this.$emit("update:value", newList); | |||||
this.$emit("input", newList); | this.$emit("input", newList); | ||||
this.$emit("change"); | this.$emit("change"); | ||||
this.$emit("del"); | this.$emit("del"); | ||||
}, | }, | ||||
showfile() { | showfile() { | ||||
console.log(this.value); | |||||
return true; | return true; | ||||
}, | }, | ||||
chooseImg() { | chooseImg() { | ||||
uni.chooseImage({ | uni.chooseImage({ | ||||
count: Number(this.number), | |||||
count: (Number(this.number) - this.imgList.length), | |||||
sizeType: ["original", "compressed"], | sizeType: ["original", "compressed"], | ||||
sourceType: ["album", "camera"], | sourceType: ["album", "camera"], | ||||
success: ({ tempFilePaths }) => { | |||||
const newList = JSON.parse(JSON.stringify(this.value || [])).concat( | |||||
success: (res) => { | |||||
let {tempFilePaths,tempFiles} = res | |||||
if(!this.validate(tempFiles))return | |||||
const newList = JSON.parse(JSON.stringify(this.imgList || [])).concat( | |||||
tempFilePaths | tempFilePaths | ||||
); | ); | ||||
//this.$parent.HTTP_UPLOAD(tempFilePaths[0]); | |||||
this.imgList = newList | |||||
this.$emit("update:value", newList); | |||||
this.$emit("input", newList); | this.$emit("input", newList); | ||||
this.$emit("change"); | this.$emit("change"); | ||||
this.$emit("add"); | this.$emit("add"); | ||||
}, | }, | ||||
}); | }); | ||||
}, | }, | ||||
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 <= 2 * 1024 * 1024 | |||||
}) | |||||
if(!size){ | |||||
this.TOAST('文件大小不得超过2M'); | |||||
return false | |||||
} | |||||
return true | |||||
}, | |||||
viewImg(index) { | viewImg(index) { | ||||
uni.previewImage({ | uni.previewImage({ | ||||
urls: this.value, | |||||
current: this.value[index], | |||||
urls: this.imgList, | |||||
current: this.imgList[index], | |||||
}); | }); | ||||
}, | }, | ||||
}, | }, | ||||
created() { | |||||
this.imgList = JSON.parse(JSON.stringify(this.value)) | |||||
} | |||||
}; | }; | ||||
</script> | </script> |
@@ -22,11 +22,11 @@ export default { | |||||
// ], | // ], | ||||
"apiHost": [ | "apiHost": [ | ||||
// "http://localhost:31173/" | // "http://localhost:31173/" | ||||
"http://192.168.10.58:8012/" | |||||
"http://192.168.10.58:31173/" | |||||
], | ], | ||||
// 开发环境下自动填充登录账号密码,与接口地址一一对应,只在开发环境下显示 | // 开发环境下自动填充登录账号密码,与接口地址一一对应,只在开发环境下显示 | ||||
"devAccount": [ | "devAccount": [ | ||||
{ username: "system", password: "www.qj.com" } | |||||
{ username: "21364200000400266", password: "www.qj.com" } | |||||
], | ], | ||||
//是否分布式部署 指WebApi与Web不在一台服务器 | //是否分布式部署 指WebApi与Web不在一台服务器 | ||||
"isDistributed":true, | "isDistributed":true, | ||||
@@ -1,6 +1,6 @@ | |||||
{ | { | ||||
"name" : "智慧校园", | "name" : "智慧校园", | ||||
"appid" : "__UNI__611EB80", | |||||
"appid" : "__UNI__0CE0195", | |||||
"description" : "智慧校园移动端", | "description" : "智慧校园移动端", | ||||
"versionName" : "2.1.0", | "versionName" : "2.1.0", | ||||
"versionCode" : 20100, | "versionCode" : 20100, | ||||
@@ -16,18 +16,11 @@ | |||||
<l-input title="户口类别" placeholder="请填写" :value="StuInfoFreshEntity.ResidenceNo" disabled right /> | <l-input title="户口类别" placeholder="请填写" :value="StuInfoFreshEntity.ResidenceNo" disabled right /> | ||||
<l-input title="政治面貌" placeholder="请填写" :value="displayListItem(StuInfoFreshEntity, 'PartyFaceNo')" disabled right /> | <l-input title="政治面貌" placeholder="请填写" :value="displayListItem(StuInfoFreshEntity, 'PartyFaceNo')" disabled right /> | ||||
</view> | </view> | ||||
<!-- {{ StuInfoFreshEntity.GenderNo }} --> | |||||
<!-- <view class="welLine"></view> --> | |||||
<view class="welT" style="padding-top: 10px;">采集照片信息</view> | <view class="welT" style="padding-top: 10px;">采集照片信息</view> | ||||
<view class="welBox"> | |||||
<input type="hidden" id="Photo" value="" /> | |||||
<input id="files" type="file" accept="image/*" /> | |||||
<view class="welImgAdd"> | |||||
<!--<view id="welImgBtn">上传照片</view>--> | |||||
<img id="PhotoImg" :src="imgSrc" alt="" /> | |||||
</view> | |||||
<!--<view class="welText">说明:近期两寸免冠正面彩色照小于100K</view>--> | |||||
</view> | |||||
<l-upload | |||||
:number="1" | |||||
:value.sync="photo" | |||||
/> | |||||
<view class="welLine"></view> | <view class="welLine"></view> | ||||
<view class="welT" style="padding-top: 10px;">自然信息</view> | <view class="welT" style="padding-top: 10px;">自然信息</view> | ||||
<view class="welLine"></view> | <view class="welLine"></view> | ||||
@@ -79,6 +72,7 @@ import set from 'lodash/set'; | |||||
export default { | export default { | ||||
data() { | data() { | ||||
return { | return { | ||||
photo:[], | |||||
imgSrc: '', | imgSrc: '', | ||||
scheme: { | scheme: { | ||||
PartyFaceNo: { | PartyFaceNo: { | ||||
@@ -120,9 +114,7 @@ export default { | |||||
StuInfoFreshFamilyEntities:[], | StuInfoFreshFamilyEntities:[], | ||||
StuInfoFreshEmergePeopleEntities: [] | StuInfoFreshEmergePeopleEntities: [] | ||||
}, | }, | ||||
StuInfoFreshEntity:{ | |||||
} | |||||
StuInfoFreshEntity:{} | |||||
}; | }; | ||||
}, | }, | ||||
methods: { | methods: { | ||||
@@ -137,14 +129,13 @@ export default { | |||||
value: t.partyfaceno | value: t.partyfaceno | ||||
})); | })); | ||||
}), | }), | ||||
() => {} | () => {} | ||||
]); | ]); | ||||
_this.LOADING('加载数据…'); | _this.LOADING('加载数据…'); | ||||
_this.HTTP_GET('StuInfoFresh/stuInfoFreshEntity', _this.userInfo.account, '加载数据时出错').then(res => { | _this.HTTP_GET('StuInfoFresh/stuInfoFreshEntity', _this.userInfo.account, '加载数据时出错').then(res => { | ||||
this.HIDE_LOADING(); | this.HIDE_LOADING(); | ||||
// console.log(res); | |||||
_this.StuInfoFreshEntity = _this.COPY(res.StuInfoFreshEntity); | |||||
console.log(res,"==="); | |||||
_this.StuInfoFreshEntity = _this.COPY(res.StuInfoFreshEntity)||{}; | |||||
_this.queryData.StuInfoFreshFamilyEntities = _this.COPY(res.StuInfoFreshFamilyList); | _this.queryData.StuInfoFreshFamilyEntities = _this.COPY(res.StuInfoFreshFamilyList); | ||||
_this.queryData.StuInfoFreshEmergePeopleEntities = _this.COPY(res.StuInfoFreshEmergePeopleList); | _this.queryData.StuInfoFreshEmergePeopleEntities = _this.COPY(res.StuInfoFreshEmergePeopleList); | ||||
_this.queryData.ID = res.StuInfoFreshEntity.ID; | _this.queryData.ID = res.StuInfoFreshEntity.ID; | ||||