user.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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. parm:{
  48. name:null,
  49. id:null
  50. },
  51. showOrNo: null
  52. };
  53. },
  54. onPullDownRefresh() {
  55. setTimeout(function() {
  56. uni.stopPullDownRefresh();
  57. }, 800);
  58. },
  59. onShow() {
  60. uni.startPullDownRefresh();
  61. var me = this;
  62. var name = uni.getStorageSync("name");
  63. me.name = name;
  64. var listName = uni.getStorageSync("listName");
  65. me.listName = listName;
  66. var adminId = listName[0].adminId;
  67. if (adminId != '1' && adminId != null) {
  68. me.show = true;
  69. }
  70. },
  71. onLoad() {
  72. },
  73. methods: {
  74. bindLogout() {
  75. uni.reLaunch({
  76. url: '/pages/Login/Login',
  77. });
  78. },
  79. setStyle() {
  80. this.showOrNo = "block";
  81. },
  82. setStyle2() {
  83. this.showOrNo = "none";
  84. },
  85. // updata() {
  86. // //挂载方式
  87. // var serverurl = this.serverurl;
  88. // var id = this.id;
  89. // var value = this.value;
  90. // if (value != null && value != '') {
  91. // uni.request({
  92. // url: serverurl+'/TEquipment/updateName',
  93. // data: {
  94. // id: id,
  95. // name: value
  96. // },
  97. // dataType: 'json',
  98. // method: "POST",
  99. // success: (res) => {
  100. // uni.showModal({
  101. // title: '提示',
  102. // content: '名称:' + value + res.data.message,
  103. // });
  104. // }
  105. // });
  106. // }
  107. // },
  108. getValue: function(event) {
  109. // 绕过v-model 获取input输入框的值
  110. var value = event.target.value;
  111. var id = event.target.id;
  112. this.value = value;
  113. this.id = id;
  114. this.parm.name = value;
  115. this.parm.id = id;
  116. },
  117. ...mapActions('chart', ['updata']),
  118. updata(){
  119. debugger;
  120. this.updata(this.parm)
  121. .then(data => {
  122. var merchantList = data;
  123. }
  124. , _ => void uni.stopPullDownRefresh());
  125. }
  126. }
  127. }
  128. </script>
  129. <style>
  130. .page-fill {
  131. width: 100%;
  132. height: 100%;
  133. }
  134. .header {
  135. padding: 60upx 30upx 40upx 30upx;
  136. background-color: #ffd655;
  137. background: url(../../static/icons/CpoxxFwu_1OAYFAIAAAzO_Q1tPg693.png) repeat;
  138. display: flex;
  139. flex-direction: row;
  140. justify-content: flex-start;
  141. }
  142. .face {
  143. width: 120upx;
  144. height: 120upx;
  145. border-radius: 50%;
  146. flex-shrink: 0;
  147. }
  148. .info-wapper {
  149. width: 60%;
  150. margin-left: 40upx;
  151. display: flex;
  152. flex-direction: column;
  153. }
  154. .nickname {
  155. color: #6a5018;
  156. font-size: 12px;
  157. font-weight: bold;
  158. padding: 30upx 0upx 0upx 0upx;
  159. }
  160. .set-wapper {
  161. display: flex;
  162. flex-direction: row;
  163. justify-content: flex-end;
  164. width: 15%;
  165. }
  166. .settings {
  167. width: 160upx;
  168. height: 110upx;
  169. }
  170. .button {
  171. padding: 10upx 10upx 10upx 0upx;
  172. width: 80upx;
  173. height: 60upx;
  174. }
  175. .input {
  176. padding: 10upx 10upx 10upx 0upx;
  177. background-color: #EEEEEE;
  178. width: 550upx;
  179. height: 50upx;
  180. }
  181. .body {
  182. background-color: #D9D9D9;
  183. padding: 10upx 10upx 10upx 10upx;
  184. display: flex;
  185. flex-direction: row;
  186. justify-content: flex-start;
  187. }
  188. .input-two {
  189. width: 600upx;
  190. height: 100upx;
  191. }
  192. .p {
  193. width: 80upx;
  194. height: 50upx;
  195. }
  196. .p2 {
  197. color: #DD524D;
  198. display: none;
  199. width: 600upx;
  200. height: 50upx;
  201. border: 1px;
  202. }
  203. </style>