my.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <view>
  3. <template v-if="!userInfo || !userInfo.realName">
  4. <view class="top d-flex a-center px3 main-color-bg" @tap="login">
  5. <view class="img">
  6. <image src="/static/images/user_pic.png" mode=""></image>
  7. </view>
  8. <view class="ml-3 f-size-36 text-color-white">登录 / 注册</view>
  9. </view>
  10. </template>
  11. <template v-else>
  12. <view class="top d-flex a-center px3 main-color-bg">
  13. <view class="img">
  14. <image :src="myAvatar" @error="myDefaultAvatar" mode=""></image>
  15. </view>
  16. <view class="ml-3 f-size-36 text-color-white">{{
  17. userInfo.realName
  18. }}</view>
  19. </view>
  20. </template>
  21. <view class="divider"></view>
  22. <view class="px3 bg-color-white">
  23. <view class="f-size-32 f-weight-bold py2 border-bottom">我的任务</view>
  24. <!-- <my-card
  25. icon="icon-runhuaguanli"
  26. title="点检任务"
  27. :tipNum="gatherTask.checkTask"
  28. @handleLubrication="handleCheck"
  29. ></my-card>
  30. <my-card
  31. icon="icon-xunjianguanli"
  32. title="巡检填报"
  33. @handleLubrication="handleInspection"
  34. ></my-card>-->
  35. <!-- <my-card icon="icon-tubiaozhizuomoban-135" title="今日保养任务" :tipNum="gatherTask.lubricationTask" @handleLubrication="handleMaintain(1)"></my-card> -->
  36. <!-- <my-card icon="icon-tubiaozhizuomoban-135" title="本周保养任务" :tipNum="gatherTask.lubricationTaskWeek" @handleLubrication="handleMaintain(2)"></my-card> -->
  37. <my-card icon="icon-tubiaozhizuomoban-135" title="本月保养任务" :tipNum="gatherTask.lubricationTaskMonth"
  38. @handleLubrication="handleMaintain(3)"></my-card>
  39. <!-- <my-card
  40. icon="icon-jiayou"
  41. title="加油任务"
  42. :tipNum="gatherTask.oilTask"
  43. @handleLubrication="handleOiling"
  44. iColor="#F1650C"
  45. ></my-card>-->
  46. <my-card
  47. v-show="$BaseTool.UserUtil.getUserInfo() != null && ($BaseTool.UserUtil.isRepairRole() || $BaseTool.UserUtil.isManagerRole())"
  48. icon="icon-weixiu" title="维修任务" :tipNum="gatherTask.repairTask"
  49. @handleLubrication="handleService"></my-card>
  50. <my-card v-show="$BaseTool.UserUtil.getUserInfo() != null && ($BaseTool.UserUtil.isManagerRole() || $BaseTool.UserUtil.isExamineRole())"
  51. icon="icon-tubiaozhizuomoban-135" title="审核任务" :tipNum="gatherTask.repairCheckTask"
  52. @handleLubrication="handleRepairCheck"></my-card>
  53. <my-card v-show="$BaseTool.UserUtil.getUserInfo() != null && ($BaseTool.UserUtil.isManagerRole() || $BaseTool.UserUtil.isExamineRole())"
  54. icon="icon-tubiaozhizuomoban-135" title="转派审批" :tipNum="gatherTask.transferApproveTask"
  55. @handleLubrication="handleTransferApproval"></my-card>
  56. <!-- <my-card
  57. icon="icon-tubiaozhizuomoban-135"
  58. title="盘点任务"
  59. :tipNum="gatherTask.storeCheckTask"
  60. @handleLubrication="handleStoreCheck"
  61. ></my-card>-->
  62. </view>
  63. <view class="divider"></view>
  64. <view class="px3 bg-color-white">
  65. <my-card icon="icon-shezhi" title="设置" @handleLubrication="getSetting"></my-card>
  66. </view>
  67. <u-tabbar :list="tabbar" :mid-button="true" active-color="#0082ff"></u-tabbar>
  68. </view>
  69. </template>
  70. <script>
  71. export default {
  72. data() {
  73. return {
  74. userInfo: {
  75. realName: null,
  76. avatar: null
  77. },
  78. gatherTask: {
  79. checkTask: 0,
  80. maintainTask: 0,
  81. lubricationTask: 0,
  82. lubricationTaskWeek: 0,
  83. lubricationTaskMonth: 0,
  84. oilTask: 0,
  85. repairTask: 0,
  86. repairCheckTask: 0,
  87. transferApproveTask: 0
  88. },
  89. myAvatar: '',
  90. tabbar: [
  91. {
  92. iconPath: '/static/tabars/home.png',
  93. pagePath: '/pages/home/home',
  94. selectedIconPath: '/static/tabars/home_s.png',
  95. text: '首页'
  96. },
  97. {
  98. iconPath: '/static/tabars/order.png',
  99. pagePath: '/pages/operate/operate',
  100. selectedIconPath: '/static/tabars/order_s.png',
  101. text: '功能'
  102. },
  103. {
  104. iconPath: '/static/tabars/publish.png',
  105. pagePath: '/pages/middle/middle',
  106. selectedIconPath: '/static/tabars/publish.png',
  107. text: '报修',
  108. midButton: true
  109. },
  110. {
  111. iconPath: '/static/tabars/tiding.png',
  112. pagePath: '/pages/tidings/tidings',
  113. selectedIconPath: '/static/tabars/tiding_s.png',
  114. text: '消息'
  115. },
  116. {
  117. iconPath: '/static/tabars/mine.png',
  118. pagePath: '/pages/my/my',
  119. selectedIconPath: '/static/tabars/mine_s.png',
  120. text: '我的'
  121. }
  122. ]
  123. }
  124. },
  125. onLoad() { },
  126. onShow() {
  127. this.userInfo = this.$BaseTool.UserUtil.getUserInfo()
  128. if (!this.userInfo || !this.userInfo.username) {
  129. uni.showModal({
  130. content: '登录后方可查看内容',
  131. showCancel: true,
  132. cancelText: '账号登录',
  133. confirmText: '快捷登录',
  134. success: res => {
  135. if (res.confirm) {
  136. this.$Http.loginQuickly().then(res => {
  137. const url = res.data
  138. if (url !== '' && url !== null && url != undefined) {
  139. // 请求用户授权
  140. window.location.href = url
  141. }
  142. })
  143. } else if (res.cancel) {
  144. uni.reLaunch({ url: '/pages/login/login' })
  145. }
  146. }
  147. })
  148. return
  149. }
  150. this.myAvatar = this.$BaseTool.UserUtil.getFileUrl(this.userInfo.avatar)
  151. this.$Http.getGatherTask().then(res => {
  152. this.gatherTask = res.data
  153. })
  154. },
  155. methods: {
  156. myDefaultAvatar() {
  157. this.myAvatar = '/static/images/user_pic.png'
  158. },
  159. getSetting() {
  160. uni.navigateTo({
  161. url: '../setting/setting'
  162. })
  163. },
  164. // 维修任务
  165. handleService() {
  166. uni.navigateTo({
  167. url: '../service/service?filter=0'
  168. })
  169. },
  170. // 维修验收任务
  171. handleRepairCheck() {
  172. uni.navigateTo({
  173. url: '../repair-check/repair-check'
  174. })
  175. },
  176. // 转派审批
  177. handleTransferApproval() {
  178. uni.navigateTo({
  179. url: '../transfer-approval/transfer-approval'
  180. })
  181. },
  182. // 盘点任务
  183. handleStoreCheck() {
  184. uni.navigateTo({
  185. url: '../store-check/list'
  186. })
  187. },
  188. // 加油任务
  189. handleOiling() {
  190. uni.navigateTo({
  191. url: '../oiling/oiling'
  192. })
  193. },
  194. // 点检任务
  195. handleCheck() {
  196. uni.navigateTo({
  197. url: '../check/check'
  198. })
  199. },
  200. // 保养任务
  201. handleMaintain(searchType) {
  202. uni.navigateTo({
  203. url: '/pages/maintain/maintain?filter=2&searchType=' + searchType
  204. })
  205. },
  206. // 巡检任务
  207. handleInspection() {
  208. uni.navigateTo({
  209. url: '../inspection/inspection'
  210. })
  211. },
  212. // 润滑任务
  213. handleLubrication(e) {
  214. uni.navigateTo({
  215. url: '../lubrication/lubrication'
  216. })
  217. },
  218. // 扫码
  219. handleCode() {
  220. // #ifdef H5
  221. uni.showToast({
  222. title: '暂不支持该功能',
  223. icon: 'none'
  224. })
  225. // #endif
  226. // #ifndef H5
  227. uni.scanCode({
  228. success(e) {
  229. console.log(e.result)
  230. if (e.result) {
  231. uni.navigateTo({
  232. url: '/pages/equipment-detail/equipment-detail?detailId=' + e.result
  233. })
  234. }
  235. }
  236. })
  237. // #endif
  238. },
  239. // 扫码出库
  240. handleCodeOut() {
  241. // #ifdef H5
  242. uni.showToast({
  243. title: '暂不支持该功能',
  244. icon: 'none'
  245. })
  246. // #endif
  247. // #ifndef H5
  248. uni.scanCode({
  249. success(e) {
  250. console.log(e.result)
  251. if (e.result) {
  252. uni.navigateTo({
  253. url: '/pages/out-store/out-store?detailId=' + e.result
  254. })
  255. }
  256. }
  257. })
  258. // #endif
  259. },
  260. // 登录
  261. login() {
  262. uni.navigateTo({
  263. url: '../login/login'
  264. })
  265. }
  266. }
  267. }
  268. </script>
  269. <style lang="less">
  270. page {
  271. background-color: #f4f4f4;
  272. }
  273. .often {
  274. image {
  275. width: unit(50, rpx);
  276. height: unit(50, rpx);
  277. }
  278. .iconfont {
  279. font-size: unit(50, rpx);
  280. }
  281. }
  282. .top {
  283. height: unit(200, rpx);
  284. .img {
  285. width: unit(128, rpx);
  286. height: unit(128, rpx);
  287. border-radius: 50%;
  288. image {
  289. width: unit(128, rpx);
  290. height: unit(128, rpx);
  291. border-radius: 50%;
  292. background-color: #999;
  293. // border: 5rpx solid #fff;
  294. }
  295. }
  296. }
  297. </style>