people.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <template>
  2. <view>
  3. <scroll-view scroll-y class="page">
  4. <!-- 头部logo-->
  5. <view class="UCenter-bg">
  6. <view class="avatar-box"> </view>
  7. </view>
  8. <view class="padding flex text-center bg-white userinfo-box">
  9. <view class="user1" :style="[{ animationDelay: '0.2s' }]">
  10. <view class="username1">
  11. <view class="text-xl" style="color: #fff">{{
  12. personalList.username
  13. }}</view>
  14. <view class="text-info">用户</view>
  15. </view>
  16. <view class="usericon1"> </view>
  17. </view>
  18. <view class="user2" :style="[{ animationDelay: '0.2s' }]">
  19. <view class="username2">
  20. <view class="text-xl" style="color: #fff">{{
  21. personalList.post ? personalList.post : "员工"
  22. }}</view>
  23. <view class="text-info">职务</view>
  24. </view>
  25. <view class="usericon2"> </view>
  26. </view>
  27. </view>
  28. <!-- 列表list-->
  29. <view
  30. class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg radius people-menu"
  31. >
  32. <view
  33. class="cu-item arrow animation-slide-bottom"
  34. :style="[{ animationDelay: '0.3s' }]"
  35. @tap="scan"
  36. >
  37. <view class="content">
  38. <text class="cuIcon-scan menu-icon"></text>
  39. <text class="text-grey">扫码</text>
  40. </view>
  41. </view>
  42. <navigator
  43. class="cu-item arrow animation-slide-bottom"
  44. url="/pages/user/userdetail"
  45. :style="[{ animationDelay: '0.6s' }]"
  46. >
  47. <view class="content">
  48. <text class="cuIcon-settings menu-icon"></text>
  49. <text class="text-grey">设置</text>
  50. </view>
  51. </navigator>
  52. <navigator
  53. class="cu-item arrow animation-slide-bottom"
  54. :style="[{ animationDelay: '0.7s' }]"
  55. url="/pages/user/userexit"
  56. hover-class="none"
  57. >
  58. <view class="content">
  59. <text class="cuIcon-exit menu-icon"></text>
  60. <text class="text-grey">退出</text>
  61. </view>
  62. </navigator>
  63. </view>
  64. <view class="cu-tabbar-height"></view>
  65. </scroll-view>
  66. </view>
  67. </template>
  68. <script>
  69. import api from "@/api/api";
  70. export default {
  71. name: "people",
  72. data() {
  73. return {
  74. personalList: {
  75. avatar: "",
  76. realname: "",
  77. username: "",
  78. post: "",
  79. },
  80. positionUrl: "/sys/position/list",
  81. departUrl: "/sys/user/userDepartList",
  82. userUrl: "/sys/user/queryById",
  83. postUrl: "/sys/position/queryByCode",
  84. userId: "",
  85. id: "",
  86. };
  87. },
  88. watch: {
  89. cur: {
  90. immediate: true,
  91. handler() {
  92. console.log("watch", this.cur);
  93. this.userId = this.$store.getters.userid;
  94. this.load();
  95. },
  96. },
  97. },
  98. methods: {
  99. scan() {
  100. console.log("进来了");
  101. // #ifndef H5
  102. uni.scanCode({
  103. success: function (res) {
  104. console.log("条码res:" + res);
  105. console.log("条码类型:" + res.scanType);
  106. console.log("条码内容:" + res.result);
  107. },
  108. });
  109. // #endif
  110. // #ifdef H5
  111. this.$tip.alert("暂不支持");
  112. // #endif
  113. },
  114. load() {
  115. if (!this.userId) {
  116. return;
  117. }
  118. this.$http
  119. .get(this.userUrl, { params: { id: this.userId } })
  120. .then((res) => {
  121. console.log("res", res);
  122. if (res.data.success) {
  123. let perArr = res.data.result;
  124. let avatar =
  125. perArr.avatar && perArr.avatar.length > 0
  126. ? api.getFileAccessHttpUrl(perArr.avatar)
  127. : "/static/user2.png";
  128. this.personalList.realname = perArr.realname;
  129. this.personalList.username = perArr.username;
  130. this.personalList.depart = perArr.departIds;
  131. this.getpost(perArr.post);
  132. }
  133. })
  134. .catch((err) => {
  135. console.log(err);
  136. });
  137. },
  138. getpost(code) {
  139. if (!code || code.length == 0) {
  140. this.personalList.post = "员工";
  141. return false;
  142. }
  143. this.$http
  144. .get(this.postUrl, { params: { code: code } })
  145. .then((res) => {
  146. console.log("postUrl", res);
  147. if (res.data.success) {
  148. this.personalList.post = res.data.result.name;
  149. }
  150. })
  151. .catch((err) => {
  152. console.log(err);
  153. });
  154. },
  155. },
  156. };
  157. </script>
  158. <style>
  159. .UCenter-bg {
  160. /* #ifdef MP-WEIXIN */
  161. background-image: url("/static/topnavbar.png");
  162. /* #endif */
  163. /* #ifndef MP-WEIXIN */
  164. background-image: url("/static/user/usertopbg.png");
  165. /* #endif */
  166. background-size: cover;
  167. height: 400rpx;
  168. display: flex;
  169. justify-content: center;
  170. padding-top: 40rpx;
  171. overflow: hidden;
  172. position: relative;
  173. flex-direction: column;
  174. align-items: center;
  175. color: #fff;
  176. font-weight: 300;
  177. text-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
  178. }
  179. .avatar-box {
  180. position: relative;
  181. width: 250rpx;
  182. height: 250rpx;
  183. background-image: url("/static/user/userTop.png");
  184. background-size: 100% 100%;
  185. }
  186. .avatar {
  187. position: absolute;
  188. width: 100%;
  189. height: 95%;
  190. background-image: url("/static/user2.png");
  191. background-size: 50% 50%;
  192. background-repeat: no-repeat;
  193. background-position: center;
  194. }
  195. .userinfo-box {
  196. display: flex;
  197. justify-content: space-between;
  198. align-items: center;
  199. padding: 20rpx;
  200. margin: 16rpx 15rpx 0;
  201. box-sizing: border-box;
  202. border-radius: 12rpx;
  203. background-color: #f9f9fb;
  204. border: 1px solid #fff;
  205. }
  206. .user1 {
  207. display: flex;
  208. align-items: center;
  209. justify-content: space-between;
  210. flex: 1;
  211. min-width: 0;
  212. box-sizing: border-box;
  213. position: relative;
  214. overflow: visible;
  215. background-image: url("/static/user/userbg1.png");
  216. background-size: 100% 100%;
  217. background-repeat: no-repeat;
  218. margin: 0;
  219. padding: 14rpx 10rpx 10rpx 20rpx;
  220. height: 128rpx;
  221. border-radius: 16rpx;
  222. }
  223. .usericon1 {
  224. flex: 0 0 auto;
  225. position: relative;
  226. z-index: 1;
  227. width: 82px;
  228. height: 90px;
  229. margin: 0 0px -5px 0;
  230. align-self: flex-end;
  231. background-image: url("/static/user/user.png");
  232. background-size: cover;
  233. background-position: right bottom;
  234. background-repeat: no-repeat;
  235. }
  236. .username1 {
  237. display: flex;
  238. flex-direction: column;
  239. justify-content: center;
  240. flex: 1;
  241. min-width: 0;
  242. padding-bottom: 8rpx;
  243. text-align: left;
  244. }
  245. .user2 {
  246. display: flex;
  247. align-items: center;
  248. justify-content: space-between;
  249. flex: 1;
  250. min-width: 0;
  251. box-sizing: border-box;
  252. position: relative;
  253. overflow: visible;
  254. background-image: url("/static/user/userbg2.png");
  255. background-size: 100% 100%;
  256. background-repeat: no-repeat;
  257. margin: 0 0 0 16rpx;
  258. padding: 14rpx 10rpx 10rpx 20rpx;
  259. height: 128rpx;
  260. border-radius: 16rpx;
  261. }
  262. .usericon2 {
  263. flex: 0 0 auto;
  264. position: relative;
  265. z-index: 1;
  266. width: 90px;
  267. height: 89px;
  268. margin: 0 -1px -4px 0;
  269. align-self: flex-end;
  270. background-image: url("/static/user/user1.png");
  271. background-size: cover;
  272. background-position: right bottom;
  273. background-repeat: no-repeat;
  274. }
  275. .username2 {
  276. display: flex;
  277. flex-direction: column;
  278. justify-content: center;
  279. flex: 1;
  280. min-width: 0;
  281. padding-bottom: 8rpx;
  282. text-align: left;
  283. }
  284. .username1 .text-xl,
  285. .username2 .text-xl {
  286. overflow: hidden;
  287. color: #fff;
  288. font-size: 36rpx;
  289. font-weight: bold;
  290. line-height: 1.2;
  291. text-overflow: ellipsis;
  292. white-space: nowrap;
  293. }
  294. .username1 .text-info,
  295. .username2 .text-info {
  296. color: rgba(255, 255, 255, 0.92);
  297. font-size: 22rpx;
  298. font-weight: 400;
  299. }
  300. .UCenter-bg text {
  301. opacity: 0.8;
  302. }
  303. .UCenter-bg image {
  304. width: 200rpx;
  305. height: 200rpx;
  306. }
  307. .UCenter-bg .gif-wave {
  308. position: absolute;
  309. width: 100%;
  310. bottom: 0;
  311. left: 0;
  312. z-index: 99;
  313. mix-blend-mode: screen;
  314. height: 100rpx;
  315. }
  316. map,
  317. .mapBox {
  318. left: 0;
  319. z-index: 99;
  320. mix-blend-mode: screen;
  321. height: 100rpx;
  322. }
  323. map,
  324. .mapBox {
  325. width: 750rpx;
  326. height: 300rpx;
  327. }
  328. .card-menu {
  329. margin: 20rpx;
  330. }
  331. .people-menu {
  332. overflow: visible;
  333. margin-top: 20rpx;
  334. background-color: transparent;
  335. box-shadow: none;
  336. }
  337. .people-menu > .cu-item {
  338. min-height: 80rpx;
  339. margin-bottom: 20rpx;
  340. border-radius: 12rpx;
  341. background-color: #f9f9fb;
  342. border: 1rpx solid #fff;
  343. }
  344. .people-menu > .cu-item:last-child {
  345. margin-bottom: 0;
  346. }
  347. .people-menu > .cu-item.arrow:before {
  348. color: #1677ff;
  349. }
  350. .people-menu .menu-icon {
  351. display: inline-flex;
  352. align-items: center;
  353. justify-content: center;
  354. width: 52rpx;
  355. height: 52rpx;
  356. margin-right: 16rpx;
  357. border-radius: 8rpx;
  358. background: linear-gradient(135deg, #80b4ff, #347df3);
  359. color: #fff;
  360. font-size: 30rpx;
  361. vertical-align: middle;
  362. }
  363. .people-menu .content > text[class*="cuIcon"] {
  364. width: 52rpx;
  365. margin-right: 16rpx;
  366. }
  367. .text-grey {
  368. color: #000;
  369. font-weight: bold;
  370. }
  371. </style>