|
@@ -2,7 +2,6 @@
|
|
|
<u-navbar :autoBack="false" :placeholder="true" :safeAreaInsetTop="true" :bgColor="proxy.$settingStore.themeColor.color">
|
|
|
<template #left>
|
|
|
<view class="u-navbar__content__left__item">
|
|
|
- <!-- <u-icon name="arrow-left" size="19" color="#fff" style="display: none"></u-icon> -->
|
|
|
<view class="u-navbar__content__left__item__title">应用中心</view>
|
|
|
</view>
|
|
|
</template>
|
|
@@ -39,32 +38,24 @@
|
|
|
<text class="transition-section-content-icon iconfont oaIcon-saoyisao"></text>
|
|
|
<view class="transition-section-content-text"> 扫一扫 </view>
|
|
|
</view>
|
|
|
- <!-- <div class="transition-section-divider"></div>
|
|
|
- <view class="transition-section-content">
|
|
|
- <text class="transition-section-content-icon iconfont oaIcon-saoyisao"></text>
|
|
|
- <view class="transition-section-content-text">发起群聊 </view>
|
|
|
- </view> -->
|
|
|
</view>
|
|
|
</view>
|
|
|
</u-transition>
|
|
|
|
|
|
<!-- 轮播图 -->
|
|
|
- <u-swiper v-if="swiperBool" :list="swiperList" :interval="swiperTime" indicatorMode="line" radius="0" height="160" indicator circular keyName="url" @click="swiperClick" @change="swiperChange">
|
|
|
+ <u-swiper v-if="state.swiperBool" :list="state.swiperList" :interval="state.swiperTime" indicatorMode="line" radius="0" height="160" indicator circular keyName="url" @click="swiperClick">
|
|
|
</u-swiper>
|
|
|
- <image v-if="!swiperBool" style="width: 100%; height: 160px" src="@/static/images/index/banner1.png"></image>
|
|
|
+ <image v-if="!state.swiperBool" style="width: 100%; height: 160px" src="@/static/images/index/banner1.png"></image>
|
|
|
|
|
|
<!-- 天气 -->
|
|
|
<oa-weather ref="oaWeatherRef"></oa-weather>
|
|
|
|
|
|
<!-- 最近使用宫格 -->
|
|
|
- <view class="grid-area bg-white" v-if="recentlyUsed.length > 0">
|
|
|
+ <view class="grid-area bg-white" v-if="state.recentlyUsed.length > 0">
|
|
|
<view class="grid-area_title">最近使用</view>
|
|
|
<view class="grid-area_center cu-list grid col-5 no-border">
|
|
|
- <view class="grid-area_center_item cu-item justify-center align-center" @tap="navItemClick(item)" v-for="(item, index) in recentlyUsed.slice(0, 5)" :key="index">
|
|
|
+ <view class="grid-area_center_item cu-item justify-center align-center" @tap="navItemClick(item)" v-for="(item, index) in state.recentlyUsed.slice(0, 5)" :key="index">
|
|
|
<image class="grid-area_center_item_image" :src="item.meta.icon"></image>
|
|
|
- <!-- <view class="cu-tag badge" v-if="item.badge != 0">
|
|
|
- <block v-if="item.badge != 0">{{ item.badge > 99 ? "99+" : item.badge }}</block>
|
|
|
- </view> -->
|
|
|
<text class="grid-area_center_item_title">{{ item.meta.aliasTitle ? item.meta.aliasTitle : item.meta.title }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -74,11 +65,8 @@
|
|
|
<view class="grid-area bg-white">
|
|
|
<view class="grid-area_title">常用功能</view>
|
|
|
<view class="grid-area_center cu-list grid col-5 no-border">
|
|
|
- <view class="grid-area_center_item cu-item justify-center align-center" @tap="navItemClick(item)" v-for="(item, index) in cuIconList" :key="index">
|
|
|
+ <view class="grid-area_center_item cu-item justify-center align-center" @tap="navItemClick(item)" v-for="(item, index) in state.cuIconList" :key="index">
|
|
|
<image class="grid-area_center_item_image" :src="item.meta.icon"></image>
|
|
|
- <!-- <view class="cu-tag badge" v-if="item.badge != 0">
|
|
|
- <block v-if="item.badge != 0">{{ item.badge > 99 ? "99+" : item.badge }}</block>
|
|
|
- </view> -->
|
|
|
<text class="grid-area_center_item_title">{{ item.meta.aliasTitle ? item.meta.aliasTitle : item.meta.title }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -91,18 +79,22 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
+/*----------------------------------依赖引入-----------------------------------*/
|
|
|
import { onReady, onLoad, onShow, onNavigationBarButtonTap, onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app";
|
|
|
import { ref, onMounted, inject, shallowRef, reactive, getCurrentInstance, toRefs, nextTick } from "vue";
|
|
|
-import { useStores, commonStores } from "@/store/modules/index";
|
|
|
-
|
|
|
+/*----------------------------------接口引入-----------------------------------*/
|
|
|
import { scan_push, getHomePageData, getFunctionalModuleStatistics, getAppRouters, qrCodeSend, getMobileBanner } from "@/api/index";
|
|
|
+/*----------------------------------组件引入-----------------------------------*/
|
|
|
+/*----------------------------------store引入-----------------------------------*/
|
|
|
+import { useStores, stystemStores } from "@/store/modules/index";
|
|
|
+/*----------------------------------公共方法引入-----------------------------------*/
|
|
|
import * as jwx from "@/utils/jssdk.js"; //引入js sdk的封装
|
|
|
-
|
|
|
-const useStore = useStores();
|
|
|
-const commonStore = commonStores(); //全局公共Store
|
|
|
+import { storage_stystem } from "@/utils/storage"; // 公共方法引用
|
|
|
+/*----------------------------------公共变量-----------------------------------*/
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
-
|
|
|
-const arrayList = reactive({
|
|
|
+const useStore = useStores();
|
|
|
+/*----------------------------------变量声明-----------------------------------*/
|
|
|
+const state = reactive({
|
|
|
dialogFlag: false,
|
|
|
|
|
|
swiperBool: false,
|
|
@@ -114,23 +106,32 @@ const arrayList = reactive({
|
|
|
recentlyUsed: [],
|
|
|
});
|
|
|
|
|
|
-const { dialogFlag, swiperBool, swiperIndex, swiperTime, swiperList, cuIconList, recentlyUsed } = toRefs(arrayList);
|
|
|
+const { dialogFlag } = toRefs(state);
|
|
|
|
|
|
/**
|
|
|
- * @获取轮播图下标
|
|
|
- * @change事件
|
|
|
+ * @初始化
|
|
|
*/
|
|
|
-function swiperChange(e) {
|
|
|
- swiperIndex.value = e.current;
|
|
|
+function init() {
|
|
|
+ //#ifdef H5
|
|
|
+ // if (proxy.$common.isWechatMp()) {
|
|
|
+ // window.location.href = proxy.$BASE_URL + "/service-iot/weChat/getPageAuthorization";
|
|
|
+ // }
|
|
|
+ //#endif
|
|
|
+
|
|
|
+ nextTick(() => {
|
|
|
+ getAppRoutersData(); //调用路由信息接口
|
|
|
+ getMobileBannerApi(); //调用banner图接口
|
|
|
+ getLocation(); //调用获取地理位置方法
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @轮播图点击事件
|
|
|
*/
|
|
|
function swiperClick(list) {
|
|
|
- if (typeof swiperList.value[list] == "object") {
|
|
|
- let linkType = swiperList.value[list].linkType;
|
|
|
- let url = swiperList.value[list].link;
|
|
|
+ if (typeof state.swiperList[list] == "object") {
|
|
|
+ let linkType = state.swiperList[list].linkType;
|
|
|
+ let url = state.swiperList[list].link;
|
|
|
|
|
|
if (url) {
|
|
|
if (linkType == 1) {
|
|
@@ -146,6 +147,48 @@ function swiperClick(list) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * @九宫格页面跳转
|
|
|
+ */
|
|
|
+function navItemClick(item) {
|
|
|
+ if (item.path) {
|
|
|
+ item.sort = 0;
|
|
|
+
|
|
|
+ state.recentlyUsed.push(item);
|
|
|
+ state.recentlyUsed = proxy.$common.uniq(state.recentlyUsed, "path");
|
|
|
+ state.recentlyUsed.filter((el) => {
|
|
|
+ if (el.path === item.path) {
|
|
|
+ el.meta.icon = item.meta.icon;
|
|
|
+ el.sort++;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ state.recentlyUsed = proxy.$common.sortEvent(state.recentlyUsed, 1);
|
|
|
+
|
|
|
+ storage_stystem.set("homeList", state);
|
|
|
+
|
|
|
+ if (item.path.indexOf("http") != -1) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pages/common/webview/index?url=" + item.path,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: item.path,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ uni.showModal({
|
|
|
+ title: "Tips",
|
|
|
+ content: "此模块开发中~",
|
|
|
+ showCancel: false,
|
|
|
+ success: function (res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ } else if (res.cancel) {
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// function connected() {
|
|
|
// refresh();
|
|
|
// uni.setNavigationBarColor({
|
|
@@ -163,9 +206,7 @@ function swiperClick(list) {
|
|
|
* @scrollView刷新数据
|
|
|
*/
|
|
|
function refresh() {
|
|
|
- getAppRoutersData(); //调用路由信息接口
|
|
|
- getMobileBannerApi(); //调用banner图接口
|
|
|
- getLocation(); //调用获取地理位置方法
|
|
|
+ init();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -206,8 +247,8 @@ function scanCode() {
|
|
|
});
|
|
|
qrCodeSend({
|
|
|
qrCode: list.uid,
|
|
|
- tenantId: useStore.$state.tenantId,
|
|
|
- userName: useStore.$state.name,
|
|
|
+ tenantId: useStore.tenantId,
|
|
|
+ userName: useStore.name,
|
|
|
}).then((res) => {});
|
|
|
},
|
|
|
fail: (err) => {
|
|
@@ -252,48 +293,6 @@ function getLocation() {
|
|
|
//#endif
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * @九宫格页面跳转
|
|
|
- */
|
|
|
-function navItemClick(item) {
|
|
|
- if (item.path) {
|
|
|
- item.sort = 0;
|
|
|
-
|
|
|
- recentlyUsed.value.push(item);
|
|
|
- recentlyUsed.value = proxy.$common.uniq(recentlyUsed.value, "path");
|
|
|
- recentlyUsed.value.filter((el) => {
|
|
|
- if (el.path === item.path) {
|
|
|
- el.meta.icon = item.meta.icon;
|
|
|
- el.sort++;
|
|
|
- }
|
|
|
- });
|
|
|
- recentlyUsed.value = commonStore.sortEvent(recentlyUsed.value, 1);
|
|
|
-
|
|
|
- uni.setStorageSync(useStore.$state.nickName + useStore.$state.tenantId, recentlyUsed.value);
|
|
|
-
|
|
|
- if (item.path.indexOf("http") != -1) {
|
|
|
- uni.navigateTo({
|
|
|
- url: "/pages/common/webview/index?url=" + item.path,
|
|
|
- });
|
|
|
- } else {
|
|
|
- uni.navigateTo({
|
|
|
- url: item.path,
|
|
|
- });
|
|
|
- }
|
|
|
- } else {
|
|
|
- uni.showModal({
|
|
|
- title: "Tips",
|
|
|
- content: "此模块开发中~",
|
|
|
- showCancel: false,
|
|
|
- success: function (res) {
|
|
|
- if (res.confirm) {
|
|
|
- } else if (res.cancel) {
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* @右侧按钮点击事件
|
|
|
*/
|
|
@@ -307,16 +306,16 @@ function rightButtonClick() {
|
|
|
*/
|
|
|
function getMobileBannerApi() {
|
|
|
getMobileBanner({
|
|
|
- tenantId: useStore.$state.tenantId,
|
|
|
+ tenantId: useStore.tenantId,
|
|
|
}).then((res) => {
|
|
|
if (res.data.length > 0) {
|
|
|
- swiperList.value = [];
|
|
|
- swiperBool.value = res.data[0].openNot == 1 ? true : false;
|
|
|
- swiperTime.value = res.data[0].carouselTime * 1000;
|
|
|
+ state.swiperList = [];
|
|
|
+ state.swiperBool = res.data[0].openNot == 1 ? true : false;
|
|
|
+ state.swiperTime = res.data[0].carouselTime * 1000;
|
|
|
|
|
|
for (let i = 1; i <= 5; i++) {
|
|
|
if (res.data[0]["bannerPath" + i]) {
|
|
|
- swiperList.value.push({
|
|
|
+ state.swiperList.push({
|
|
|
url: res.data[0]["bannerPath" + i],
|
|
|
link: res.data[0]["linkUrl" + i],
|
|
|
linkType: res.data[0]["linkType" + i],
|
|
@@ -334,26 +333,28 @@ function getMobileBannerApi() {
|
|
|
*/
|
|
|
function getAppRoutersData() {
|
|
|
getAppRouters().then((res) => {
|
|
|
- cuIconList.value = res.data;
|
|
|
+ state.cuIconList = res.data;
|
|
|
+ storage_stystem.set("homeList", state);
|
|
|
+
|
|
|
+ // plus.downloader
|
|
|
+ // .createDownload("http://172.16.120.165:9300/statics/202312/20231201113810A027.jpg", {}, (d, status) => {
|
|
|
+ // status != 200 && console.log("error");
|
|
|
+ // console.log("Download success: " + d.filename);
|
|
|
+ // })
|
|
|
+ // .start();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
onLoad((option) => {
|
|
|
uni.hideTabBar(); //隐藏自带tabbar
|
|
|
-
|
|
|
- nextTick(() => {
|
|
|
- getAppRoutersData(); //调用路由信息接口
|
|
|
- getMobileBannerApi(); //调用banner图接口
|
|
|
- getLocation(); //调用获取地理位置方法
|
|
|
- });
|
|
|
+ init();
|
|
|
});
|
|
|
|
|
|
onShow(() => {
|
|
|
- if (uni.getStorageSync(useStore.$state.nickName + useStore.$state.tenantId)) {
|
|
|
- recentlyUsed.value = uni.getStorageSync(useStore.$state.nickName + useStore.$state.tenantId);
|
|
|
- } else {
|
|
|
- recentlyUsed.value = [];
|
|
|
- }
|
|
|
+ var storages = storage_stystem.get("homeList");
|
|
|
+ Object.keys(storages).forEach((key) => {
|
|
|
+ state[key] = storages[key];
|
|
|
+ });
|
|
|
});
|
|
|
</script>
|
|
|
|