user.vue 4.4 KB

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