user.vue 6.9 KB

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