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.
 
 
 
 
 
 

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