index.vue 8.4 KB

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