user.vue 6.1 KB

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