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.
 
 
 
 
 
 

304 lines
4.3 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. uni-app{
  50. }
  51. body {
  52. max-width: 1024px;
  53. min-height: 100%;
  54. margin: 0 auto;
  55. background-color: #eee;
  56. /* background-image: linear-gradient(to right, #fa709a 0%, #fee140 100%)!important */
  57. }
  58. uni-modal {
  59. .uni-modal__hd {
  60. padding: 20px !important;
  61. }
  62. }
  63. uni-page{
  64. min-height: 100%;
  65. background-color: white;
  66. }
  67. .uni-tabbar {
  68. max-width: 1024px !important;
  69. left: 0;
  70. right: 0;
  71. margin: auto;
  72. }
  73. /* project id 1729059 */
  74. @font-face {
  75. font-family: 'unishop';
  76. font-weight: normal;
  77. font-style: normal;
  78. src: url('https://at.alicdn.com/t/font_1729059_llr8d2acjac.ttf') format('truetype');
  79. }
  80. .ProgressBar {
  81. font-size: 12rpx;
  82. }
  83. .yticon {
  84. font-family: "unishop" !important;
  85. font-size: 16px;
  86. font-style: normal;
  87. -webkit-font-smoothing: antialiased;
  88. -moz-osx-font-smoothing: grayscale;
  89. }
  90. .icon-shouhuodizhi:before {
  91. content: "\e6b5";
  92. }
  93. .icon-xuanzhong:before {
  94. content: "\e64c";
  95. }
  96. .icon-fenlei:before {
  97. content: "\e71b";
  98. }
  99. .icon-bianji:before {
  100. content: "\e77d";
  101. }
  102. .icon-jiahao:before {
  103. content: "\e616";
  104. }
  105. .icon-jianhao:before {
  106. content: "\e617";
  107. }
  108. .icon-wxpay:before {
  109. content: "\e607";
  110. }
  111. .icon-pay:before {
  112. content: "\e624";
  113. }
  114. .icon-alipay:before {
  115. content: "\e60b";
  116. }
  117. .icon-you:before {
  118. content: "\e65f";
  119. }
  120. .icon-huoche:before {
  121. content: "\e6f0";
  122. }
  123. .icon-shoucang:before {
  124. content: "\e60a";
  125. }
  126. .icon-gouwuche:before {
  127. content: "\e60e";
  128. }
  129. .icon-fangzi:before {
  130. content: "\e657";
  131. }
  132. .icon-daifukuan:before {
  133. content: "\e601";
  134. }
  135. .icon-daifahuo:before {
  136. content: "\e704";
  137. }
  138. .icon-daishouhuo:before {
  139. content: "\e62f";
  140. }
  141. .icon-pingjia:before {
  142. content: "\e61d";
  143. }
  144. .icon-shouhou:before {
  145. content: "\e610";
  146. }
  147. .icon-shoucang-setting:before {
  148. content: "\e612";
  149. }
  150. .icon-setting:before {
  151. content: "\e62b";
  152. }
  153. .icon-dizhi:before {
  154. content: "\e67c";
  155. }
  156. .icon-lajitong:before {
  157. content: "\e615";
  158. }
  159. view,
  160. scroll-view,
  161. swiper,
  162. swiper-item,
  163. cover-view,
  164. cover-image,
  165. icon,
  166. text,
  167. rich-text,
  168. progress,
  169. button,
  170. checkbox,
  171. form,
  172. input,
  173. label,
  174. radio,
  175. slider,
  176. switch,
  177. textarea,
  178. navigator,
  179. audio,
  180. camera,
  181. image,
  182. video {
  183. box-sizing: border-box;
  184. }
  185. /* 骨架屏替代方案 */
  186. .Skeleton {
  187. background: #f3f3f3;
  188. padding: 20upx 0;
  189. border-radius: 8upx;
  190. }
  191. /* 图片载入替代方案 */
  192. .image-wrapper {
  193. font-size: 0;
  194. background: #f3f3f3;
  195. border-radius: 4px;
  196. image {
  197. width: 100%;
  198. height: 100%;
  199. transition: .6s;
  200. opacity: 0;
  201. &.loaded {
  202. opacity: 1;
  203. }
  204. }
  205. }
  206. .clamp {
  207. overflow: hidden;
  208. text-overflow: ellipsis;
  209. white-space: nowrap;
  210. display: block;
  211. }
  212. .common-hover {
  213. background: #f5f5f5;
  214. }
  215. /*边框*/
  216. .b-b:after,
  217. .b-t:after {
  218. position: absolute;
  219. z-index: 3;
  220. left: 0;
  221. right: 0;
  222. height: 0;
  223. content: '';
  224. transform: scaleY(.5);
  225. border-bottom: 1px solid $border-color-base;
  226. }
  227. .b-b:after {
  228. bottom: 0;
  229. }
  230. .b-t:after {
  231. top: 0;
  232. }
  233. /* button样式改写 */
  234. uni-button,
  235. button {
  236. height: 80upx;
  237. line-height: 80upx;
  238. font-size: $font-lg + 2upx;
  239. font-weight: normal;
  240. &.no-border:before,
  241. &.no-border:after {
  242. border: 0;
  243. }
  244. }
  245. uni-button[type=default],
  246. button[type=default] {
  247. color: $font-color-dark;
  248. }
  249. /* input 样式 */
  250. .input-placeholder {
  251. color: #999999;
  252. }
  253. .placeholder {
  254. color: #999999;
  255. }
  256. </style>