user.vue 7.0 KB

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