user.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <view class="top-bg">
  5. <image src="../../static/img/userBg.png" mode=""></image>
  6. </view>
  7. <view class="userInfo">
  8. <view class="avatar">
  9. <image src="../../static/img/avatar.png" mode=""></image>
  10. </view>
  11. <view class="user">
  12. <view class="userbox">
  13. <view class="name">
  14. 海儿
  15. </view>
  16. <view class="post">
  17. 部门管理
  18. </view>
  19. </view>
  20. <view class="phone">
  21. 137****1523
  22. </view>
  23. </view>
  24. </view>
  25. <view class="tz">
  26. <view class="tzimage">
  27. <image src="../../static/img/tong.png" mode=""></image>
  28. </view>
  29. <u-notice-bar class="tz-main" :text="text1" direction="column" :icon="false" bgColor="#ffffff"
  30. color="#000000" fontSize="25rpx"></u-notice-bar>
  31. </view>
  32. </view>
  33. <view class="main">
  34. <view class="main-item" v-for="(item,index) in list" @click="navTo(item)">
  35. <view class="main-bg">
  36. <image :src="item.bg" mode=""></image>
  37. </view>
  38. <view class="main-info" v-if="item.num">
  39. <view class="main-info-bg">
  40. <image src="../../static/img/infoBg.png" mode=""></image>
  41. </view>
  42. <view class="main-info-name">
  43. {{item.num}}条未读
  44. </view>
  45. </view>
  46. <view class="main-icon">
  47. <image :src="item.icon" mode="heightFix"></image>
  48. </view>
  49. <view class="main-name">
  50. {{item.name}}
  51. </view>
  52. <view class="main-tip">
  53. {{item.tip}}
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. import {
  61. mapState,
  62. mapMutations
  63. } from 'vuex';
  64. import {
  65. orderData,
  66. getUserInfo
  67. } from '@/api/user.js';
  68. export default {
  69. data() {
  70. return {
  71. text1: ['123456', '654321'],
  72. list: [{
  73. icon: '../../static/icon/u1.png',
  74. name: '领单',
  75. tip: '领取新订单',
  76. bg: '../../static/img/user-item1.png'
  77. },
  78. {
  79. icon: '../../static/icon/u2.png',
  80. name: '待检验订单',
  81. tip: '检验 | 添加记录',
  82. bg: '../../static/img/user-item2.png'
  83. },
  84. {
  85. icon: '../../static/icon/u3.png',
  86. name: '外发检验订单',
  87. tip: '订单外发处理',
  88. bg: '../../static/img/user-item1.png'
  89. },
  90. {
  91. icon: '../../static/icon/u4.png',
  92. name: '我的订单',
  93. tip: '订单列表 | 提交记录',
  94. bg: '../../static/img/user-item2.png'
  95. },
  96. {
  97. icon: '../../static/icon/u5.png',
  98. name: '工资记录',
  99. tip: '历月工资详情',
  100. bg: '../../static/img/user-item1.png'
  101. },
  102. {
  103. icon: '../../static/icon/u6.png',
  104. name: '打卡记录',
  105. tip: '上班 | 迟到记录',
  106. bg: '../../static/img/user-item2.png',
  107. src: '/pages/user/dkdetail'
  108. },
  109. {
  110. icon: '../../static/icon/u7.png',
  111. name: '奖罚记录',
  112. tip: '奖励 | 处罚记录',
  113. bg: '../../static/img/user-item2.png'
  114. },
  115. {
  116. icon: '../../static/icon/u8.png',
  117. name: '订单监管',
  118. tip: '订单详情',
  119. bg: '../../static/img/user-item2.png'
  120. },
  121. {
  122. icon: '../../static/icon/u9.png',
  123. name: '待处理办件',
  124. tip: '处罚 | 报废返工处理',
  125. bg: '../../static/img/user-item1.png',
  126. num: 2
  127. },
  128. {
  129. icon: '../../static/icon/u10.png',
  130. name: '外发不合格处理',
  131. tip: '订单外发处理',
  132. bg: '../../static/img/user-item2.png',
  133. num: 2
  134. },
  135. {
  136. icon: '../../static/icon/u11.png',
  137. name: '处罚管理',
  138. tip: '奖励 | 处罚记录',
  139. bg: '../../static/img/user-item1.png',
  140. num: 2
  141. },
  142. {
  143. icon: '../../static/icon/u12.png',
  144. name: '报废返工处理',
  145. tip: '提交报废返工的数量',
  146. bg: '../../static/img/user-item1.png',
  147. num: 2
  148. },
  149. {
  150. icon: '../../static/icon/u13.png',
  151. name: '外发订单管理',
  152. tip: '提交检验 | 检验记录',
  153. bg: '../../static/img/user-item2.png'
  154. },
  155. {
  156. icon: '../../static/icon/u14.png',
  157. name: '外发不合格通知',
  158. tip: '外发不合格消息',
  159. bg: '../../static/img/user-item2.png',
  160. num: 2
  161. },
  162. {
  163. icon: '../../static/icon/u15.png',
  164. name: '订单状态预警',
  165. tip: '订单到期时间预警',
  166. bg: '../../static/img/user-item1.png',
  167. num: 2
  168. },
  169. {
  170. icon: '../../static/icon/u16.png',
  171. name: '材料未到通知',
  172. tip: '材料未到预警',
  173. bg: '../../static/img/user-item1.png',
  174. num: 2
  175. },
  176. {
  177. icon: '../../static/icon/u17.png',
  178. name: '外发未到通知',
  179. tip: '外发时间到期预警',
  180. bg: '../../static/img/user-item2.png',
  181. num: 2
  182. },
  183. {
  184. icon: '../../static/icon/u18.png',
  185. name: '订单外发',
  186. tip: '订单外发给合作公司',
  187. bg: '../../static/img/user-item2.png',
  188. num: 2
  189. },
  190. {
  191. icon: '../../static/icon/u19.png',
  192. name: '订单抽检',
  193. tip: '订单抽取检验',
  194. bg: '../../static/img/user-item1.png'
  195. },
  196. ]
  197. };
  198. },
  199. computed: {
  200. ...mapState('user', ['hasLogin']),
  201. },
  202. onShow() {
  203. // 判断是否已经登录
  204. // this.loadBaseData();
  205. },
  206. methods: {
  207. toJSON() {
  208. return this;
  209. },
  210. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  211. navTo(item) {
  212. if (item.src) {
  213. console.log(111);
  214. uni.navigateTo({
  215. url: item.src
  216. })
  217. }
  218. },
  219. // 加载初始数据
  220. loadBaseData() {
  221. getUserInfo({})
  222. .then(({
  223. data
  224. }) => {
  225. this.setUserInfo(data);
  226. // 获取用户数据完毕后在获取订单数据防止多次跳转到登录页
  227. orderData({})
  228. .then(({
  229. data
  230. }) => {
  231. this.setOrderInfo(data);
  232. })
  233. .catch(e => {
  234. this.setOrderInfo({
  235. complete_count: 0, //完成
  236. received_count: 0, //待收货
  237. unshipped_count: 0, //待发货
  238. order_count: 0, //订单总数
  239. unpaid_count: 0 //待付款
  240. });
  241. });
  242. })
  243. .catch(e => {
  244. console.log(e);
  245. });
  246. },
  247. /**
  248. * 统一跳转接口,拦截未登录路由
  249. * navigator标签现在默认没有转场动画,所以用view
  250. */
  251. }
  252. };
  253. </script>
  254. <style lang="scss">
  255. .content,
  256. page {
  257. height: auto;
  258. min-height: 100%;
  259. background: #ffffff;
  260. }
  261. .top {
  262. position: relative;
  263. image {
  264. width: 100%;
  265. height: 100%;
  266. }
  267. .top-bg {
  268. position: absolute;
  269. top: 0;
  270. left: 0;
  271. right: 0;
  272. width: 750rpx;
  273. height: 490rpx;
  274. }
  275. .userInfo {
  276. display: flex;
  277. align-items: center;
  278. padding: 126rpx 20rpx 0;
  279. .avatar {
  280. width: 126rpx;
  281. height: 126rpx;
  282. border-radius: 50%;
  283. image {
  284. border-radius: 50%;
  285. }
  286. }
  287. .user {
  288. position: relative;
  289. z-index: 2;
  290. padding-left: 10rpx;
  291. line-height: 1;
  292. .userbox {
  293. display: flex;
  294. .name {
  295. font-size: 36rpx;
  296. font-family: PingFang SC;
  297. font-weight: bold;
  298. color: #FFFFFF;
  299. }
  300. .post {
  301. margin-left: 10rpx;
  302. border: 1rpx solid #FFFFFF;
  303. border-radius: 10rpx;
  304. padding: 4rpx 8rpx;
  305. font-size: 24rpx;
  306. font-family: PingFang SC;
  307. font-weight: 500;
  308. color: #FFFFFF;
  309. }
  310. }
  311. .phone {
  312. margin-top: 20rpx;
  313. font-size: 24rpx;
  314. font-family: PingFang SC;
  315. font-weight: 500;
  316. color: #FFFFFF;
  317. }
  318. }
  319. }
  320. .tz {
  321. position: relative;
  322. z-index: 2;
  323. padding: 20rpx 30rpx 0;
  324. display: flex;
  325. align-items: center;
  326. .tzimage {
  327. width: 68rpx;
  328. height: 68rpx;
  329. image {
  330. border-radius: 50%;
  331. }
  332. }
  333. .tz-main {
  334. height: 58rpx;
  335. margin-left: -34rpx;
  336. padding-left: 44rpx;
  337. border-radius: 0px 29rpx 29rpx 0px;
  338. }
  339. }
  340. }
  341. .main {
  342. padding: 50rpx 10rpx;
  343. display: flex;
  344. flex-wrap: wrap;
  345. .main-item {
  346. padding: 26rpx 36rpx 34rpx;
  347. width: 46%;
  348. height: 220rpx;
  349. box-shadow: 0px 7rpx 20rpx 0px rgba(50, 50, 52, 0.09);
  350. border-radius: 15rpx;
  351. margin: 0 10rpx 30rpx;
  352. position: relative;
  353. line-height: 1;
  354. image {
  355. width: 100%;
  356. height: 100%;
  357. }
  358. .main-bg {
  359. position: absolute;
  360. top: 0;
  361. left: 0;
  362. right: 0;
  363. width: 100%;
  364. height: 220rpx;
  365. }
  366. .main-info {
  367. position: absolute;
  368. z-index: 3;
  369. right: 0;
  370. top: 0;
  371. width: 120rpx;
  372. height: 38rpx;
  373. display: flex;
  374. justify-content: center;
  375. align-items: center;
  376. .main-info-bg {
  377. position: absolute;
  378. left: 0;
  379. right: 0;
  380. top: 0;
  381. width: 120rpx;
  382. height: 38rpx;
  383. }
  384. .main-info-name {
  385. position: relative;
  386. z-index: 4;
  387. font-size: 22rpx;
  388. font-family: PingFang SC;
  389. font-weight: 500;
  390. color: #FFFFFF;
  391. }
  392. }
  393. .main-icon {
  394. position: relative;
  395. z-index: 2;
  396. height: 50rpx;
  397. }
  398. .main-name {
  399. position: relative;
  400. z-index: 2;
  401. margin-top: 26rpx;
  402. font-size: 36rpx;
  403. font-family: PingFang SC;
  404. font-weight: bold;
  405. color: #3F3F3F;
  406. }
  407. .main-tip {
  408. font-size: 24rpx;
  409. font-family: PingFang SC;
  410. font-weight: 500;
  411. color: #8C8C8C;
  412. position: relative;
  413. z-index: 2;
  414. margin-top: 14rpx;
  415. }
  416. }
  417. }
  418. </style>