user.vue 4.2 KB

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