user.vue 7.1 KB

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