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.
 
 
 
 
 
 

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