加油站付款小程序,打印小票
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
2.2 KiB

11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
  1. <template>
  2. <view class="login">
  3. <view class="title">
  4. 帧视界
  5. </view>
  6. <view class="title">
  7. 申请获取你的头像昵称
  8. </view>
  9. <button class="chooseAvatar" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
  10. <view class="line">
  11. <view class="">
  12. 头像
  13. </view>
  14. <view class="">
  15. <image :src="avatarUrl" v-if="avatarUrl" style="width: 60rpx;height: 60rpx;" mode=""></image>
  16. <image src="/static/image/tabbar/6.png" v-else style="width: 50rpx;height: 50rpx;" mode=""></image>
  17. </view>
  18. </view>
  19. </button>
  20. <view class="line">
  21. <view class="">
  22. 昵称
  23. </view>
  24. <view class="">
  25. <input type="nickname" placeholder="请输入昵称" style="text-align: right;" v-model="nickname" />
  26. </view>
  27. </view>
  28. <view @click="login" class="btn">
  29. 授权登录
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import api from '@/utils/api.js'
  35. export default {
  36. data() {
  37. return {
  38. avatarUrl: '',
  39. nickname: '',
  40. };
  41. },
  42. onShow() {},
  43. methods: {
  44. onChooseAvatar(res) {
  45. console.log(res);
  46. this.avatarUrl = res.target.avatarUrl
  47. },
  48. login(state) {
  49. uni.login({
  50. success(res) {
  51. if (res.errMsg != "login:ok") {
  52. return
  53. }
  54. api('loginLogin', {
  55. code: res.code
  56. }, res => {
  57. if (res.code != 200) {
  58. return
  59. }
  60. state.userInfo = res.result.userInfo
  61. uni.setStorageSync('token', res.result.token)
  62. if (state.userInfo) {
  63. }
  64. })
  65. }
  66. })
  67. },
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .login {
  73. display: flex;
  74. flex-direction: column;
  75. justify-content: center;
  76. align-items: center;
  77. height: 80vh;
  78. .title {
  79. line-height: 45rpx;
  80. font-weight: 900;
  81. }
  82. .line {
  83. display: flex;
  84. justify-content: space-between;
  85. align-items: center;
  86. width: 80%;
  87. border-bottom: 1px solid #00000023;
  88. padding: 30rpx 0;
  89. margin: 0 auto;
  90. }
  91. .chooseAvatar {
  92. width: 100%;
  93. padding: 0;
  94. margin: 0;
  95. margin-top: 10vh;
  96. border: none;
  97. }
  98. .btn {
  99. // background: $uni-linear-gradient-btn-color;
  100. background: lightblue;
  101. color: #fff;
  102. width: 80%;
  103. padding: 20rpx 0;
  104. text-align: center;
  105. border-radius: 15rpx;
  106. margin-top: 10vh;
  107. }
  108. }
  109. </style>