home.vue 12 KB

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