user.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <template>
  2. <view class="page-fill">
  3. <view class="headimg"></view>
  4. <view class="header">
  5. <view v-if="weixinUp" class="face3">
  6. <image :src="avatarUrl" class="face2"></image>
  7. </view>
  8. <view v-if="weixinDown">
  9. <image src="../../static/img/userimg.png" class="face"></image>
  10. </view>
  11. <view class="info-wapper">
  12. <view class="nickname">
  13. {{name}}
  14. </view>
  15. </view>
  16. <view class="tuichu">
  17. <button @tap="bindLogout" class="settings">
  18. <p class="p3">{{$t('user.bindLogout')}}</p>
  19. </button>
  20. </view>
  21. </view>
  22. <view class="">
  23. <uni-list>
  24. <view class="" v-show="level<=2">
  25. <view v-if="show">
  26. <uni-list-item title="员工信息" @click="worker()" />
  27. <uni-list-item :title="$t('user.equipmentname')" @click="updataName()" />
  28. </view>
  29. </view>
  30. <view v-show="level<=2">
  31. <uni-list-item title="签到详情" @click="qiandaoList()" />
  32. </view>
  33. <view v-show="level<=2">
  34. <uni-list-item title="签到" @click="qiandao()" />
  35. </view>
  36. </uni-list>
  37. </view>
  38. <view class="xiugai2" v-show="level<2">
  39. <button type="primary" @click="trant()" class="xiugai2">
  40. <p class="xiugai3">解除微信绑定</p>
  41. </button>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import uniList from '@/components/uni-list/uni-list.vue'
  47. import uniListItem from '@/components/uni-list-item/uni-list-item.vue'
  48. import {
  49. mapState,
  50. mapActions,
  51. mapMutations
  52. } from 'vuex'
  53. export default {
  54. components: {
  55. uniList,
  56. uniListItem,
  57. },
  58. data() {
  59. return {
  60. name: '',
  61. show: false,
  62. ifForeign: false,
  63. listName: [],
  64. value: null,
  65. id: null,
  66. gid: false,
  67. level: 3,
  68. parm: {
  69. name: null,
  70. id: null
  71. },
  72. showOrNo: null,
  73. avatarUrl: null,
  74. weixinUp: false,
  75. weixinDown: true
  76. };
  77. },
  78. onPullDownRefresh() {
  79. setTimeout(function() {
  80. uni.stopPullDownRefresh();
  81. }, 800);
  82. },
  83. onShow() {
  84. uni.setNavigationBarTitle({
  85. title: this.$t('user.title')
  86. });
  87. uni.setTabBarItem({
  88. index: 4,
  89. text: this.$t('tabs.tab5')
  90. });
  91. // uni.startPullDownRefresh();
  92. var globalUser = uni.getStorageSync("globalUser");
  93. this.level = uni.getStorageSync("level");
  94. var gid = globalUser.id;
  95. if (gid != 1) {
  96. this.gid = true;
  97. this.show = true;
  98. }
  99. var ifForeign = globalUser.ifForeign;
  100. if (ifForeign == 0) {
  101. this.ifForeign = true;
  102. }
  103. var token = uni.getStorageSync("token");
  104. if (token.length > 1) {
  105. var name = uni.getStorageSync("name");
  106. this.name = name;
  107. var listName = uni.getStorageSync("listName");
  108. this.listName = listName;
  109. } else {
  110. uni.reLaunch({
  111. url: '../Login/Login',
  112. });
  113. }
  114. if (listName != '' && listName != null) {
  115. var adminId = listName[0].adminId;
  116. if (adminId != '1' && adminId != null) {
  117. this.show = true;
  118. }
  119. }
  120. var newparm = uni.getStorageSync("newparm");
  121. if (newparm.toString().length > 1) {
  122. if (newparm.avatarUrl.length > 1) {
  123. this.avatarUrl = newparm.avatarUrl;
  124. this.weixinUp = true;
  125. this.weixinDown = false;
  126. }
  127. }
  128. },
  129. onLoad() {
  130. },
  131. methods: {
  132. updataName() {
  133. uni.navigateTo({
  134. url: '../../packageA/pages/user/equipmentName',
  135. });
  136. },
  137. worker(){
  138. uni.navigateTo({
  139. url: '../../packageA/pages/user/workerList',
  140. });
  141. },
  142. qiandao() {
  143. uni.navigateTo({
  144. url: '../../packageA/pages/user/qiandao',
  145. });
  146. },
  147. qiandaoList(){
  148. uni.navigateTo({
  149. url: "../../packageA/pages/user/sign",
  150. });
  151. },
  152. trant() {
  153. uni.reLaunch({
  154. url: '../WeixinSwicth/WeixinSwicth',
  155. });
  156. },
  157. bindLogout() {
  158. //清楚缓存
  159. uni.clearStorageSync();
  160. uni.reLaunch({
  161. url: '/pages/Login/Login',
  162. });
  163. },
  164. setStyle() {
  165. this.showOrNo = "block";
  166. },
  167. setStyle2() {
  168. this.showOrNo = "none";
  169. },
  170. }
  171. }
  172. </script>
  173. <style>
  174. .page-fill {
  175. width: 100%;
  176. height: 100%;
  177. background: #FFFFFF;
  178. padding-bottom: 100upx;
  179. }
  180. .headimg {
  181. height: 120upx;
  182. background: #206DC3;
  183. width: 750upx;
  184. }
  185. .header {
  186. height: 160upx;
  187. width: 690upx;
  188. background: #FFFFFF;
  189. margin: auto;
  190. padding-top: 50upx;
  191. box-shadow: 0upx -1upx 20upx #D3D3D3;
  192. border-radius: 15upx;
  193. transform: translateY(-90upx);
  194. display: flex;
  195. flex-direction: row;
  196. justify-content: flex-start;
  197. }
  198. .face {
  199. width: 116upx;
  200. height: 116upx;
  201. padding-left: 30upx;
  202. border-radius: 50%;
  203. flex-shrink: 0;
  204. }
  205. .face2 {
  206. width: 120upx;
  207. height: 120upx;
  208. padding-right: 0upx;
  209. border-radius: 50%;
  210. flex-shrink: 0;
  211. }
  212. .face3 {
  213. width: 120upx;
  214. height: 120upx;
  215. padding-left: 30upx;
  216. padding-right: 0upx;
  217. border-radius: 50%;
  218. flex-shrink: 0;
  219. }
  220. .info-wapper {
  221. width: 50%;
  222. margin-left: 30upx;
  223. display: flex;
  224. flex-direction: column;
  225. }
  226. .nickname {
  227. color: #363D44;
  228. font-size: 16px;
  229. font-weight: 600;
  230. padding: 30upx 0upx 0upx 0upx;
  231. font-family: "PingFang-SC-Bold";
  232. }
  233. .set-wapper {
  234. display: flex;
  235. flex-direction: row;
  236. justify-content: flex-end;
  237. width: 15%;
  238. }
  239. .tuichu {
  240. width: 100upx;
  241. height: 64upx;
  242. padding-top: 30upx;
  243. text-align: center;
  244. margin: 0 auto;
  245. }
  246. .settings {
  247. width: 100upx;
  248. height: 64upx;
  249. border-radius: 10upx;
  250. background: #D6101F;
  251. text-align: center;
  252. margin: 0 auto;
  253. }
  254. .p3 {
  255. /* #ifdef H5 */
  256. top: -13%;
  257. /* #endif */
  258. font-size: 32upx;
  259. color: #FFFFFF;
  260. font-weight: bold;
  261. width: 100upx;
  262. height: 64upx;
  263. /* #ifndef H5 */
  264. padding-top: 3upx;
  265. /* #endif */
  266. position: absolute;
  267. /* 水平居中 */
  268. left: 50%;
  269. -webkit-transform: translateX(-50%);
  270. transform: translateX(-50%);
  271. }
  272. .centerY {
  273. position: absolute;
  274. top: 50%;
  275. -webkit-transform: translateY(-50%);
  276. transform: translateY(-50%);
  277. }
  278. .button2 {
  279. padding-right: 60upx;
  280. padding-top: 2upx;
  281. }
  282. .button {
  283. width: 80upx;
  284. height: 60upx;
  285. border-radius: 10upx;
  286. }
  287. .p {
  288. /* #ifdef H5 */
  289. top: -13%;
  290. /* #endif */
  291. width: 80upx;
  292. height: 60upx;
  293. font-size: 30upx;
  294. /* #ifndef H5 */
  295. padding-top: 3upx;
  296. /* #endif */
  297. position: absolute;
  298. /* 水平居中 */
  299. left: 50%;
  300. -webkit-transform: translateX(-50%);
  301. transform: translateX(-50%);
  302. }
  303. .xiugai2 {
  304. width: 100%;
  305. height: 80upx;
  306. font-family: "PingFang-SC-Bold";
  307. font-weight: bold;
  308. margin: auto;
  309. font-size: 50upx;
  310. color: #363D44;
  311. position: fixed;
  312. bottom: 0;
  313. }
  314. .xiugai3 {
  315. height: 80upx;
  316. font-family: "PingFang-SC-Bold";
  317. font-weight: bold;
  318. margin: auto;
  319. font-size: 40upx;
  320. color: #363D44;
  321. }
  322. .body {
  323. background-color: #FFFFFF;
  324. padding: 10upx 10upx 10upx 10upx;
  325. display: flex;
  326. flex-direction: row;
  327. justify-content: flex-start;
  328. }
  329. </style>