第三方app跳转
This commit is contained in:
1 parent
06f5ebd9be
commit
dee8d2e21f
6 files changed
+81
-27
No files matched your search
+3
-2
@@ -139,8 +139,6 @@ export default {
|
||||
async onLaunch() {
|
||||
if (isDevEnv()) return
|
||||
|
||||
uni.setNavigationBarTitle({ title: "" })
|
||||
|
||||
// 环境判断
|
||||
const appInfo = await getAppInfo()
|
||||
if (appInfo == "zzd") {
|
||||
@@ -155,6 +153,9 @@ export default {
|
||||
case "coopMerchant":
|
||||
uni.switchTab({ url: "/pages/tabbar/coopMerchant" })
|
||||
break
|
||||
case "thirdApp":
|
||||
uni.navigateTo({ url: "/pages/thirdApp/thirdAppList" })
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
@@ -16,14 +16,44 @@
|
||||
>
|
||||
<view class="h-20rpx" />
|
||||
<view class="flex-row card p-20rpx m-b-20rpx" v-for="(v, i) in pageHook.list" :key="i" @tap="toDetail(v)">
|
||||
<image class="w-180rpx h-180rpx rounded-12rpx" :src="filePath(v.logoPic)" mode="aspectFill" />
|
||||
<image class="w-180rpx h-180rpx rounded-12rpx my-auto" :src="filePath(v.logoPic)" mode="aspectFill" />
|
||||
<view class="flex-1 flex-col m-l-20rpx">
|
||||
<view class="flex-row items-center justify-between">
|
||||
<!-- <view class="flex-row-center sub-text-34">{{ v.name }}</view> -->
|
||||
<view class="sub-text-34">
|
||||
<text class="mr-2">{{ v.name }}</text>
|
||||
<!-- <tm-tag v-if="v.supType == '10' && Number(v.mchCount) > 0" size="xs" skin="thin">共{{ v.mchCount }}家</tm-tag> -->
|
||||
</view>
|
||||
<view class="m-t-10rpx">
|
||||
<view class="flex justify-between items-center">
|
||||
<view>
|
||||
<view v-if="v.phone" class="flex items-center">
|
||||
<image class="w-24rpx h-24rpx" src="@/static/page/phone.svg" />
|
||||
<view class="second-text-28 ml-1">{{ v.phone }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<tm-tag size="xs">{{ v.deptName.length > 5 ? v.deptName.substring(0, 5) + "..." : v.deptName }}</tm-tag>
|
||||
</view>
|
||||
<view v-if="v.addressDes" class="second-text-28">
|
||||
<image class="w-24rpx h-24rpx" src="@/static/page/address.svg" />
|
||||
<text class="ml-1">地址:</text>
|
||||
<text class="m-l-10rpx">{{ v.addressDes }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="second-text-24"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<tm-modal
|
||||
v-model:show="state.show"
|
||||
:overlayClick="false"
|
||||
title="注意"
|
||||
position="bottom"
|
||||
:showCancel="true"
|
||||
cancelText="取消"
|
||||
confirmText="继续访问"
|
||||
@confirm="thirdAppJump()"
|
||||
@cancel="state.show = false"
|
||||
>
|
||||
<tm-text font-size="30" color="#999999">您即将离开智慧后勤应用并跳转到第三方应用,请注意账号财产安全</tm-text>
|
||||
</tm-modal>
|
||||
</z-paging>
|
||||
</crud-layout>
|
||||
</template>
|
||||
@@ -35,7 +65,13 @@ import { hooks, router } from "@@/index"
|
||||
import { merchantApi } from "@@/api"
|
||||
import { filePath } from "@@/utils/file"
|
||||
|
||||
const state = reactive<any>({})
|
||||
const params = reactive<any>({
|
||||
type: "4",
|
||||
})
|
||||
|
||||
const state = reactive({
|
||||
show: false,
|
||||
})
|
||||
|
||||
onLoad(() => {
|
||||
const app = getApp()
|
||||
@@ -50,13 +86,30 @@ onShow(() => {
|
||||
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, state.pa)
|
||||
pageHook.startPage(page, pagesize, false, params)
|
||||
}
|
||||
|
||||
const toDetail = async (v: any) => {
|
||||
const isLogin = await hooks.useCheckLogin()
|
||||
if (isLogin) {
|
||||
router.jump("", { id: v.id })
|
||||
state.show = true
|
||||
}
|
||||
}
|
||||
|
||||
// 确认或拒绝协议
|
||||
const thirdAppJump = async () => {
|
||||
try {
|
||||
uni.showLoading({ title: "跳转中", mask: true })
|
||||
const res: any = await merchantApi.lbLogin()
|
||||
if (res.code == 0) {
|
||||
state.show = 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>
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { defineProps, computed } from "vue"
|
||||
import { computed } from "vue"
|
||||
import { router } from "@@/index"
|
||||
|
||||
const props = defineProps({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { defineProps, computed } from "vue"
|
||||
import { computed } from "vue"
|
||||
import { router } from "@@/index"
|
||||
|
||||
const props = defineProps({
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
<script setup lang="ts">
|
||||
import { defineProps, withDefaults } from "vue";
|
||||
import { withDefaults } from "vue"
|
||||
|
||||
export interface Props {
|
||||
type: "top" | "bottom";
|
||||
bgColor: string;
|
||||
type: "top" | "bottom"
|
||||
bgColor: string
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
type: "top",
|
||||
bgColor: "transparent",
|
||||
});
|
||||
type: "top",
|
||||
bgColor: "transparent",
|
||||
})
|
||||
|
||||
function getHeight() {
|
||||
const { top, bottom } = uni.getSystemInfoSync().safeAreaInsets!;
|
||||
if (props.type && props.type === "bottom") {
|
||||
return bottom + "px";
|
||||
}
|
||||
return top + "px";
|
||||
const { top, bottom } = uni.getSystemInfoSync().safeAreaInsets!
|
||||
if (props.type && props.type === "bottom") {
|
||||
return bottom + "px"
|
||||
}
|
||||
return top + "px"
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="safe" :style="{ backgroundColor: props.bgColor, height: getHeight() }"></view>
|
||||
<view class="safe" :style="{ backgroundColor: props.bgColor, height: getHeight() }"></view>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.safe-top {
|
||||
width: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -1,6 +1,6 @@
|
||||
// 获取启动参数
|
||||
const getLaunchParam = (): "canteen" | "selfMerchant" | "coopMerchant" | null => {
|
||||
return new URL(window.location.href).searchParams.get("launchParam") as "canteen" | "selfMerchant" | "coopMerchant" | null
|
||||
const getLaunchParam = (): "canteen" | "selfMerchant" | "coopMerchant" | "thirdApp" | null => {
|
||||
return new URL(window.location.href).searchParams.get("launchParam") as "canteen" | "selfMerchant" | "coopMerchant" | "thirdApp" | null
|
||||
}
|
||||
|
||||
export default getLaunchParam
|
||||
Reference in new issue
Block a user