user.vue 6.3 KB

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