四零语境前端代码仓库
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.

83 lines
1.6 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. <script>
  2. export default {
  3. methods: {
  4. // 提前获取二维码并保存起来
  5. async getQrcode() {
  6. uni.getImageInfo({
  7. src: `${this.$config.baseURL}/promotion/qrCode?token=${uni.getStorageSync('token')}`
  8. // #ifdef H5
  9. + '&type=official'
  10. // #endif
  11. ,
  12. success: (image) => {
  13. this.Qrcode = image.path;
  14. this.$store.commit('setQrcode', this.Qrcode)
  15. },
  16. fail: (err) => {
  17. console.error('获取二维码失败:', err);
  18. }
  19. });
  20. }
  21. },
  22. onLaunch() {
  23. // 提前获取二维码
  24. this.getQrcode()
  25. },
  26. async onShow() {
  27. // if(!uni.getStorageSync('token')){
  28. // uni.redirectTo({
  29. // url: '/subPages/login/login',
  30. // })
  31. // }
  32. await this.$store.dispatch('initData')
  33. console.log('配置数据初始化完成')
  34. if(uni.getStorageSync('token')){
  35. this.getUserInfo()
  36. }
  37. },
  38. onHide: function() {
  39. console.log('App Hide')
  40. },
  41. async getUserInfo() {
  42. const res = await this.$api.login.getUserInfo();
  43. if (res.code === 200) {
  44. this.$store.dispatch('updateUserInfo', this.userInfo)
  45. }
  46. },
  47. }
  48. </script>
  49. <style lang="scss">
  50. // @import '@/uni_modules/uv-ui-tools/index.scss';
  51. /* 富文本全局样式 - rich-text组件的class样式必须写在全局中 */
  52. h1, h2, h3, h4, h5, h6 {
  53. font-weight: bold;
  54. margin: 10px 0;
  55. line-height: 1.4;
  56. }
  57. h2 {
  58. font-size: 20px;
  59. color: #333;
  60. }
  61. p {
  62. margin: 8px 0;
  63. line-height: 1.6;
  64. color: #666;
  65. }
  66. strong {
  67. font-weight: bold;
  68. color: #333;
  69. }
  70. /* 首行缩进样式 */
  71. .text-indent {
  72. text-indent: 2em;
  73. }
  74. </style>