user.vue 4.3 KB

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