|
|
@@ -35,6 +35,12 @@ import { computed, ref } from 'vue'
|
|
|
|
|
|
import { onShow } from '@dcloudio/uni-app'
|
|
|
|
|
|
+import {
|
|
|
+ getQuizPltTestResultApi,
|
|
|
+ resetPasswordApi,
|
|
|
+ stopSixtyReminderApi,
|
|
|
+} from '@/services/modules/userInfo'
|
|
|
+
|
|
|
import { useUserStore } from '@/stores/modules/user'
|
|
|
|
|
|
import HonestAgreementGate from './components/HonestAgreementGate.vue'
|
|
|
@@ -57,11 +63,23 @@ onShow(async () => {
|
|
|
uni.hideTabBar()
|
|
|
openHonestAgreementGate()
|
|
|
return
|
|
|
- } else {
|
|
|
- uni.showTabBar()
|
|
|
}
|
|
|
|
|
|
- console.log('qaq', userInfo)
|
|
|
+ // 超龄退出
|
|
|
+ if (userInfo.ageLimit) {
|
|
|
+ isAgeOverLimit()
|
|
|
+ }
|
|
|
+ // 超龄提醒
|
|
|
+ if (userInfo.ageReminder) {
|
|
|
+ notifyUpcomingAgeLimit()
|
|
|
+ }
|
|
|
+ // 平台合规测试
|
|
|
+ const res = await getPltQuizResult()
|
|
|
+ if (!res) return
|
|
|
+ // 密码修改提醒
|
|
|
+ checkLastChangePassword()
|
|
|
+ // 兜底处理
|
|
|
+ uni.showTabBar()
|
|
|
})
|
|
|
|
|
|
const ensureCanOperate = (): boolean => {
|
|
|
@@ -110,10 +128,104 @@ const handleSelectTask = (item: any) => {
|
|
|
// 业务判断
|
|
|
// 显示签署廉洁协议弹窗
|
|
|
const isHonestAgreementVisible = ref(false)
|
|
|
-
|
|
|
const openHonestAgreementGate = () => {
|
|
|
isHonestAgreementVisible.value = true
|
|
|
}
|
|
|
+
|
|
|
+// 年龄已超限
|
|
|
+const isAgeOverLimit = () => {
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ showCancel: false,
|
|
|
+ content: userStore?.currentUserInfo?.ageReminderInfo || '',
|
|
|
+ success() {
|
|
|
+ userStore.logout()
|
|
|
+ uni.reLaunch({
|
|
|
+ url: '/pages/login/index',
|
|
|
+ })
|
|
|
+ },
|
|
|
+ })
|
|
|
+}
|
|
|
+// 提前提醒年龄即将超限
|
|
|
+const notifyUpcomingAgeLimit = () => {
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ cancelText: '不再提醒',
|
|
|
+ confirmText: '确定',
|
|
|
+ content: userStore?.currentUserInfo?.ageReminderInfo || '',
|
|
|
+ async success(res) {
|
|
|
+ if (res.cancel) {
|
|
|
+ const res = await stopSixtyReminderApi()
|
|
|
+ if (res.code === 0 && res.data) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '不再弹出年龄提醒',
|
|
|
+ icon: 'none',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
+}
|
|
|
+const getPltQuizResult = async (): Promise<boolean> => {
|
|
|
+ const res = await getQuizPltTestResultApi()
|
|
|
+
|
|
|
+ if (res.code === 0) {
|
|
|
+ const { required, testResults } = res.data
|
|
|
+ const hasInvalidResult = testResults.some((item) => !item.valid)
|
|
|
+ const flag = required && hasInvalidResult
|
|
|
+ if (flag) {
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ cancelText: '暂不处理',
|
|
|
+ confirmText: '去测试',
|
|
|
+ content: '因平台合规升级,现需要您完成风险评估测试,请您认真作答。感谢您的配合!',
|
|
|
+ async success(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/quiz-plt-test/index',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (res.cancel) {
|
|
|
+ userStore.logout()
|
|
|
+ uni.reLaunch({
|
|
|
+ url: '/pages/login/index',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true
|
|
|
+}
|
|
|
+
|
|
|
+// 是否修改过密码
|
|
|
+const checkLastChangePassword = async () => {
|
|
|
+ const userInfo = userStore.currentUserInfo
|
|
|
+ if (!userInfo) return
|
|
|
+ const latestChangePwdTime = userInfo.latestChangePwdTime
|
|
|
+ const now = Date.now()
|
|
|
+ const ninetyDaysAgo = now - 90 * 24 * 60 * 60 * 1000
|
|
|
+ const lastChangeTime = new Date(latestChangePwdTime).getTime()
|
|
|
+
|
|
|
+ if (lastChangeTime < ninetyDaysAgo) {
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '您的登录密码长时间未修改,为保障账号安全,建议您及时修改密码!',
|
|
|
+ confirmText: '去修改',
|
|
|
+ cancelText: '暂不修改',
|
|
|
+ success: async (res) => {
|
|
|
+ if (res.confirm) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/reset-password/index',
|
|
|
+ })
|
|
|
+ } else if (res.cancel) {
|
|
|
+ resetPasswordApi(userInfo.userId)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|