接口调试
This commit is contained in:
parent
d4250fa50b
commit
8b8d1c0fc1
|
|
@ -24,6 +24,7 @@
|
|||
"@dcloudio/uni-mp-xhs": "3.0.0-4050720250324001",
|
||||
"@dcloudio/uni-quickapp-webview": "3.0.0-4050720250324001",
|
||||
"clipboard": "^2.0.11",
|
||||
"crypto-js": "^4.2.0",
|
||||
"dayjs": "^1.11.13",
|
||||
"lodash-es": "^4.17.21",
|
||||
"pinia": "^2.3.0",
|
||||
|
|
@ -49,7 +50,8 @@
|
|||
"sass": "^1.63.2",
|
||||
"sass-loader": "^10.4.1",
|
||||
"vite": "5.2.8",
|
||||
"vite-plugin-eslint": "^1.8.1"
|
||||
"vite-plugin-eslint": "^1.8.1",
|
||||
"vite-plugin-remove-console": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@ampproject/remapping": {
|
||||
|
|
@ -6110,6 +6112,11 @@
|
|||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/crypto-js": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/crypto-js/-/crypto-js-4.2.0.tgz",
|
||||
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
|
||||
},
|
||||
"node_modules/css-font-size-keywords": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/css-font-size-keywords/-/css-font-size-keywords-1.0.0.tgz",
|
||||
|
|
@ -12157,6 +12164,12 @@
|
|||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-remove-console": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/vite-plugin-remove-console/-/vite-plugin-remove-console-2.2.0.tgz",
|
||||
"integrity": "sha512-qgjh5pz75MdE9Kzs8J0kBwaCfifHV0ezRbB9rpGsIOxam+ilcGV7WOk91vFJXquzRmiKrFh3Hxlh0JJWAmXTbQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/vue": {
|
||||
"version": "3.5.13",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/vue/-/vue-3.5.13.tgz",
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
"@dcloudio/uni-mp-xhs": "3.0.0-4050720250324001",
|
||||
"@dcloudio/uni-quickapp-webview": "3.0.0-4050720250324001",
|
||||
"clipboard": "^2.0.11",
|
||||
"crypto-js": "^4.2.0",
|
||||
"dayjs": "^1.11.13",
|
||||
"lodash-es": "^4.17.21",
|
||||
"pinia": "^2.3.0",
|
||||
|
|
@ -75,6 +76,7 @@
|
|||
"sass": "^1.63.2",
|
||||
"sass-loader": "^10.4.1",
|
||||
"vite": "5.2.8",
|
||||
"vite-plugin-eslint": "^1.8.1"
|
||||
"vite-plugin-eslint": "^1.8.1",
|
||||
"vite-plugin-remove-console": "^2.2.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<up-input
|
||||
clearable
|
||||
prefixIcon="account"
|
||||
placeholder="填输入登录手机号"
|
||||
placeholder="填输入手机号"
|
||||
v-model="opinionModel.username"
|
||||
/>
|
||||
</up-form-item>
|
||||
|
|
@ -47,13 +47,26 @@
|
|||
<up-button type="primary" text="登录" @tap="onSubmitLogin" shape="circle" />
|
||||
</up-form-item>
|
||||
</up-form>
|
||||
<up-loading-page
|
||||
color="#333"
|
||||
fontSize="16"
|
||||
loadingColor="#2979ff"
|
||||
:loading="sendLoading"
|
||||
bg-color="rgba(0,0,0,0.5)"
|
||||
loading-text="正在登录..."
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { loginApi } from '@/services/login.js'
|
||||
const showPassword = ref(false)
|
||||
import { debounce } from 'lodash-es' // 引入防抖函数
|
||||
import { useMemberStore } from '@/stores'
|
||||
import { loginApi, getUserInfoApi } from '@/services/login.js'
|
||||
|
||||
const showPassword = ref(false) // 密码是否可见
|
||||
const sendLoading = ref(false) // 加载中
|
||||
const memberStore = useMemberStore() // 用户信息
|
||||
|
||||
// 表单数据源
|
||||
const opinionModel = ref({
|
||||
|
|
@ -66,17 +79,17 @@ const opinionRules = ref({
|
|||
{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请填写账号',
|
||||
message: '请填写手机号',
|
||||
trigger: ['blur', 'change'],
|
||||
},
|
||||
// {
|
||||
// pattern: /^[\u4e00-\u9fa5]{2,6}$/,
|
||||
// // 正则检验前先将值转为字符串
|
||||
// transform(value) {
|
||||
// return String(value)
|
||||
// },
|
||||
// message: '请填写正确的姓名',
|
||||
// },
|
||||
{
|
||||
pattern: /^(1\d{10}|!Admin)$/,
|
||||
// 正则检验前先将值转为字符串
|
||||
transform(value) {
|
||||
return String(value)
|
||||
},
|
||||
message: '请填写正确手机号',
|
||||
},
|
||||
],
|
||||
password: [
|
||||
{
|
||||
|
|
@ -98,35 +111,63 @@ const isSuccess = ref(false)
|
|||
const showModal = ref(false)
|
||||
|
||||
// 提交按钮
|
||||
const onSubmitLogin = () => {
|
||||
const onSubmitLogin = debounce(() => {
|
||||
sendLoading.value = true
|
||||
loginModelRef.value
|
||||
.validate()
|
||||
.then(async (valid) => {
|
||||
if (valid) {
|
||||
uni.$u.toast('登录成功')
|
||||
setTimeout(() => {
|
||||
// uni.switchTab({ url: '/pages/workbenches/index' })
|
||||
uni.switchTab({ url: '/pages/workbenches/index' })
|
||||
}, 500)
|
||||
console.log(
|
||||
'%c🔍 登录请求入参 %c',
|
||||
'background: linear-gradient(90deg, #FF6B6B, #4ECDC4); color: white; padding: 5px 10px; border-radius: 5px; font-weight: bold;',
|
||||
'',
|
||||
opinionModel.value,
|
||||
)
|
||||
|
||||
try {
|
||||
const res = await loginApi(opinionModel.value)
|
||||
console.log(
|
||||
'%c🔍 登录请求出参 %c',
|
||||
'background: linear-gradient(90deg, #FF6B6B, #4ECDC4); color: white; padding: 5px 10px; border-radius: 5px; font-weight: bold;',
|
||||
'',
|
||||
res,
|
||||
)
|
||||
sendLoading.value = false
|
||||
if (res.code === 200) {
|
||||
memberStore.setToken(res.token)
|
||||
uni.$u.toast('登录成功')
|
||||
getUserInfo()
|
||||
setTimeout(() => {
|
||||
uni.switchTab({ url: '/pages/workbenches/index' })
|
||||
}, 500)
|
||||
} else {
|
||||
uni.$u.toast('登录失败' + res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
sendLoading.value = false
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 处理验证错误
|
||||
})
|
||||
}
|
||||
}, 500)
|
||||
|
||||
// 继续填写
|
||||
const onContinueFill = () => {
|
||||
isSuccess.value = false
|
||||
}
|
||||
// 退出
|
||||
const onExit = () => {
|
||||
showModal.value = true
|
||||
}
|
||||
// 获取用户信息
|
||||
const getUserInfo = () => {
|
||||
getUserInfoApi().then((res) => {
|
||||
if (res.code === 200) {
|
||||
console.log(
|
||||
'%c🔍 用户信息请求出参 %c',
|
||||
'background: linear-gradient(90deg, #FF6B6B, #4ECDC4); color: white; padding: 5px 10px; border-radius: 5px; font-weight: bold;',
|
||||
'',
|
||||
res,
|
||||
)
|
||||
|
||||
// 确认退出
|
||||
const onConfirm = () => {
|
||||
uni.redirectTo({ url: '/pages/index/index' })
|
||||
// 存储用户信息
|
||||
memberStore.setUserInfo(res.data)
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -18,19 +18,19 @@
|
|||
>
|
||||
<up-form-item prop="username">
|
||||
<up-input
|
||||
readonly
|
||||
clearable
|
||||
prefixIcon="account"
|
||||
placeholder="填输入手机号"
|
||||
v-model="editPasswordModel.username"
|
||||
/>
|
||||
</up-form-item>
|
||||
<up-form-item prop="password">
|
||||
<up-form-item prop="oldP">
|
||||
<up-input
|
||||
clearable
|
||||
prefixIcon="lock"
|
||||
:password="!showPassword_1"
|
||||
placeholder="填输入密码"
|
||||
v-model="editPasswordModel.password"
|
||||
placeholder="填输入原密码"
|
||||
v-model="editPasswordModel.oldP"
|
||||
>
|
||||
<template #suffix>
|
||||
<u-icon
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
clearable
|
||||
prefixIcon="lock"
|
||||
:password="!showPassword_2"
|
||||
placeholder="填输入8-20位新密码"
|
||||
placeholder="请输入8-20位新密码"
|
||||
v-model="editPasswordAgainModel.newPassword"
|
||||
>
|
||||
<template #suffix>
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
clearable
|
||||
prefixIcon="lock"
|
||||
:password="!showPassword_3"
|
||||
placeholder="填再次输入8-20位新密码"
|
||||
placeholder="请再次输入8-20位新密码"
|
||||
v-model="editPasswordAgainModel.newPasswordAgain"
|
||||
>
|
||||
<template #suffix>
|
||||
|
|
@ -122,7 +122,10 @@
|
|||
|
||||
<script setup>
|
||||
import { nextTick, ref } from 'vue'
|
||||
import { useMemberStore } from '@/stores'
|
||||
import { checkPasswordApi, editPasswordApi } from '@/services/my.js'
|
||||
|
||||
const memberStore = useMemberStore() // 用户信息
|
||||
const showPassword_1 = ref(false) // 密码是否显示
|
||||
const showPassword_2 = ref(false) // 密码是否显示
|
||||
const showPassword_3 = ref(false) // 密码是否显示
|
||||
|
|
@ -130,9 +133,10 @@ const currenSteps = ref(0) // 步骤索引
|
|||
const countDownRef = ref(null) // 倒计时组件
|
||||
const editPasswordRef = ref(null) // 密码表单
|
||||
const editPasswordAgainRef = ref(null) // 重复密码表单
|
||||
|
||||
const editPasswordModel = ref({
|
||||
username: '',
|
||||
password: '',
|
||||
username: memberStore.userInfo.loginName || '',
|
||||
oldP: '',
|
||||
})
|
||||
const editPasswordAgainModel = ref({
|
||||
newPassword: '',
|
||||
|
|
@ -146,12 +150,20 @@ const editPasswordRules = ref({
|
|||
trigger: ['blur', 'change'],
|
||||
message: '请输入手机号',
|
||||
},
|
||||
{
|
||||
pattern: /^(1\d{10}|!Admin)$/,
|
||||
// 正则检验前先将值转为字符串
|
||||
transform(value) {
|
||||
return String(value)
|
||||
},
|
||||
message: '请填写正确手机号',
|
||||
},
|
||||
],
|
||||
password: [
|
||||
{
|
||||
required: true,
|
||||
trigger: ['blur', 'change'],
|
||||
message: '请输入密码',
|
||||
message: '请输入原密码',
|
||||
},
|
||||
],
|
||||
})
|
||||
|
|
@ -195,7 +207,25 @@ const onHandleNext = () => {
|
|||
.validate()
|
||||
.then(async (valid) => {
|
||||
if (valid) {
|
||||
currenSteps.value++
|
||||
console.log(
|
||||
'%c🔍 校验原密码请求入参 %c',
|
||||
'background: linear-gradient(90deg, #FF6B6B, #4ECDC4); color: white; padding: 5px 10px; border-radius: 5px; font-weight: bold;',
|
||||
'',
|
||||
editPasswordModel.value.oldP,
|
||||
)
|
||||
// 调后台接口判断原密码是否正确
|
||||
const res = await checkPasswordApi({ oldP: editPasswordModel.value.oldP })
|
||||
console.log(
|
||||
'%c🔍 校验原密码请求出参 %c',
|
||||
'background: linear-gradient(90deg, #FF6B6B, #4ECDC4); color: white; padding: 5px 10px; border-radius: 5px; font-weight: bold;',
|
||||
'',
|
||||
res,
|
||||
)
|
||||
if (res.code === 200) {
|
||||
currenSteps.value++
|
||||
} else {
|
||||
uni.$u.toast('验证失败' + res.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
|
|
@ -203,18 +233,41 @@ const onHandleNext = () => {
|
|||
})
|
||||
}
|
||||
// 确定
|
||||
const onHandleSubmit = async () => {
|
||||
const onHandleSubmit = () => {
|
||||
editPasswordAgainRef.value
|
||||
.validate()
|
||||
.then(async (valid) => {
|
||||
if (valid) {
|
||||
currenSteps.value++
|
||||
// 开启倒计时
|
||||
nextTick(() => {
|
||||
if (countDownRef.value) {
|
||||
countDownRef.value.start()
|
||||
}
|
||||
})
|
||||
// 调后台接口修改密码
|
||||
const editParams = {
|
||||
password: editPasswordAgainModel.value.newPassword,
|
||||
id: memberStore.userInfo.id,
|
||||
}
|
||||
console.log(
|
||||
'%c🔍 修改密码请求入参 %c',
|
||||
'background: linear-gradient(90deg, #FF6B6B, #4ECDC4); color: white; padding: 5px 10px; border-radius: 5px; font-weight: bold;',
|
||||
'',
|
||||
editParams,
|
||||
)
|
||||
const res = await editPasswordApi(editParams)
|
||||
console.log(
|
||||
'%c🔍 修改密码请求出参 %c',
|
||||
'background: linear-gradient(90deg, #FF6B6B, #4ECDC4); color: white; padding: 5px 10px; border-radius: 5px; font-weight: bold;',
|
||||
'',
|
||||
res,
|
||||
)
|
||||
|
||||
if (res.code === 200) {
|
||||
uni.$u.toast('密码修改成功')
|
||||
currenSteps.value++
|
||||
nextTick(() => {
|
||||
if (countDownRef.value) {
|
||||
countDownRef.value.start()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.$u.toast('修改失败' + res.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@
|
|||
|
||||
<view class="my-info-right">
|
||||
<view class="my-info-name">
|
||||
<text>用户名</text>
|
||||
<text class="my-info-name-job">项目经理</text>
|
||||
<text>{{ userInfo.username }}</text>
|
||||
<text class="my-info-name-job">{{ userInfo.roleName || '无' }}</text>
|
||||
</view>
|
||||
<view style="color: #999"> 139****5213 </view>
|
||||
<view style="color: #999"> {{ userInfo.loginName }} </view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -22,9 +22,9 @@
|
|||
<view class="my-info-list">
|
||||
<up-cell-group>
|
||||
<up-cell
|
||||
isLink
|
||||
size="large"
|
||||
title="修改密码"
|
||||
isLink
|
||||
class="edit-password"
|
||||
@tap="onEditPassWord"
|
||||
>
|
||||
|
|
@ -42,17 +42,21 @@
|
|||
title="温馨提示"
|
||||
:show="showModalLogout"
|
||||
:showCancelButton="true"
|
||||
content="是否确认退出当前账号?"
|
||||
@confirm="onConfirmLogout"
|
||||
@cancel="onCancelLogout"
|
||||
@confirm="onConfirmLogout"
|
||||
content="是否确认退出当前账号?"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { reactive, ref, watch } from 'vue'
|
||||
import { useMemberStore } from '@/stores'
|
||||
|
||||
const showModalLogout = ref(false)
|
||||
const memberStore = useMemberStore() // 用户信息
|
||||
|
||||
const userInfo = ref(memberStore.userInfo || {})
|
||||
|
||||
// 修改密码
|
||||
const onEditPassWord = () => {
|
||||
|
|
@ -66,8 +70,8 @@ const onLogOut = () => {
|
|||
}
|
||||
// 确认退出
|
||||
const onConfirmLogout = () => {
|
||||
uni.removeStorageSync('token')
|
||||
uni.removeStorageSync('userInfo')
|
||||
memberStore.clearUserInfo() // 清除用户信息
|
||||
memberStore.clearToken() // 清除token
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/index',
|
||||
})
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { useMemberStore } from '@/stores'
|
||||
import iconCard from './components/icon-card.vue'
|
||||
import icon_1 from '../../static/image/home_1.png'
|
||||
import icon_2 from '../../static/image/home_2.png'
|
||||
|
|
@ -16,6 +17,9 @@ import icon_4 from '../../static/image/home_4.png'
|
|||
import icon_5 from '../../static/image/home_5.png'
|
||||
import icon_6 from '../../static/image/home_6.png'
|
||||
|
||||
const memberStore = useMemberStore() // 用户信息
|
||||
const userPermissions = ref(memberStore.userInfo.permissions || [])
|
||||
|
||||
const iconList_1 = ref([
|
||||
{
|
||||
jumpPath: '/pages/safetyViolations/index',
|
||||
|
|
@ -50,12 +54,14 @@ const iconList_2 = ref([
|
|||
iconUrl: icon_6,
|
||||
},
|
||||
])
|
||||
|
||||
if (userPermissions.value.length > 0) {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.workbenches-container {
|
||||
// height: 100%;
|
||||
// height: 100vh;
|
||||
height: 100%;
|
||||
background-color: #f6f9ff;
|
||||
padding-bottom: 60px;
|
||||
overflow-y: auto;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,17 @@ export const loginApi = (data) => {
|
|||
return http({
|
||||
method: 'POST',
|
||||
url: '/imgTool/login',
|
||||
isEncrypt: true,
|
||||
data,
|
||||
header: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
})
|
||||
}
|
||||
// 获取用户信息
|
||||
export const getUserInfoApi = () => {
|
||||
return http({
|
||||
method: 'GET',
|
||||
url: '/imgTool/users/current',
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
import { http } from '@/utils/http'
|
||||
|
||||
// 原密码校验接口
|
||||
export const checkPasswordApi = (data) => {
|
||||
return http({
|
||||
method: 'POST',
|
||||
url: '/imgTool/users/checkPassword',
|
||||
data,
|
||||
header: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
})
|
||||
}
|
||||
// 修改密码
|
||||
export const editPasswordApi = (data) => {
|
||||
return http({
|
||||
method: 'POST',
|
||||
url: '/imgTool/users/password',
|
||||
data,
|
||||
header: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
// 加解密方法
|
||||
import CryptoJS from 'crypto-js'
|
||||
|
||||
const key = 'zhst@bonus@zhst@bonus@1234567890' // 加密密钥
|
||||
const utf8Key = CryptoJS.enc.Utf8.parse(key)
|
||||
|
||||
// AES 加密(UTF-8 处理)
|
||||
export const encrypt = (message) => {
|
||||
const utf8Message = CryptoJS.enc.Utf8.parse(message)
|
||||
const cbc_iv = CryptoJS.enc.Utf8.parse('1234567812345678')
|
||||
const encrypted = CryptoJS.AES.encrypt(utf8Message, utf8Key, {
|
||||
iv: cbc_iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7,
|
||||
})
|
||||
return encrypted.toString()
|
||||
}
|
||||
|
||||
// AES 解密
|
||||
export const decrypt = (encryptedBase64) => {
|
||||
const decrypted = CryptoJS.AES.decrypt(encryptedBase64, utf8Key, {
|
||||
iv: cbc_iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7,
|
||||
})
|
||||
return CryptoJS.enc.Utf8.stringify(decrypted)
|
||||
}
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
import { useMemberStore } from '@/stores'
|
||||
import { encrypt, decrypt } from './encrypt' // 引入加解密方法
|
||||
import { cloneDeep } from 'lodash-es' // 引入深拷贝函数
|
||||
|
||||
/**
|
||||
* 添加拦截器
|
||||
|
|
@ -19,6 +21,19 @@ const httpInterceptor = {
|
|||
options.url = baseURL + options.url
|
||||
}
|
||||
|
||||
if (options.isEncrypt) {
|
||||
if (options.data) {
|
||||
options.data = cloneDeep(options.data) // 参数深拷贝 避免影响视图
|
||||
for (const key in options.data) {
|
||||
options.data[key] = encrypt(options.data[key])
|
||||
}
|
||||
}
|
||||
} else {
|
||||
options.data = {
|
||||
encryptedData: encrypt(JSON.stringify(options.data)),
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 设置请求超时时间,默认为60s,设置为 10s
|
||||
options.timeout = 10000
|
||||
|
||||
|
|
@ -33,6 +48,7 @@ const httpInterceptor = {
|
|||
const token = memberStore.token
|
||||
if (token) {
|
||||
options.header.Authorization = token
|
||||
options.header.Token = token
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
@ -47,6 +63,7 @@ export const http = (options) => {
|
|||
...options,
|
||||
success(res) {
|
||||
// 1. 判断是否请求成功
|
||||
|
||||
if (res.statusCode >= 200 && res.statusCode < 300) {
|
||||
if (res.data.code >= 200 && res.data.code < 300) {
|
||||
resolve(res.data)
|
||||
|
|
@ -71,12 +88,13 @@ export const http = (options) => {
|
|||
}
|
||||
} else if (res.statusCode === 401) {
|
||||
// 2. 401 表示token过期 去往登录页重新登录
|
||||
const memberStore = useMemberStore()
|
||||
memberStore.clearUserInfo()
|
||||
memberStore.clearToken()
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/index',
|
||||
})
|
||||
// const memberStore = useMemberStore()
|
||||
// memberStore.clearUserInfo()
|
||||
// memberStore.clearToken()
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/login/index',
|
||||
// })
|
||||
uni.$u.toast(res.data.message)
|
||||
reject(res)
|
||||
} else {
|
||||
// 3. 其他错误
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
import { defineConfig } from 'vite'
|
||||
import removeConsole from 'vite-plugin-remove-console'
|
||||
import uni from '@dcloudio/vite-plugin-uni'
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [uni()],
|
||||
plugins: [uni(), removeConsole()],
|
||||
server: {
|
||||
proxy: {
|
||||
// 在此处编写代理规则
|
||||
'/api': {
|
||||
target: 'http://192.168.2.135:11997', // 梁超
|
||||
target: 'http://192.168.0.133:11997', // 梁超
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => {
|
||||
return path.replace(/\/api/, '')
|
||||
|
|
|
|||
Loading…
Reference in New Issue