index.vue 815 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <view class="login">
  3. 登录页
  4. <view class="logIn" @click="logIn">
  5. 登录
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. import tools from '@/service/tools.js';
  11. export default {
  12. data() {
  13. return {
  14. }
  15. },
  16. mounted() {
  17. },
  18. methods: {
  19. logIn() {
  20. uni.login({
  21. provider:'weixin',
  22. success:(res)=>{
  23. if(res.errMsg === 'login:ok'){
  24. console.log(res);
  25. }else{
  26. tools.error('失败')
  27. }
  28. },
  29. fail:(res)=>{
  30. tools.error('失败')
  31. }
  32. })
  33. },
  34. },
  35. }
  36. </script>
  37. <style lang="scss" scoped>
  38. .login {
  39. width: 100%;
  40. min-height: 100vh;
  41. background: #fff;
  42. .logIn {
  43. width: 50%;
  44. height: 40px;
  45. text-align: center;
  46. margin: 0 auto;
  47. line-height: 40px;
  48. }
  49. }
  50. </style>