user.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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="ifForeign">
  25. <view v-if="gid">
  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. ifForeign: false,
  59. listName: [],
  60. value: null,
  61. id: null,
  62. gid: false,
  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({
  80. title: this.$t('user.title')
  81. });
  82. uni.setTabBarItem({
  83. index: 4,
  84. text: this.$t('tabs.tab5')
  85. });
  86. // uni.startPullDownRefresh();
  87. var globalUser = uni.getStorageSync("globalUser");
  88. var gid = globalUser.id;
  89. if (gid != 1) {
  90. this.gid = true;
  91. }
  92. var ifForeign = globalUser.ifForeign;
  93. if (ifForeign == 0) {
  94. this.ifForeign = true;
  95. }
  96. var token = uni.getStorageSync("token");
  97. if (token.length>1) {
  98. var name = uni.getStorageSync("name");
  99. this.name = name;
  100. var listName = uni.getStorageSync("listName");
  101. this.listName = listName;
  102. } else {
  103. uni.reLaunch({
  104. url: '../Login/Login',
  105. });
  106. }
  107. if (listName != '' && listName != null) {
  108. var adminId = listName[0].adminId;
  109. if (adminId != '1' && adminId != null) {
  110. this.show = true;
  111. }
  112. }
  113. var newparm = uni.getStorageSync("newparm");
  114. if (newparm.toString().length > 1) {
  115. if (newparm.avatarUrl.length > 1) {
  116. this.avatarUrl = newparm.avatarUrl;
  117. this.weixinUp = true;
  118. this.weixinDown = false;
  119. }
  120. }
  121. },
  122. onLoad() {
  123. },
  124. methods: {
  125. open() {
  126. uni.navigateTo({
  127. url: 'promoCode',
  128. });
  129. },
  130. updataName() {
  131. uni.navigateTo({
  132. url: 'equipmentName',
  133. });
  134. },
  135. trant() {
  136. uni.reLaunch({
  137. url: '../WeixinSwicth/WeixinSwicth',
  138. });
  139. },
  140. bindLogout() {
  141. //清楚缓存
  142. uni.clearStorageSync();
  143. uni.reLaunch({
  144. url: '/pages/Login/Login',
  145. });
  146. },
  147. setStyle() {
  148. this.showOrNo = "block";
  149. },
  150. setStyle2() {
  151. this.showOrNo = "none";
  152. },
  153. }
  154. }
  155. </script>
  156. <style>
  157. .page-fill {
  158. width: 100%;
  159. height: 100%;
  160. background: #FFFFFF;
  161. padding-bottom: 100upx;
  162. }
  163. .headimg {
  164. height: 120upx;
  165. background: #206DC3;
  166. width: 750upx;
  167. }
  168. .header {
  169. height: 160upx;
  170. width: 690upx;
  171. background: #FFFFFF;
  172. margin: auto;
  173. padding-top: 50upx;
  174. box-shadow: 0upx -1upx 20upx #D3D3D3;
  175. border-radius: 15upx;
  176. transform: translateY(-90upx);
  177. display: flex;
  178. flex-direction: row;
  179. justify-content: flex-start;
  180. }
  181. .face {
  182. width: 116upx;
  183. height: 116upx;
  184. padding-left: 30upx;
  185. border-radius: 50%;
  186. flex-shrink: 0;
  187. }
  188. .face2 {
  189. width: 120upx;
  190. height: 120upx;
  191. padding-right: 0upx;
  192. border-radius: 50%;
  193. flex-shrink: 0;
  194. }
  195. .face3 {
  196. width: 120upx;
  197. height: 120upx;
  198. padding-left: 30upx;
  199. padding-right: 0upx;
  200. border-radius: 50%;
  201. flex-shrink: 0;
  202. }
  203. .info-wapper {
  204. width: 50%;
  205. margin-left: 30upx;
  206. display: flex;
  207. flex-direction: column;
  208. }
  209. .nickname {
  210. color: #363D44;
  211. font-size: 16px;
  212. font-weight: 600;
  213. padding: 30upx 0upx 0upx 0upx;
  214. font-family: "PingFang-SC-Bold";
  215. }
  216. .set-wapper {
  217. display: flex;
  218. flex-direction: row;
  219. justify-content: flex-end;
  220. width: 15%;
  221. }
  222. .tuichu {
  223. width: 100upx;
  224. height: 64upx;
  225. padding-top: 30upx;
  226. text-align: center;
  227. margin: 0 auto;
  228. }
  229. .settings {
  230. width: 100upx;
  231. height: 64upx;
  232. border-radius: 10upx;
  233. background: #D6101F;
  234. text-align: center;
  235. margin: 0 auto;
  236. }
  237. .p3 {
  238. /* #ifdef H5 */
  239. top: -13%;
  240. /* #endif */
  241. font-size: 32upx;
  242. color: #FFFFFF;
  243. font-weight: bold;
  244. width: 100upx;
  245. height: 64upx;
  246. /* #ifndef H5 */
  247. padding-top: 3upx;
  248. /* #endif */
  249. position: absolute;
  250. /* 水平居中 */
  251. left: 50%;
  252. -webkit-transform: translateX(-50%);
  253. transform: translateX(-50%);
  254. }
  255. .centerY {
  256. position: absolute;
  257. top: 50%;
  258. -webkit-transform: translateY(-50%);
  259. transform: translateY(-50%);
  260. }
  261. .button2 {
  262. padding-right: 60upx;
  263. padding-top: 2upx;
  264. }
  265. .button {
  266. width: 80upx;
  267. height: 60upx;
  268. border-radius: 10upx;
  269. }
  270. .p {
  271. /* #ifdef H5 */
  272. top: -13%;
  273. /* #endif */
  274. width: 80upx;
  275. height: 60upx;
  276. font-size: 30upx;
  277. /* #ifndef H5 */
  278. padding-top: 3upx;
  279. /* #endif */
  280. position: absolute;
  281. /* 水平居中 */
  282. left: 50%;
  283. -webkit-transform: translateX(-50%);
  284. transform: translateX(-50%);
  285. }
  286. .xiugai2 {
  287. width: 100%;
  288. height: 80upx;
  289. font-family: "PingFang-SC-Bold";
  290. font-weight: bold;
  291. margin: auto;
  292. font-size: 50upx;
  293. color: #363D44;
  294. position: fixed;
  295. bottom: 0;
  296. }
  297. .xiugai3 {
  298. height: 80upx;
  299. font-family: "PingFang-SC-Bold";
  300. font-weight: bold;
  301. margin: auto;
  302. font-size: 40upx;
  303. color: #363D44;
  304. }
  305. .body {
  306. background-color: #FFFFFF;
  307. padding: 10upx 10upx 10upx 10upx;
  308. display: flex;
  309. flex-direction: row;
  310. justify-content: flex-start;
  311. }
  312. </style>