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.
 
 
 
 
 
 

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