Commit 61ac71151b86c93e1124e1eccc184e081be3da71
1 parent
98cfd1c0
接口地址修改
Showing
2 changed files
with
10 additions
and
9 deletions
project-wl-kuaidiyuan-uniapp-vue3/pages/login/user.vue
| ... | ... | @@ -52,7 +52,6 @@ import { userLogins } from '../api/user.js'; |
| 52 | 52 | // 导入接口 |
| 53 | 53 | import { getHomeInfo } from '@/pages/api/index.js'; |
| 54 | 54 | |
| 55 | -import { encrypt, decrypt } from '@/utils/crypto.js' | |
| 56 | 55 | |
| 57 | 56 | // ------定义变量------ |
| 58 | 57 | const store = useStore(); //vuex获取储存数据 |
| ... | ... | @@ -94,7 +93,7 @@ onMounted(() => { |
| 94 | 93 | const accountHistory = uni.getStorageSync('accountHistory') |
| 95 | 94 | if(accountHistory) { |
| 96 | 95 | fromInfo.account = accountHistory.account |
| 97 | - fromInfo.password = decrypt(accountHistory.password) | |
| 96 | + fromInfo.password = accountHistory.password | |
| 98 | 97 | // console.log(accountHistory) |
| 99 | 98 | } |
| 100 | 99 | |
| ... | ... | @@ -115,6 +114,7 @@ const handleSubmit = async () => { |
| 115 | 114 | },500) |
| 116 | 115 | await userLogins(fromInfo) |
| 117 | 116 | .then(async res => { |
| 117 | + console.log('success', res) | |
| 118 | 118 | if (res.code === 200) { |
| 119 | 119 | // 操作成功后清除loading |
| 120 | 120 | setTimeout(function () { |
| ... | ... | @@ -126,7 +126,7 @@ const handleSubmit = async () => { |
| 126 | 126 | store.commit('user/setToken', res.data.token); |
| 127 | 127 | |
| 128 | 128 | //存储用户账号和密码,密码加密存储 |
| 129 | - const data = { account: fromInfo.account, password: encrypt(fromInfo.password) } | |
| 129 | + const data = { account: fromInfo.account, password: fromInfo.password } | |
| 130 | 130 | uni.setStorageSync('accountHistory', data) |
| 131 | 131 | // // 通过vuex获取用户信息 |
| 132 | 132 | store.dispatch('user/GetUsersInfo'); |
| ... | ... | @@ -147,6 +147,7 @@ const handleSubmit = async () => { |
| 147 | 147 | } |
| 148 | 148 | }) |
| 149 | 149 | .catch(err => { |
| 150 | + console.log('error', err) | |
| 150 | 151 | // uni.showToast({ |
| 151 | 152 | // title: err.msg, |
| 152 | 153 | // duration: 15000, | ... | ... |
project-wl-kuaidiyuan-uniapp-vue3/utils/request.js
| 1 | -// import { baseUrl } from "./env"; | |
| 1 | +import { baseUrl } from "./env"; | |
| 2 | 2 | // 参数: url:请求地址 param:请求参数 method:请求方式 callBack:回调函数 |
| 3 | +// import { } from '' | |
| 4 | + | |
| 3 | 5 | export function request({ url = "", params = {}, method = "GET" }) { |
| 4 | 6 | // baseUrl改为可配置地址 |
| 5 | - if (!uni.getStorageSync('baseUrl')){ | |
| 6 | - uni.setStorageSync('baseUrl', 'https://tms-gateway.zrpfsc.com/courier') | |
| 7 | - } | |
| 8 | - let baseUrl = uni.getStorageSync('baseUrl') | |
| 9 | - | |
| 7 | + console.log('baseUrl', baseUrl) | |
| 10 | 8 | // 获取token |
| 11 | 9 | const token = uni.getStorageSync("token"); |
| 12 | 10 | let header = { |
| ... | ... | @@ -19,6 +17,7 @@ export function request({ url = "", params = {}, method = "GET" }) { |
| 19 | 17 | header['Content-Type'] = 'application/x-www-form-urlencoded' |
| 20 | 18 | } |
| 21 | 19 | const requestRes = new Promise((resolve, reject) => { |
| 20 | + console.log('fullUrl:', baseUrl + url) | |
| 22 | 21 | uni.request({ |
| 23 | 22 | url: baseUrl + url, |
| 24 | 23 | data: params, |
| ... | ... | @@ -63,6 +62,7 @@ export function request({ url = "", params = {}, method = "GET" }) { |
| 63 | 62 | reject(res.data); |
| 64 | 63 | } |
| 65 | 64 | }).catch((err)=>{ |
| 65 | + console.log('request error:', err) | |
| 66 | 66 | const error = { data: { msg: err.data } }; |
| 67 | 67 | reject(error); |
| 68 | 68 | }); | ... | ... |