stystem.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // 组件引用
  2. import { defineStore } from "pinia";
  3. // 接口引用
  4. // 公共方法引用
  5. import storage from "@/utils/storage";
  6. import common from "@/plugins/common.plugins.js";
  7. const stystemStores = defineStore(`${storage.get("nickName") + storage.get("tenantId")}_storage-stystem`, {
  8. state: () => ({
  9. homeList: {
  10. swiperBool: false,
  11. swiperIndex: 0,
  12. swiperTime: 5000,
  13. swiperList: [],
  14. cuIconList: [],
  15. recentlyUsed: [],
  16. },
  17. infoList: {
  18. },
  19. }),
  20. unistorage: true,
  21. actions: {
  22. /**
  23. * @九宫格页面跳转
  24. */
  25. navItemClick(item) {
  26. if (item.path) {
  27. item.sort = 0;
  28. this.homeList.recentlyUsed.push(item);
  29. this.homeList.recentlyUsed = common.uniq(this.homeList.recentlyUsed, "path");
  30. this.homeList.recentlyUsed.filter((el) => {
  31. if (el.path === item.path) {
  32. el.meta.icon = item.meta.icon;
  33. el.sort++;
  34. }
  35. });
  36. this.homeList.recentlyUsed = common.sortEvent(this.homeList.recentlyUsed, 1);
  37. if (item.path.indexOf("http") != -1) {
  38. uni.navigateTo({
  39. url: "/pages/common/webview/index?url=" + item.path,
  40. });
  41. } else {
  42. uni.navigateTo({
  43. url: item.path,
  44. });
  45. }
  46. } else {
  47. uni.showModal({
  48. title: "Tips",
  49. content: "此模块开发中~",
  50. showCancel: false,
  51. success: function (res) {
  52. if (res.confirm) {
  53. } else if (res.cancel) {
  54. }
  55. },
  56. });
  57. }
  58. }
  59. },
  60. });
  61. export default stystemStores;