feat:增加tabbar
This commit is contained in:
1 parent
cc39f190d0
commit
108521704f
47 files changed
+201
-79
No files matched your search
@@ -3,7 +3,8 @@ import { ref, reactive, computed } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { isEmpty } from "radash"
|
||||
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { boxesApi } from "@@/api"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
|
||||
const emit = defineEmits(["update:modelValue", "add", "remove"])
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { hooks } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
|
||||
const emit = defineEmits(["submit", "doContainer"])
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ import { reactive, nextTick } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { isEmpty } from "radash"
|
||||
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { merchantApi, foodApi, payApi, orderApi } from "@@/api"
|
||||
import { filePath } from "@@/utils/file"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
|
||||
@@ -4,7 +4,8 @@ import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { isEmpty } from "radash"
|
||||
import dayjs from "dayjs"
|
||||
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { foodApi } from "@@/api"
|
||||
import zTabs from "@@/components/other/z-tabs/z-tabs.vue"
|
||||
import CustomWaterfallsFlow from "@@/components/other/custom-waterfalls-flow/custom-waterfalls-flow.vue"
|
||||
|
||||
@@ -5,7 +5,7 @@ import { isEmpty } from "radash"
|
||||
|
||||
import { productApi } from "@@/api"
|
||||
import { filePath } from "@@/utils/file"
|
||||
import { hooks } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
|
||||
const state = reactive<any>({
|
||||
|
||||
@@ -3,7 +3,8 @@ import { ref, reactive } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import PlateNum from "@@/components/tongtong-plate/plate-number.vue";
|
||||
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { userCarApi } from "@@/api"
|
||||
import { serviceEnum } from "@/sheep/constant"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
@@ -110,4 +111,4 @@ const doSubmit = async () => {
|
||||
padding-bottom: 10rpx !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -2,7 +2,8 @@
|
||||
import { ref, reactive } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { userCarApi } from "@@/api"
|
||||
import { serviceEnum } from "@/sheep/constant"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
@@ -79,4 +80,4 @@ const doApply = () => {
|
||||
</template>
|
||||
</z-paging>
|
||||
</crud-layout>
|
||||
</template>
|
||||
</template>
|
||||
@@ -3,7 +3,8 @@ import { ref, reactive } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { isEmpty } from "radash"
|
||||
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { faceApi } from "@@/api"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
import { ref, reactive } from "vue"
|
||||
import { onShow } from "@dcloudio/uni-app"
|
||||
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { faceApi } from "@@/api"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
import { ref, computed, onMounted, watch, nextTick } from 'vue'
|
||||
import { onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
|
||||
|
||||
import { hooks } from '@@/index'
|
||||
import * as hooks from '@@/hooks'
|
||||
|
||||
import maintenanceApi from '@/sheep/api/maintenance'
|
||||
import { filePath } from '@/sheep/utils/file'
|
||||
|
||||
@@ -113,7 +113,8 @@ import { onShow } from "@dcloudio/uni-app"
|
||||
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
import { filePath } from "@@/utils/file"
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import zTabs from "@@/components/other/z-tabs/z-tabs.vue"
|
||||
import { invitationApi } from "@/sheep/api"
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
import { ref, reactive } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { merchantApi } from "@@/api"
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { filePath } from "@@/utils/file"
|
||||
|
||||
const pageRef = ref<any>(null)
|
||||
|
||||
@@ -54,7 +54,7 @@ import { reactive, ref } from "vue"
|
||||
import zTabs from "@@/components/other/z-tabs/z-tabs.vue"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
import { filePath } from "@@/utils/file"
|
||||
import { hooks } from "@/sheep"
|
||||
import * as hooks from "@@/hooks"
|
||||
|
||||
const tabs = [
|
||||
{ id: null, name: "全部", disabled: false, color: "#7f7f7f77" },
|
||||
|
||||
@@ -119,7 +119,8 @@
|
||||
import { reactive, nextTick } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { isEmpty } from "radash"
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { foodApi, merchantApi, orderApi, payApi, shopApi } from "@@/api"
|
||||
import { filePath } from "@@/utils/file"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
|
||||
@@ -87,7 +87,8 @@ import { reactive, ref, nextTick } from "vue"
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
|
||||
import { actCancel, actComApi, actCouponApi, userApi } from "@/sheep/api"
|
||||
import { hooks, router } from "@/sheep"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { serviceEnum, storageConstant, SERVICE_IMAGE } from "@@/constant"
|
||||
import { filePath } from "@@/utils/file"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { reactive, ref, computed } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
|
||||
import { router } from "@/sheep"
|
||||
import * as router from "@@/router"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
import { filePath } from "@@/utils/file"
|
||||
|
||||
@@ -10,7 +10,7 @@ import uqrcode from "@@/utils/uqrcode"
|
||||
import * as CryptoJS from "crypto-js"
|
||||
|
||||
import { actCancel, actComApi, actCouponApi, applyApi } from "@@/api"
|
||||
import { hooks } from "@/sheep"
|
||||
import * as hooks from "@@/hooks"
|
||||
import { serviceEnum } from "@@/constant"
|
||||
|
||||
import zTabs from "@@/components/other/z-tabs/z-tabs.vue"
|
||||
|
||||
@@ -3,7 +3,8 @@ import { reactive } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { isEmpty } from "radash"
|
||||
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { orderApi, refundApi } from "@@/api"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
|
||||
import payApi from "@@/api/pay"
|
||||
import { merchantApi, orderApi, walletApi } from "@/sheep/api"
|
||||
import { hooks } from "@@/index"
|
||||
import { router } from "@/sheep"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { filePath } from "@/sheep/utils/file"
|
||||
import { displayPrice, storePrice } from "@/sheep/utils/format-money"
|
||||
import { usePayStore } from "@/sheep/stores/pay"
|
||||
|
||||
@@ -67,7 +67,8 @@ import { ref, computed, reactive } from "vue"
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
import NumberKeyboard from "@/sheep/components/number-keyboard.vue"
|
||||
import { payApi, walletApi } from "@/sheep/api"
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { filePath } from "@/sheep/utils/file"
|
||||
import { storePrice } from "@/sheep/utils/format-money"
|
||||
import { usePayStore } from "@/sheep/stores/pay"
|
||||
|
||||
@@ -63,7 +63,7 @@ import { onLoad } from "@dcloudio/uni-app"
|
||||
import { reactive, ref } from "vue"
|
||||
import NodeTree from "@/sheep/components/node-tree.vue"
|
||||
import { useCategaryManage } from "./use-categary-manage"
|
||||
import { hooks } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import { filePath } from "@/sheep/utils/file"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<script setup lang="ts">
|
||||
import { filePath } from "@/sheep/utils/file"
|
||||
import { SERVICE_IMAGE } from "@/sheep/constant/index"
|
||||
import { hooks } from "@/sheep"
|
||||
import * as hooks from "@@/hooks"
|
||||
|
||||
import useCartBuy from "../use-cart-buy"
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { hooks } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import useCartBuy from "../use-cart-buy"
|
||||
|
||||
const emit = defineEmits(["submit", "doContainer"])
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, watch } from "vue"
|
||||
import { hooks } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
|
||||
import { prosperityShopApi } from "@/sheep/api"
|
||||
import ShopCategaryPicker from "@/sheep/components/shop-categary-picker.vue"
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
import { reactive, ref } from "vue"
|
||||
|
||||
import { prosperityShopApi } from "@/sheep/api"
|
||||
import { hooks } from "@/sheep"
|
||||
import * as hooks from "@@/hooks"
|
||||
import { filePath } from "@/sheep/utils/file"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { displayPrice } from "@/sheep/utils/format-money"
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { hooks } from "@/sheep"
|
||||
import * as hooks from "@@/hooks"
|
||||
import { prosperityShopApi } from "@/sheep/api"
|
||||
import { reactive, ref } from "vue"
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, reactive, ref } from "vue"
|
||||
|
||||
import { hooks } from "@/sheep"
|
||||
import * as hooks from "@@/hooks"
|
||||
import useCartBuy from "./use-cart-buy"
|
||||
import { filePath } from "@/sheep/utils/file"
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { ref, reactive, computed, nextTick, onMounted } from "vue"
|
||||
import { onHide, onShow } from "@dcloudio/uni-app"
|
||||
|
||||
import { router } from "@@/index"
|
||||
import { router, constant } from "@@/index"
|
||||
import { noticeApi, appApi } from "@@/api/index"
|
||||
import { getAppInfo } from "@@/utils/app"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
@@ -25,12 +25,14 @@ const state = reactive<any>({
|
||||
appMenuList: [],
|
||||
})
|
||||
const groupSize = 3
|
||||
const shouldScroll = computed(() => state.noticeList.length > groupSize)
|
||||
const noticeListSafe = computed(() => (Array.isArray(state.noticeList) ? state.noticeList : []).filter(Boolean))
|
||||
const appMenuListSafe = computed(() => (Array.isArray(state.appMenuList) ? state.appMenuList : []).filter(Boolean))
|
||||
const shouldScroll = computed(() => noticeListSafe.value.length > groupSize)
|
||||
|
||||
const groupedNoticeList = computed(() => {
|
||||
const base = state.noticeList
|
||||
const base = noticeListSafe.value
|
||||
if (!base || base.length === 0) return []
|
||||
if (base.length <= groupSize) return base
|
||||
if (base.length <= groupSize) return [base]
|
||||
const groups: any[] = []
|
||||
for (let i = 0; i < base.length; i += groupSize) {
|
||||
const group = base.slice(i, i + groupSize)
|
||||
@@ -61,6 +63,7 @@ onHide(() => {
|
||||
})
|
||||
|
||||
const doMenu = async (v: any) => {
|
||||
if (!v) return
|
||||
if (v.page.includes("thirdApp")) {
|
||||
router.jump("/pages/third-app/happyMall")
|
||||
return
|
||||
@@ -79,7 +82,7 @@ const getNoticeList = async () => {
|
||||
if (code != 0) {
|
||||
throw new Error()
|
||||
}
|
||||
state.noticeList = data?.records || []
|
||||
state.noticeList = (data?.records || []).filter(Boolean)
|
||||
} catch (error) {
|
||||
console.log("获取通知公告列表意外的错误error:", error);
|
||||
}
|
||||
@@ -97,7 +100,7 @@ const getAppMenuList = async () => {
|
||||
if (code != 0) {
|
||||
throw new Error()
|
||||
}
|
||||
state.appMenuList = data || []
|
||||
state.appMenuList = (data || []).filter(Boolean)
|
||||
} catch (error) {
|
||||
console.log("获取应用菜单列表意外的错误error:", error);
|
||||
}
|
||||
@@ -105,7 +108,7 @@ const getAppMenuList = async () => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<crud-layout title="智慧后勤系统" :bg="filePath(SERVICE_IMAGE.blueBg)" ref="crudLayoutRef">
|
||||
<crud-layout title="智慧后勤系统" mainIsScroll :bg="filePath(SERVICE_IMAGE.blueBg)" ref="crudLayoutRef">
|
||||
<view class="h-20rpx" />
|
||||
<swiper class="w-full h-280rpx rounded-16rpx overflow-hidden" circular :indicator-dots="true"
|
||||
indicator-active-color="#0779FD" indicator-color="#ffffff" :autoplay="true">
|
||||
@@ -125,7 +128,7 @@ const getAppMenuList = async () => {
|
||||
查看更多
|
||||
</view>
|
||||
<view class="w-full h-50rpx" />
|
||||
<view class="h-300rpx overflow-hidden" v-if="state?.noticeList?.length > 0">
|
||||
<view class="h-300rpx overflow-hidden" v-if="noticeListSafe.length > 0">
|
||||
<swiper class="w-full h-full" :vertical="true" :circular="shouldScroll" :autoplay="shouldScroll"
|
||||
:interval="2500" :duration="500" :indicator-dots="false" :disable-touch="true">
|
||||
<swiper-item v-for="(group, i) in groupedNoticeList" :key="i">
|
||||
@@ -151,13 +154,13 @@ const getAppMenuList = async () => {
|
||||
常用功能
|
||||
</view>
|
||||
<view class="w-full h-50rpx" />
|
||||
<view v-if="state?.appMenuList?.length > 0">
|
||||
<view v-if="appMenuListSafe.length > 0">
|
||||
<view class="grid grid-cols-3 h-full items-center gap-y-30rpx p-y-30rpx">
|
||||
<view class="flex flex-col items-center justify-center" v-for="(v, i) in state.appMenuList" :key="i"
|
||||
<view class="flex flex-col items-center justify-center" v-for="(v, i) in appMenuListSafe" :key="i"
|
||||
@tap="doMenu(v)">
|
||||
<view class="flex-col-center">
|
||||
<image class="size-100rpx" :src="filePath(v.icon)" mode="aspectFill" />
|
||||
<view class="m-t-10rpx sub-text-26">{{ v.title }}</view>
|
||||
<image class="size-100rpx" :src="filePath(v?.icon)" mode="aspectFill" />
|
||||
<view class="m-t-10rpx sub-text-26">{{ v?.title || "" }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -166,6 +169,7 @@ const getAppMenuList = async () => {
|
||||
<empty text="暂无App" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="h-30rpx" />
|
||||
</crud-layout>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, nextTick } from "vue"
|
||||
import { hooks, router } from "@/sheep"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { doorApi } from "@/sheep/api"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { filePath } from "@@/utils/file"
|
||||
|
||||
@@ -3,7 +3,9 @@ import { ref, reactive, nextTick, onMounted } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import dayjs from "dayjs"
|
||||
|
||||
import { hooks, router, constant } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import * as constant from "@@/constant"
|
||||
import { accessStatsApi, merchantApi } from "@@/api"
|
||||
import { filePath } from "@@/utils/file"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
@@ -81,4 +83,4 @@ const toDetail = async (v: any) => {
|
||||
</template>
|
||||
</z-paging>
|
||||
</crud-layout>
|
||||
</template>
|
||||
</template>
|
||||
@@ -83,7 +83,7 @@ import { ref, onMounted, nextTick } from "vue"
|
||||
|
||||
import qiunDataCharts from "@/components/qiun-data-charts/qiun-data-charts.vue"
|
||||
import { totalApi } from "@/sheep/api"
|
||||
import { hooks } from "@/sheep"
|
||||
import * as hooks from "@@/hooks"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
import { filePath } from "@@/utils/file"
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ import { ref, reactive, onMounted, nextTick } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
|
||||
import { merchantApi } from "@@/api"
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { filePath } from "@@/utils/file"
|
||||
import zTabs from "@@/components/other/z-tabs/z-tabs.vue"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
|
||||
@@ -36,7 +36,7 @@ import { filePath } from "@@/utils/file"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
|
||||
import integratedApi from "@/sheep/api/integrated"
|
||||
import { hooks } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
|
||||
const todoCount = ref(0)
|
||||
const crudLayoutRef = ref<any>(null)
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<view class="w-10rpx" />
|
||||
<view @click="doPhone('15657370065')">15657370065</view>
|
||||
</view>
|
||||
<view class="h-30rpx" />
|
||||
<view class="h-60rpx" />
|
||||
</crud-layout>
|
||||
|
||||
<modify-user ref="modifyUserRef" warnText="填写出生日期即可领取生日兑换券" @close="storage.getUserInfo" />
|
||||
@@ -76,13 +76,15 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, onMounted, nextTick } from "vue"
|
||||
import { ref, reactive, onMounted, nextTick } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { isEmpty } from "radash"
|
||||
import dayjs from "dayjs"
|
||||
import { filePath } from "@@/utils/file"
|
||||
import { getAppInfo } from "@@/utils/app"
|
||||
import { hooks, router, constant } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import * as constant from "@@/constant"
|
||||
import { accessStatsApi, actCancelApi, userApi } from "@@/api"
|
||||
import { APPENV } from "@/sheep/constant"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
@@ -90,7 +92,7 @@ import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
import ModifyUser from "@@/components/modify-user.vue"
|
||||
|
||||
const crudLayoutRef = ref<any>(null)
|
||||
const modifyUserRef = ref(null)
|
||||
const modifyUserRef = ref<InstanceType<typeof ModifyUser> | null>(null)
|
||||
const state = reactive<any>({
|
||||
wallet: [],
|
||||
userInfo: {},
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
import { ref, reactive, onMounted, nextTick } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { orderApi } from "@@/api"
|
||||
|
||||
import { filePath } from "@@/utils/file"
|
||||
|
||||
@@ -71,7 +71,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { hooks, router } from "@/sheep"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { prosperityShopApi } from "@/sheep/api"
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
import { isEmpty } from "radash"
|
||||
|
||||
@@ -3,7 +3,8 @@ import { ref, reactive, onMounted, nextTick } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
|
||||
import { merchantApi } from "@@/api"
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { filePath } from "@@/utils/file"
|
||||
import zTabs from "@@/components/other/z-tabs/z-tabs.vue"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
|
||||
@@ -3,7 +3,8 @@ import { ref, reactive, onMounted, nextTick } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
|
||||
import { merchantApi } from "@@/api"
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { filePath } from "@@/utils/file"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
import { ref } from "vue"
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { merchantApi } from "@@/api"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
import { filePath } from "@@/utils/file"
|
||||
|
||||
@@ -5,7 +5,7 @@ import { isEmpty } from "radash"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
import { filePath } from "@@/utils/file"
|
||||
|
||||
import { hooks } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import { walletApi } from "@@/api"
|
||||
|
||||
import zTabs from "@@/components/other/z-tabs/z-tabs.vue"
|
||||
|
||||
@@ -3,7 +3,8 @@ import { ref, reactive } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import uqrcode from "@@/utils/uqrcode"
|
||||
|
||||
import { hooks, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as router from "@@/router"
|
||||
import { walletApi } from "@@/api"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
|
||||
|
||||
@@ -3,7 +3,9 @@ import { ref, reactive } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { isEmpty } from "radash"
|
||||
|
||||
import { hooks, constant, router } from "@@/index"
|
||||
import * as hooks from "@@/hooks"
|
||||
import * as constant from "@@/constant"
|
||||
import * as router from "@@/router"
|
||||
import { walletApi, payApi, miniPlatformApi, type MiniPayDto } from "@@/api"
|
||||
import { SERVICE_IMAGE, storageConstant } from "@@/constant/index"
|
||||
import { filePath } from "@@/utils/file"
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, reactive, onMounted, computed } from "vue"
|
||||
|
||||
import { router, constant } from "@@/index"
|
||||
import { router, hooks, constant } from "@@/index"
|
||||
import { useTabbarStore } from "@@/stores/tabbar"
|
||||
import { jump } from "@/sheep/router";
|
||||
import { userApi } from "@@/api/index"
|
||||
|
||||
import VerifyDeviceImpModel from "../../verify-device-imp-model.vue"
|
||||
import { getMiniUniqueCode, getDeviceKey } from "@@/utils/mini-tool"
|
||||
|
||||
const tabbarStore = useTabbarStore()
|
||||
|
||||
@@ -22,6 +21,8 @@ export type Props = {
|
||||
bg: string
|
||||
}
|
||||
|
||||
const { scanCodeAction, processUrlScanResult, processBase64ScanResult } = hooks.useScanCode(false)
|
||||
|
||||
const verifyDeviceImpModelRef = ref()
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
tabBarType: "default",
|
||||
@@ -94,6 +95,35 @@ function tabbarChange(index: number) {
|
||||
jump(target.pagePath, {}, 3)
|
||||
}
|
||||
|
||||
function rootTabbarChange(index: number) {
|
||||
// 扫一扫
|
||||
if (index == 1) {
|
||||
appScanCode()
|
||||
return
|
||||
}
|
||||
tabbarStore.setRootActiveIndex(index)
|
||||
const target = tabbarStore.rootTabbarList[index]
|
||||
if (!target) return
|
||||
jump(target.pagePath, {}, 3)
|
||||
}
|
||||
|
||||
const appScanCode = async () => {
|
||||
const scanResult = await scanCodeAction()
|
||||
if (!scanResult) {
|
||||
// uni.showToast({ title: "扫码错误", icon: "none" })
|
||||
return
|
||||
}
|
||||
// 判断扫码结果
|
||||
if (scanResult.startsWith("http")) {
|
||||
// 扫码结果是url链接
|
||||
processUrlScanResult(scanResult.replace("/#", ""))
|
||||
} else {
|
||||
// 扫码结果是base64字符串
|
||||
processBase64ScanResult(scanResult)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 校验该设备是否被验证
|
||||
async function checkVerifyDevice() {
|
||||
// 从本地存储中获取用户信息
|
||||
@@ -152,12 +182,15 @@ defineExpose({
|
||||
<slot name="main-bottom"></slot>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="tabbarStore.isTabbar" class="layout_foot">
|
||||
<tm-tabbar class="layout_foot" :activeIndex="tabbarStore.activeIndex" :list="tabbarStore.pageTabbarList"
|
||||
:outIndex="-1" fontSize="12px" iconSize="24px" bgColor="#F6F5FA" :zIndex="99999" darkBgColor="#F6F5FA"
|
||||
borderColor="#DBDDDE" color="#8E8E8E" selected-color="#0094ff" position="relative"
|
||||
@change="tabbarChange">
|
||||
</tm-tabbar>
|
||||
<view class="layout_foot">
|
||||
<tm-tabbar v-if="tabbarStore.isTabbar && tabbarStore.rootActiveIndex != 2" class="layout_foot"
|
||||
:activeIndex="tabbarStore.activeIndex" :list="tabbarStore.pageTabbarList" :outIndex="-1" fontSize="12px"
|
||||
iconSize="24px" bgColor="#F6F5FA" :zIndex="99999" darkBgColor="#F6F5FA" borderColor="#DBDDDE"
|
||||
color="#8E8E8E" selected-color="#0094ff" position="fixed" @change="tabbarChange" />
|
||||
<tm-tabbar v-else class="layout_foot" :activeIndex="tabbarStore.rootActiveIndex"
|
||||
:list="tabbarStore.rootPageTabbarList" :outIndex="1" fontSize="12px" iconSize="24px" bgColor="#F6F5FA"
|
||||
:zIndex="99999" darkBgColor="#F6F5FA" borderColor="#DBDDDE" color="#8E8E8E" outBgColor="#0094ff"
|
||||
selected-color="#0094ff" position="fixed" @change="rootTabbarChange" />
|
||||
</view>
|
||||
<VerifyDeviceImpModel ref="verifyDeviceImpModelRef" :close="verifyDeviceImpModelClose" />
|
||||
</view>
|
||||
|
||||
@@ -13,6 +13,8 @@ type TabbarItem = {
|
||||
}
|
||||
|
||||
type StoreState = {
|
||||
rootTabbarList: Array<TabbarItem>
|
||||
rootActiveIndex: number
|
||||
tabbarList: Array<TabbarItem>
|
||||
launchParam: string | null
|
||||
currentRoute: string
|
||||
@@ -126,9 +128,38 @@ const TABBAR_CONSTANT: Array<TabbarItem> = [
|
||||
},
|
||||
]
|
||||
|
||||
const defaultRootTabbarList: Array<TabbarItem> = [
|
||||
{
|
||||
pagePath: "/pages/root/dashboard",
|
||||
text: "首页",
|
||||
iconPath: "/static/tabbar/home.png",
|
||||
selectedIconPath: "/static/tabbar/home-select.png",
|
||||
launchParam: [],
|
||||
auth: [],
|
||||
},
|
||||
{
|
||||
pagePath: "/pages/tabbar/scan",
|
||||
text: "扫一扫",
|
||||
iconPath: "/static/tabbar/scan.png",
|
||||
selectedIconPath: "/static/tabbar/scan.png",
|
||||
launchParam: [],
|
||||
auth: [],
|
||||
},
|
||||
{
|
||||
pagePath: "/pages/tabbar/my",
|
||||
text: "我的",
|
||||
iconPath: "/static/tabbar/my.png",
|
||||
selectedIconPath: "/static/tabbar/my-select.png",
|
||||
launchParam: [],
|
||||
auth: [],
|
||||
},
|
||||
]
|
||||
|
||||
// tabbar
|
||||
export const useTabbarStore = defineStore("tabbarStore", {
|
||||
state: (): StoreState => ({
|
||||
rootTabbarList: defaultRootTabbarList,
|
||||
rootActiveIndex: 0,
|
||||
tabbarList: [],
|
||||
launchParam: null,
|
||||
currentRoute: "/pages/root/dashboard",
|
||||
@@ -149,6 +180,16 @@ export const useTabbarStore = defineStore("tabbarStore", {
|
||||
}
|
||||
})
|
||||
},
|
||||
rootPageTabbarList(state) {
|
||||
return defaultRootTabbarList.map((item, index) => {
|
||||
return {
|
||||
title: item.text,
|
||||
icon: item.iconPath,
|
||||
selectedIcon: item.selectedIconPath,
|
||||
disabled: index == 1 ? true : false,
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async componetTabbarList(launchParam?: string) {
|
||||
@@ -184,5 +225,8 @@ export const useTabbarStore = defineStore("tabbarStore", {
|
||||
}
|
||||
this.currentRoute = route
|
||||
},
|
||||
setRootActiveIndex(index: number) {
|
||||
this.rootActiveIndex = index
|
||||
},
|
||||
},
|
||||
})
|
||||
+18
-10
@@ -1,11 +1,10 @@
|
||||
import Request from "luch-request"
|
||||
import base64 from "base64-utf8"
|
||||
import { isEmpty } from "radash"
|
||||
|
||||
import { router, constant } from "@@/index"
|
||||
import { createCooldown, getBaseApiUrl, getAppInfo, isDevEnv } from "@@/utils/app"
|
||||
|
||||
import { userApi } from "../api"
|
||||
import { APPENV } from "../constant"
|
||||
import * as router from "@@/router"
|
||||
import * as constant from "@@/constant"
|
||||
import { createCooldown, getBaseApiUrl } from "@@/utils/app"
|
||||
|
||||
const TOKEN_KEY = constant.storageConstant.TOKEN
|
||||
const USER_INFO_KEY = constant.storageConstant.USERINFO
|
||||
@@ -20,8 +19,7 @@ const SKIP_REFRESH_TOKEN = ["/sys/auth/refresh-token", "/auth/token/check_token"
|
||||
|
||||
let refreshTokenLock = true
|
||||
const runLoginRedirect = createCooldown(1500)
|
||||
|
||||
console.log("getBaseApiUrl:", getBaseApiUrl())
|
||||
const BASIC_AUTH = "Basic " + base64.encode(import.meta.env.VITE_OAUTH2_APP_CLIENT)
|
||||
|
||||
const https = new Request({
|
||||
baseURL: getBaseApiUrl(),
|
||||
@@ -124,18 +122,28 @@ const isTokenExpires = (tokenStorage: GlobalSetting.TokenStorage): boolean => {
|
||||
async function refreshToken(): Promise<any> {
|
||||
refreshTokenLock = false
|
||||
try {
|
||||
// 调用接口判断token是否过期
|
||||
const tokenStorage = uni.getStorageSync(TOKEN_KEY) as GlobalSetting.TokenStorage
|
||||
const { data } = await userApi.refreshToken(tokenStorage.refreshToken)
|
||||
const res: any = await https.middleware({
|
||||
url: "/auth/oauth2/token",
|
||||
header: {
|
||||
skipToken: "true",
|
||||
Authorization: BASIC_AUTH,
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
method: "POST",
|
||||
params: { refresh_token: tokenStorage.refreshToken, grant_type: "refresh_token", scope: "server" },
|
||||
})
|
||||
const { data } = res || {}
|
||||
if (data) {
|
||||
tokenStorage.accessToken = data?.accessToken?.tokenValue
|
||||
tokenStorage.refreshToken = data?.refreshToken?.tokenValue
|
||||
tokenStorage.accessTokenExpiresIn = data?.accessToken?.expiresAt
|
||||
tokenStorage.refreshTokenExpiresIn = data?.refreshToken?.expiresAt
|
||||
uni.setStorageSync(TOKEN_KEY, tokenStorage)
|
||||
return tokenStorage
|
||||
}
|
||||
return null
|
||||
} catch (error) {
|
||||
console.log("APP登录意外的错误error:", error)
|
||||
return false
|
||||
} finally {
|
||||
refreshTokenLock = true
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
@@ -297,6 +297,11 @@ const itemClick = (index: number) => {
|
||||
*/
|
||||
emits('change', index)
|
||||
let item = _list.value[index]
|
||||
// TODO 手动修改 start
|
||||
if (item.disabled) {
|
||||
return
|
||||
}
|
||||
// TODO 手动修改 end
|
||||
nowIndex.value = index;
|
||||
emits('update:activeIndex', index)
|
||||
if (item.url != null && item.url != '' && !item.disabled) {
|
||||
|
||||
Reference in new issue
Block a user