user.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  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.avatarUrl.length>1) {
  90. this.avatarUrl = newparm.avatarUrl;
  91. this.weixinUp = true;
  92. this.weixinDown = false;
  93. }
  94. },
  95. onLoad() {
  96. },
  97. methods: {
  98. trant(){
  99. uni.reLaunch({
  100. url: '../WeixinSwicth/WeixinSwicth',
  101. });
  102. },
  103. bindLogout() {
  104. //清楚缓存
  105. uni.clearStorageSync();
  106. uni.reLaunch({
  107. url: '/pages/Login/Login',
  108. });
  109. },
  110. setStyle() {
  111. this.showOrNo = "block";
  112. },
  113. setStyle2() {
  114. this.showOrNo = "none";
  115. },
  116. getValue: function(event) {
  117. // 绕过v-model 获取input输入框的值
  118. var value = event.target.value;
  119. var id = event.target.id;
  120. this.value = value;
  121. this.id = id;
  122. this.parm.name = value;
  123. this.parm.id = id;
  124. },
  125. ...mapActions('chart', ['updata']),
  126. updata1() {
  127. if (this.parm.id != null) {
  128. this.updata(this.parm)
  129. .then(res => {
  130. uni.showModal({
  131. title: '提示',
  132. content: '名称:' + this.parm.name + res.message,
  133. });
  134. }, _ => void uni.stopPullDownRefresh());
  135. }
  136. }
  137. }
  138. }
  139. </script>
  140. <style>
  141. .page-fill {
  142. width: 100%;
  143. height: 100%;
  144. background: #FFFFFF;
  145. padding-bottom: 100upx;
  146. }
  147. .headimg {
  148. height: 120upx;
  149. background: #206DC3;
  150. width: 750upx;
  151. }
  152. .header {
  153. height: 160upx;
  154. width: 690upx;
  155. background: #FFFFFF;
  156. margin: auto;
  157. padding-top: 50upx;
  158. box-shadow: 0upx -1upx 20upx #D3D3D3;
  159. border-radius: 15upx;
  160. transform: translateY(-90upx);
  161. display: flex;
  162. flex-direction: row;
  163. justify-content: flex-start;
  164. }
  165. .face {
  166. width: 116upx;
  167. height: 116upx;
  168. padding-left: 30upx;
  169. border-radius: 50%;
  170. flex-shrink: 0;
  171. }
  172. .face2 {
  173. /* border-left: 10upx; */
  174. width: 120upx;
  175. height: 120upx;
  176. /* padding-left: 30upx; */
  177. padding-right: 0upx;
  178. border-radius: 50%;
  179. flex-shrink: 0;
  180. }
  181. .face3{
  182. /* border-left: 10upx; */
  183. width: 120upx;
  184. height: 120upx;
  185. padding-left: 30upx;
  186. padding-right: 0upx;
  187. border-radius: 50%;
  188. flex-shrink: 0;
  189. }
  190. .info-wapper {
  191. width: 50%;
  192. margin-left: 30upx;
  193. display: flex;
  194. flex-direction: column;
  195. }
  196. .nickname {
  197. color: #363D44;
  198. font-size: 16px;
  199. font-weight: 600;
  200. padding: 30upx 0upx 0upx 0upx;
  201. font-family: "PingFang-SC-Bold";
  202. }
  203. .set-wapper {
  204. display: flex;
  205. flex-direction: row;
  206. justify-content: flex-end;
  207. width: 15%;
  208. }
  209. .tuichu {
  210. width: 100upx;
  211. height: 64upx;
  212. padding-top: 30upx;
  213. /* padding-right: 30upx; */
  214. text-align: center;
  215. margin: 0 auto;
  216. }
  217. .settings {
  218. width: 100upx;
  219. height: 64upx;
  220. border-radius: 10upx;
  221. background: #D6101F;
  222. /* padding-right: 50upx; */
  223. /* padding-top: 5upx; */
  224. text-align: center;
  225. margin: 0 auto;
  226. }
  227. .p3 {
  228. /* #ifdef H5 */
  229. top: -13%;
  230. /* #endif */
  231. font-size: 32upx;
  232. color: #FFFFFF;
  233. font-weight: bold;
  234. width: 100upx;
  235. height: 64upx;
  236. /* #ifndef H5 */
  237. padding-top: 3upx;
  238. /* #endif */
  239. position: absolute;
  240. /* 水平居中 */
  241. left: 50%;
  242. -webkit-transform: translateX(-50%);
  243. transform: translateX(-50%);
  244. }
  245. .centerY {
  246. position: absolute;
  247. top: 50%;
  248. -webkit-transform: translateY(-50%);
  249. transform: translateY(-50%);
  250. }
  251. .button2 {
  252. padding-right: 60upx;
  253. padding-top: 2upx;
  254. }
  255. .button {
  256. /* padding: 5upx 10upx 10upx 0upx; */
  257. width: 80upx;
  258. height: 60upx;
  259. border-radius: 10upx;
  260. }
  261. .p {
  262. /* #ifdef H5 */
  263. top: -13%;
  264. /* #endif */
  265. width: 80upx;
  266. height: 60upx;
  267. font-size: 30upx;
  268. /* #ifndef H5 */
  269. padding-top: 3upx;
  270. /* #endif */
  271. position: absolute;
  272. /* 水平居中 */
  273. left: 50%;
  274. -webkit-transform: translateX(-50%);
  275. transform: translateX(-50%);
  276. }
  277. .input {
  278. /* padding: 10upx 20upx 10upx 0upx; */
  279. padding-left: 20upx;
  280. padding-top: 10upx;
  281. background-color: #FFFFFF;
  282. width: 500upx;
  283. height: 50upx;
  284. box-shadow: 0upx 0upx 20upx #D3D3D3;
  285. border-radius: 5upx;
  286. }
  287. .xiugai {
  288. width: 92%;
  289. border-left: 20upx;
  290. border-left: 10upx solid #206DC3;
  291. padding-left: 10upx;
  292. height: 38upx;
  293. padding-bottom: 20upx;
  294. font-family: "PingFang-SC-Bold";
  295. font-weight: bold;
  296. margin: auto;
  297. font-size: 32upx;
  298. color: #363D44;
  299. }
  300. .xiugai2 {
  301. width: 100%;
  302. height: 80upx;
  303. font-family: "PingFang-SC-Bold";
  304. font-weight: bold;
  305. margin: auto;
  306. font-size: 50upx;
  307. color: #363D44;
  308. position:fixed;
  309. bottom:0;
  310. }
  311. .xiugai3 {
  312. height: 80upx;
  313. font-family: "PingFang-SC-Bold";
  314. font-weight: bold;
  315. margin: auto;
  316. font-size: 40upx;
  317. color: #363D44;
  318. }
  319. .body {
  320. background-color: #FFFFFF;
  321. padding: 10upx 10upx 10upx 10upx;
  322. display: flex;
  323. flex-direction: row;
  324. justify-content: flex-start;
  325. }
  326. .input-two {
  327. width: 600upx;
  328. height: 100upx;
  329. padding-left: 30upx;
  330. }
  331. .p2 {
  332. color: #DD524D;
  333. display: none;
  334. width: 600upx;
  335. height: 50upx;
  336. border: 1px;
  337. }
  338. </style>