Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
basic-uniapp-v3
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-uniapp-v3
Commits
1a838b31
提交
1a838b31
authored
11月 03, 2025
作者:
方治民
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 修复接口配置、退出登录后校验登录信息引起的错误
上级
12722441
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
149 行增加
和
132 行删除
+149
-132
.env.development
.env.development
+1
-1
App.vue
src/App.vue
+1
-15
manifest.json
src/manifest.json
+97
-103
login.vue
src/pages/login/login.vue
+11
-7
shouye.vue
src/pages/shouye/shouye.vue
+21
-0
user.ts
src/store/modules/user.ts
+16
-5
index.ts
src/utils/http/axios/index.ts
+2
-1
没有找到文件。
.env.development
浏览文件 @
1a838b31
...
...
@@ -3,4 +3,4 @@ VITE_GLOB_API_URL=http://111.22.182.169:49600
# VITE_GLOB_API_URL=http://36.133.16.81:42111
# API 接口地址前缀
VITE_GLOB_API_URL_PREFIX=/jeecg
-
boot
VITE_GLOB_API_URL_PREFIX=/jeecgboot
src/App.vue
浏览文件 @
1a838b31
...
...
@@ -2,12 +2,6 @@
import
{
onExit
}
from
'@dcloudio/uni-app'
import
{
isDevMode
}
from
'@/utils/env'
import
{
usePermissions
}
from
'@/hooks/app/usePermissions'
import
*
as
UserInfoAPI
from
'@/api/model/userInfo'
import
{
useDictStore
}
from
'@/store/modules/dict'
import
{
useUserStore
}
from
'@/store/modules/user'
const
userStore
=
useUserStore
()
const
dictStore
=
useDictStore
()
// import * as Push from '@/utils/push'
...
...
@@ -35,13 +29,6 @@
}
// #endif
})
function
getDictList
()
{
if
(
!
userStore
.
getToken
)
return
if
(
Object
.
keys
(
dictStore
.
getDictList
).
length
!==
0
)
return
UserInfoAPI
.
dictList
().
then
((
res
)
=>
{
dictStore
.
setDictList
(
res
)
})
}
onExit
(()
=>
{
// 停用监听权限
...
...
@@ -50,7 +37,6 @@
onShow
(()
=>
{
console
.
log
(
'App Show'
)
getDictList
()
})
onHide
(()
=>
{
...
...
@@ -58,7 +44,7 @@
})
onError
((
err
)
=>
{
//
Message.toast(`App Error: ${err}`)
Message
.
toast
(
`App Error:
${
err
}
`
)
console
.
error
(
'App Error:'
,
err
)
})
...
...
src/manifest.json
浏览文件 @
1a838b31
{
"name"
:
"数智农服"
,
"appid"
:
"__UNI__FD09823"
,
"description"
:
"数智农服 APP"
,
"versionName"
:
"1.0.6"
,
"versionCode"
:
10006
,
"transformPx"
:
false
,
"locale"
:
"zh-Hans"
,
"vueVersion"
:
"3"
,
/*
5
+App特有相关
*/
//
配置文件详细说明
"name"
:
"数智农服"
,
"appid"
:
"__UNI__FD09823"
,
"description"
:
"数智农服 APP"
,
"versionName"
:
"1.0.6"
,
"versionCode"
:
10006
,
"transformPx"
:
false
,
"locale"
:
"zh-Hans"
,
"vueVersion"
:
"3"
,
/*
5
+App特有相关
*///
配置文件详细说明
//
https
:
//uniapp.dcloud.net.cn/collocation/manifest-app.html#full-manifest
"app-plus"
:
{
"usingComponents"
:
true
,
"nvueCompiler"
:
"uni-app"
,
"nvueStyleCompiler"
:
"uni-app"
,
"nvueLaunchMode"
:
"fast"
,
"compilerVersion"
:
3
,
"splashscreen"
:
{
"alwaysShowBeforeRender"
:
false
,
"autoclose"
:
false
,
"waiting"
:
true
"app-plus"
:
{
"usingComponents"
:
true
,
"nvueCompiler"
:
"uni-app"
,
"nvueStyleCompiler"
:
"uni-app"
,
"nvueLaunchMode"
:
"fast"
,
"compilerVersion"
:
3
,
"splashscreen"
:
{
"alwaysShowBeforeRender"
:
false
,
"autoclose"
:
false
,
"waiting"
:
true
},
"screenOrientation"
:
[
"portrait-primary"
,
"landscape-primary"
],
"compatible"
:
{
"screenOrientation"
:
[
"portrait-primary"
,
"landscape-primary"
],
"compatible"
:
{
//
忽略版本提示
"ignoreVersion"
:
true
"ignoreVersion"
:
true
},
/*
模块配置
*/
"modules"
:
{
"Geolocation"
:
{},
"Camera"
:
{}
"modules"
:
{
"Geolocation"
:
{},
"Camera"
:
{},
"VideoPlayer"
:
{},
"Barcode"
:
{},
"Bluetooth"
:
{}
},
/*
应用发布信息
*/
"distribute"
:
{
"distribute"
:
{
/*
android打包配置
*/
"android"
:
{
"permissions"
:
[
"android"
:
{
"permissions"
:
[
"<uses-permission android:name=
\"
android.permission.CHANGE_NETWORK_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.MOUNT_UNMOUNT_FILESYSTEMS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.VIBRATE
\"
/>"
,
...
...
@@ -54,103 +54,97 @@
"<uses-feature android:name=
\"
android.hardware.camera
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WRITE_SETTINGS
\"
/>"
],
"permissionPhoneState"
:
{
"permissionPhoneState"
:
{
//
app首次启动关闭权限申请
"request"
:
"none"
"request"
:
"none"
},
"minSdkVersion"
:
23
,
"targetSdkVersion"
:
30
,
"abiFilters"
:
[
"armeabi-v7a"
,
"arm64-v8a"
]
"minSdkVersion"
:
23
,
"targetSdkVersion"
:
30
,
"abiFilters"
:
[
"armeabi-v7a"
,
"arm64-v8a"
]
},
/*
ios打包配置
*/
"ios"
:
{
"dSYMs"
:
false
,
"privacyDescription"
:
{
"NSUserTrackingUsageDescription"
:
"请放心,开启权限不会获取您在其他站点的隐私信息,该权限仅用于标识设备并保障服务安全与提示浏览体验"
,
"NSLocationAlwaysAndWhenInUseUsageDescription"
:
"该应用需要你的地理位置,以便检查你当前位置信息"
,
"NSLocationAlwaysUsageDescription"
:
"该应用需要你的地理位置,以便检查你当前位置信息"
,
"NSLocationWhenInUseUsageDescription"
:
"该应用需要你的地理位置,以便检查你当前位置信息"
,
"NSPhotoLibraryUsageDescription"
:
"请允许访问您的照片图库,以便能够上传应用异常问题的截图"
"ios"
:
{
"dSYMs"
:
false
,
"privacyDescription"
:
{
"NSUserTrackingUsageDescription"
:
"请放心,开启权限不会获取您在其他站点的隐私信息,该权限仅用于标识设备并保障服务安全与提示浏览体验"
,
"NSLocationAlwaysAndWhenInUseUsageDescription"
:
"该应用需要你的地理位置,以便检查你当前位置信息"
,
"NSLocationAlwaysUsageDescription"
:
"该应用需要你的地理位置,以便检查你当前位置信息"
,
"NSLocationWhenInUseUsageDescription"
:
"该应用需要你的地理位置,以便检查你当前位置信息"
,
"NSPhotoLibraryUsageDescription"
:
"请允许访问您的照片图库,以便能够上传应用异常问题的截图"
}
},
/*
SDK配置
*/
"sdkConfigs"
:
{
"ad"
:
{},
"statics"
:
{},
"geolocation"
:
{
"system"
:
{
"__platform__"
:
[
"ios"
,
"android"
]
"sdkConfigs"
:
{
"ad"
:
{},
"statics"
:
{},
"geolocation"
:
{
"system"
:
{
"__platform__"
:
[
"ios"
,
"android"
]
}
}
},
"icons"
:
{
"android"
:
{
"hdpi"
:
"unpackage/res/icons/72x72.png"
,
"xhdpi"
:
"unpackage/res/icons/96x96.png"
,
"xxhdpi"
:
"unpackage/res/icons/144x144.png"
,
"xxxhdpi"
:
"unpackage/res/icons/192x192.png"
"icons"
:
{
"android"
:
{
"hdpi"
:
"unpackage/res/icons/72x72.png"
,
"xhdpi"
:
"unpackage/res/icons/96x96.png"
,
"xxhdpi"
:
"unpackage/res/icons/144x144.png"
,
"xxxhdpi"
:
"unpackage/res/icons/192x192.png"
},
"ios"
:
{
"appstore"
:
"unpackage/res/icons/1024x1024.png"
,
"ipad"
:
{
"app"
:
"unpackage/res/icons/76x76.png"
,
"app@2x"
:
"unpackage/res/icons/152x152.png"
,
"notification"
:
"unpackage/res/icons/20x20.png"
,
"notification@2x"
:
"unpackage/res/icons/40x40.png"
,
"proapp@2x"
:
"unpackage/res/icons/167x167.png"
,
"settings"
:
"unpackage/res/icons/29x29.png"
,
"settings@2x"
:
"unpackage/res/icons/58x58.png"
,
"spotlight"
:
"unpackage/res/icons/40x40.png"
,
"spotlight@2x"
:
"unpackage/res/icons/80x80.png"
"ios"
:
{
"appstore"
:
"unpackage/res/icons/1024x1024.png"
,
"ipad"
:
{
"app"
:
"unpackage/res/icons/76x76.png"
,
"app@2x"
:
"unpackage/res/icons/152x152.png"
,
"notification"
:
"unpackage/res/icons/20x20.png"
,
"notification@2x"
:
"unpackage/res/icons/40x40.png"
,
"proapp@2x"
:
"unpackage/res/icons/167x167.png"
,
"settings"
:
"unpackage/res/icons/29x29.png"
,
"settings@2x"
:
"unpackage/res/icons/58x58.png"
,
"spotlight"
:
"unpackage/res/icons/40x40.png"
,
"spotlight@2x"
:
"unpackage/res/icons/80x80.png"
},
"iphone"
:
{
"app@2x"
:
"unpackage/res/icons/120x120.png"
,
"app@3x"
:
"unpackage/res/icons/180x180.png"
,
"notification@2x"
:
"unpackage/res/icons/40x40.png"
,
"notification@3x"
:
"unpackage/res/icons/60x60.png"
,
"settings@2x"
:
"unpackage/res/icons/58x58.png"
,
"settings@3x"
:
"unpackage/res/icons/87x87.png"
,
"spotlight@2x"
:
"unpackage/res/icons/80x80.png"
,
"spotlight@3x"
:
"unpackage/res/icons/120x120.png"
"iphone"
:
{
"app@2x"
:
"unpackage/res/icons/120x120.png"
,
"app@3x"
:
"unpackage/res/icons/180x180.png"
,
"notification@2x"
:
"unpackage/res/icons/40x40.png"
,
"notification@3x"
:
"unpackage/res/icons/60x60.png"
,
"settings@2x"
:
"unpackage/res/icons/58x58.png"
,
"settings@3x"
:
"unpackage/res/icons/87x87.png"
,
"spotlight@2x"
:
"unpackage/res/icons/80x80.png"
,
"spotlight@3x"
:
"unpackage/res/icons/120x120.png"
}
}
},
"splashscreen"
:
{
"useOriginalMsgbox"
:
true
"splashscreen"
:
{
"useOriginalMsgbox"
:
true
}
},
"uniStatistics"
:
{
"enable"
:
true
"uniStatistics"
:
{
"enable"
:
true
}
},
"uniStatistics"
:
{
"enable"
:
true
,
"version"
:
"2"
,
"debug"
:
true
"uniStatistics"
:
{
"enable"
:
true
,
"version"
:
"2"
,
"debug"
:
true
},
/*
快应用特有相关
*/
"quickapp"
:
{},
"quickapp"
:
{},
/*
小程序特有相关
*/
"mp-weixin"
:
{
"appid"
:
""
,
"setting"
:
{
"urlCheck"
:
false
"mp-weixin"
:
{
"appid"
:
""
,
"setting"
:
{
"urlCheck"
:
false
},
"usingComponents"
:
true
"usingComponents"
:
true
},
"mp-alipay"
:
{
"usingComponents"
:
true
"mp-alipay"
:
{
"usingComponents"
:
true
},
"mp-baidu"
:
{
"usingComponents"
:
true
"mp-baidu"
:
{
"usingComponents"
:
true
},
"mp-toutiao"
:
{
"usingComponents"
:
true
"mp-toutiao"
:
{
"usingComponents"
:
true
}
}
src/pages/login/login.vue
浏览文件 @
1a838b31
...
...
@@ -8,7 +8,7 @@
const
userStore
=
useUserStore
()
on
Load
(
async
()
=>
{
on
Show
(
async
()
=>
{
// 获取推送标识并设置 PushClientId 缓存
// uni.getPushClientId({
// success: (res) => {
...
...
@@ -37,6 +37,7 @@
// 跳转到登录页
goHome
()
Message
.
toast
(
`欢迎回来~`
)
}
else
{
// 关闭启动页并检查更新
try
{
...
...
@@ -59,7 +60,7 @@
show
:
false
,
isLogin
:
false
,
loading
:
false
,
text
:
''
,
text
:
defaultText
,
form
:
{
rules
:
[
{
...
...
@@ -128,7 +129,7 @@
// 打开登录页
goHome
()
Message
.
toast
(
`登录成功, 欢迎回来
!
`
)
Message
.
toast
(
`登录成功, 欢迎回来
~
`
)
}
else
{
Message
.
toast
(
body
.
message
)
return
false
...
...
@@ -153,7 +154,7 @@
// 添加欢迎登录的文字打字动态效果
let
loop
=
null
let
direction
=
'right'
const
count
=
ref
(
0
)
const
count
=
ref
(
defaultText
.
length
)
watch
(
()
=>
model
.
show
,
(
show
)
=>
{
...
...
@@ -185,9 +186,12 @@
},
)
onUnload
(()
=>
{
model
.
show
=
false
onHide
(()
=>
{
loop
&&
clearInterval
(
loop
)
loop
=
null
direction
=
'right'
count
.
value
=
0
model
.
show
=
false
})
function
onReadConfirm
(
val
)
{
...
...
@@ -392,7 +396,7 @@
//
position
:
absolute
;
//
left
:
40
rpx
;
//
bottom
:
40
rpx
;
font-size
:
40
rpx
;
font-size
:
38
rpx
;
color
:
#474747
;
display
:
flex
;
flex-direction
:
column
;
...
...
src/pages/shouye/shouye.vue
浏览文件 @
1a838b31
...
...
@@ -5,6 +5,12 @@
import
{
closeSplashscreenAndChechUpgrade
}
from
'@/utils/upgrade'
import
*
as
WeatherAPI
from
'@/api/model/weather'
import
*
as
HomeAPI
from
'@/api/model/home'
import
*
as
UserInfoAPI
from
'@/api/model/userInfo'
import
{
useDictStore
}
from
'@/store/modules/dict'
import
{
useUserStore
}
from
'@/store/modules/user'
const
userStore
=
useUserStore
()
const
dictStore
=
useDictStore
()
const
model
=
reactive
({
// 湖南省人民政府
...
...
@@ -47,6 +53,9 @@
},
})
// 获取字典数据
getDictList
()
// 查询金刚区数据
getServiceItems
()
getMenuItems
()
...
...
@@ -106,6 +115,18 @@
})
}
function
getDictList
()
{
if
(
!
userStore
.
getToken
)
{
return
}
if
(
Object
.
keys
(
dictStore
.
getDictList
).
length
!==
0
)
{
return
}
UserInfoAPI
.
dictList
().
then
((
res
)
=>
{
dictStore
.
setDictList
(
res
)
})
}
// 页面数据
const
pageData
=
reactive
({
// 顶部标题和搜索
...
...
src/store/modules/user.ts
浏览文件 @
1a838b31
import
{
defineStore
}
from
'pinia'
import
{
store
}
from
'/@/store'
import
{
useDictStore
}
from
'./dict'
import
{
Storage
}
from
'@/utils/storage'
import
{
TOKEN_KEY
,
USER_INFO_KEY
}
from
'@/enums/cacheEnum'
import
Navigate
from
'@/utils/page/navigate'
import
*
as
API
from
'/@/api/model/userInfo'
import
{
useDictStore
}
from
'./dict'
export
interface
UserInfo
{
id
:
string
...
...
@@ -37,6 +36,8 @@ export const useUserStore = defineStore({
this
.
token
=
token
return
token
}
return
null
},
getUserInfo
():
Nullable
<
UserInfo
>
{
if
(
this
.
userInfo
)
{
...
...
@@ -62,11 +63,19 @@ export const useUserStore = defineStore({
actions
:
{
setToken
(
token
:
string
)
{
this
.
token
=
token
Storage
.
set
(
TOKEN_KEY
,
token
)
if
(
!
token
)
{
Storage
.
remove
(
TOKEN_KEY
)
}
else
{
Storage
.
set
(
TOKEN_KEY
,
token
)
}
},
setUserInfo
(
info
:
UserInfo
)
{
this
.
userInfo
=
info
Storage
.
set
(
USER_INFO_KEY
,
info
?
JSON
.
stringify
(
info
)
:
null
)
if
(
!
info
)
{
Storage
.
remove
(
USER_INFO_KEY
)
}
else
{
Storage
.
set
(
USER_INFO_KEY
,
info
?
JSON
.
stringify
(
info
)
:
null
)
}
},
async
logout
()
{
if
(
this
.
loading
)
{
...
...
@@ -84,8 +93,10 @@ export const useUserStore = defineStore({
const
dictStore
=
useDictStore
(
store
)
dictStore
.
clearDict
()
await
Navigate
.
to
(
'/pages/login/login'
)
this
.
loading
=
false
uni
.
reLaunch
({
url
:
'/pages/login/login'
,
})
}
},
async
refreshUserInfo
()
{
...
...
src/utils/http/axios/index.ts
浏览文件 @
1a838b31
...
...
@@ -48,8 +48,9 @@ const transform: AxiosTransform = {
// 错误的时候返回
const
{
data
}
=
res
if
(
!
data
)
{
if
(
!
data
||
typeof
data
!==
'object'
)
{
// return '[HTTP] Request has no return value';
// Message.toast(`${JSON.stringify(options)} --- ${res.data}`)
throw
new
Error
(
t
(
'sys.api.apiRequestFailed'
))
}
// 这里 status,body,message为 后台统一的字段,需要在 types.ts 内修改为项目自己的接口返回格式
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论