index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <view class="u-flex u-f-d-c home u-p-l-30 u-p-r-30">
  3. <view class="u-flex u-f-d-c m-w min-hei">
  4. <view class="u-m-18">
  5. <u-image width="690rpx" height="300rpx" src="https://xj.chuanghai-tech.com/image/f6ac3cbb2d2d2f29d769cec3b051e05.png"></u-image>
  6. </view>
  7. <view @click="tsanavtask()" class="info-swiper u-m-b-40 u-flex u-col-center">
  8. <view class="info-ti"></view>
  9. <view class="info-icon u-flex u-row-center u-col-center">
  10. <u-image width="40" height="40" :src="tzicon"></u-image>
  11. </view>
  12. <view class="u-m-l-16 u-flex f-d-c u-col-top">
  13. <view class="annou-title">{{ taskdetail.title || '最新任务' }}</view>
  14. <view class="annou-cig">{{ taskdetail.content || '内容' }}</view>
  15. </view>
  16. <view class="right-icon u-flex u-row-right">
  17. <view v-show="taskCount != 0" class="hint">
  18. {{ taskCount }}
  19. </view>
  20. <u-icon name="arrow-right" color="rgba(153, 153, 153, 1)" size="25"></u-icon>
  21. </view>
  22. </view>
  23. <view class="u-flex f-d-c u-col-top m-w">
  24. <view class="u-font-32 u-m-b-30" style="color: #000000">主要功能</view>
  25. <view class="to-menus u-p-t-28 u-p-b-28">
  26. <view class="nav-itm">
  27. <navigator hover-class="none" :url="index.url" class="u-flex u-f-d-c" v-for="(index, key) in nav_obj1" :key="key">
  28. <view class="menu-icon">
  29. <u-image :width="index.size" :height="index.size" :src="index.imgurl"></u-image>
  30. </view>
  31. <view class="u-m-t-16 u-f-26">{{ index.name }}</view>
  32. </navigator>
  33. </view>
  34. <view class="nav-itm">
  35. <navigator hover-class="none" :url="index.url" class="u-flex u-f-d-c" v-for="(index, key) in nav_obj2" :key="key">
  36. <view class="menu-icon">
  37. <u-image :width="index.size" :height="index.size" :src="index.imgurl"></u-image>
  38. </view>
  39. <view class="u-m-t-16 u-f-28">{{ index.name }}</view>
  40. </navigator>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="u-m-t-46 mai-color u-p-l-16 u-p-r-16 sc-view">
  46. <view class="u-flex u-row-between u-m-b-30">
  47. <view class="u-font-32" style="color: #000000">当日巡检</view>
  48. <navigator hover-class="none" url="/scan_pages/seemore/seemore" class="u-f-24 u-flex" style="font-weight: 400; color: #4a8bff">
  49. <view class="u-m-r-8">查看更多</view>
  50. <u-icon name="arrow-right"></u-icon>
  51. </navigator>
  52. </view>
  53. <view class="scr-hei">
  54. <block v-if="partlist.length > 0">
  55. <block v-for="(index, key) in partlist" :key="key">
  56. <cDisk :more="0" :parobj="index" :prourl="`/scan_pages/patrol/patrol?taskId=${index.id}&status=${index.status}`" />
  57. </block>
  58. </block>
  59. <block v-else>
  60. <u-empty text="暂无数据" mode="list"></u-empty>
  61. </block>
  62. </view>
  63. </view>
  64. <u-tabbar :before-switch="beforeSwitch" :height="tabheight" :list="tabbar" :mid-button="true"></u-tabbar>
  65. </view>
  66. </template>
  67. <script>
  68. import { mapState } from 'vuex'
  69. import { taskecl, patrolTask, tasknewst } from '@/api/index.js'
  70. // import banner from "@/static/img/banner.png";
  71. import tzicon from '@/static/img/tzicon.png'
  72. import nav1 from '@/static/img/navbar/nav1.png'
  73. import nav2 from '@/static/img/navbar/nav2.png'
  74. import nav3 from '@/static/img/navbar/nav3.png'
  75. import nav4 from '@/static/img/navbar/nav4.png'
  76. import nav5 from '@/static/img/navbar/nav5.png'
  77. import nav6 from '@/static/img/navbar/nav6.png'
  78. import nav7 from '@/static/img/navbar/nav7.png'
  79. import nav8 from '@/static/img/navbar/nav8.png'
  80. import cDisk from '@/components/c-disk/index.vue'
  81. export default {
  82. components: {
  83. cDisk
  84. },
  85. data() {
  86. return {
  87. ifOnShow: false, //页面刷新
  88. taskCount: 0, //我收到的处理中的任务
  89. //导航栏
  90. nav_obj1: [
  91. {
  92. name: '公司简介',
  93. icon: 'company',
  94. url: '/pages/company/company',
  95. imgurl: nav1,
  96. size: 82.9
  97. },
  98. {
  99. name: '数据中心',
  100. icon: 'data_sys',
  101. url: '/pages/datasys/datasys',
  102. imgurl: nav2,
  103. size: 82.9
  104. },
  105. {
  106. name: '巡检路线',
  107. icon: 'polling',
  108. url: '/scan_pages/checkpoint/checkpoint',
  109. imgurl: nav3,
  110. size: 82.9
  111. },
  112. {
  113. name: '巡检记录',
  114. icon: 'polling_rcd',
  115. url: '/scan_pages/patrolrecored/patrolrecored',
  116. imgurl: nav4,
  117. size: 82.9
  118. }
  119. ],
  120. nav_obj2: [
  121. {
  122. name: '临时任务',
  123. icon: 'temporary_task',
  124. url: '/task_pages/taskarrment/taskarrment',
  125. imgurl: nav5,
  126. size: 82.9
  127. },
  128. {
  129. name: '任务查询',
  130. icon: 'task_sear',
  131. url: `/task_pages/taskarrment/tasklist/tasklist`,
  132. imgurl: nav6,
  133. size: 82.9
  134. },
  135. {
  136. name: '资产查询',
  137. icon: 'assert_sear',
  138. url: '/pages/assetsear/assetsear',
  139. imgurl: nav7,
  140. size: 82.9
  141. },
  142. {
  143. name: '库存查询',
  144. icon: 'num_sear',
  145. url: '/pages/numsear/numsear',
  146. imgurl: nav8,
  147. size: 82.9
  148. }
  149. ],
  150. //背景图
  151. // banner: banner,
  152. tzicon: tzicon, //图片
  153. partlist: null,
  154. taskdetail: null,
  155. tabheight: null
  156. }
  157. },
  158. computed: {
  159. ...mapState({
  160. tabbar: (state) => state.tabbar.tabbar,
  161. timer: (state) => state.user.timer
  162. })
  163. },
  164. onHide() {
  165. this.ifOnShow = true
  166. },
  167. onShow() {
  168. if (this.ifOnShow) {
  169. this.init()
  170. }
  171. },
  172. onLoad() {
  173. this.init()
  174. this.tabheight = getApp().globalData.tabhei
  175. },
  176. //下拉刷新
  177. onPullDownRefresh() {
  178. this.init()
  179. setTimeout(function () {
  180. uni.stopPullDownRefresh()
  181. }, 1000)
  182. },
  183. methods: {
  184. //底部导航栏
  185. beforeSwitch(id) {
  186. if (id == 1) {
  187. this.$store.dispatch('user/gettasklist')
  188. return false
  189. } else {
  190. return true
  191. }
  192. },
  193. //查看处理中任务列表
  194. tsanavtask() {
  195. this.$store.state.user.taskdetail = this.taskdetail
  196. if (this.taskCount !== 0) {
  197. uni.navigateTo({
  198. url: `/task_pages/taskarrment/tasklist/tasklist?staus=${0}&id=${1}`
  199. })
  200. } else {
  201. //只有一条任务跳转任务详情
  202. uni.navigateTo({
  203. url: '/task_pages/taskarrment/viewtask/viewtask'
  204. })
  205. }
  206. },
  207. //获取当日巡检列表与最新一条任务讯息
  208. init() {
  209. //获取当日巡检计划
  210. patrolTask(this.timer).then(({ data }) => {
  211. this.partlist = data.list
  212. })
  213. //获取最新任务
  214. tasknewst().then(({ data }) => {
  215. this.taskdetail = data
  216. })
  217. //获取我收到处理中的任务个数
  218. taskecl().then(({ data }) => {
  219. this.taskCount = 0
  220. data.forEach((Element) => {
  221. if (Element.status == 1) {
  222. this.taskCount = Element.count
  223. }
  224. })
  225. })
  226. }
  227. }
  228. }
  229. </script>
  230. <style lang="scss">
  231. @import '@/static/css/chj.css';
  232. .home {
  233. width: 100%;
  234. background: #ffffff;
  235. // border-top: 1rpx solid #000000;
  236. }
  237. .mai-color {
  238. width: 100%;
  239. background: #ffffff;
  240. }
  241. .info-swiper {
  242. width: 100%;
  243. height: 120rpx;
  244. box-sizing: border-box;
  245. background: #ffffff;
  246. box-shadow: 0px 0px 13rpx 0px rgba(6, 0, 1, 0.11);
  247. border-radius: 6rpx;
  248. position: relative;
  249. .info-ti {
  250. width: 9rpx;
  251. height: 44rpx;
  252. background: #4a8bff;
  253. }
  254. .info-icon {
  255. width: 58rpx;
  256. height: 58rpx;
  257. background: #ffffff;
  258. box-shadow: 0px 0px 5rpx 0px rgba(6, 0, 1, 0.11);
  259. border-radius: 50%;
  260. margin-left: 15rpx;
  261. }
  262. .annou-title {
  263. font-size: 28rpx;
  264. font-family: Microsoft YaHei-3970(82674968);
  265. font-weight: 400;
  266. color: #000000;
  267. }
  268. .annou-cig {
  269. font-size: 24rpx;
  270. font-family: Microsoft YaHei-3970(82674968);
  271. font-weight: 400;
  272. color: #999999;
  273. margin-top: 10rpx;
  274. }
  275. .hint {
  276. width: 30rpx;
  277. height: 30rpx;
  278. margin-right: 30rpx;
  279. border-radius: 50%;
  280. background-color: #f19536;
  281. font-size: 24rpx;
  282. text-align: center;
  283. line-height: 30rpx;
  284. color: #fbeee5;
  285. }
  286. .right-icon {
  287. position: absolute;
  288. right: 14rpx;
  289. width: 80rpx;
  290. }
  291. }
  292. .to-menus {
  293. display: flex;
  294. flex-direction: column;
  295. width: 100%;
  296. background: #ffffff;
  297. box-shadow: 0px 0px 13rpx 0px rgba(6, 0, 1, 0.11);
  298. border-radius: 6rpx;
  299. .nav-itm {
  300. display: flex;
  301. justify-content: space-around;
  302. width: 100%;
  303. height: 90px;
  304. }
  305. }
  306. .scr-hei {
  307. background: #ffffff;
  308. box-shadow: 0px 0px 13rpx 0px rgba(6, 0, 1, 0.11);
  309. border-radius: 6rpx;
  310. position: relative;
  311. }
  312. .sc-view {
  313. .u-progress-info {
  314. font-size: 36rpx;
  315. font-weight: 400;
  316. color: #4a8bff;
  317. }
  318. }
  319. </style>