无感登录

parent 746fd0ff
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
export {} export {}
declare global { declare global {
const EffectScope: typeof import('vue')['EffectScope'] const EffectScope: typeof import('vue')['EffectScope']
const closeToast: typeof import('vant/es')['closeToast']
const computed: typeof import('vue')['computed'] const computed: typeof import('vue')['computed']
const createApp: typeof import('vue')['createApp'] const createApp: typeof import('vue')['createApp']
const createRouter: typeof import('uni-mini-router')['createRouter'] const createRouter: typeof import('uni-mini-router')['createRouter']
...@@ -70,6 +71,7 @@ declare global { ...@@ -70,6 +71,7 @@ declare global {
const shallowReactive: typeof import('vue')['shallowReactive'] const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly'] const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef'] const shallowRef: typeof import('vue')['shallowRef']
const showLoadingToast: typeof import('vant/es')['showLoadingToast']
const showToast: typeof import('vant/es')['showToast'] const showToast: typeof import('vant/es')['showToast']
const toRaw: typeof import('vue')['toRaw'] const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef'] const toRef: typeof import('vue')['toRef']
......
{ {
"easycom": { "easycom": {
"autoscan": true, "autoscan": true,
"custom": { "custom": {
"^wd-(.*)": "wot-design-uni/components/wd-$1/wd-$1.vue" "^wd-(.*)": "wot-design-uni/components/wd-$1/wd-$1.vue"
} }
}, },
"pages": [ // pages 数组中第一项表示应用启动页 "pages": [ // pages 数组中第一项表示应用启动页
{ {
"path": "pages/home/index", "path": "pages/home/loading",
"name": "loading",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
},
{
"path": "pages/home/index",
"name": "home", "name": "home",
"style": { "style": {
"navigationBarTitleText": "甲秀图库", "navigationBarTitleText": "甲秀图库",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{ {
"path": "pages/classify/index", "path": "pages/classify/index",
"name": "classify", "name": "classify",
"style": { "style": {
"navigationBarTitleText": "分类", "navigationBarTitleText": "分类",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{ {
"path": "pages/mine/index", "path": "pages/mine/index",
"name": "mine", "name": "mine",
"style": { "style": {
"navigationBarTitleText": "个人中心", "navigationBarTitleText": "个人中心",
"navigationStyle": "custom" "navigationStyle": "custom"
}, },
"meta": { "meta": {
"requireAuth": true "requireAuth": true
} }
}, },
{ {
"path": "pages/home/content", "path": "pages/home/content",
"name": "home-content", "name": "home-content",
"style": { "style": {
"navigationBarTitleText": "图组详情" "navigationBarTitleText": "图组详情"
} }
}, },
{ {
"path": "pages/publish/index", "path": "pages/publish/index",
"name": "publish", "name": "publish",
"style": { "style": {
"navigationBarTitleText": "图组发布" "navigationBarTitleText": "图组发布"
} }
}, },
{ {
"path": "pages/publish/result", "path": "pages/publish/result",
"name": "publish-result", "name": "publish-result",
"style": { "style": {
"navigationBarTitleText": "发布结果" "navigationBarTitleText": "发布结果"
}, },
"meta": { "meta": {
"requireAuth": true "requireAuth": true
} }
}, },
{ {
"path": "pages/prefecture/index", "path": "pages/prefecture/index",
"name": "prefecture", "name": "prefecture",
"style": { "style": {
"navigationBarTitleText": "专区" "navigationBarTitleText": "专区"
}, },
"meta": { "meta": {
"requireAuth": true "requireAuth": true
} }
}, },
{ {
"path": "pages/subject/index", "path": "pages/subject/index",
"name": "subject", "name": "subject",
"style": { "style": {
"navigationBarTitleText": "专题" "navigationBarTitleText": "专题"
}, },
"meta": { "meta": {
"requireAuth": true "requireAuth": true
} }
}, },
{ {
"path": "pages/subject/list", "path": "pages/subject/list",
"name": "subject-list", "name": "subject-list",
"style": { "style": {
"navigationBarTitleText": "专题列表" "navigationBarTitleText": "专题列表"
}, },
"meta": { "meta": {
"requireAuth": true "requireAuth": true
} }
}, },
{ {
"path": "pages/account/login", "path": "pages/account/login",
"name": "account-login", "name": "account-login",
"style": { "style": {
"navigationBarTitleText": "登录" "navigationBarTitleText": "登录"
} }
}, },
{ {
"path": "pages/account/userinfo", "path": "pages/account/userinfo",
"name": "account-userinfo", "name": "account-userinfo",
"style": { "style": {
"navigationBarTitleText": "用户信息" "navigationBarTitleText": "用户信息"
}, },
"meta": { "meta": {
"requireAuth": true "requireAuth": true
} }
}, },
{ {
"path": "pages/classify/list", "path": "pages/classify/list",
"name": "classify-list", "name": "classify-list",
"style": { "style": {
"navigationBarTitleText": "分类列表" "navigationBarTitleText": "分类列表"
} }
} }
], ],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app", "navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#fff", "navigationBarBackgroundColor": "#fff",
"backgroundColor": "#F8F8F8", "backgroundColor": "#F8F8F8",
"app-plus": { "app-plus": {
"background": "#efeff4" "background": "#efeff4"
}, },
"navigationStyle": "custom" "navigationStyle": "custom"
}, },
"tabBar": { "tabBar": {
"color": "#707070", "color": "#707070",
"selectedColor": "#0E7CE3", "selectedColor": "#0E7CE3",
"borderStyle": "black", "borderStyle": "black",
"backgroundColor": "#ffffff", "backgroundColor": "#ffffff",
"list": [{ "list": [
"pagePath": "pages/home/index", {
"iconPath": "static/image/home.png", "pagePath": "pages/home/index",
"selectedIconPath": "static/image/home-select.png", "iconPath": "static/image/home.png",
"text": "首页" "selectedIconPath": "static/image/home-select.png",
}, { "text": "首页"
"pagePath": "pages/classify/index", },
"iconPath": "static/image/classify.png", {
"selectedIconPath": "static/image/classify-select.png", "pagePath": "pages/classify/index",
"text": "分类" "iconPath": "static/image/classify.png",
}, { "selectedIconPath": "static/image/classify-select.png",
"pagePath": "pages/mine/index", "text": "分类"
"iconPath": "static/image/mine.png", },
"selectedIconPath": "static/image/mine-select.png", {
"text": "我的" "pagePath": "pages/mine/index",
}] "iconPath": "static/image/mine.png",
} "selectedIconPath": "static/image/mine-select.png",
} "text": "我的"
}
]
}
}
\ No newline at end of file
...@@ -98,11 +98,10 @@ const login = async () => { ...@@ -98,11 +98,10 @@ const login = async () => {
message: '登录中', message: '登录中',
forbidClick: true, forbidClick: true,
duration: 0 duration: 0
}) })
const res = await loginByPassword(formData.value) const res = await loginByPassword(formData.value)
userStore.login(res) userStore.login(res)
closeToast() xma.closeToast()
showToast('登录成功') showToast('登录成功')
router.pushTab({ name: 'home' }) router.pushTab({ name: 'home' })
} }
...@@ -110,7 +109,8 @@ const login = async () => { ...@@ -110,7 +109,8 @@ const login = async () => {
const sgyLoginParams = ref({ const sgyLoginParams = ref({
appid: import.meta.env.VITE_APP_SGY_APPID, appid: import.meta.env.VITE_APP_SGY_APPID,
type: "sgy", type: "sgy",
encryptDataMap: {} encryptDataMap: {},
systemcode: import.meta.env.VITE_APP_SYSTEM_CODE
}) })
const fastLoginBySgy = () => { const fastLoginBySgy = () => {
xma.xh.getUserProfile({ xma.xh.getUserProfile({
......
<template>
<view class="loading"></view>
</template>
<script setup>
import { showToast, showLoadingToast, closeToast } from 'vant'
import testJson from '@/utils/test.json';
import useUserStore from '@/store/user'
import { loginBySgy } from '@/api/account'
const router = useRouter()
const userStore = useUserStore()
onLoad(async () => {
await fastLoginBySgy();
// if (userStore.logout) await signIn2();
router.pushTab({ name: 'home' })
});
const sgyLoginParams = ref({
appid: import.meta.env.VITE_APP_SGY_APPID,
type: "sgy",
encryptDataMap: {},
systemcode: import.meta.env.VITE_APP_SYSTEM_CODE
})
// 登录
const signIn2 = async () => {
showLoadingToast({
title: '加载中...',
mask: true,
});
sgyLoginParams.value.encryptDataMap = testJson
const res = await loginBySgy(sgyLoginParams.value)
console.log(res)
userStore.login(res)
closeToast()
};
const fastLoginBySgy = () => {
xma.showLoading({
title: '加载中',
mask: true,
});
xma.xh.getUserProfile({
range: ['ACCOUNT', 'MOBILE', 'CITIZEN'],
async success(info) {
showLoadingToast({
message: '登录中',
forbidClick: true,
duration: 0
})
sgyLoginParams.value.encryptDataMap = info.data
const res = await loginBySgy(sgyLoginParams.value)
userStore.login(res)
closeToast()
}
});
}
</script>
<style lang="scss" scoped></style>
...@@ -8,9 +8,10 @@ ...@@ -8,9 +8,10 @@
@click="router.push({ name: 'account-userinfo' })"> @click="router.push({ name: 'account-userinfo' })">
<div class="user"> <div class="user">
<div class="nickname">{{ userStore.userinfo.user.name }}</div> <div class="nickname">{{ userStore.userinfo.user.name }}</div>
<div class="section"> <div class="section" v-if="userStore.userinfo.organizeList">
{{ userStore.userinfo.organizeList[0]?.organName ?? '未知部门' }} {{ userStore.userinfo.organizeList[0].organName }}
</div> </div>
<div class="section" v-else>未知部门</div>
</div> </div>
<div class="exit"> <div class="exit">
<img src="../../static/image/exit.png" @click="logout"> <img src="../../static/image/exit.png" @click="logout">
......
{
"uIdCardNo": "042301C037638FD0B0DC2C7E686103340DBFD84737E9E4E881641B38533B751CF13A2DE635C0C3E4C16DB80C2635857106D416748FDE4915DF4960F95D75E219EAFDF34BE8F6052649678978164A2E44898C6108E9188ABBEABA16D576B9A9C2C4660BC190F73E4CB9921A6034F2E437F1F087",
"uMobile": "04E2B06A5932C633264C4E3460529C7884CBF1011FB544D7E5699C9D829ECA72209667C1A9652C79D342D37EDF42758CC228B3CE0F13C829205D83D33411BAD92126F684690B90D4CBBCE469D70720D535A2B1AD0113CD5F3039763B87BCA11D5856F496283F0626C0F0924A",
"uName": "0452A3DEF6FB3C45F07705C062BC59A3F3FCD1769BAE16A9F75D7FE597AC6688DC3CFCCAF523518568F474600EC34991695E9C3857094CC4CB32850FF112F9960B9D0CF7D293C39591A22C77F16D2E670754D647E3B363440887239A6870C288BEE266C3A561EEA93881",
"uNickname": "041C4CC7295ACC5012A29DC19F7E3643E897B8025A9D464B3C6B9A0FEA6BA10DF11AC8F91F7EC4B4D954DEE77CCB21B7A2C28F67A496121663183038E5D4C99BA8FD10F45563030F1936100FE19CB4553358172E5B1F5E3E9F300F97D086DB17C5D7B9C244C2503D9D7E2DC5DC0528E43025B2134CF48E2C1279EA8473B434C495DF06",
"uid": "049322D0BAD3EC033D477CCB9A10A2B031F87E38B59B6E8E104F91AD7C8973BAD23AE3941F81F2401C1E21C862933E10245EC0F0452AB133431F2006986FCEBDA6179119555D46CCFF1752654C3DA85EA68E3A125B4B46FF6F9030064F0E26179F0E3B5BAC5116205DA7B1E8852EFDB78DA54F38A36D0DE5A3EE31F2A24030AFE1"
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment