home.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. <template>
  2. <view>
  3. <!-- 轮播 -->
  4. <u-swiper :list="list" height="280"></u-swiper>
  5. <!-- 分类 -->
  6. <view class="px3 py2 d-flex f-wrap mt-1 bg-color-white cate">
  7. <block v-for="(item, index) in cateList" :key="index">
  8. <view @tap="handleView(item.type, item.url)" class="d-flex a-center j-center f-column col4 mb-2">
  9. <image :src="item.logo" class="mb-1" mode=""></image>
  10. <text class="f-size-24">{{ item.name }}</text>
  11. </view>
  12. </block>
  13. </view>
  14. <!-- 广告 -->
  15. <!-- <view class="px3 ad bg-color-white">
  16. <view class="py2">
  17. <u-section
  18. title="灵活用工优势"
  19. font-size="34"
  20. :show-line="false"
  21. >
  22. <view slot="right" class="f-size-26 text-color-6">
  23. <text class="mr-1">灵活结算</text>
  24. <text class="mr-1">员工自由</text>
  25. <text>效能提升</text>
  26. </view>
  27. </u-section>
  28. </view>
  29. <view class="d-flex j-between f-wrap bottom pb-2">
  30. <block v-for="(item, index) in adList" :key="index">
  31. <view class="mt-2" style="width: 330rpx">
  32. <image
  33. :src="item.icon"
  34. class="bottom-img"
  35. mode=""
  36. ></image>
  37. </view>
  38. </block>
  39. </view>
  40. </view>-->
  41. <!-- 最新消息 -->
  42. <view style="background-color: #f2f3f4" class="pb-1">
  43. <view class="f-size-32 f-weight-bold py2 border-bottom main-color-text" style="padding-left: 15px">最新消息</view>
  44. <view class="mx3 my2 p3 bg-color-white" v-for="(item, index) in listData" :key="index" @tap="handleDetail(item)"
  45. style="border-radius: 16rpx">
  46. <view class="d-flex j-between">
  47. <view class="f-size-32 f-weight-bold main-color-text">{{
  48. typeDict[item.detailType]
  49. }}</view>
  50. <view class="f-size-26 text-color-b">{{
  51. item.createdTime
  52. }}</view>
  53. </view>
  54. <view class="f-size-28 text-color-3 f-weight-4 mt-2">
  55. <rich-text :nodes="item.content"></rich-text>
  56. </view>
  57. </view>
  58. </view>
  59. <!-- 维修工单 -->
  60. <!-- <view style="background-color: #f2f3f4" class="" >
  61. <view class="mx3 pb-1 pt-3" @tap="handleRepair()">
  62. <u-section
  63. title="维修工单"
  64. sub-title="查看更多"
  65. font-size="34"
  66. :show-line="false"
  67. ></u-section>
  68. </view>
  69. <serve-list :order-list="orderList" />
  70. </view>-->
  71. <!-- 热门 -->
  72. <!-- <view class="hot-p">
  73. <view class="mx3 py3">
  74. <u-section
  75. title="热门接单人"
  76. sub-title="查看更多"
  77. font-size="34"
  78. :show-line="false"
  79. @click="goMineList"
  80. >
  81. </u-section>
  82. </view>
  83. <view class="mx3 d-flex f-wrap bottom">
  84. <view class="d-flex j-center">
  85. <view
  86. class="d-flex f-column bg-color-white mb-2 pl-3 pt-3 pb-2 bottom-item"
  87. >
  88. <image
  89. src="https://www.xingzhits.cn/xzts/static/images/avatar1.png"
  90. class="bg-color-light mb-2 bottom-img"
  91. ></image>
  92. <text class="f-weight-6 one-ellipsis">慕容晓晓</text>
  93. <view class="f-size-24 mt-1 one-ellipsis bottom-desc">
  94. UI设计师</view
  95. >
  96. </view>
  97. </view>
  98. <view class="d-flex j-center">
  99. <view
  100. class="d-flex f-column bg-color-white mb-2 pl-3 pt-3 pb-2 bottom-item"
  101. >
  102. <image
  103. src="https://www.xingzhits.cn/xzts/static/images/avatar1.png"
  104. class="bg-color-light mb-2 bottom-img"
  105. ></image>
  106. <text class="f-weight-6 one-ellipsis">慕容晓晓</text>
  107. <view class="f-size-24 mt-1 one-ellipsis bottom-desc">
  108. UI设计师</view
  109. >
  110. </view>
  111. </view>
  112. </view>
  113. </view>-->
  114. <u-popup v-model="show" :mask-close-able="false" :border-radius="20" mode="bottom">
  115. <view class="account-title">
  116. <u-avatar src="../../static/logo.png" :size="30"></u-avatar>
  117. <span class="ml-3">设备管理系统</span>
  118. </view>
  119. <view class="px3 py3 f-size-24 f-weight-bold text-color-6">请选择以下账号做为你的登录账号</view>
  120. <view class="accounts">
  121. <view class="account-item" v-for="item in accounts" :key="item" @click="handleSelectLogin(item)">{{ item }}</view>
  122. </view>
  123. </u-popup>
  124. <u-tabbar :list="tabbar" :mid-button="true" active-color="#0082ff"></u-tabbar>
  125. </view>
  126. </template>
  127. <script>
  128. const basePath = 'https://www.xingzhits.cn/xzts/static'
  129. export default {
  130. data() {
  131. return {
  132. listData: [],
  133. typeDict: {},
  134. list: [
  135. {
  136. image: 'http://www.qykh2009.com/images/sbgl_banner.png'
  137. },
  138. {
  139. image: 'http://www.qykh2009.com/upload/pic/50921544089534569.jpg'
  140. },
  141. {
  142. image: 'http://www.qykh2009.com/upload/pic/84401544089632806.jpg'
  143. },
  144. {
  145. image: 'http://www.qykh2009.com/upload/pic/69531466063518453.png'
  146. }
  147. ],
  148. cateList: [
  149. // {
  150. // logo: basePath + '/images/icon1.png',
  151. // name: '设备扫码',
  152. // url: '',
  153. // type: 1
  154. // },
  155. /* {
  156. logo: basePath + '/images/icon2.png',
  157. name: '点检管理',
  158. url: '../check/check',
  159. type: 2
  160. },
  161. {
  162. logo: basePath + '/images/icon4.png',
  163. name: '巡检填报',
  164. url: '../inspection/inspection',
  165. type: 2
  166. }, */
  167. {
  168. logo: basePath + '/images/icon3.png',
  169. name: '保养管理',
  170. url: '../maintain/maintain',
  171. type: 2
  172. },
  173. /* {
  174. logo: basePath + '/images/icon4.png',
  175. name: '运行填报',
  176. url: '../running/running',
  177. type: 2
  178. }, */
  179. {
  180. logo: basePath + '/images/icon5.png',
  181. name: '设备报修',
  182. url: '../repair/repair',
  183. type: 2
  184. },
  185. /* {
  186. logo: basePath + '/images/icon7.png',
  187. name: '备品备件',
  188. url: '../receive/receive',
  189. type: 2
  190. }, */
  191. {
  192. logo: basePath + '/images/icon8.png',
  193. name: '设备台账',
  194. url: '../equipment/equipment',
  195. type: 2
  196. }
  197. ],
  198. adList: [
  199. {
  200. icon: basePath + '/images/ad1.png'
  201. },
  202. {
  203. icon: basePath + '/images/ad2.png'
  204. },
  205. {
  206. icon: basePath + '/images/ad3.png'
  207. },
  208. {
  209. icon: basePath + '/images/ad4.png'
  210. }
  211. ],
  212. orderList: [{}, {}],
  213. companyList: [{}, {}],
  214. accounts: [],
  215. tabbar: [
  216. {
  217. iconPath: '/static/tabars/home.png',
  218. pagePath: '/pages/home/home',
  219. selectedIconPath: '/static/tabars/home_s.png',
  220. text: '首页'
  221. },
  222. {
  223. iconPath: '/static/tabars/order.png',
  224. pagePath: '/pages/operate/operate',
  225. selectedIconPath: '/static/tabars/order_s.png',
  226. text: '功能'
  227. },
  228. {
  229. iconPath: '/static/tabars/publish.png',
  230. pagePath: '/pages/middle/middle',
  231. selectedIconPath: '/static/tabars/publish.png',
  232. text: '报修',
  233. midButton: true
  234. },
  235. {
  236. iconPath: '/static/tabars/tiding.png',
  237. pagePath: '/pages/tidings/tidings',
  238. selectedIconPath: '/static/tabars/tiding_s.png',
  239. text: '消息'
  240. },
  241. {
  242. iconPath: '/static/tabars/mine.png',
  243. pagePath: '/pages/my/my',
  244. selectedIconPath: '/static/tabars/mine_s.png',
  245. text: '我的'
  246. }
  247. ],
  248. show: false
  249. }
  250. },
  251. onLoad(options) {
  252. this.initData()
  253. if (options.code) {
  254. this.login(options.code)
  255. }
  256. },
  257. onShow() {
  258. this.initData()
  259. },
  260. methods: {
  261. login(code) {
  262. this.$Http.loginQuicklyOauth(code).then(res => {
  263. if (res.data.length > 1) {
  264. this.accounts = res.data
  265. this.show = true
  266. } else {
  267. this.handleSelectLogin(res.data[0])
  268. }
  269. })
  270. },
  271. handleSelectLogin(params) {
  272. console.log(2)
  273. this.$Http
  274. .mobileLogin({
  275. username: params,
  276. password: 'quickly_login',
  277. grant_type: 'quickly_login',
  278. scope: 'server'
  279. })
  280. .then(res => {
  281. this.show = false
  282. })
  283. },
  284. handleRepair() {
  285. uni.navigateTo({
  286. url: '/pages/repair/repair'
  287. })
  288. },
  289. handleView(type, url) {
  290. if (type === 1) {
  291. this.handleCode()
  292. } else {
  293. uni.navigateTo({
  294. url: url
  295. })
  296. }
  297. },
  298. handleMessage() {
  299. uni.navigateTo({
  300. url: '/pages/tidings/tidings'
  301. })
  302. },
  303. // 去详情
  304. handleDetail(detail) {
  305. if (detail.status == 1) {
  306. this.$Http.updateWorkplaceBacklog({ id: detail.backlogId }).then(res => {
  307. console.log('已置为已办')
  308. })
  309. }
  310. uni.navigateTo({
  311. url: '/pages/tidings-detail/tidings-detail?detail=' + JSON.stringify(detail)
  312. })
  313. },
  314. handleCode() {
  315. // #ifdef H5
  316. uni.showToast({
  317. title: '暂不支持该功能',
  318. icon: 'none'
  319. })
  320. // #endif
  321. // #ifndef H5
  322. uni.scanCode({
  323. success(e) {
  324. const sbId = e.result.split('=')[1]
  325. if (sbId != null) {
  326. uni.navigateTo({
  327. url: '/pages/equipment-detail/equipment-detail?detailId=' + sbId
  328. })
  329. } else {
  330. uni.showToast('非本系统二维码,无法识别')
  331. }
  332. }
  333. })
  334. // #endif
  335. },
  336. getDict() {
  337. this.typeDict = this.$DictCache.getLabelByValueMapByType(this.$DictCache.TYPE.WORKPLACE_BACKLOG_DETAIL_TYPE)
  338. },
  339. initData() {
  340. const that = this
  341. this.$Http
  342. .getWorkplaceBacklogUserPage({
  343. pageNum: 1,
  344. pageSize: 4,
  345. dataScope: {
  346. sortBy: 'desc',
  347. sortName: 'task_create_time'
  348. }
  349. })
  350. .then(res => {
  351. that.getDict()
  352. console.log(res)
  353. const data = res.data.rows
  354. that.listData = data
  355. })
  356. }
  357. }
  358. }
  359. </script>
  360. <style lang="scss" scoped>
  361. .uni-swiper-slides {
  362. inset: 0px 0px !important;
  363. }
  364. .cate {
  365. image {
  366. width: 100rpx;
  367. height: 100rpx;
  368. border-radius: 50%;
  369. }
  370. text {
  371. color: #595c68;
  372. }
  373. }
  374. .hot-p {
  375. .bottom {
  376. &>view {
  377. width: 33%;
  378. }
  379. .bottom-item {
  380. border-radius: 15rpx;
  381. width: 210rpx;
  382. .bottom-desc {
  383. border: 1rpx solid #fa5445;
  384. width: 150rpx;
  385. text-align: center;
  386. border-radius: 7rpx;
  387. color: #fa5445;
  388. }
  389. }
  390. }
  391. }
  392. .ad {
  393. .bottom {
  394. &-img {
  395. width: 330rpx;
  396. height: 240rpx;
  397. border-radius: 20rpx;
  398. }
  399. }
  400. }
  401. .hot-p {
  402. background-color: #f2f3f4;
  403. .bottom {
  404. &-img {
  405. width: 80rpx;
  406. height: 80rpx;
  407. border-radius: 50%;
  408. }
  409. }
  410. }
  411. .account-title {
  412. padding: 30rpx;
  413. display: flex;
  414. align-items: center;
  415. font-weight: bold;
  416. background: #fff;
  417. }
  418. .accounts {
  419. padding: 40rpx;
  420. height: 600rpx;
  421. line-height: 60rpx;
  422. overflow-y: auto;
  423. .account-item {
  424. padding: 40rpx;
  425. margin: 0 auto;
  426. font-size: 40rpx;
  427. text-align: center;
  428. border-radius: 20rpx;
  429. background: #fff;
  430. margin-bottom: 20rpx;
  431. &:hover {
  432. cursor: pointer;
  433. }
  434. }
  435. }
  436. ::v-deep .u-drawer-content {
  437. background: #eee !important;
  438. }
  439. </style>