Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

login.vue 2.7KB

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