index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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. let query = { yesOrNoShow: "0" };
  170. // 获取推荐列表数据
  171. listDept(query).then(res => {
  172. _that.recommendList = res.rows;
  173. });
  174. },
  175. getListscolle(){
  176. const userId = getApp().globalData.userId;
  177. collectlist(userId).then(res =>{
  178. this.favoriteList = res.rows
  179. })
  180. },
  181. getmatter(item) {
  182. uni.setStorageSync('id', item.id);
  183. uni.navigateTo({
  184. url: '/pages/handleAffairs/mattercontent/mattercontent',
  185. });
  186. },
  187. addNewItem(item) {
  188. uni.navigateTo({
  189. url: '/pages/handleAffairs/mattersAdd/mattersAdd',
  190. });
  191. },
  192. changeTab(tab) {
  193. this.activeTab = tab;
  194. this.getListDept()
  195. this.getListscolle()
  196. },
  197. dept(){
  198. uni.navigateTo({
  199. url: '/pages/handleAffairs/dept/dept',
  200. });
  201. }
  202. }
  203. }
  204. </script>
  205. <style scoped lang="scss">
  206. .not-highlight{
  207. color:#ABB7C7;
  208. background-color:#fff
  209. }
  210. .highlight{
  211. color:#0CC689;
  212. background-color:#fff;
  213. border-bottom: 2px solid #0CC689;
  214. }
  215. .uni-header-image {
  216. width: 40px;
  217. height: 40px;
  218. display: block;
  219. margin: 0 auto;
  220. border-radius: 50%;
  221. }
  222. .demo-uni-row{
  223. position: relative;
  224. display: flex;
  225. width: 92%;
  226. height: 8vh;
  227. margin: auto;
  228. border-radius: 10px;
  229. border: 1px solid #19C56B;
  230. }
  231. .demo-uni-row button{
  232. width: 45%;
  233. color: #27C874;
  234. height: 100%;
  235. line-height: 250%;
  236. text-indent: 9%;
  237. background-color: #F1F1F1;
  238. border: none !important;
  239. background-color:#fff
  240. }
  241. .demo-uni-row button:after{
  242. border: none;
  243. }
  244. .demo-uni-row::after{
  245. content: '';
  246. position: absolute;
  247. width: 4rpx;
  248. height: 46%;
  249. left: 50%;
  250. top: 33%;
  251. z-index: 10;
  252. margin: auto;
  253. background-color: #E1E1E1;
  254. }
  255. /* 主导航 */
  256. .mainNav {
  257. width: 100%;
  258. background: #fff;
  259. }
  260. .input-view_contain{
  261. height: 50px;
  262. width: 100%;
  263. background-color: #07C160;
  264. }
  265. .input-view {
  266. justify-content: space-between;
  267. align-items: center;
  268. /* #ifndef APP-PLUS-NVUE */
  269. display: flex;
  270. /* #endif */
  271. flex-direction: row;
  272. // width: 500rpx;
  273. flex: 1;
  274. background-color: #f8f8f8;
  275. height: 80%;
  276. border-radius: 5px;
  277. padding: 0 15px;
  278. flex-wrap: nowrap;
  279. margin: auto;
  280. line-height: 5vh;
  281. width: 96%;
  282. .nav-bar-input{
  283. margin: auto 0;
  284. font-size: 15px;
  285. }
  286. }
  287. .segmented-control {
  288. width: 100%;
  289. height: 8vh;
  290. display: flex;
  291. justify-content: space-around;
  292. background-color: #f0f0f0;
  293. }
  294. .rnwdList{
  295. min-height: 63vh;
  296. background-color: #fff;
  297. }
  298. .segmented-control-item {
  299. width: 50%;
  300. height: 100%;
  301. line-height: 250%;
  302. text-align: center;
  303. padding: 10px;
  304. font-size: 34rpx;
  305. }
  306. .segmented-control-item.active {
  307. color: #007aff;
  308. }
  309. .spacing {
  310. height: 40rpx;
  311. }
  312. .image-hei{
  313. height:80px
  314. }
  315. .list-item {
  316. border-bottom: 1px dotted #ccc;
  317. height:35px
  318. }
  319. </style>