You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

300 lines
4.2 KiB

  1. <script>
  2. /**
  3. * vuex管理登陆状态,具体可以参考官方登陆模板示例
  4. */
  5. import {
  6. mapMutations,
  7. mapState
  8. } from 'vuex';
  9. export default {
  10. methods: {
  11. ...mapMutations(['login', 'logout', 'setUserInfo']),
  12. // #ifdef H5
  13. // 检查登录状态
  14. async checkLogin() {
  15. let user = uni.getStorageSync('userInfo');
  16. if (user) {
  17. this.login(user);
  18. }
  19. let result = await this.$api.request('/user/status');
  20. if (!result) {
  21. // 若没有登录则清空个人信息
  22. this.logout();
  23. }
  24. },
  25. // #endif
  26. },
  27. onLaunch: function() {
  28. // 锁定屏幕竖向
  29. // #ifdef APP-PLUS
  30. plus.screen.lockOrientation('portrait-primary');
  31. // #endif
  32. // 检查用户登录情况
  33. // #ifdef H5
  34. this.checkLogin();
  35. // #endif
  36. // #ifdef MP-WEIXIN
  37. this.$wechatMiniLogin();
  38. // #endif
  39. },
  40. onShow: function() {
  41. console.log('App Show')
  42. },
  43. onHide: function() {
  44. console.log('App Hide')
  45. },
  46. }
  47. </script>
  48. <style lang='scss'>
  49. body {
  50. max-width: 1024px;
  51. margin: 0 auto;
  52. background-image: linear-gradient(to right, #fa709a 0%, #fee140 100%)!important
  53. }
  54. uni-modal {
  55. .uni-modal__hd {
  56. padding: 20px !important;
  57. }
  58. }
  59. uni-page{
  60. min-height: 100%;
  61. background-color: white;
  62. }
  63. .uni-tabbar {
  64. max-width: 1024px !important;
  65. left: 0;
  66. right: 0;
  67. margin: auto;
  68. }
  69. /* project id 1729059 */
  70. @font-face {
  71. font-family: 'unishop';
  72. font-weight: normal;
  73. font-style: normal;
  74. src: url('https://at.alicdn.com/t/font_1729059_llr8d2acjac.ttf') format('truetype');
  75. }
  76. .ProgressBar {
  77. font-size: 12rpx;
  78. }
  79. .yticon {
  80. font-family: "unishop" !important;
  81. font-size: 16px;
  82. font-style: normal;
  83. -webkit-font-smoothing: antialiased;
  84. -moz-osx-font-smoothing: grayscale;
  85. }
  86. .icon-shouhuodizhi:before {
  87. content: "\e6b5";
  88. }
  89. .icon-xuanzhong:before {
  90. content: "\e64c";
  91. }
  92. .icon-fenlei:before {
  93. content: "\e71b";
  94. }
  95. .icon-bianji:before {
  96. content: "\e77d";
  97. }
  98. .icon-jiahao:before {
  99. content: "\e616";
  100. }
  101. .icon-jianhao:before {
  102. content: "\e617";
  103. }
  104. .icon-wxpay:before {
  105. content: "\e607";
  106. }
  107. .icon-pay:before {
  108. content: "\e624";
  109. }
  110. .icon-alipay:before {
  111. content: "\e60b";
  112. }
  113. .icon-you:before {
  114. content: "\e65f";
  115. }
  116. .icon-huoche:before {
  117. content: "\e6f0";
  118. }
  119. .icon-shoucang:before {
  120. content: "\e60a";
  121. }
  122. .icon-gouwuche:before {
  123. content: "\e60e";
  124. }
  125. .icon-fangzi:before {
  126. content: "\e657";
  127. }
  128. .icon-daifukuan:before {
  129. content: "\e601";
  130. }
  131. .icon-daifahuo:before {
  132. content: "\e704";
  133. }
  134. .icon-daishouhuo:before {
  135. content: "\e62f";
  136. }
  137. .icon-pingjia:before {
  138. content: "\e61d";
  139. }
  140. .icon-shouhou:before {
  141. content: "\e610";
  142. }
  143. .icon-shoucang-setting:before {
  144. content: "\e612";
  145. }
  146. .icon-setting:before {
  147. content: "\e62b";
  148. }
  149. .icon-dizhi:before {
  150. content: "\e67c";
  151. }
  152. .icon-lajitong:before {
  153. content: "\e615";
  154. }
  155. view,
  156. scroll-view,
  157. swiper,
  158. swiper-item,
  159. cover-view,
  160. cover-image,
  161. icon,
  162. text,
  163. rich-text,
  164. progress,
  165. button,
  166. checkbox,
  167. form,
  168. input,
  169. label,
  170. radio,
  171. slider,
  172. switch,
  173. textarea,
  174. navigator,
  175. audio,
  176. camera,
  177. image,
  178. video {
  179. box-sizing: border-box;
  180. }
  181. /* 骨架屏替代方案 */
  182. .Skeleton {
  183. background: #f3f3f3;
  184. padding: 20upx 0;
  185. border-radius: 8upx;
  186. }
  187. /* 图片载入替代方案 */
  188. .image-wrapper {
  189. font-size: 0;
  190. background: #f3f3f3;
  191. border-radius: 4px;
  192. image {
  193. width: 100%;
  194. height: 100%;
  195. transition: .6s;
  196. opacity: 0;
  197. &.loaded {
  198. opacity: 1;
  199. }
  200. }
  201. }
  202. .clamp {
  203. overflow: hidden;
  204. text-overflow: ellipsis;
  205. white-space: nowrap;
  206. display: block;
  207. }
  208. .common-hover {
  209. background: #f5f5f5;
  210. }
  211. /*边框*/
  212. .b-b:after,
  213. .b-t:after {
  214. position: absolute;
  215. z-index: 3;
  216. left: 0;
  217. right: 0;
  218. height: 0;
  219. content: '';
  220. transform: scaleY(.5);
  221. border-bottom: 1px solid $border-color-base;
  222. }
  223. .b-b:after {
  224. bottom: 0;
  225. }
  226. .b-t:after {
  227. top: 0;
  228. }
  229. /* button样式改写 */
  230. uni-button,
  231. button {
  232. height: 80upx;
  233. line-height: 80upx;
  234. font-size: $font-lg + 2upx;
  235. font-weight: normal;
  236. &.no-border:before,
  237. &.no-border:after {
  238. border: 0;
  239. }
  240. }
  241. uni-button[type=default],
  242. button[type=default] {
  243. color: $font-color-dark;
  244. }
  245. /* input 样式 */
  246. .input-placeholder {
  247. color: #999999;
  248. }
  249. .placeholder {
  250. color: #999999;
  251. }
  252. </style>