login.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <!-- 登录 -->
  3. <view style="padding: 0 44rpx">
  4. <view class="" style="text-align: center; margin-top: 156rpx">
  5. <image src="../../static/images/logo.png" style="width: 350rpx; height: 350rpx" mode=""></image>
  6. </view>
  7. <!-- <button
  8. open-type="getPhoneNumber"
  9. class="login-btn"
  10. @getphonenumber="tologin"
  11. >
  12. 微信授权登录
  13. </button> -->
  14. <view>
  15. <u--input placeholder="请输入内容" border="surround" v-model="mobile"></u--input>
  16. <u--input placeholder="请输入内容" border="surround" v-model="code"></u--input>
  17. </view>
  18. <button @click="submit">登录</button>
  19. <view class="" style="margin-top: 42rpx; display: flex">
  20. <!-- <u-checkbox-group
  21. v-model="checkboxValue1"
  22. placement="column"
  23. @change="checkboxChange"
  24. >
  25. <u-checkbox
  26. shape="circle"
  27. :customStyle="{ marginBottom: '8px' }"
  28. :name="1"
  29. >
  30. </u-checkbox>
  31. </u-checkbox-group> -->
  32. <text class="fontYin">我已阅读并同意</text>
  33. <text class="fontYin" style="color: #f83224">《用户协议》</text>
  34. <text class="fontYin">和</text>
  35. <text class="fontYin" style="color: #f83224">《隐私协议》</text>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import {
  41. login
  42. } from "../../network/api/homeApi.js";
  43. export default {
  44. data() {
  45. return {
  46. mobile: "",
  47. code: "",
  48. checkboxValue1: false,
  49. };
  50. },
  51. methods: {
  52. checkboxChange(n) {
  53. console.log("change", n);
  54. },
  55. submit() {
  56. // login({ mobile: "13000000000", password: "123456" }).then((res) => {
  57. // console.log(res);
  58. // if (res.data.code == 10000) {
  59. // uni.setStorage({
  60. // key: "token",
  61. // data: res.data.data.token,
  62. // success: function () {
  63. // uni.switchTab({
  64. // url: "../index/index",
  65. // });
  66. // },
  67. // });
  68. // }
  69. // });
  70. uni.$u.http.post('/api/login', {
  71. mobile: "13000000000",
  72. password: "123456"
  73. }).then((res) => {
  74. uni.setStorageSync('token', res.token)
  75. uni.switchTab({
  76. url: '/pages/index/index'
  77. })
  78. }).catch((error) => {
  79. console.log(error);
  80. })
  81. },
  82. },
  83. };
  84. </script>
  85. <style lang="scss" scoped>
  86. .login-btn {
  87. width: 662rpx;
  88. height: 96rpx;
  89. background: #f83224;
  90. box-shadow: 0rpx 16rpx 40rpx -12rpx rgba(255, 21, 21, 0.5);
  91. border-radius: 48rpx;
  92. font-family: PingFangSC, PingFang SC;
  93. font-weight: 500;
  94. font-size: 32rpx;
  95. color: #ffffff;
  96. line-height: 96rpx;
  97. text-align: center;
  98. font-style: normal;
  99. }
  100. .fontYin {
  101. font-family: PingFangSC, PingFang SC;
  102. font-weight: 400;
  103. font-size: 24rpx;
  104. color: #666666;
  105. line-height: 34rpx;
  106. text-align: left;
  107. font-style: normal;
  108. }
  109. </style>