user.vue 4.4 KB

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