people.vue 8.6 KB

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