App.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <script>
  2. import {showSuccess} from '@/util'
  3. import config from '@/config'
  4. import qcloud from 'wafer2-client-sdk'
  5. export default {
  6. async created () {
  7. let user = wx.getStorageSync('userInfo')
  8. if (!user) {
  9. qcloud.setLoginUrl(config.loginUrl)
  10. qcloud.login({
  11. success: function (userInfo) {
  12. showSuccess('登录成功')
  13. wx.setStorageSync('userInfo', userInfo)
  14. },
  15. fail: function (err) {
  16. console.log('登录失败', err)
  17. }
  18. })
  19. }
  20. // const res = await get('/weapp/demo')
  21. // console.log(123, res)
  22. // wx.request({
  23. // url:config.host+'/weapp/demo',
  24. // success:function(res){
  25. // console.log(res)
  26. // }
  27. // })
  28. console.log('小程序启动了')
  29. }
  30. }
  31. </script>
  32. <style>
  33. .text-footer{
  34. text-align: center;
  35. font-size: 12px;
  36. margin-bottom:5px;
  37. }
  38. .text-primary{
  39. color:#EA5149;
  40. }
  41. .btn{
  42. color:white;
  43. background:#EA5A49;
  44. margin-bottom: 10px;
  45. padding-left: 15px;
  46. padding-left: 15px;
  47. border-radius: 2px;
  48. font-size: 16px;
  49. line-height: 40px;
  50. height: 40px;
  51. width: 100%;
  52. }
  53. .btn:active{
  54. background: #FA5A49;
  55. }
  56. </style>