type: String, | type: String, | ||||
default: "", //1正常发验证码 2 ETC预留手机号验证码发送 3 ETC预留手机号修改-新手机验证码发送 | default: "", //1正常发验证码 2 ETC预留手机号验证码发送 3 ETC预留手机号修改-新手机验证码发送 | ||||
}, | }, | ||||
businessType: { | |||||
type: Number, | |||||
default: 0, //0-登录 1-注册 2-忘记密码 3-修改手机号 | |||||
}, | |||||
}); | }); | ||||
let interval = null; | let interval = null; | ||||
if(props.type=="1"){ | if(props.type=="1"){ | ||||
const options = { | const options = { | ||||
type: 2, | type: 2, | ||||
data: { mobile: props.mobile }, | |||||
data: { | |||||
mobile: props.mobile, | |||||
businessType:props.businessType | |||||
}, | |||||
method: "POST", | method: "POST", | ||||
showLoading: true, | showLoading: true, | ||||
}; | }; |
<view class="form-input" v-if="state.loginType === 'code'"> | <view class="form-input" v-if="state.loginType === 'code'"> | ||||
<input class="input" v-model="state.code" placeholder="请输入验证码" placeholder-class="form-placeholder" | <input class="input" v-model="state.code" placeholder="请输入验证码" placeholder-class="form-placeholder" | ||||
maxlength="6" type="number" /> | maxlength="6" type="number" /> | ||||
<verification-code :bg="false" :mobile="state.username"></verification-code> | |||||
<verification-code :bg="false" :mobile="state.username" businessType=0></verification-code> | |||||
</view> | </view> | ||||
</view> | </view> | ||||
<script setup lang="ts"> | <script setup lang="ts"> | ||||
import { reactive } from "vue"; | import { reactive } from "vue"; | ||||
import { checkStr, msg, navTo, subscribeMessages } from "@/utils/utils"; | |||||
import { checkStr, msg, navTo, subscribeMessages} from "@/utils/utils"; | |||||
import { onLoad, onUnload } from "@dcloudio/uni-app"; | import { onLoad, onUnload } from "@dcloudio/uni-app"; | ||||
import { login, loginCode, loginTime, wechatAppID } from "@/utils/network/api.js"; | import { login, loginCode, loginTime, wechatAppID } from "@/utils/network/api.js"; | ||||
import { requestNew} from "@/utils/network/request.js"; | import { requestNew} from "@/utils/network/request.js"; | ||||
import { stringToJson } from "@/utils/network/encryption"; | |||||
import { useUserStore } from "@/stores/user"; | import { useUserStore } from "@/stores/user"; | ||||
import { setItem } from "@/utils/storage"; | |||||
import { setItem,getItem } from "@/utils/storage"; | |||||
const userStore = useUserStore(); | const userStore = useUserStore(); | ||||
const { fetchToken } = userStore; | const { fetchToken } = userStore; | ||||
msg("请勾选我已阅读并同意《平台用户服务隐私协议》"); | msg("请勾选我已阅读并同意《平台用户服务隐私协议》"); | ||||
return; | return; | ||||
} | } | ||||
if(!getItem('mpOpenId')){ | |||||
navTo(`/subpackage/after-sale/wxWebView`) | |||||
return; | |||||
} | |||||
//判断是验证码登录,还是账号密码登录 | //判断是验证码登录,还是账号密码登录 | ||||
if (state.loginType === "code") { | if (state.loginType === "code") { | ||||
reqLogin(loginCode, { | reqLogin(loginCode, { |
/*根据登录code获取token信息*/ | /*根据登录code获取token信息*/ | ||||
fetchToken(code) { | fetchToken(code) { | ||||
if(getItem("QYorder") && getItem("QYorder").openid){ | |||||
if(getItem("wxOpenid")){ | |||||
const options = { | const options = { | ||||
type: 2, | type: 2, | ||||
data: { | data: { | ||||
deviceId: "", | deviceId: "", | ||||
code: code, | code: code, | ||||
loginSource: getItem("loginSource"), | loginSource: getItem("loginSource"), | ||||
wxOpenid: getItem("QYorder").openid, | |||||
wxOpenid: getItem("wxOpenid"), | |||||
zfbOpenId: getItem("zfbOpenId"), | zfbOpenId: getItem("zfbOpenId"), | ||||
zfbUserId: getItem("zfbUserId"), | zfbUserId: getItem("zfbUserId"), | ||||
}, | }, | ||||
uni.login({ | uni.login({ | ||||
provider: "weixin", | provider: "weixin", | ||||
success: function(e) { | success: function(e) { | ||||
console.log("jsCode",e.code) | |||||
console.log("jsCode",e) | |||||
const options = { | const options = { | ||||
type: 2, | type: 2, | ||||
data: { | data: { | ||||
requestNew(getOpenId, options).then((res) => { | requestNew(getOpenId, options).then((res) => { | ||||
const result =res; | const result =res; | ||||
console.log("getOpenId===",result) | console.log("getOpenId===",result) | ||||
const openidData = stringToJson(result.data); | |||||
setItem("QYorder", openidData); | |||||
setItem("wxOpenid", result.openid); | |||||
const options = { | const options = { | ||||
type: 2, | type: 2, | ||||
data: { | data: { | ||||
deviceId: "", | deviceId: "", | ||||
code: code, | code: code, | ||||
loginSource: getItem("loginSource"), | loginSource: getItem("loginSource"), | ||||
wxOpenid: getItem("QYorder").openid, | |||||
wxOpenid: getItem("wxOpenid"), | |||||
zfbOpenId: getItem("zfbOpenId"), | zfbOpenId: getItem("zfbOpenId"), | ||||
zfbUserId: getItem("zfbUserId"), | zfbUserId: getItem("zfbUserId"), | ||||
mpOpenId:getItem('mpOpenId')//用户在微信公众号的唯一身份标识openid | |||||
}, | }, | ||||
method: "POST", | method: "POST", | ||||
showLoading: false, | showLoading: false, |
export const queryPage= "/iaw/issue/order/queryPage" //订单分页查询 | export const queryPage= "/iaw/issue/order/queryPage" //订单分页查询 | ||||
export const orderReceiveGoods= "/iaw/issue/order/orderReceiveGoods" //订单收货 | export const orderReceiveGoods= "/iaw/issue/order/orderReceiveGoods" //订单收货 | ||||
export const orderDetailQuery= "/iaw/issue/order/orderDetailQuery" //订单详情查询 | export const orderDetailQuery= "/iaw/issue/order/orderDetailQuery" //订单详情查询 | ||||
export const getOpenId= "/iaw/issue/userBasic/getOpenId" //获取微信小程序openid | |||||
export const getOpenId= "/iaw/portal/getWxOpenId" //获取微信小程序openid | |||||
export const agreementInSertOrder= "/iaw/issue/order/agreementInSertOrder" //订单查询协议 | export const agreementInSertOrder= "/iaw/issue/order/agreementInSertOrder" //订单查询协议 | ||||
export const agreeOrderProdcut= "/iaw/issue/order/agreeOrderProduct" //订单确认协议 | export const agreeOrderProdcut= "/iaw/issue/order/agreeOrderProduct" //订单确认协议 | ||||
export const monthlyStatementQuery= "/iaw/app/issue/monthlyStatement/query" //月结单查询 | export const monthlyStatementQuery= "/iaw/app/issue/monthlyStatement/query" //月结单查询 | ||||
export const passbill= "/iaw/app/issue/cardAnnounce/passbill" //ETC通行流水记录查询 | export const passbill= "/iaw/app/issue/cardAnnounce/passbill" //ETC通行流水记录查询 | ||||
// 验证码 | // 验证码 | ||||
export const sendMessage= "/iaw/message/sendMessage" //发送短信验证码 | |||||
// export const sendMessage= "/iaw/message/sendMessage" //发送短信验证码 | |||||
export const sendMessage= "/iaw/portal/sendCode" //发送短信验证码 | |||||
export const messageValid= "/iaw/message/messageValid" //短信验证码验证 | export const messageValid= "/iaw/message/messageValid" //短信验证码验证 | ||||
// 卡签挂失解挂 | // 卡签挂失解挂 |
Common['orderSource'] = "WECHAT" | Common['orderSource'] = "WECHAT" | ||||
// #endif | // #endif | ||||
// options.url = envs[process.env.NODE_ENV].baseUrl+'/prod' + code | // options.url = envs[process.env.NODE_ENV].baseUrl+'/prod' + code | ||||
options.url = envs[process.env.NODE_ENV].baseUrl+'/ndev' + code | |||||
options.url = envs[process.env.NODE_ENV].baseUrl+'/newDev/ndev' + code | |||||
// options.url = envs[process.env.NODE_ENV].baseUrl+'/ndev' + code | |||||
//默认json数据格式提交` | //默认json数据格式提交` | ||||
let contentType = 'application/json' | let contentType = 'application/json' | ||||
resolve(res.data.data) | resolve(res.data.data) | ||||
} else { | } else { | ||||
if(res.data.code == 401002){ | if(res.data.code == 401002){ | ||||
updateGetTokenNew().then((data) => { | |||||
console.log("token刷新", data); | |||||
clie(data) | |||||
requestNew(code, options, true) | |||||
}) | |||||
// updateGetTokenNew().then((data) => { | |||||
// console.log("token刷新", data); | |||||
// clie(data) | |||||
// requestNew(code, options, true) | |||||
// }) | |||||
}else if(res.data.code == 403001 || res.data.code == 403004 || res.data.code == 403003){ | }else if(res.data.code == 403001 || res.data.code == 403004 || res.data.code == 403003){ | ||||
// 会详细列出具体字段的错误信息。 | // 会详细列出具体字段的错误信息。 | ||||
uni.showModal({ | uni.showModal({ |
success: (uploadFileRes) => { | success: (uploadFileRes) => { | ||||
let uploadFileImage = 'http://100.64.2.113:9000' + '/default-bucket/' + JSON.parse(uploadFileRes.data).data.ossFilePath | let uploadFileImage = 'http://100.64.2.113:9000' + '/default-bucket/' + JSON.parse(uploadFileRes.data).data.ossFilePath | ||||
console.log("111", JSON.parse(uploadFileRes.data).data.ossFilePath,JSON.parse(uploadFileRes.data)); | console.log("111", JSON.parse(uploadFileRes.data).data.ossFilePath,JSON.parse(uploadFileRes.data)); | ||||
var data={} | |||||
if (code == "/iaw/txOcr/idCardOcr") { //身份证 imageType 1 2 | if (code == "/iaw/txOcr/idCardOcr") { //身份证 imageType 1 2 | ||||
var data = { | |||||
data = { | |||||
source: "1", | source: "1", | ||||
agencyId: agentId, | agencyId: agentId, | ||||
imageType: imageType, | imageType: imageType, | ||||
url: uploadFileImage | url: uploadFileImage | ||||
}; | }; | ||||
} else if (code == "/iaw/txOcr/vehicleLicenseOcr") { //行驶证 imageType 1正 2反 | } else if (code == "/iaw/txOcr/vehicleLicenseOcr") { //行驶证 imageType 1正 2反 | ||||
var data = { | |||||
data = { | |||||
source: "1", | source: "1", | ||||
agencyId: agentId, | agencyId: agentId, | ||||
imageType: imageType, | imageType: imageType, | ||||
console.log("17", uploadFileImage) | console.log("17", uploadFileImage) | ||||
resolve(uploadFileImage) | resolve(uploadFileImage) | ||||
return; | return; | ||||
} else if (code == '/iaw/txOcr/businessLicenseOcrNew') { //营业执照 | |||||
var data = { | |||||
} else if (code == '/iaw/txOcr/businessLicenseOcr') { //营业执照 | |||||
data = { | |||||
type: 'business_license', | type: 'business_license', | ||||
url: uploadFileImage, | url: uploadFileImage, | ||||
agencyId: agentId, | agencyId: agentId, |