This commit is contained in:
wangyilin 2024-11-12 17:12:07 +08:00
parent a2385c5632
commit 57bf502664
3 changed files with 135 additions and 48 deletions

View File

@ -1,57 +1,94 @@
<template>
<view>
<view class="swiperDemo">
<nut-swiper ref="swiperRef" pagination-visible pagination-color="#e53e31" :auto-play="3000" :init-page="0">
<nut-swiper-item v-for="(item, index) in list" :key="index" style="height: 200px">
<image :src="item" alt="" style="height: 100%; width: 100%" draggable="false"/>
</nut-swiper-item>
</nut-swiper>
<view class="search" id="search">
<nut-input v-model="valueInput" @input="searchInput" placeholder="请进行搜索"></nut-input>
<view v-if="valueInput">
<ul>
<li v-for="item in searchResults" :key="item.id">{{item}}</li>
</ul>
</view>
<view class="swiperDemoItem">
<view class="swiperDemoIndex"></view>
<view>请选择</view>
</view>
<!--九宫格-->
<view>
<view class="subModule">
<view class="subModuleItem" v-for="item in subModuleList" :key="item.id" @click="subNavigation(item.url)">
<view class="subModuleIndex">
<image :src="item.icon"></image>
</view>
<view style=" font-size: 12px;color: #414141;margin-top: 9px">{{ item.name }}</view>
</view>
</view>
<view v-else >
没有找到相关结果
</view>
</view>
</template>
<script setup lang="ts">
import {ref} from 'vue'
import Taro from "@tarojs/taro";
import icon from '@/assets/images/project.png'
import './index.scss'
const list = ref([process.env.TARO_APP_MINIO_URL + '/police-security/2024/11/5/dunpai.jpg',process.env.TARO_APP_MINIO_URL + '/police-security/2024/11/5/xingqiu.jpg'])
const swiperRef = ref() //
const subModuleList = ref([
import { ref} from "vue";
const valueInput = ref('')
// '','','','','','','','','',''
const list = ref([])
const dataList = ref([
{
id: 0,
icon: icon,
name: '企事业单位',
url: '/subPages/police/myEnterprisesUnit/myEnterprisesUnit'
id:0,
value:'齐家园'
},
{
id: 1,
icon: icon,
name: '警保风采',
url: ''
id:1,
value:'刘德华'
},
{
id: 2,
icon: icon,
name: '待定',
url: ''
id:2,
value:'张学友'
},{
id:3,
value:'黎明'
},
{
id:4,
value:'家具城'
},
{
id:5,
value:'左岸春天'
},
{
id:6,
value:'麦德龙商城'
},
{
id:7,
value:'世纪酒店'
},
{
id:8,
value:'四方小学'
},
{
id:9,
value:'海洋半岛'
},
{
id:10,
value:'育英小学'
},
{
id:11,
value:'明德小学'
},{
id:12,
value:'希望小学'
}
])
const subNavigation = async (url: string) => Taro.navigateTo({url})
const searchResults = ref([])
const searchInput = (e:any)=>{
valueInput.value = e.target.value
if (!valueInput.value) {
searchResults.value = []
return [];
}else{
dataList.value.map((item)=>{
return list.value.push(item.value)
})
searchResults.value = list.value.filter(item =>
item.toLowerCase().includes(valueInput.value.toLowerCase())
);
}
// console.log(searchResults.value)
}
</script>
<style scoped lang="scss">
</style>

View File

@ -15,7 +15,7 @@
</view>
<!-- 用户信息 -->
<view class="userIndex">
<view class="exit" v-for="item in datalist" :key="item.value">
<view class="exit" v-for="item in datalist" :key="item.value" @click="addExit(item.value)">
<view class="exitItem">
<!-- <view class="exitItemIndex">-->
<!-- <image :src="item.url" mode="scaleToFill" class="image" />-->
@ -28,20 +28,30 @@
</view>
</view>
<!-- 退出弹框-->
<nut-dialog
content="是否退出登录?"
v-model:visible="visible" @cancel="visible = false" @ok="onOk"
/>
</view>
</template>
<script setup lang="ts">
import './index.scss'
import {ref} from "vue";
import {useUserStore} from "@/store/userStore";
import {useTabBarStore} from "@/store/tabBarStore"
import Taro from "@tarojs/taro";
const {setSelected} = useTabBarStore()
const {resetUserInfo} = useUserStore()
const visible = ref<boolean>(false)
const datalist = ref([
{
value: 1,
value: 0,
name: '简介',
},
{
value: 0,
value: 1,
name: '退出登录',
},
{
@ -53,4 +63,18 @@ const datalist = ref([
name: '意见收集',
},
])
const addExit = (index:number)=>{
switch (index) {
case 1:
visible.value = true
break;
}
}
const onOk = ()=>{
resetUserInfo()
setSelected(0)
Taro.navigateTo({
url: "/pages/login/login",
});
}
</script>

View File

@ -14,7 +14,7 @@
</view>
<!-- 用户信息 -->
<view class="userIndex">
<view class="exit" v-for="item in datalist" :key="item.value">
<view class="exit" v-for="item in datalist" :key="item.value" @click="addExit(item.value)">
<view class="exitItem">
<!-- <view class="exitItemIndex">-->
<!-- <image :src="item.url" mode="scaleToFill" class="image" />-->
@ -27,20 +27,30 @@
</view>
</view>
<!-- 退出弹框-->
<nut-dialog
content="是否退出登录?"
v-model:visible="visible" @cancel="visible = false" @ok="onOk"
/>
</view>
</template>
<script setup lang="ts">
import './index.scss'
import {ref} from "vue";
import {useUserStore} from "@/store/userStore";
import {useTabBarStore} from "@/store/tabBarStore"
import Taro from "@tarojs/taro";
const {setSelected} = useTabBarStore()
const {resetUserInfo} = useUserStore()
const visible = ref<boolean>(false)
const datalist = ref([
{
value: 1,
value: 0,
name: '小程序简介',
},
{
value: 0,
value: 1,
name: '退出登录',
},
{
@ -52,4 +62,20 @@ const datalist = ref([
name: '意见收集',
},
])
const addExit = (index:number)=>{
switch (index) {
case 1:
visible.value = true
break;
}
}
const onOk = ()=>{
resetUserInfo()
setSelected(0)
Taro.navigateTo({
url: "/pages/login/login",
});
}
</script>