DESKTOP-2IO5MST\huting преди 1 година
родител
ревизия
7ec7e4fcd8
променени са 7 файла, в които са добавени 79 реда и са изтрити 118 реда
  1. 1
    10
      login/login.vue
  2. 4
    11
      pages.json
  3. 17
    1
      pages/user/user.vue
  4. 0
    60
      subpackage/orders/takePhoto.vue
  5. 45
    35
      subpackage/personal-center/get-code.vue
  6. 3
    1
      utils/network/request.js
  7. 9
    0
      utils/utils.ts

+ 1
- 10
login/login.vue Целия файл

@@ -72,7 +72,7 @@

<script setup lang="ts">
import { reactive } from "vue";
import { checkStr, msg, navTo } from "@/utils/utils";
import { checkStr, msg, navTo, subscribeMessages } from "@/utils/utils";
import { onLoad, onUnload } from "@dcloudio/uni-app";
import { login, loginCode, loginTime, wechatAppID } from "@/utils/network/api.js";
import { request } from "@/utils/network/request.js";
@@ -176,15 +176,6 @@
});
});
};
// 订阅消息
const subscribeMessages = () => {
uni.requestSubscribeMessage({
tmplIds: ['aNr4T2JEtaLtR9dihM2w3NAznz4bFMkutVZCbaSTjxg'],
success(res) {
console.log("订阅消息", res)
}
})
}
</script>

<style lang="scss" scoped>

+ 4
- 11
pages.json Целия файл

@@ -855,11 +855,10 @@
}
},
{
"path" : "account-opening-template/account-opening-template",
"style" :
{
"navigationBarTitleText" : "",
"enablePullDownRefresh" : false
"path": "account-opening-template/account-opening-template",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
]
@@ -878,12 +877,6 @@
}
}
},
{
"path": "takePhoto",
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "changeInformation",
"style": {

+ 17
- 1
pages/user/user.vue Целия файл

@@ -286,6 +286,22 @@
console.log("state.data.opId", state.data.opId)
if (state.data.opId) {
getUserInfo();
} else {
state.userVehicleInfoSumQueryVo = {
vehicleSum: 0,
orderStatus0: 0
}
state.monthFlowingVo = {
duration: 0,
mileage: 0,
flowingNum: 0,
num: 0,
parkingLotMoney: 0,
parkingLotNum: 0,
money: 0,
},
state.list = [],
state.carNumber = 0
}
});
// 查询车辆信息
@@ -323,7 +339,7 @@
openId: state.data.opId
},
method: "POST",
// showLoading: true,
showLoading: true,
};
//调用方式
request(userInfoIndex, options)

+ 0
- 60
subpackage/orders/takePhoto.vue Целия файл

@@ -1,60 +0,0 @@
<template>
<view>
<viewfinder :phoneType="state.phoneType" @confirmReturn="confirmReturn"></viewfinder>
</view>
</template>

<script setup lang="ts">
import viewfinder from "../../components/viewfinder.vue"
import {
onLoad
} from "@dcloudio/uni-app";
import {
reactive
} from "vue";
const state = reactive({
phoneType: 1,
allParams: {}
})
onLoad((option : any) => {
state.phoneType = option.phoneType;
state.allParams = option.allParams;
});
const confirmReturn = (val) => {
// uni.navigateTo({
// url: ``
// })
uni.navigateBack({
delta: 1
})
console.log("val", val)
}
</script>

<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}

.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}

.text-area {
display: flex;
justify-content: center;
}

.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>

+ 45
- 35
subpackage/personal-center/get-code.vue Целия файл

@@ -23,9 +23,9 @@

<script setup lang="ts">
import { reactive } from "vue";
import { checkStr, msg, navTo } from "@/utils/utils";
import { checkStr, msg, navTo, subscribeMessages } from "@/utils/utils";
import { onLoad, onUnload } from "@dcloudio/uni-app";
import { checkCode } from "@/utils/network/api.js";
import { checkCode, loginCode, loginTime } from "@/utils/network/api.js";
import { request } from "@/utils/network/request.js";
import { stringToJson } from "@/utils/network/encryption";
import { useUserStore } from "@/stores/user";
@@ -50,19 +50,19 @@
console.log(q);
state.json = getRequest(q)
console.log("state.json", state.json, getItem("mobile"), getItem("mobile") == state.json.phone)
setItem('scanCode', state.json)
if (!getItem("mobile")) {
uni.showModal({
title: '提示',
content: '您还未登录小程序,请先登录小程序',
showCancel: false,
success: function (res) {
if (res.confirm) {
navTo('/login/login')
}
}
});
}
// setItem('scanCode', state.json)
// if (!getItem("mobile")) {
// uni.showModal({
// title: '提示',
// content: '您还未登录小程序,请先登录小程序',
// showCancel: false,
// success: function (res) {
// if (res.confirm) {
// navTo('/login/login')
// }
// }
// });
// }
// 直接用传过来的手机号(不让他修改)
state.mobile = state.json.phone
} else {
@@ -87,33 +87,43 @@
msg("请输入正确的手机号!");
return;
}

// 直接去登录
reqLogin(loginCode, {
mobile: state.mobile,
code: state.code,
loginTime: loginTime,
});
};
/* 执行登录 */
const reqLogin = (code : string, data : object) => {
console.log(code, data);
const options = {
type: 2,
data: {
mobile: state.mobile,
code: state.code
},
data: data,
method: "POST",
showLoading: true,
};
request(checkCode, options).then((res) => {
console.log("过来了", res)
// type 1扫码支付 2扫描协议确认
if (state.json.type == 1) {
uni.navigateTo({
url: `/subpackage/orders/order_payment?orderId=${state.json.orderId}`,
});
} else if (state.json.type == 2) {
uni.navigateTo({
url: `/subpackage/orders/product-detail?orderId=${state.json.orderId}&url=${state.json.url}&typeScanCode=${state.json.type}`,
});
}
})
.catch((err) => {
// msg("验证码错误");
request(code, options).then((res) => {
const result = stringToJson(res.bizContent);
console.log(result);
console.log(typeof (result));
fetchToken(result.code).then((data : any) => {
console.log("登录", data);
setItem('mobile', state.mobile)
subscribeMessages();
if (state.json.type == 1) {
uni.navigateTo({
url: `/subpackage/orders/order_payment?orderId=${state.json.orderId}`,
});
} else if (state.json.type == 2) {
uni.navigateTo({
url: `/subpackage/orders/product-detail?orderId=${state.json.orderId}&url=${state.json.url}&typeScanCode=${state.json.type}`,
});
}
});
});
};

//解析URL获取参数
const getRequest = (urlStr) => {
if (typeof urlStr == "undefined") {

+ 3
- 1
utils/network/request.js Целия файл

@@ -103,7 +103,9 @@ export function request(code, options = {}, start = false) {
options.success = (res) => {
console.log('请求成功返回参数:', code, res)
// 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading)
uni.hideLoading()
if (options.showLoading) {
uni.hideLoading()
}
if (res.data.statusCode !== 0) {
if (res.data.statusCode == 600) {
resolve(res.data)

+ 9
- 0
utils/utils.ts Целия файл

@@ -521,4 +521,13 @@ export function timesDiff(timesData : any) {
}

return diffObj
}
// 订阅消息
export function subscribeMessages() {
uni.requestSubscribeMessage({
tmplIds: ['aNr4T2JEtaLtR9dihM2w3NAznz4bFMkutVZCbaSTjxg'],
success(res) {
console.log("订阅消息", res)
}
})
}

Loading…
Отказ
Запис