index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <view style="background-color:#fff ;">
  3. <!-- 搜索栏 -->
  4. <view class="input-view_contain data-v-53a1f34c">
  5. <view class="input-view">
  6. <input confirm-type="search" class="nav-bar-input" type="text" placeholder="输入搜索内容" @confirm="confirm" v-model="title"/>
  7. <uni-icons type="search" size="20" class="search-icon" @tap="confirm"></uni-icons>
  8. </view>
  9. </view>
  10. <view class="spacing"></view>
  11. <!-- 网格配置列表滑动 -->
  12. <view class="image-hei">
  13. <uni-swiper-dot :info="info" :current="current" field="content" :mode="mode">
  14. <swiper class="swiper-box" style="height: 160rpx;">
  15. <swiper-item v-for="(item ,index) in gridtType" :key="index">
  16. <uni-grid :column="5" :highlight="true" :showBorder="false">
  17. <uni-grid-item v-for="(dataitem,dataindex) in item" :key="dataitem.id">
  18. <view @click="querygrid(dataitem)">
  19. <image class="uni-header-image" :src="loadImgSrcLocalhost(dataitem.fileUrl)"></image>
  20. <uni-title type="h5" :title="dataitem.name" align="center"></uni-title>
  21. </view>
  22. </uni-grid-item>
  23. </uni-grid>
  24. </swiper-item>
  25. </swiper>
  26. </uni-swiper-dot>
  27. </view>
  28. <view>
  29. <view class="demo-uni-row">
  30. <button align="center" @click="topic">主题导航</button>
  31. <button align="center" @click="dept">部门导航</button>
  32. </view>
  33. </view>
  34. <!-- ------------------------------------------------------------------------------------------------------------------------------------------ -->
  35. <view>
  36. <!-- 使用分段器来切换推荐和收藏列表 -->
  37. <view class="segmented-control">
  38. <!-- <view class="segmented-control-item" :class="{ active: activeTab === 'recommend' }" @click="changeTab('recommend')">常办事项</view>
  39. <view class="segmented-control-item" :class="{ active: activeTab === 'favorite' }" @click="changeTab('favorite')">我的事</view> -->
  40. <view
  41. class="segmented-control-item"
  42. :class="activeTab == e.label ? 'highlight' : 'not-highlight' "
  43. @click="changeTab(e.label)"
  44. v-for="(e,idx) in switchOption"
  45. :key="idx"
  46. >
  47. {{ e.value }}
  48. </view>
  49. </view>
  50. <!-- 根据选中的标签显示对应的列表 -->
  51. <view v-if="activeTab === 'recommend'">
  52. <view class="rnwdList">
  53. <ul>
  54. <!-- <li v-for="(item,index) in recommendList" :key="index">
  55. <p @click="getmatter(item)">{{ item.title }}</p>
  56. </li> -->
  57. <uni-list>
  58. <uni-list-item class="list-item":title="item.title" v-for="(item,index) in recommendList" @click="getmatter(item)" clickable="true" link></uni-list-item>
  59. </uni-list>
  60. </ul>
  61. </view>
  62. </view>
  63. <view v-if="activeTab === 'favorite'">
  64. <view class="rnwdList">
  65. <ul>
  66. <!-- <li v-for="(item,index) in favoriteList" :key="index">
  67. <p @click="getmatter(item)">{{ item.title }}</p>
  68. </li> -->
  69. <uni-list>
  70. <uni-list-item class="list-item" :title="item.title" v-for="(item,index) in favoriteList" @click="getmatter(item)" clickable="true" link></uni-list-item>
  71. </uni-list>
  72. </ul>
  73. </view>
  74. </view>
  75. <uni-fab ref="fab" :horizontal="right" :vertical="bottom"
  76. @fabClick="goToMatterAllPage()"/>
  77. <!-- <view class="add-button" @click="goToMatterAllPage">
  78. <text>+</text>
  79. </view> -->
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. import {
  85. listGridType
  86. } from '@/api/handleAffairs/gridType.js';
  87. import { listDept,collectlist } from '@/api/handleAffairs/matter.js';
  88. export default {
  89. data() {
  90. return {
  91. title:"",
  92. gridtType: [], //是一个list<map>数据 [[1,2,3]]
  93. activeTab: 'recommend', // 默认选中推荐列表
  94. recommendList: [], // 推荐列表数据
  95. favoriteList: [], // 收藏列表数据
  96. userList: [], // 收藏列表数据
  97. switchOption:[
  98. {
  99. value:'常办事项',
  100. label:'recommend'
  101. },
  102. {
  103. value:'收藏事项',
  104. label:'favorite'
  105. }
  106. ],
  107. userList: [], // 收藏列表数据
  108. //悬浮按钮右对齐
  109. right: 'right',
  110. //悬浮按钮下对齐
  111. bottom: 'bottom',
  112. color:'#8FBC8F '
  113. };
  114. },
  115. created() {
  116. this.getListListGrid();
  117. this.getListDept();
  118. this.getListscolle();
  119. },
  120. methods: {
  121. goToMatterAllPage() {
  122. // 使用 uni-app 的路由跳转方法跳转到 matterAll 页面
  123. uni.navigateTo({
  124. url: '/pages/handleAffairs/mattersAdd/mattersAdd'
  125. });
  126. },
  127. confirm(){
  128. if (!this.title.trim()) {//去除前后空格,在判断是否为空
  129. return
  130. }
  131. console.log(this.title)
  132. uni.setStorageSync('data', {title:this.title,examine:1})
  133. uni.navigateTo({
  134. url: '/pages/handleAffairs/matterAll/matterAll',
  135. });
  136. },
  137. //主题导航跳转
  138. topic(){
  139. uni.navigateTo({
  140. url: '/pages/handleAffairs/topic/topic',
  141. });
  142. },
  143. querygrid(item) {
  144. console.log(item)
  145. uni.setStorageSync('id', item.id)
  146. uni.navigateTo({
  147. url: '/pages/handleAffairs/gridQuery/gridQuery?titleText='+item.name
  148. });
  149. },
  150. getListListGrid() {
  151. const _that = this
  152. let query = {
  153. yesOrNoShow: "0"
  154. };
  155. listGridType(query).then(res => {
  156. let gridtTypeLits = res.rows
  157. let dataList = []
  158. for (var i = 0; i < gridtTypeLits.length; i++) {
  159. dataList.push(gridtTypeLits[i])
  160. if (((i + 1) % 5 == 0) || i == gridtTypeLits.length - 1) {
  161. _that.gridtType.push(dataList)
  162. dataList = []
  163. }
  164. }
  165. });
  166. },
  167. getListDept() {
  168. const _that = this;
  169. // 获取推荐列表数据
  170. listDept().then(res => {
  171. _that.recommendList = res.rows;
  172. });
  173. },
  174. getListscolle(){
  175. const userId = getApp().globalData.userId;
  176. collectlist(userId).then(res =>{
  177. this.favoriteList = res.rows
  178. })
  179. },
  180. getmatter(item) {
  181. uni.setStorageSync('id', item.id);
  182. uni.navigateTo({
  183. url: '/pages/handleAffairs/mattercontent/mattercontent',
  184. });
  185. },
  186. addNewItem(item) {
  187. uni.navigateTo({
  188. url: '/pages/handleAffairs/mattersAdd/mattersAdd',
  189. });
  190. },
  191. changeTab(tab) {
  192. this.activeTab = tab;
  193. this.getListDept()
  194. this.getListscolle()
  195. },
  196. dept(){
  197. uni.navigateTo({
  198. url: '/pages/handleAffairs/dept/dept',
  199. });
  200. }
  201. }
  202. }
  203. </script>
  204. <style scoped lang="scss">
  205. .not-highlight{
  206. color:#ABB7C7;
  207. background-color:#fff
  208. }
  209. .highlight{
  210. color:#0CC689;
  211. background-color:#fff;
  212. border-bottom: 2px solid #0CC689;
  213. }
  214. .uni-list .list-item{
  215. height: 100%;
  216. }
  217. .uni-list-item{
  218. height: 100%;
  219. }
  220. .uni-header-image {
  221. width: 40px;
  222. height: 40px;
  223. display: block;
  224. margin: 0 auto;
  225. border-radius: 50%;
  226. }
  227. .demo-uni-row{
  228. position: relative;
  229. display: flex;
  230. width: 92%;
  231. height: 8vh;
  232. margin: auto;
  233. border-radius: 10px;
  234. border: 1px solid #19C56B;
  235. }
  236. .demo-uni-row button{
  237. width: 45%;
  238. color: #27C874;
  239. height: 100%;
  240. line-height: 250%;
  241. text-indent: 9%;
  242. background-color: #F1F1F1;
  243. border: none !important;
  244. background-color:#fff
  245. }
  246. .demo-uni-row button:after{
  247. border: none;
  248. }
  249. .demo-uni-row::after{
  250. content: '';
  251. position: absolute;
  252. width: 4rpx;
  253. height: 46%;
  254. left: 50%;
  255. top: 33%;
  256. z-index: 10;
  257. margin: auto;
  258. background-color: #E1E1E1;
  259. }
  260. /* 主导航 */
  261. .mainNav {
  262. width: 100%;
  263. background: #fff;
  264. }
  265. .input-view_contain{
  266. height: 50px;
  267. width: 100%;
  268. background-color: #07C160;
  269. }
  270. .input-view {
  271. justify-content: space-between;
  272. align-items: center;
  273. /* #ifndef APP-PLUS-NVUE */
  274. display: flex;
  275. /* #endif */
  276. flex-direction: row;
  277. // width: 500rpx;
  278. flex: 1;
  279. background-color: #f8f8f8;
  280. height: 80%;
  281. border-radius: 5px;
  282. padding: 0 15px;
  283. flex-wrap: nowrap;
  284. margin: auto;
  285. line-height: 5vh;
  286. width: 96%;
  287. .nav-bar-input{
  288. margin: auto 0;
  289. font-size: 15px;
  290. }
  291. }
  292. .segmented-control {
  293. width: 100%;
  294. height: 8vh;
  295. display: flex;
  296. justify-content: space-around;
  297. background-color: #f0f0f0;
  298. }
  299. .rnwdList{
  300. min-height: 63vh;
  301. background-color: #fff;
  302. }
  303. .segmented-control-item {
  304. width: 50%;
  305. height: 100%;
  306. line-height: 250%;
  307. text-align: center;
  308. padding: 10px;
  309. font-size: 34rpx;
  310. }
  311. .segmented-control-item.active {
  312. color: #007aff;
  313. }
  314. .spacing {
  315. height: 40rpx;
  316. }
  317. .image-hei{
  318. height:80px
  319. }
  320. .list-item {
  321. border-bottom: 1px dotted #ccc;
  322. height:35px
  323. }
  324. </style>