App.vue 3.8 KB

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