Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

login.vue 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view class="item">
  3. <text>对公用户:</text>
  4. <input class="uni-input" focus placeholder="请输入用户名" v-model='state.name'/>
  5. </view>
  6. <view class="item">
  7. <text>密码:</text>
  8. <input style='width:412rpx;' class="uni-input" focus placeholder="请输入密码" v-model='state.password' type='password'/>
  9. </view>
  10. <button @click='login()'>登录</button>
  11. <view class='go'>
  12. <text @click='goAccount()'>去开户</text>
  13. <!-- <text @click='forgetPassword()'>忘记密码</text> -->
  14. </view>
  15. </template>
  16. <script setup lang='ts'>
  17. import { navTo,msg} from "@/utils/utils";
  18. import {request} from "@/utils/network/request.js";
  19. import {accountLogin} from "@/utils/network/api.js";
  20. import {onLoad} from "@dcloudio/uni-app";
  21. import {reactive} from "vue";
  22. const state = reactive({
  23. name:'',
  24. password:''
  25. })
  26. onLoad((option : any) => {
  27. });
  28. const login=()=>{
  29. if(!state.name){
  30. msg("请输入用户名!");
  31. return;
  32. }
  33. if(!state.password){
  34. msg("请输入密码!");
  35. return;
  36. }
  37. let options = {
  38. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  39. data: {
  40. accountId: state.name,
  41. passWord: state.password
  42. }, //请求参数
  43. method: "POST", //提交方式(默认POST)
  44. showLoading: true, //是否显示加载中(默认显示)
  45. };
  46. //调用方式
  47. request(accountLogin, options).then((res) => {
  48. let data = stringToJson(res.bizContent)
  49. console.log(data, "#################");
  50. navTo(`/subpackage/after-sale/account-recharge/index?name=state.name`);
  51. })
  52. .catch((err) => {
  53. console.log(err);
  54. });
  55. // navTo(`/subpackage/after-sale/account-recharge/index?name=state.name`);
  56. // navTo(`/subpackage/after-sale/account-recharge/index?name=scyl12345`);
  57. }
  58. const goAccount=()=>{
  59. navTo(`/subpackage/after-sale/account-recharge/go-account`);
  60. // navTo(`/pages/recharge/select-car?type=1`);
  61. }
  62. const forgetPassword=()=>{
  63. navTo(`/subpackage/after-sale/account-recharge/forget-password`);
  64. }
  65. </script>
  66. <style scoped>
  67. .item{
  68. display:flex;
  69. border-bottom:2rpx solid rgb(239,239,239);
  70. padding: 18rpx 36rpx;
  71. font-size:32rpx;
  72. align-items: center;
  73. }
  74. .item>text{
  75. width:23%;
  76. }
  77. button{
  78. width: 75%;
  79. height: 80rpx;
  80. margin-top:60rpx;
  81. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  82. border-radius: 40rpx;
  83. font-size: 32rpx;
  84. font-weight: 400;
  85. color: #ffffff;
  86. line-height: 80rpx;
  87. }
  88. .go{
  89. display:flex;
  90. color:#43a1e0;
  91. justify-content: space-around;
  92. font-size: 32rpx;
  93. margin-top: 90rpx;
  94. }
  95. .go>text{
  96. text-decoration: underline;
  97. }
  98. .uni-input{
  99. background: transparent;
  100. }
  101. </style>