user.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <!-- <view class="content">
  3. <view class="btn-row">
  4. <button type="default" @tap="bindLogout">退出登录</button>
  5. </view>
  6. </view> -->
  7. <view class="page-fill">
  8. <view class="header">
  9. <image src="../../static/icons/CpoxxFw_-5-AFyVyAABLIH8xBTw233.png" class="face"></image>
  10. <view class="info-wapper">
  11. <view class="nickname">
  12. 用户名:{{name}}
  13. </view>
  14. </view>
  15. <view>
  16. <button type="default" @tap="bindLogout" class="settings">退出</button>
  17. </view>
  18. </view>
  19. <view v-if="show">
  20. <view v-for="(list,index) in listName" :key="index" class="body">
  21. <view class="input-two">
  22. <input :id=list.id type="text" class="input" @focus="setStyle()" @blur="setStyle2()" :value=list.name @input="getValue" />
  23. <p id="p2" class="p2" :style="{display:showOrNo}">如:广东省广州市xx广场301型x号机</p>
  24. </view>
  25. <view class="">
  26. <button type="primary" @click="updata()" class="button">
  27. <p class="p">更改</p>
  28. </button>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import {
  36. mapState,
  37. mapMutations
  38. } from 'vuex'
  39. export default {
  40. data() {
  41. return {
  42. name: '',
  43. show: false,
  44. listName: [],
  45. value: null,
  46. id: null,
  47. showOrNo: null
  48. };
  49. },
  50. onPullDownRefresh() {
  51. setTimeout(function() {
  52. uni.stopPullDownRefresh();
  53. }, 800);
  54. },
  55. onShow() {
  56. uni.startPullDownRefresh();
  57. var me = this;
  58. var name = uni.getStorageSync("name");
  59. me.name = name;
  60. var listName = uni.getStorageSync("listName");
  61. me.listName = listName;
  62. var adminId = listName[0].adminId;
  63. if (adminId != '1' && adminId != null) {
  64. me.show = true;
  65. }
  66. },
  67. onLoad() {
  68. },
  69. computed: {},
  70. methods: {
  71. bindLogout() {
  72. uni.reLaunch({
  73. url: '/pages/Login/Login',
  74. });
  75. },
  76. setStyle() {
  77. this.showOrNo = "block";
  78. },
  79. setStyle2() {
  80. this.showOrNo = "none";
  81. },
  82. updata() {
  83. var id = this.id;
  84. var value = this.value;
  85. if (value != null && value != '') {
  86. uni.request({
  87. url: 'http://127.0.0.1:8090/TEquipment/updateName',
  88. data: {
  89. id: id,
  90. name: value
  91. },
  92. dataType: 'json',
  93. method: "POST",
  94. success: (res) => {
  95. uni.showModal({
  96. title: '提示',
  97. content: '名称:' + value + res.data.message,
  98. });
  99. }
  100. });
  101. }
  102. },
  103. getValue: function(event) {
  104. // 绕过v-model 获取input输入框的值
  105. var value = event.target.value;
  106. var id = event.target.id;
  107. this.value = value;
  108. this.id = id;
  109. }
  110. }
  111. }
  112. </script>
  113. <style>
  114. .page-fill {
  115. width: 100%;
  116. height: 100%;
  117. }
  118. .header {
  119. padding: 60upx 30upx 40upx 30upx;
  120. background-color: #ffd655;
  121. background: url(../../static/icons/CpoxxFwu_1OAYFAIAAAzO_Q1tPg693.png) repeat;
  122. display: flex;
  123. flex-direction: row;
  124. justify-content: flex-start;
  125. }
  126. .face {
  127. width: 120upx;
  128. height: 120upx;
  129. border-radius: 50%;
  130. flex-shrink: 0;
  131. }
  132. .info-wapper {
  133. width: 60%;
  134. margin-left: 40upx;
  135. display: flex;
  136. flex-direction: column;
  137. }
  138. .nickname {
  139. color: #6a5018;
  140. font-size: 12px;
  141. font-weight: bold;
  142. padding: 30upx 0upx 0upx 0upx;
  143. }
  144. .set-wapper {
  145. display: flex;
  146. flex-direction: row;
  147. justify-content: flex-end;
  148. width: 15%;
  149. }
  150. .settings {
  151. width: 160upx;
  152. height: 110upx;
  153. }
  154. .button {
  155. padding: 10upx 10upx 10upx 0upx;
  156. width: 80upx;
  157. height: 60upx;
  158. }
  159. .input {
  160. padding: 10upx 10upx 10upx 0upx;
  161. background-color: #EEEEEE;
  162. width: 550upx;
  163. height: 50upx;
  164. }
  165. .body {
  166. background-color: #D9D9D9;
  167. padding: 10upx 10upx 10upx 10upx;
  168. display: flex;
  169. flex-direction: row;
  170. justify-content: flex-start;
  171. }
  172. .input-two {
  173. width: 600upx;
  174. height: 100upx;
  175. }
  176. .p {
  177. width: 80upx;
  178. height: 50upx;
  179. }
  180. .p2 {
  181. color: #DD524D;
  182. display: none;
  183. width: 600upx;
  184. height: 50upx;
  185. border: 1px;
  186. }
  187. </style>