user.vue 6.7 KB

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