|
@@ -56,10 +56,18 @@
|
|
|
<p>若长时间未跳转,请稍后重试</p>
|
|
<p>若长时间未跳转,请稍后重试</p>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <!-- 修改密码弹窗 -->
|
|
|
|
|
+ <ModernDialog
|
|
|
|
|
+ :closeOnClickOverlay="false"
|
|
|
|
|
+ v-model:show="showDialog"
|
|
|
|
|
+ title="提示"
|
|
|
|
|
+ :message="message"
|
|
|
|
|
+ />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
|
|
+import ModernDialog from '@/components/ModernDialog.vue'
|
|
|
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
|
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
|
|
import { useRoute } from 'vue-router'
|
|
import { useRoute } from 'vue-router'
|
|
|
import { showToast } from 'vant'
|
|
import { showToast } from 'vant'
|
|
@@ -69,6 +77,8 @@ const route = useRoute()
|
|
|
|
|
|
|
|
const progress = ref(10)
|
|
const progress = ref(10)
|
|
|
|
|
|
|
|
|
|
+const message = ref('')
|
|
|
|
|
+
|
|
|
const getPushRecordId = (): string => {
|
|
const getPushRecordId = (): string => {
|
|
|
const { pushRecordId } = route.query
|
|
const { pushRecordId } = route.query
|
|
|
|
|
|
|
@@ -96,7 +106,7 @@ const getMiniappLinkParams = (redirectUrl: string) => {
|
|
|
return {
|
|
return {
|
|
|
path: 'pages/index/index',
|
|
path: 'pages/index/index',
|
|
|
query: `redirect=${encodeURIComponent(redirectUrl)}`,
|
|
query: `redirect=${encodeURIComponent(redirectUrl)}`,
|
|
|
- envVersion: import.meta.env.VITE_APP_ENV === 'prod' ? 'release' : 'trial',
|
|
|
|
|
|
|
+ envVersion: 'release',
|
|
|
} as const
|
|
} as const
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -104,7 +114,8 @@ const redirectToMiniapp = async (): Promise<void> => {
|
|
|
const pushRecordId = getPushRecordId()
|
|
const pushRecordId = getPushRecordId()
|
|
|
|
|
|
|
|
if (!pushRecordId) {
|
|
if (!pushRecordId) {
|
|
|
- showToast('链接不完整或参数错误')
|
|
|
|
|
|
|
+ message.value = '链接不完整或参数错误'
|
|
|
|
|
+ showDialog.value = true
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -117,8 +128,8 @@ const redirectToMiniapp = async (): Promise<void> => {
|
|
|
showToast(res.msg || '跳转链接生成失败')
|
|
showToast(res.msg || '跳转链接生成失败')
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- window.location.href = res.data
|
|
|
|
|
|
|
+ // 跳转
|
|
|
|
|
+ window.location.replace(res.data)
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('[redirectToMiniapp] failed:', error)
|
|
console.error('[redirectToMiniapp] failed:', error)
|
|
|
showToast('页面跳转失败,请稍后重试')
|
|
showToast('页面跳转失败,请稍后重试')
|
|
@@ -170,11 +181,28 @@ const startProgress = (): void => {
|
|
|
}, 300)
|
|
}, 300)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-onMounted(() => {
|
|
|
|
|
|
|
+const showDialog = ref(false)
|
|
|
|
|
+
|
|
|
|
|
+const isMobile = (): boolean => {
|
|
|
|
|
+ const ua = navigator.userAgent.toLowerCase()
|
|
|
|
|
+ return /android|iphone|ipad|ipod|mobile|wechat|micromessenger/i.test(ua)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const init = async (): Promise<void> => {
|
|
|
|
|
+ if (!isMobile()) {
|
|
|
|
|
+ message.value =
|
|
|
|
|
+ '电脑无法访问本链接,请使用手机访问。如您已使用手机访问,请将您的默认浏览器的浏览器标识设置为“手机版”'
|
|
|
|
|
+ showDialog.value = true
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
startProgress()
|
|
startProgress()
|
|
|
- redirectToMiniapp()
|
|
|
|
|
-})
|
|
|
|
|
|
|
+ await redirectToMiniapp()
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
+onMounted(() => {
|
|
|
|
|
+ init()
|
|
|
|
|
+})
|
|
|
onBeforeUnmount(() => {
|
|
onBeforeUnmount(() => {
|
|
|
clearTimer()
|
|
clearTimer()
|
|
|
})
|
|
})
|