user.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <view class="page-fill">
  3. <view class="headimg"></view>
  4. <view class="header">
  5. <view v-if="weixinUp" class="face3">
  6. <image :src="avatarUrl" class="face2"></image>
  7. </view>
  8. <view v-if="weixinDown">
  9. <image src="../../static/img/userimg.png" class="face"></image>
  10. </view>
  11. <view class="info-wapper">
  12. <view class="nickname">
  13. {{name}}
  14. </view>
  15. </view>
  16. <view class="tuichu">
  17. <button @tap="bindLogout" class="settings">
  18. <p class="p3">退出</p>
  19. </button>
  20. </view>
  21. </view>
  22. <view v-if="show">
  23. <view class="xiugai">
  24. 修改设备名称
  25. </view>
  26. <view v-for="(list,index) in listName" :key="index" class="body">
  27. <view class="input-two">
  28. <input :id=list.id type="text" class="input" @focus="setStyle()" @blur="setStyle2()" :value=list.name @input="getValue" />
  29. <p id="p2" class="p2" :style="{display:showOrNo}">如:xx广场301机</p>
  30. </view>
  31. <view class="button2">
  32. <button type="primary" @click="updata1()" class="button">
  33. <p class="p">更改</p>
  34. </button>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="xiugai2">
  39. <button type="primary" @click="trant()" class="xiugai2">
  40. <p class="xiugai3">解除微信绑定</p>
  41. </button>
  42. <!-- <font @click="trant()">解除微信绑定</font> -->
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. import {
  48. mapState,
  49. mapActions,
  50. mapMutations
  51. } from 'vuex'
  52. export default {
  53. data() {
  54. return {
  55. name: '',
  56. show: false,
  57. listName: [],
  58. value: null,
  59. id: null,
  60. parm: {
  61. name: null,
  62. id: null
  63. },
  64. showOrNo: null,
  65. avatarUrl: null,
  66. weixinUp: false,
  67. weixinDown: true
  68. };
  69. },
  70. onPullDownRefresh() {
  71. setTimeout(function() {
  72. uni.stopPullDownRefresh();
  73. }, 800);
  74. },
  75. onShow() {
  76. // uni.startPullDownRefresh();
  77. var me = this;
  78. var name = uni.getStorageSync("name");
  79. me.name = name;
  80. var listName = uni.getStorageSync("listName");
  81. me.listName = listName;
  82. if (listName != '' && listName != null) {
  83. var adminId = listName[0].adminId;
  84. if (adminId != '1' && adminId != null) {
  85. me.show = true;
  86. }
  87. }
  88. var newparm = uni.getStorageSync("newparm");
  89. if (newparm.toString().length>1) {
  90. if (newparm.avatarUrl.length > 1) {
  91. this.avatarUrl = newparm.avatarUrl;
  92. this.weixinUp = true;
  93. this.weixinDown = false;
  94. }
  95. }
  96. },
  97. onLoad() {
  98. },
  99. methods: {
  100. trant() {
  101. uni.reLaunch({
  102. url: '../WeixinSwicth/WeixinSwicth',
  103. });
  104. },
  105. bindLogout() {
  106. //清楚缓存
  107. uni.clearStorageSync();
  108. uni.reLaunch({
  109. url: '/pages/Login/Login',
  110. });
  111. },
  112. setStyle() {
  113. this.showOrNo = "block";
  114. },
  115. setStyle2() {
  116. this.showOrNo = "none";
  117. },
  118. getValue: function(event) {
  119. // 绕过v-model 获取input输入框的值
  120. var value = event.target.value;
  121. var id = event.target.id;
  122. this.value = value;
  123. this.id = id;
  124. this.parm.name = value;
  125. this.parm.id = id;
  126. },
  127. ...mapActions('chart', ['updata']),
  128. updata1() {
  129. if (this.parm.id != null) {
  130. this.updata(this.parm)
  131. .then(res => {
  132. uni.showModal({
  133. title: '提示',
  134. content: '名称:' + this.parm.name + res.message,
  135. });
  136. }, _ => void uni.stopPullDownRefresh());
  137. }
  138. }
  139. }
  140. }
  141. </script>
  142. <style>
  143. .page-fill {
  144. width: 100%;
  145. height: 100%;
  146. background: #FFFFFF;
  147. padding-bottom: 100upx;
  148. }
  149. .headimg {
  150. height: 120upx;
  151. background: #206DC3;
  152. width: 750upx;
  153. }
  154. .header {
  155. height: 160upx;
  156. width: 690upx;
  157. background: #FFFFFF;
  158. margin: auto;
  159. padding-top: 50upx;
  160. box-shadow: 0upx -1upx 20upx #D3D3D3;
  161. border-radius: 15upx;
  162. transform: translateY(-90upx);
  163. display: flex;
  164. flex-direction: row;
  165. justify-content: flex-start;
  166. }
  167. .face {
  168. width: 116upx;
  169. height: 116upx;
  170. padding-left: 30upx;
  171. border-radius: 50%;
  172. flex-shrink: 0;
  173. }
  174. .face2 {
  175. /* border-left: 10upx; */
  176. width: 120upx;
  177. height: 120upx;
  178. /* padding-left: 30upx; */
  179. padding-right: 0upx;
  180. border-radius: 50%;
  181. flex-shrink: 0;
  182. }
  183. .face3 {
  184. /* border-left: 10upx; */
  185. width: 120upx;
  186. height: 120upx;
  187. padding-left: 30upx;
  188. padding-right: 0upx;
  189. border-radius: 50%;
  190. flex-shrink: 0;
  191. }
  192. .info-wapper {
  193. width: 50%;
  194. margin-left: 30upx;
  195. display: flex;
  196. flex-direction: column;
  197. }
  198. .nickname {
  199. color: #363D44;
  200. font-size: 16px;
  201. font-weight: 600;
  202. padding: 30upx 0upx 0upx 0upx;
  203. font-family: "PingFang-SC-Bold";
  204. }
  205. .set-wapper {
  206. display: flex;
  207. flex-direction: row;
  208. justify-content: flex-end;
  209. width: 15%;
  210. }
  211. .tuichu {
  212. width: 100upx;
  213. height: 64upx;
  214. padding-top: 30upx;
  215. /* padding-right: 30upx; */
  216. text-align: center;
  217. margin: 0 auto;
  218. }
  219. .settings {
  220. width: 100upx;
  221. height: 64upx;
  222. border-radius: 10upx;
  223. background: #D6101F;
  224. /* padding-right: 50upx; */
  225. /* padding-top: 5upx; */
  226. text-align: center;
  227. margin: 0 auto;
  228. }
  229. .p3 {
  230. /* #ifdef H5 */
  231. top: -13%;
  232. /* #endif */
  233. font-size: 32upx;
  234. color: #FFFFFF;
  235. font-weight: bold;
  236. width: 100upx;
  237. height: 64upx;
  238. /* #ifndef H5 */
  239. padding-top: 3upx;
  240. /* #endif */
  241. position: absolute;
  242. /* 水平居中 */
  243. left: 50%;
  244. -webkit-transform: translateX(-50%);
  245. transform: translateX(-50%);
  246. }
  247. .centerY {
  248. position: absolute;
  249. top: 50%;
  250. -webkit-transform: translateY(-50%);
  251. transform: translateY(-50%);
  252. }
  253. .button2 {
  254. padding-right: 60upx;
  255. padding-top: 2upx;
  256. }
  257. .button {
  258. /* padding: 5upx 10upx 10upx 0upx; */
  259. width: 80upx;
  260. height: 60upx;
  261. border-radius: 10upx;
  262. }
  263. .p {
  264. /* #ifdef H5 */
  265. top: -13%;
  266. /* #endif */
  267. width: 80upx;
  268. height: 60upx;
  269. font-size: 30upx;
  270. /* #ifndef H5 */
  271. padding-top: 3upx;
  272. /* #endif */
  273. position: absolute;
  274. /* 水平居中 */
  275. left: 50%;
  276. -webkit-transform: translateX(-50%);
  277. transform: translateX(-50%);
  278. }
  279. .input {
  280. /* padding: 10upx 20upx 10upx 0upx; */
  281. padding-left: 20upx;
  282. padding-top: 10upx;
  283. background-color: #FFFFFF;
  284. width: 500upx;
  285. height: 50upx;
  286. box-shadow: 0upx 0upx 20upx #D3D3D3;
  287. border-radius: 5upx;
  288. }
  289. .xiugai {
  290. width: 92%;
  291. border-left: 20upx;
  292. border-left: 10upx solid #206DC3;
  293. padding-left: 10upx;
  294. height: 38upx;
  295. padding-bottom: 20upx;
  296. font-family: "PingFang-SC-Bold";
  297. font-weight: bold;
  298. margin: auto;
  299. font-size: 32upx;
  300. color: #363D44;
  301. }
  302. .xiugai2 {
  303. width: 100%;
  304. height: 80upx;
  305. font-family: "PingFang-SC-Bold";
  306. font-weight: bold;
  307. margin: auto;
  308. font-size: 50upx;
  309. color: #363D44;
  310. position: fixed;
  311. bottom: 0;
  312. }
  313. .xiugai3 {
  314. height: 80upx;
  315. font-family: "PingFang-SC-Bold";
  316. font-weight: bold;
  317. margin: auto;
  318. font-size: 40upx;
  319. color: #363D44;
  320. }
  321. .body {
  322. background-color: #FFFFFF;
  323. padding: 10upx 10upx 10upx 10upx;
  324. display: flex;
  325. flex-direction: row;
  326. justify-content: flex-start;
  327. }
  328. .input-two {
  329. width: 600upx;
  330. height: 100upx;
  331. padding-left: 30upx;
  332. }
  333. .p2 {
  334. color: #DD524D;
  335. display: none;
  336. width: 600upx;
  337. height: 50upx;
  338. border: 1px;
  339. }
  340. </style>