App.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <script>
  2. export default {
  3. onLaunch: function() {
  4. this.createUser();
  5. },
  6. onShow: function() {
  7. console.log('App Show')
  8. },
  9. onHide: function() {
  10. console.log('App Hide')
  11. },
  12. methods: {
  13. //查询用户信息
  14. createUser() {
  15. let _this = this;
  16. // #ifdef H5
  17. this.$request
  18. .get({
  19. url: 'system/temporaryUser',
  20. loadingTip: "加载中..."
  21. })
  22. .then((res) => {
  23. uni.setStorageSync("user", res.data.user);
  24. uni.setStorageSync("token", res.data.token);
  25. });
  26. // #endif
  27. // #ifdef MP-TOUTIAO
  28. tt.login({
  29. success(res) {
  30. let para = {
  31. code: res.code,
  32. petName: '',
  33. modelPhone: '',
  34. };
  35. _this.$request
  36. .post({
  37. url: 'api/douyin/code2Session',
  38. data: para
  39. })
  40. .then(
  41. (res) => {
  42. console.log(res);
  43. uni.setStorageSync("user", res.data.user);
  44. uni.setStorageSync("token", res.data.token);
  45. uni.setStorageSync("openId", res.data.openId);
  46. },
  47. (err) => {
  48. console.log("登录失败", err);
  49. }
  50. );
  51. },
  52. })
  53. // #endif
  54. }
  55. }
  56. }
  57. </script>
  58. <style>
  59. /*每个页面公共css */
  60. @font-face {
  61. font-family: 'Alibaba PuHuiTi 2.0';
  62. src: url('https://test.jue-ming.com:8849/api/show?filePath=./webo/font/AlibabaPuHuiTi-2-55-Regular/AlibabaPuHuiTi-2-55-Regular.woff2') format('woff2'),
  63. url('https://test.jue-ming.com:8849/api/show?filePath=./webo/font/AlibabaPuHuiTi-2-55-Regular/AlibabaPuHuiTi-2-55-Regular.woff') format('woff'),
  64. url('https://test.jue-ming.com:8849/api/show?filePath=./webo/font/AlibabaPuHuiTi-2-55-Regular/AlibabaPuHuiTi-2-55-Regular.ttf') format('truetype');
  65. font-weight: normal;
  66. font-style: normal;
  67. font-display: swap;
  68. }
  69. @font-face {
  70. font-family: 'ZhankuKuaiLeTi';
  71. src: url('https://test.jue-ming.com:8849/api/show?filePath=./webo/font/ZhankuKuaiLeTi.ttf') format('truetype');
  72. font-weight: normal;
  73. font-style: normal;
  74. font-display: swap;
  75. }
  76. @font-face {
  77. font-family: 'YanShiXieHeiTi';
  78. src: url('https://test.jue-ming.com:8849/api/show?filePath=./webo/font/演示斜黑体.otf') format('truetype');
  79. font-weight: normal;
  80. font-style: normal;
  81. font-display: swap;
  82. }
  83. </style>