人脸管理修改
This commit is contained in:
1 parent
4a495558d7
commit
a8c7b33331
1 file changed
+76
-60
@@ -1,79 +1,95 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from "vue";
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app";
|
||||
import { ref, reactive } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
|
||||
import { hooks, router } from "@@/index";
|
||||
import { faceApi } from "@@/api";
|
||||
import { hooks, router } from "@@/index"
|
||||
import { faceApi } from "@@/api"
|
||||
|
||||
import { filePath } from "@@/utils/file"
|
||||
|
||||
const state = reactive<any>({
|
||||
pa: {
|
||||
pagesize: 10,
|
||||
},
|
||||
});
|
||||
pa: {
|
||||
pagesize: 10,
|
||||
},
|
||||
})
|
||||
|
||||
const pageRef = ref<any>(null);
|
||||
const pageHook = hooks.usePage(pageRef, faceApi.page, null, "data.records");
|
||||
const pageRef = ref<any>(null)
|
||||
const pageHook = hooks.usePage(pageRef, faceApi.page, null, "data.records")
|
||||
const query = (page: number, pagesize: number) => {
|
||||
pageHook.startPage(page, pagesize, false, state.pa);
|
||||
};
|
||||
pageHook.startPage(page, pagesize, false, state.pa)
|
||||
}
|
||||
|
||||
onLoad(() => { });
|
||||
onLoad(() => {})
|
||||
onShow(() => {
|
||||
if (pageRef.value) {
|
||||
pageRef.value.reload(false);
|
||||
}
|
||||
});
|
||||
if (pageRef.value) {
|
||||
pageRef.value.reload(false)
|
||||
}
|
||||
})
|
||||
|
||||
const doAdd = () => {
|
||||
router.jump("/pages/human-face/apply");
|
||||
};
|
||||
router.jump("/pages/human-face/apply")
|
||||
}
|
||||
|
||||
const doEdit = (id: string) => {
|
||||
router.jump("/pages/human-face/apply", { type: "edit", id });
|
||||
};
|
||||
router.jump("/pages/human-face/apply", { type: "edit", id })
|
||||
}
|
||||
|
||||
const doDel = (id: string) => {
|
||||
faceApi.del({ id }).then(
|
||||
() => {
|
||||
uni.showToast({ title: "删除成功", icon: "none" });
|
||||
pageRef.value.reload(true);
|
||||
},
|
||||
() => {
|
||||
uni.showToast({ title: "删除失败", icon: "none" });
|
||||
}
|
||||
);
|
||||
};
|
||||
faceApi.del({ id }).then(
|
||||
() => {
|
||||
uni.showToast({ title: "删除成功", icon: "none" })
|
||||
pageRef.value.reload(true)
|
||||
},
|
||||
() => {
|
||||
uni.showToast({ title: "删除失败", icon: "none" })
|
||||
},
|
||||
)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<crud-layout title="人脸管理" bg="/static/page/blue-bg.png">
|
||||
<z-paging ref="pageRef" height="100%" :fixed="false" v-model="pageHook.list" :default-page-size="10"
|
||||
safe-area-inset-bottom :loading-more-enabled="true" :show-scrollbar="false" @query="query"
|
||||
:auto-clean-list-when-reload="false" :auto-scroll-to-top-when-reload="false" @scroll="pageHook.scroll">
|
||||
<view class="h-20rpx" />
|
||||
<view class="flex-col card p-x-20rpx p-y-30rpx m-b-20rpx" v-for="(v, i) in pageHook.list" :key="v.id">
|
||||
<view class="flex items-center justify-between second-text-26">
|
||||
<div class="flex items-center">
|
||||
<image mode="aspectFill" class="w-100rpx h-100rpx rounded-50rpx" :src="filePath(v.faceImg)" />
|
||||
<view class="w-30rpx" />
|
||||
<text class="font-600">{{ v.username }}</text>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<text class="botder_btn" @click="doEdit(v.id)">修改</text>
|
||||
<view class="w-30rpx" />
|
||||
<tm-modal title="确定删除吗?" height="auto" @confirm="doDel(v.id)">
|
||||
<template v-slot:trigger><text class="botder_btn">删除</text></template>
|
||||
</tm-modal>
|
||||
</div>
|
||||
</view>
|
||||
</view>
|
||||
<template #bottom>
|
||||
<view class="bg-#0094ff p-y-20rpx text-center rounded-40rpx m-x-30rpx m-t-60rpx sub-text-30 color-white!"
|
||||
@tap="doAdd">添加</view>
|
||||
<view class="h-30rpx" />
|
||||
</template>
|
||||
</z-paging>
|
||||
</crud-layout>
|
||||
</template>
|
||||
<crud-layout title="人脸管理" bg="/static/page/blue-bg.png">
|
||||
<z-paging
|
||||
ref="pageRef"
|
||||
height="100%"
|
||||
:fixed="false"
|
||||
v-model="pageHook.list"
|
||||
:default-page-size="10"
|
||||
safe-area-inset-bottom
|
||||
:loading-more-enabled="true"
|
||||
:show-scrollbar="false"
|
||||
@query="query"
|
||||
:auto-clean-list-when-reload="false"
|
||||
:auto-scroll-to-top-when-reload="false"
|
||||
@scroll="pageHook.scroll"
|
||||
>
|
||||
<view class="h-20rpx" />
|
||||
<view class="flex-col card p-x-20rpx p-y-30rpx m-b-20rpx" v-for="(v, i) in pageHook.list" :key="v.id">
|
||||
<view class="flex items-center justify-between second-text-26">
|
||||
<div class="flex items-center">
|
||||
<image mode="aspectFill" class="w-100rpx h-100rpx rounded-50rpx" :src="filePath(v.faceImg)" />
|
||||
<view class="w-30rpx" />
|
||||
<text class="font-600">{{ v.username }}</text>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<text class="botder_btn" @click="doEdit(v.id)">修改</text>
|
||||
<view class="w-30rpx" />
|
||||
<tm-modal v-if="false" title="确定删除吗?" height="auto" @confirm="doDel(v.id)">
|
||||
<template v-slot:trigger><text class="botder_btn">删除</text></template>
|
||||
</tm-modal>
|
||||
</div>
|
||||
</view>
|
||||
</view>
|
||||
<template #bottom>
|
||||
<view
|
||||
v-if="false"
|
||||
class="bg-#0094ff p-y-20rpx text-center rounded-40rpx m-x-30rpx m-t-60rpx sub-text-30 color-white!"
|
||||
@tap="doAdd"
|
||||
>
|
||||
添加
|
||||
</view>
|
||||
<view class="h-30rpx" />
|
||||
</template>
|
||||
</z-paging>
|
||||
</crud-layout>
|
||||
</template>
|
||||
Reference in new issue
Block a user