1、增加‘‘设置——家长二维码’’功能

2、修复图片上传组件在app端删除图片问题
unocss
chris 8 months ago
parent 2d417b1472
commit 7db8a995b2

@ -1,9 +1,9 @@
<template> <template>
<view class="ch-image-uploader"> <view class="ch-image-uploader">
<ch-flex class="img-list" justify="center" items="center" @click.native="handleSelect"> <ch-flex class="img-list" justify="center" items="center" @click.native="handleSelect">
<block v-for="item in imageList" key="item.name"> <block v-for="item in imageList" key="item.path">
<view class="img-item" data-type="img"> <view class="img-item" data-type="img">
<uni-icons type="clear" class="del-btn" size="50" v-if="showClose" data-type="delete" @click="delImg(item.name)"></uni-icons> <uni-icons type="clear" class="del-btn" size="50" v-if="showClose" data-type="delete" @click="delImg(item.path)"></uni-icons>
<image :src="item.path" mode="aspectFit"></image> <image :src="item.path" mode="aspectFit"></image>
</view> </view>
</block> </block>
@ -78,6 +78,7 @@ function handleSelect (e) {
extension: props.extList, extension: props.extList,
sourceType: props.sourceType, sourceType: props.sourceType,
success: (res) => { success: (res) => {
console.log(res)
if (props.limit > 1) { if (props.limit > 1) {
const newImageList = filterImage(res.tempFiles) const newImageList = filterImage(res.tempFiles)
imageList.value = [...imageList.value, ...newImageList] imageList.value = [...imageList.value, ...newImageList]
@ -122,8 +123,9 @@ function upload () {
}) })
} }
function delImg (delName) { function delImg (path) {
imageList.value = imageList.value.filter(item => item.name !== delName) imageList.value = imageList.value.filter(item => item.path !== path)
emit('update:modelValue', imageList.value)
} }
// image // image
@ -141,7 +143,7 @@ function formatImageFiles (fileList) {
// //
function filterImage (images) { function filterImage (images) {
return images.filter(item => { return images.filter(item => {
const result = imageList.value.find(img => img.name === item.name ); const result = imageList.value.find(img => img.path === item.path );
return !result; return !result;
}) })
} }

@ -8,7 +8,12 @@
<text v-else>{{ appInfo.appWgtVersion }}</text> <text v-else>{{ appInfo.appWgtVersion }}</text>
</template> </template>
</uni-list-item> </uni-list-item>
<uni-list-item title="家长二维码" show-arrow="true" clickable @click="checkQrcode">
</uni-list-item>
</uni-list> </uni-list>
<uni-popup ref="qrcodePopupRef" type="dialog">
<image :src="userInfo.qrcode" mode="aspectFit"></image>
</uni-popup>
</view> </view>
</template> </template>
@ -16,16 +21,19 @@
import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update'; import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
import { reactive, ref, toRefs } from 'vue'; import { reactive, ref, toRefs } from 'vue';
import { useSystemStore } from '@/store/system.js'; import { useSystemStore } from '@/store/system.js';
import { useUserStore } from '@/store/user.js';
const sysStore = useSystemStore(); const sysStore = useSystemStore();
console.log(sysStore) const userStore = useUserStore();
const qrcodePopupRef = ref(null)
const data = reactive({ const data = reactive({
hadUpdate: false, hadUpdate: false,
appInfo: sysStore.appInfo appInfo: sysStore.appInfo,
userInfo: userStore.userInfo
}) })
const { hadUpdate, appInfo } = toRefs(data); const { hadUpdate, appInfo, userInfo } = toRefs(data);
// //
function checkAppUpdate () { function checkAppUpdate () {
@ -42,6 +50,10 @@ function checkAppUpdate () {
}) })
// #endif // #endif
} }
function checkQrcode () {
qrcodePopupRef.value.open('center')
}
</script> </script>
<style lang="scss"> <style lang="scss">

Loading…
Cancel
Save