浏览代码

提交

yxb
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 查看文件



<script setup lang="ts"> <script setup lang="ts">
import { reactive } from "vue"; 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 { 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 { request } from "@/utils/network/request.js"; import { request } from "@/utils/network/request.js";
}); });
}); });
}; };
// 订阅消息
const subscribeMessages = () => {
uni.requestSubscribeMessage({
tmplIds: ['aNr4T2JEtaLtR9dihM2w3NAznz4bFMkutVZCbaSTjxg'],
success(res) {
console.log("订阅消息", res)
}
})
}
</script> </script>


<style lang="scss" scoped> <style lang="scss" scoped>

+ 4
- 11
pages.json 查看文件

} }
}, },
{ {
"path" : "account-opening-template/account-opening-template",
"style" :
{
"navigationBarTitleText" : "",
"enablePullDownRefresh" : false
"path": "account-opening-template/account-opening-template",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
} }
} }
] ]
} }
} }
}, },
{
"path": "takePhoto",
"style": {
"navigationBarTitleText": ""
}
},
{ {
"path": "changeInformation", "path": "changeInformation",
"style": { "style": {

+ 17
- 1
pages/user/user.vue 查看文件

console.log("state.data.opId", state.data.opId) console.log("state.data.opId", state.data.opId)
if (state.data.opId) { if (state.data.opId) {
getUserInfo(); 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
} }
}); });
// 查询车辆信息 // 查询车辆信息
openId: state.data.opId openId: state.data.opId
}, },
method: "POST", method: "POST",
// showLoading: true,
showLoading: true,
}; };
//调用方式 //调用方式
request(userInfoIndex, options) request(userInfoIndex, options)

+ 0
- 60
subpackage/orders/takePhoto.vue 查看文件

<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 查看文件



<script setup lang="ts"> <script setup lang="ts">
import { reactive } from "vue"; 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 { 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 { request } from "@/utils/network/request.js";
import { stringToJson } from "@/utils/network/encryption"; import { stringToJson } from "@/utils/network/encryption";
import { useUserStore } from "@/stores/user"; import { useUserStore } from "@/stores/user";
console.log(q); console.log(q);
state.json = getRequest(q) state.json = getRequest(q)
console.log("state.json", state.json, getItem("mobile"), getItem("mobile") == state.json.phone) 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 state.mobile = state.json.phone
} else { } else {
msg("请输入正确的手机号!"); msg("请输入正确的手机号!");
return; return;
} }

// 直接去登录
reqLogin(loginCode, {
mobile: state.mobile,
code: state.code,
loginTime: loginTime,
});
};
/* 执行登录 */
const reqLogin = (code : string, data : object) => {
console.log(code, data);
const options = { const options = {
type: 2, type: 2,
data: {
mobile: state.mobile,
code: state.code
},
data: data,
method: "POST", method: "POST",
showLoading: true, 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获取参数 //解析URL获取参数
const getRequest = (urlStr) => { const getRequest = (urlStr) => {
if (typeof urlStr == "undefined") { if (typeof urlStr == "undefined") {

+ 3
- 1
utils/network/request.js 查看文件

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

+ 9
- 0
utils/utils.ts 查看文件

} }


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

正在加载...
取消
保存