people.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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="usericon1"> </view>
  15. <view class="username1">
  16. <view class="text-xl" style="color: #3485fe">{{
  17. personalList.username
  18. }}</view>
  19. <view class="text-info">用户</view>
  20. </view>
  21. </view>
  22. <view class="user2" :style="[{ animationDelay: '0.2s' }]">
  23. <view class="usericon2"> </view>
  24. <view class="username2">
  25. <view class="text-xl" style="color: #09bda0">{{
  26. personalList.post ? personalList.post : "员工"
  27. }}</view>
  28. <view class="text-info">职务</view>
  29. </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"
  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="userSacll"></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="userDetail"></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="userExit"></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/userBg.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/user1.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-around;
  202. align-items: center;
  203. padding: 20rpx;
  204. background-color: #fff;
  205. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  206. }
  207. .user1 {
  208. display: flex;
  209. flex-direction: row;
  210. background-image: url("/static/user3.png");
  211. background-size: 100% 100%;
  212. margin: 10px;
  213. width: 48%;
  214. height: 120rpx;
  215. }
  216. .usericon1 {
  217. margin-left: 20rpx;
  218. margin-top: 20rpx;
  219. width: 30%;
  220. height: 80%;
  221. background-image: url("/static/usericon1.png");
  222. background-size: 100% 100%;
  223. margin-right: 20rpx;
  224. }
  225. .username1 {
  226. display: flex;
  227. flex-direction: column;
  228. justify-content: center;
  229. }
  230. .user2 {
  231. display: flex;
  232. flex-direction: row;
  233. background-image: url("/static/user4.png");
  234. background-size: 100% 100%;
  235. margin: 10px;
  236. width: 48%;
  237. height: 120rpx;
  238. }
  239. .usericon2 {
  240. margin-left: 20rpx;
  241. margin-top: 20rpx;
  242. width: 30%;
  243. height: 80%;
  244. background-image: url("/static/usericon2.png");
  245. background-size: 100% 100%;
  246. margin-right: 20rpx;
  247. }
  248. .username2 {
  249. display: flex;
  250. flex-direction: column;
  251. justify-content: center;
  252. }
  253. .text-info {
  254. color: #8094ac;
  255. font-weight: bold;
  256. }
  257. .UCenter-bg text {
  258. opacity: 0.8;
  259. }
  260. .UCenter-bg image {
  261. width: 200rpx;
  262. height: 200rpx;
  263. }
  264. .UCenter-bg .gif-wave {
  265. position: absolute;
  266. width: 100%;
  267. bottom: 0;
  268. left: 0;
  269. z-index: 99;
  270. mix-blend-mode: screen;
  271. height: 100rpx;
  272. }
  273. map,
  274. .mapBox {
  275. left: 0;
  276. z-index: 99;
  277. mix-blend-mode: screen;
  278. height: 100rpx;
  279. }
  280. map,
  281. .mapBox {
  282. width: 750rpx;
  283. height: 300rpx;
  284. }
  285. .userSacll {
  286. background-image: url("/static/userscall.png");
  287. background-size: 100% 100%;
  288. width: 36rpx;
  289. height: 36rpx;
  290. margin-right: 20rpx;
  291. display: inline-block;
  292. vertical-align: middle;
  293. }
  294. .userDetail {
  295. background-image: url("/static/userdetail.png");
  296. background-size: 100% 100%;
  297. width: 36rpx;
  298. height: 36rpx;
  299. margin-right: 20rpx;
  300. display: inline-block;
  301. vertical-align: middle;
  302. }
  303. .userExit {
  304. background-image: url("/static/userexit.png");
  305. background-size: 100% 100%;
  306. width: 36rpx;
  307. height: 36rpx;
  308. margin-right: 20rpx;
  309. display: inline-block;
  310. vertical-align: middle;
  311. }
  312. .text-grey {
  313. color: #000;
  314. font-weight: bold;
  315. }
  316. </style>