user.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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 class="">
  23. <uni-list>
  24. <view v-if="Aid!='1'">
  25. <uni-list-item title="优惠码" @click="open()" />
  26. </view>
  27. <view v-if="show">
  28. <uni-list-item title="修改设备名称" @click="updataName()" />
  29. </view>
  30. </uni-list>
  31. </view>
  32. <view class="xiugai2">
  33. <button type="primary" @click="trant()" class="xiugai2">
  34. <p class="xiugai3">解除微信绑定</p>
  35. </button>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import uniList from '@/components/uni-list/uni-list.vue'
  41. import uniListItem from '@/components/uni-list-item/uni-list-item.vue'
  42. import {
  43. mapState,
  44. mapActions,
  45. mapMutations
  46. } from 'vuex'
  47. export default {
  48. components: {
  49. uniList,
  50. uniListItem,
  51. },
  52. data() {
  53. return {
  54. name: '',
  55. show: false,
  56. listName: [],
  57. value: null,
  58. id: null,
  59. Aid: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 globalUser = uni.getStorageSync("globalUser");
  78. this.Aid = globalUser.id;
  79. var me = this;
  80. var name = uni.getStorageSync("name");
  81. me.name = name;
  82. var listName = uni.getStorageSync("listName");
  83. me.listName = listName;
  84. if (listName != '' && listName != null) {
  85. var adminId = listName[0].adminId;
  86. if (adminId != '1' && adminId != null) {
  87. me.show = true;
  88. }
  89. }
  90. var newparm = uni.getStorageSync("newparm");
  91. if (newparm.toString().length > 1) {
  92. if (newparm.avatarUrl.length > 1) {
  93. this.avatarUrl = newparm.avatarUrl;
  94. this.weixinUp = true;
  95. this.weixinDown = false;
  96. }
  97. }
  98. },
  99. onLoad() {
  100. },
  101. methods: {
  102. open() {
  103. uni.navigateTo({
  104. url: 'promoCode',
  105. });
  106. },
  107. updataName() {
  108. uni.navigateTo({
  109. url: 'equipmentName',
  110. });
  111. },
  112. trant() {
  113. uni.reLaunch({
  114. url: '../WeixinSwicth/WeixinSwicth',
  115. });
  116. },
  117. bindLogout() {
  118. //清楚缓存
  119. uni.clearStorageSync();
  120. uni.reLaunch({
  121. url: '/pages/Login/Login',
  122. });
  123. },
  124. setStyle() {
  125. this.showOrNo = "block";
  126. },
  127. setStyle2() {
  128. this.showOrNo = "none";
  129. },
  130. }
  131. }
  132. </script>
  133. <style>
  134. .page-fill {
  135. width: 100%;
  136. height: 100%;
  137. background: #FFFFFF;
  138. padding-bottom: 100upx;
  139. }
  140. .headimg {
  141. height: 120upx;
  142. background: #206DC3;
  143. width: 750upx;
  144. }
  145. .header {
  146. height: 160upx;
  147. width: 690upx;
  148. background: #FFFFFF;
  149. margin: auto;
  150. padding-top: 50upx;
  151. box-shadow: 0upx -1upx 20upx #D3D3D3;
  152. border-radius: 15upx;
  153. transform: translateY(-90upx);
  154. display: flex;
  155. flex-direction: row;
  156. justify-content: flex-start;
  157. }
  158. .face {
  159. width: 116upx;
  160. height: 116upx;
  161. padding-left: 30upx;
  162. border-radius: 50%;
  163. flex-shrink: 0;
  164. }
  165. .face2 {
  166. width: 120upx;
  167. height: 120upx;
  168. padding-right: 0upx;
  169. border-radius: 50%;
  170. flex-shrink: 0;
  171. }
  172. .face3 {
  173. width: 120upx;
  174. height: 120upx;
  175. padding-left: 30upx;
  176. padding-right: 0upx;
  177. border-radius: 50%;
  178. flex-shrink: 0;
  179. }
  180. .info-wapper {
  181. width: 50%;
  182. margin-left: 30upx;
  183. display: flex;
  184. flex-direction: column;
  185. }
  186. .nickname {
  187. color: #363D44;
  188. font-size: 16px;
  189. font-weight: 600;
  190. padding: 30upx 0upx 0upx 0upx;
  191. font-family: "PingFang-SC-Bold";
  192. }
  193. .set-wapper {
  194. display: flex;
  195. flex-direction: row;
  196. justify-content: flex-end;
  197. width: 15%;
  198. }
  199. .tuichu {
  200. width: 100upx;
  201. height: 64upx;
  202. padding-top: 30upx;
  203. text-align: center;
  204. margin: 0 auto;
  205. }
  206. .settings {
  207. width: 100upx;
  208. height: 64upx;
  209. border-radius: 10upx;
  210. background: #D6101F;
  211. text-align: center;
  212. margin: 0 auto;
  213. }
  214. .p3 {
  215. /* #ifdef H5 */
  216. top: -13%;
  217. /* #endif */
  218. font-size: 32upx;
  219. color: #FFFFFF;
  220. font-weight: bold;
  221. width: 100upx;
  222. height: 64upx;
  223. /* #ifndef H5 */
  224. padding-top: 3upx;
  225. /* #endif */
  226. position: absolute;
  227. /* 水平居中 */
  228. left: 50%;
  229. -webkit-transform: translateX(-50%);
  230. transform: translateX(-50%);
  231. }
  232. .centerY {
  233. position: absolute;
  234. top: 50%;
  235. -webkit-transform: translateY(-50%);
  236. transform: translateY(-50%);
  237. }
  238. .button2 {
  239. padding-right: 60upx;
  240. padding-top: 2upx;
  241. }
  242. .button {
  243. width: 80upx;
  244. height: 60upx;
  245. border-radius: 10upx;
  246. }
  247. .p {
  248. /* #ifdef H5 */
  249. top: -13%;
  250. /* #endif */
  251. width: 80upx;
  252. height: 60upx;
  253. font-size: 30upx;
  254. /* #ifndef H5 */
  255. padding-top: 3upx;
  256. /* #endif */
  257. position: absolute;
  258. /* 水平居中 */
  259. left: 50%;
  260. -webkit-transform: translateX(-50%);
  261. transform: translateX(-50%);
  262. }
  263. .xiugai2 {
  264. width: 100%;
  265. height: 80upx;
  266. font-family: "PingFang-SC-Bold";
  267. font-weight: bold;
  268. margin: auto;
  269. font-size: 50upx;
  270. color: #363D44;
  271. position: fixed;
  272. bottom: 0;
  273. }
  274. .xiugai3 {
  275. height: 80upx;
  276. font-family: "PingFang-SC-Bold";
  277. font-weight: bold;
  278. margin: auto;
  279. font-size: 40upx;
  280. color: #363D44;
  281. }
  282. .body {
  283. background-color: #FFFFFF;
  284. padding: 10upx 10upx 10upx 10upx;
  285. display: flex;
  286. flex-direction: row;
  287. justify-content: flex-start;
  288. }
  289. </style>