user.vue 5.7 KB

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