diff --git a/api/user/user.js b/api/user/user.js index 0dad437..da6c62f 100644 --- a/api/user/user.js +++ b/api/user/user.js @@ -1,6 +1,7 @@ import request from '@/utils/request' import { uploadFile } from '@/utils/request.js' +import { exp } from 'qrcode/lib/core/galois-field' /** * 获取用户信息 @@ -233,3 +234,9 @@ export function clearLocalUserId() { uni.removeStorageSync('userId') console.log('本地用户ID已清除') } + +export function getIsRealName() { + return request({ + url: '/app/user/isReal', + }) +} diff --git a/pages/index/index.vue b/pages/index/index.vue index 9213645..5aae8e6 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -59,6 +59,7 @@ import { getNewAnnouncement } from '../../api/article/article.js' import { getBannerList } from '../../api/banner/banner.js' import { getDeviceList } from '../../api/device/device.js' import { renewDevice, getPeriodPackages, getPeriodPackagesByTypeId } from '../../api/lease/lease.js' +import { getIsRealName } from '../../api' export default { components: { @@ -70,6 +71,7 @@ export default { data() { return { // 基础配置 + isRealName: false, indicatorDots: true, autoplay: true, interval: 2000, @@ -105,6 +107,7 @@ export default { this.fetchAnnouncement() this.fetchBannerList() this.fetchDeviceList() + this.goToRealName() }, onShow() { @@ -114,6 +117,25 @@ export default { }, methods: { + async goToRealName() { + const res = await getIsRealName() + if (!res.data) { + uni.showModal({ + title: '提示', + content: '需要租赁,请先实名', + showCancel: true, + confirmText: '去实名', + cancelText: '暂不', + success: function (res) { + if (res.confirm) { + uni.navigateTo({ + url: '/pages/realNameAuthentication/realNameAuthentication', + }) + } + }, + }) + } + }, // 获取最新公告 async fetchAnnouncement() { try {