user.vue 5.9 KB

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