fix:共富商场适配钉钉

This commit is contained in:
dzc committed 2026-08-21 10:00:41 +08:00
1 parent b6ed5de9cd
commit c7e94097c4
2 files changed
+116 -1

No files matched your search

+12 -1
View File
@@ -533,6 +533,17 @@
}
]
},
{
"root": "pages/third-app",
"pages": [
{
"path": "happyMall",
"style": {
"navigationBarTitleText": "美好商城"
}
}
]
},
{
"root": "pages/integrated",
"pages": [
@@ -753,4 +764,4 @@
}
]
}
}
}
+104
View File
@@ -0,0 +1,104 @@
<template>
<crud-layout mainIsScroll bg="/static/page/blue-bg.png">
<view class="w-full text-center mt-20">
<image src="@/static/page/happyMall.png" class="rounded-full w-1/3" mode="widthFix" />
<view>美好商城</view>
<view v-if="loginError" class="second-text-28 m-t-20rpx" style="color: #e54d42; padding: 0 40rpx">
{{ loginError }}
</view>
<view class="h-100rpx" />
<tm-button v-if="!loginError" @click="show = true">继续跳转</tm-button>
<tm-button v-else @click="retryLogin">清除缓存并重试</tm-button>
</view>
<tm-modal v-model:show="show" :overlayClick="false" title="注意" position="bottom" height="auto"
:showCancel="true" cancelText="取消" confirmText="继续访问" @confirm="thirdAppJump()" @cancel="show = false">
<tm-text font-size="30" color="#999999">
您即将离开智慧后勤应用并跳转到第三方应用,请注意个人隐私和账号财产安全。您通过第三方服务页面主动提供给第三方商户的个人信息,相关信息保护责任由第三方商户承担。
</tm-text>
</tm-modal>
</crud-layout>
</template>
<script setup lang="ts">
import { ref } from "vue"
import { onLoad } from "@dcloudio/uni-app"
import { merchantApi } from "@@/api"
import { clearBizSession, ensureBizLogin, recoverBizSession } from "@@/utils/request"
// import { filePath } from "@@/utils/file"
// const params = reactive<any>({
// type: "4",
// })
const show = ref(false)
const loginError = ref("")
const ensureLoginAndMaybeOpen = async (autoOpenModal: boolean) => {
loginError.value = ""
try {
const ok = await ensureBizLogin()
if (ok) {
if (autoOpenModal) show.value = true
return
}
loginError.value = "登录失败,可点下方清除缓存后重试"
} catch (e: any) {
loginError.value = (e && e.message) || "登录异常,请重试"
}
}
const retryLogin = async () => {
loginError.value = ""
try {
clearBizSession({ clearRole: true })
const ok = await recoverBizSession()
if (ok) {
show.value = true
return
}
loginError.value = "仍无法登录,请关闭后从工作台重新进入"
} catch (e: any) {
loginError.value = (e && e.message) || "登录异常,请重试"
}
}
onLoad(async () => {
// 门户直接跳本页时本地未必有 token,需主动走浙政钉/诗画登录,不能只用 useCheckLogin 静默判断
await ensureLoginAndMaybeOpen(true)
})
// onShow(() => {
// if (pageRef.value) pageRef.value.reload(false)
// })
// const pageRef = ref<any>(null)
// const pageHook = hooks.usePage(pageRef, merchantApi.page, null, "data.records")
// const query = (page: number, pagesize: number) => {
// pageHook.startPage(page, pagesize, false, params)
// }
// const toDetail = async (v: any) => {
// const isLogin = await hooks.useCheckLogin()
// if (isLogin) {
// state.show = true
// }
// }
// 确认或拒绝协议
const thirdAppJump = async () => {
try {
uni.showLoading({ title: "跳转中", mask: true })
const res: any = await merchantApi.lbLogin()
if (res.code == 0) {
show.value = false
if (!res.data) return uni.showToast({ title: "url错误", icon: "none" })
window.location.href = res.data
}
} catch (error: any) {
uni.showToast({ title: error, icon: "none" })
} finally {
uni.hideLoading()
}
}
</script>