App.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. uni.setStorageSync("user", res.data.user);
  43. uni.setStorageSync("token", res.data.token);
  44. },
  45. (err) => {
  46. console.log("登录失败", err);
  47. }
  48. );
  49. },
  50. })
  51. // #endif
  52. }
  53. }
  54. }
  55. </script>
  56. <style>
  57. /*每个页面公共css */
  58. @font-face {
  59. font-family: 'Alibaba PuHuiTi 2.0';
  60. src: url('https://test.jue-ming.com:8849/api/show?filePath=./webo/font/AlibabaPuHuiTi-2-55-Regular/AlibabaPuHuiTi-2-55-Regular.woff2') format('woff2'),
  61. url('https://test.jue-ming.com:8849/api/show?filePath=./webo/font/AlibabaPuHuiTi-2-55-Regular/AlibabaPuHuiTi-2-55-Regular.woff') format('woff'),
  62. url('https://test.jue-ming.com:8849/api/show?filePath=./webo/font/AlibabaPuHuiTi-2-55-Regular/AlibabaPuHuiTi-2-55-Regular.ttf') format('truetype');
  63. font-weight: normal;
  64. font-style: normal;
  65. font-display: swap;
  66. }
  67. @font-face {
  68. font-family: 'ZhankuKuaiLeTi';
  69. src: url('https://test.jue-ming.com:8849/api/show?filePath=./webo/font/ZhankuKuaiLeTi.ttf') format('truetype');
  70. font-weight: normal;
  71. font-style: normal;
  72. font-display: swap;
  73. }
  74. @font-face {
  75. font-family: 'YanShiXieHeiTi';
  76. src: url('https://test.jue-ming.com:8849/api/show?filePath=./webo/font/演示斜黑体.otf') format('truetype');
  77. font-weight: normal;
  78. font-style: normal;
  79. font-display: swap;
  80. }
  81. </style>