drawer.nvue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <div>
  3. <scroller :style="{ height: systemInfo.windowHeight + 'px' }">
  4. <view class="drawerBg">
  5. <image style="width: 750rpx;height: 672rpx;" src="../../../static/sidebar_white.png"></image>
  6. </view>
  7. <view class="blank-space"></view>
  8. <view class="flex justify-center align-center ">
  9. <view style="width: 146rpx;height: 146rpx; border-radius: 45px;">
  10. <image class="avatar-img bg-black" mode="aspectFit" :src="avatarUrl">
  11. </image>
  12. </view>
  13. <view class="flex flex-direction-row align-center margin-12px " @tap="onNavEditInfoPage">
  14. <text class="text-22px text-bold">{{userName}}
  15. </text>
  16. <image style="width: 34rpx;height: 34rpx; margin-left: 22rpx;" src="/static/sideEdit.png"></image>
  17. </view>
  18. </view>
  19. <view class="flex justify-center align-center position-relative" style="height: 256rpx;">
  20. <view class="pos-top-center ">
  21. <image class="bg-days" src="../../../static/bg-days.png"></image>
  22. </view>
  23. <text class="text-12px text-right text-white bg-days-text">{{days}}天</text>
  24. <text
  25. class="text-more text-13px text-gray text-cut text-lines1 margin-12px ">{{signature!=='null'?signature:'111111111'}}</text>
  26. </view>
  27. <list class="list-wrapper">
  28. <cell v-for="item in lists" :key="item.id">
  29. <div class="text-wrapper" @click="clickitem(item.id,item.page_type)">
  30. <view class="flex flex-direction-row align-center">
  31. <image style="width: 34rpx;height:34rpx; margin-right: 36rpx;" :src="item.url"></image>
  32. <text class="text-15px text-medium">{{item.name}}</text>
  33. </view>
  34. <text class="icon">&#xe583;</text>
  35. </div>
  36. </cell>
  37. </list>
  38. <div class="flex justify-center align-center" style="margin-top: 140rpx; margin-bottom: 140rpx">
  39. <div class="close-drawer" @click="onExit">
  40. <text class="text-16px" style="color: #6B6B6B;">退出登录</text>
  41. </div>
  42. </div>
  43. </scroller>
  44. </div>
  45. </template>
  46. <script>
  47. import sideBarData from '@/components/side-bar/sideBar.js';
  48. import {
  49. mapState,
  50. mapMutations
  51. } from 'vuex';
  52. export default {
  53. computed: mapState(['bCanvasShow', 'token', 'userName', 'avatarUrl', 'days', 'signature', 'weight',
  54. 'height', 'systemInfo'
  55. ]),
  56. data() {
  57. return {
  58. lists: sideBarData.getSideBarList,
  59. signature: null
  60. }
  61. },
  62. beforeCreate() {
  63. const domModule = weex.requireModule('dom')
  64. domModule.addRule('fontFace', {
  65. fontFamily: "unibtn",
  66. 'src': "url('../../../static/font/uni.ttf')"
  67. });
  68. },
  69. created() {
  70. // for (let i = 0; i < 5; i++) {
  71. // this.lists.push({
  72. // id: i,
  73. // name: 'Item' + i,
  74. // });
  75. // }
  76. },
  77. methods: {
  78. ...mapMutations(['loginUserInfo', 'onLuanchLogin', 'delectToken','showPopupById']),
  79. hideDrawer() {
  80. uni.getCurrentSubNVue().hide('auto')
  81. },
  82. clickitem(e, _pageType) {
  83. // uni.$emit('drawer-page', e);
  84. this.onNavListItem(_pageType);
  85. },
  86. // 跳转编辑信息页面
  87. onNavEditInfoPage() {
  88. uni.navigateTo({
  89. url: '../../my-page/userInfo/userInfo',
  90. success: res => {},
  91. fail: () => {},
  92. complete: () => {}
  93. });
  94. },
  95. //侧边栏对应页面跳转
  96. onNavListItem(pageType) {
  97. // console.log(pageType);
  98. if (pageType == "my") {
  99. this.onNavMyPage();
  100. return;
  101. }
  102. if(pageType == "signBoard")
  103. {
  104. this.hideDrawer();
  105. this.showPopupById({type:'signIn',item:null});
  106. return;
  107. }
  108. let url = '';
  109. switch (pageType) {
  110. case "recently":
  111. case "watchGame":
  112. url = '/pages/personal-page/list/list?type=' + pageType;
  113. break;
  114. case "ranking":
  115. url = '/pages/game-page/game-ranking/game-ranking';
  116. break;
  117. case "feedback":
  118. url = '/pages/login-page/feedback/feedback';
  119. break;
  120. case "friend":
  121. url = '/pages/friend-page/main/main';
  122. break;
  123. }
  124. uni.navigateTo({
  125. url: url,
  126. success: res => {},
  127. fail: () => {},
  128. complete: () => {}
  129. });
  130. },
  131. /**
  132. * 退出登录
  133. */
  134. onExit() {
  135. console.log("退出登录");
  136. // 清除token,退回首页
  137. this.delectToken({
  138. success: (res) => {
  139. uni.reLaunch({
  140. url: '../../login-page/login/login'
  141. })
  142. }
  143. });
  144. }
  145. }
  146. }
  147. </script>
  148. <style>
  149. .wrapper {
  150. flex-direction: column;
  151. flex: 1;
  152. text-align: center;
  153. padding: 60rpx 0rpx 0rpx 0rpx;
  154. background-color: #FFFFFF;
  155. }
  156. .drawerBg {
  157. position: absolute;
  158. top: 0;
  159. right: 0;
  160. /* bottom: 0; */
  161. left: 0;
  162. justify-content: center;
  163. align-items: center;
  164. }
  165. .blank-space {
  166. height: 150rpx;
  167. }
  168. .avatar-img {
  169. width: 146rpx;
  170. height: 146rpx;
  171. /* border: 8rpx solid rgba(255, 255, 255, 1); */
  172. border-radius: 50%;
  173. }
  174. .bg-days {
  175. width: 126rpx;
  176. height: 48rpx;
  177. }
  178. .bg-days-text {
  179. height: 48rpx;
  180. width: 110rpx;
  181. line-height: 48rpx;
  182. }
  183. .text-more {
  184. width: 200px;
  185. line-height: 13px;
  186. height: 13px;
  187. }
  188. /* 自定义导航栏的图片大小 */
  189. .png-more {
  190. width: 20px;
  191. height: 20px;
  192. }
  193. .nav-text {
  194. color: #8f8f94;
  195. /* #ifndef APP-PLUS-NVUE */
  196. margin-bottom: 40px;
  197. /* #endif */
  198. /* #ifdef APP-PLUS-NVUE */
  199. margin-bottom: 40rpx;
  200. /* #endif */
  201. }
  202. .list-wrapper {
  203. /* margin-top: 120rpx; */
  204. height: 540rpx;
  205. /* #ifdef APP-PLUS-NVUE */
  206. /* height: 500rpx; */
  207. /* #endif */
  208. /* #ifndef APP-PLUS-NVUE */
  209. /* height: 500px; */
  210. /* #endif */
  211. }
  212. .text-wrapper {
  213. justify-content: center;
  214. /* border-bottom-style: solid;
  215. border-bottom-width: 1rpx;
  216. border-bottom-color: rgba(0, 0, 0, .2); */
  217. margin-bottom: 54rpx;
  218. margin-left: 140rpx;
  219. margin-right: 98rpx;
  220. /* padding-bottom: 15rpx; */
  221. }
  222. .close-drawer {
  223. display: flex;
  224. justify-content: center;
  225. /* align-content: center; */
  226. align-items: center;
  227. background-color: #f8f8f8;
  228. width: 300rpx;
  229. padding: 15rpx;
  230. border-radius: 40rpx;
  231. border-style: solid;
  232. border-width: 1rpx;
  233. border-color: rgba(229, 229, 229, 1);
  234. }
  235. .icon {
  236. position: absolute;
  237. right: 0;
  238. color: #D1D1D1;
  239. font-family: unibtn;
  240. font-size: 30rpx;
  241. font-weight: 400;
  242. }
  243. </style>