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