fix: 🐛 修复日期筛选组件小程序回显问题和调整banner

This commit is contained in:
Ray.Hao
2024-11-30 01:26:43 +08:00
parent 6c3464a01b
commit adcdf4f03e
8 changed files with 32 additions and 31 deletions

View File

@@ -108,7 +108,7 @@ export interface RolePageVO {
/** 角色编码 */
code?: string;
/** 角色ID */
id?: number;
id: number;
/** 角色名称 */
name?: string;
/** 排序 */
@@ -132,7 +132,7 @@ export interface RoleForm {
/** 角色名称 */
name?: string;
/** 排序 */
sort?: number;
sort: number;
/** 角色状态(1-正常0-停用) */
status?: number;
}

View File

@@ -35,6 +35,19 @@ watch(
(val) => {
if (Array.isArray(val) && val.length === 2 && val[0] && val[1]) {
dateRange.value = val.map((item) => new Date(item).getTime());
} else if (typeof val === "string" && val.includes(",")) {
const [startDate, endDate] = val.split(",");
if (
startDate &&
endDate &&
!isNaN(new Date(startDate).getTime()) &&
!isNaN(new Date(endDate).getTime())
) {
dateRange.value = [new Date(startDate).getTime(), new Date(endDate).getTime()];
} else {
dateRange.value = null;
}
} else {
dateRange.value = null;
}

View File

@@ -1,6 +1,6 @@
<template>
<view style="width: 100%; height: var(--status-bar-height)" />
<view class="home">
<view style="width: 100%; height: var(--status-bar-height)" />
<wd-swiper
v-model:current="current"
:list="swiperList"
@@ -136,13 +136,7 @@ const chartData = ref({});
// 日期范围
const recentDaysRange = ref(7);
const swiperList = ref([
"https://registry.npmmirror.com/wot-design-uni-assets/1.0.4/files/redpanda.jpg",
"https://registry.npmmirror.com/wot-design-uni-assets/1.0.4/files/capybara.jpg",
"https://registry.npmmirror.com/wot-design-uni-assets/1.0.4/files/panda.jpg",
"https://registry.npmmirror.com/wot-design-uni-assets/1.0.4/files/moon.jpg",
"https://registry.npmmirror.com/wot-design-uni-assets/1.0.4/files/meng.jpg",
]);
const swiperList = ref(["https://oss.youlai.tech/blog/banner3.png"]);
// 快捷导航列表
const navList = reactive([

View File

@@ -62,22 +62,13 @@ const handleLogin = () => {
loginFormRef.value.validate().then(async ({ valid }: { valid: boolean }) => {
if (valid) {
try {
await userStore.login(loginFormData.value); // 等待登录和获取用户信息完成
await userStore.getInfo(); // 等待用户信息获取完成
await dictStore.loadDictionaries(); // 等待字典数据加载完成
await userStore.login(loginFormData.value);
await userStore.getInfo();
await dictStore.loadDictionaries();
uni.showToast({ title: "登录成功", icon: "success" });
const pages = getCurrentPages(); // 获取当前的页面栈
console.log("pages", pages);
if (pages.length > 1) {
// 如果页面栈中有多个页面,则可以返回上一页
uni.navigateBack();
} else {
// 如果页面栈中只有一个页面(通常是首页),则可以跳转到指定页面,避免 navigateBack 无法返回的问题
uni.reLaunch({
url: "/pages/index/index", // 替换为你想要跳转的页面路径
});
}
uni.reLaunch({
url: "/pages/index/index",
});
} catch (error: any) {
console.log("登录失败", error.message);
}

View File

@@ -1,6 +1,6 @@
<template>
<view class="work">
<template v-for="item in gridList">
<template v-for="(item, index) in gridList" :key="index">
<wd-card :title="item.title">
<wd-grid clickable :column="4">
<wd-grid-item

View File

@@ -22,7 +22,7 @@
</wd-drop-menu>
<!-- 卡片列表 -->
<wd-card v-for="(item, index) in pageData" class="card-list">
<wd-card v-for="(item, index) in pageData" :key="item.id" class="card-list">
<template #title>
{{ item.operator }}
</template>
@@ -70,6 +70,7 @@
</view>
</template>
<script lang="ts" setup>
import { onLoad, onReachBottom } from "@dcloudio/uni-app";
import { LoadMoreState } from "wot-design-uni/components/wd-loadmore/types";
import { DropMenuItemExpose } from "wot-design-uni/components/wd-drop-menu-item/types";

View File

@@ -19,7 +19,7 @@
</wd-drop-menu>
<!-- 卡片列表 -->
<view class="list-container">
<wd-card v-for="item in dataList" class="role-card">
<wd-card v-for="item in dataList" :key="item.id" class="role-card">
<template #title>
<view class="flex-between">
<view class="flex-center">
@@ -62,7 +62,7 @@
position="left-bottom"
:expandable="false"
customStyle="width: 1rem; height: 1rem; line-height: 1rem;z-index:9"
@click="handleOpenDialog(null)"
@click="handleOpenDialog()"
/>
<wd-popup v-model="dialog.visible" position="bottom" custom-class="yl-popup">
@@ -109,7 +109,6 @@ const total = ref(0);
const queryParams = reactive<RolePageQuery>({
pageNum: 1,
pageSize: 10,
keywords: "",
});
/**

View File

@@ -37,7 +37,7 @@
</view>
<!-- 用户卡片 -->
<wd-card v-for="item in pageData">
<wd-card v-for="item in pageData" :key="item.id">
<template #title>
<view class="flex-between">
<view class="flex-center">
@@ -128,6 +128,8 @@
</template>
<script lang="ts" setup>
import { onLoad, onReachBottom } from "@dcloudio/uni-app";
import { LoadMoreState } from "wot-design-uni/components/wd-loadmore/types";
import { FormRules } from "wot-design-uni/components/wd-form/types";
import { useMessage } from "wot-design-uni";
@@ -242,6 +244,7 @@ const handleQuery = () => {
filterDropMenu.value?.close();
queryParams.pageNum = 1;
loadmore();
console.log("queryParams", queryParams);
};
/**