Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <!-- 密码登录 -->
  2. <template>
  3. <view class="login-main as-gravity-center as-layout-vertical" >
  4. <view class="form">
  5. <view class="form-input">
  6. <view> +86</view>
  7. <image :src="`${$imgUrl}common/arror_down_black.png`" class="arror" mode="aspectFill" />
  8. <input class="input" v-model="state.mobile" focus placeholder="请输入手机号"
  9. placeholder-class="form-placeholder" type="number" maxlength="11" disabled />
  10. </view>
  11. <view class="form-input" v-if="state.loginType === 'code'">
  12. <input class="input" v-model="state.code" placeholder="请输入验证码" placeholder-class="form-placeholder"
  13. maxlength="6" type="number" />
  14. <verification-code :bg="false" :mobile="state.mobile"></verification-code>
  15. </view>
  16. </view>
  17. <view class="btn">
  18. <submit-button title="下一步" @submit="toNext"></submit-button>
  19. </view>
  20. </view>
  21. </template>
  22. <script setup lang="ts">
  23. import { reactive } from "vue";
  24. import { checkStr, msg, navTo } from "@/utils/utils";
  25. import { onLoad, onUnload } from "@dcloudio/uni-app";
  26. import { checkCode } from "@/utils/network/api.js";
  27. import { request } from "@/utils/network/request.js";
  28. import { useUserStore } from "@/stores/user";
  29. import { getItem, setItem } from "@/utils/storage";
  30. import { jump } from "@/datas/9901Jump.js";
  31. const userStore = useUserStore();
  32. const { fetchToken } = userStore;
  33. const state = reactive({
  34. loginType: "code", //pwd-密码登录 code-验证码登录
  35. mobile: "", //用户名
  36. password: "", //密码
  37. code: "", //验证码
  38. json: {}
  39. });
  40. onLoad((option) => {
  41. // https://qtzl.etcjz.cn/default-bucket/20231204/scanPay.html?orderId=20231016180507480853307&phone=18786896573&type=1
  42. // https://qtzl.etcjz.cn/default-bucket/20231204/protocol.html?orderId=20231012114651162505354&phone=18786896573&type=2&url=default-bucket/20231024/fcae5e580ecc4cacaaa75138_ETC用户协议20230805(法审终版).docx
  43. console.log("option", option)
  44. if (option.q) {
  45. const q = decodeURIComponent(option.q); // 获取到二维码原始链接内容
  46. console.log(q);
  47. state.json = getRequest(q)
  48. console.log("state.json==",state.json)
  49. if(state.json['wechatSignNo']){
  50. console.log("wechatSignNo",state.json)
  51. // app跳往异地得签约
  52. jump(16, state.json['wechatSignNo'])
  53. }else{
  54. console.log("state.json", state.json, getItem("mobile"), getItem("mobile") == state.json.phone)
  55. setItem('scanCode', state.json)
  56. if (!getItem("openId")) {
  57. uni.showModal({
  58. title: '提示',
  59. content: '您还未登录小程序,请先登录小程序',
  60. showCancel: false,
  61. success: function (res) {
  62. if (res.confirm) {
  63. navTo(`/login/login?back=1`)
  64. }
  65. }
  66. });
  67. }
  68. // 直接用传过来的手机号(不让他修改)
  69. state.mobile = state.json.phone
  70. }
  71. } else {
  72. state.json = getItem("scanCode")
  73. state.mobile = state.json.phone
  74. }
  75. });
  76. onUnload(() => {
  77. });
  78. const toNext = () => {
  79. if (!state.mobile) {
  80. msg("请输入手机号!");
  81. return;
  82. }
  83. if (state.loginType === "code" && !state.code) {
  84. msg("请输入验证码!");
  85. return;
  86. }
  87. if (!checkStr(state.mobile, "mobile")) {
  88. msg("请输入正确的手机号!");
  89. return;
  90. }
  91. const options = {
  92. type: 2,
  93. data: {
  94. mobile: state.mobile,
  95. code: state.code
  96. },
  97. method: "POST",
  98. showLoading: true,
  99. };
  100. request(checkCode, options).then((res) => {
  101. console.log("过来了", res)
  102. // type 1扫码支付 2扫描协议确认
  103. if (state.json.type == 1) {
  104. uni.navigateTo({
  105. url: `/subpackage/orders/order_payment?orderId=${state.json.orderId}&isValueCard=${state.json.isValueCard}&vehicleId=${state.json.vehicleId}`,
  106. });
  107. } else if (state.json.type == 2) {
  108. uni.navigateTo({
  109. url: `/subpackage/orders/product-detail?orderId=${state.json.orderId}&url=${state.json.url}&typeScanCode=${state.json.type}`,
  110. });
  111. }
  112. })
  113. .catch((err) => {
  114. // msg("验证码错误");
  115. });
  116. };
  117. //解析URL获取参数
  118. const getRequest = (urlStr) => {
  119. if (typeof urlStr == "undefined") {
  120. // 获取url中"?"符后的字符串
  121. var url = decodeURI(location.search);
  122. } else {
  123. var url = "?" + urlStr.split("?")[1];
  124. }
  125. var theRequest = new Object();
  126. if (url.indexOf("?") != -1) {
  127. var str = url.substr(1);
  128. var strs = str.split("&");
  129. for (var i = 0; i < strs.length; i++) {
  130. theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
  131. }
  132. }
  133. return theRequest;
  134. };
  135. </script>
  136. <style lang="scss" scoped>
  137. .login-main {
  138. border-top: 1rpx solid #dcdcdc;
  139. padding: 22rpx 30rpx 140rpx;
  140. .title {
  141. font-size: 46rpx;
  142. color: #333333;
  143. margin-top: 30rpx;
  144. font-weight: 600;
  145. }
  146. .form {
  147. width: 100%;
  148. margin-top: 100rpx;
  149. .form-input {
  150. display: flex;
  151. flex-direction: row;
  152. align-items: center;
  153. height: 90rpx;
  154. border-bottom: 1rpx solid #dcdcdc;
  155. padding: 0rpx 12rpx;
  156. color: #333333;
  157. &:last-child {
  158. margin-top: 50rpx;
  159. }
  160. .input {
  161. flex: 1;
  162. padding-right: 48rpx;
  163. font-size: 28rpx;
  164. font-family: Microsoft YaHei;
  165. background-color: transparent;
  166. }
  167. .arror {
  168. width: 28rpx;
  169. height: 25rpx;
  170. margin-left: 16rpx;
  171. margin-right: 40rpx;
  172. }
  173. .eye {
  174. width: 48rpx;
  175. height: 48rpx;
  176. }
  177. }
  178. .form-placeholder {
  179. color: #999999;
  180. }
  181. }
  182. .btn {
  183. width: 100%;
  184. margin: 120rpx 40rpx 50rpx;
  185. }
  186. }
  187. </style>