Browse Source

修改部分页面访问store配置

fanghuisheng 11 months ago
parent
commit
e25bd78130

+ 2 - 2
src/App.vue

@@ -53,10 +53,10 @@ onLaunch(() => {
   console.log("App Launch");
 
   //初始化默认主题
-  if (!proxy.$settingStore.$state.themeColor) {
+  if (!proxy.$settingStore.themeColor) {
     proxy.$settingStore.SET_THEMECOLOR(proxy.$constData.themeList[0]);
   } else {
-    proxy.$settingStore.SET_THEMECOLOR(proxy.$settingStore.$state.themeColor);
+    proxy.$settingStore.SET_THEMECOLOR(proxy.$settingStore.themeColor);
   }
 
   initApp();

+ 1 - 3
src/api/login.js

@@ -50,6 +50,4 @@ export function getMobileTenantConfig(data) {
     method: "GET",
     data: data,
   });
-}
-
-
+}

+ 12 - 12
src/pages/business/fireIot/deviceManage/components/deviceDetails.vue

@@ -5,12 +5,12 @@
         <image style="width: 40px; height: 40px; margin: auto 15px auto 0" :src="'/static/images/404.png'" mode="aspectFill"></image>
 
         <view style="margin: auto auto auto 0">
-          <view style="font-size: 15px"> {{ commonStore.$state.deviceDetailsArray.deviceName }} </view>
+          <view style="font-size: 15px"> {{ commonStore.deviceDetailsArray.deviceName }} </view>
         </view>
 
         <view style="margin: auto 0 auto 0">
-          <view :style="{ fontSize: '15px', color: commonStore.$state.deviceDetailsArray.deviceStatus == 1 ? '#16bf00' : 'red' }">
-            {{ commonStore.$state.deviceDetailsArray.deviceStatus == 1 ? "在线" : "离线" }}
+          <view :style="{ fontSize: '15px', color: commonStore.deviceDetailsArray.deviceStatus == 1 ? '#16bf00' : 'red' }">
+            {{ commonStore.deviceDetailsArray.deviceStatus == 1 ? "在线" : "离线" }}
           </view>
         </view>
       </view>
@@ -106,23 +106,23 @@ const commonStore = commonStores();
 const dataList = ref([
   {
     title: "设备类型",
-    value: commonStore.$state.deviceDetailsArray.productName,
+    value: commonStore.deviceDetailsArray.productName,
   },
   {
     title: "设备编号",
-    value: commonStore.$state.deviceDetailsArray.deviceId,
+    value: commonStore.deviceDetailsArray.deviceId,
   },
   {
     title: "物联网卡号",
-    value: commonStore.$state.deviceDetailsArray.simCode,
+    value: commonStore.deviceDetailsArray.simCode,
   },
   {
     title: "安装位置",
-    value: commonStore.$state.deviceDetailsArray.installAddress,
+    value: commonStore.deviceDetailsArray.installAddress,
   },
   {
     title: "添加时间",
-    value: commonStore.$state.deviceDetailsArray.createdTime ? commonStore.$state.deviceDetailsArray.createdTime.replace("T", " ") : "",
+    value: commonStore.deviceDetailsArray.createdTime ? commonStore.deviceDetailsArray.createdTime.replace("T", " ") : "",
   },
 ]);
 
@@ -150,7 +150,7 @@ function init() {
     current: 1,
     size: 100,
     attributeName: "",
-    productId: commonStore.$state.deviceDetailsArray.productId,
+    productId: commonStore.deviceDetailsArray.productId,
   }).then((requset) => {
     if (requset.status === "SUCCESS") {
       checkboxDataList.value = requset.data.records;
@@ -163,7 +163,7 @@ function init() {
       });
 
       last({
-        deviceId: commonStore.$state.deviceDetailsArray.deviceId,
+        deviceId: commonStore.deviceDetailsArray.deviceId,
         metrics: array,
       }).then((requsets) => {
         if (requsets.status === "SUCCESS") {
@@ -216,8 +216,8 @@ function historyMetricsApi() {
   historyMetrics({
     startTime: calendarStartTime.value,
     endTime: calendarEndTime.value,
-    deviceId: commonStore.$state.deviceDetailsArray.deviceId,
-    deviceType: commonStore.$state.deviceDetailsArray.deviceType,
+    deviceId: commonStore.deviceDetailsArray.deviceId,
+    deviceType: commonStore.deviceDetailsArray.deviceType,
     metrics: checkboxValueList.value,
   }).then((requset) => {
     if (requset.status === "SUCCESS") {

+ 2 - 2
src/pages/business/fireIot/deviceManage/components/deviceDetailsList.vue

@@ -120,8 +120,8 @@ function dmpDeviceInfoApi() {
 function handleToDevice(array) {
   proxy.$tab.navigateTo("/pages/business/fireIot/deviceManage/components/deviceDetails");
 
-  commonStore.$state.deviceDetailsArray = array;
-  commonStore.$state.deviceDetailsArray.productName = productName.value;
+  commonStore.deviceDetailsArray = array;
+  commonStore.deviceDetailsArray.productName = productName.value;
 }
 
 /**

+ 4 - 4
src/pages/business/fireIot/facilitiesGather/index.vue

@@ -138,7 +138,7 @@ const dataList = reactive({
     { text: "关闭", value: "2" },
   ],
 
-  form: commonStore.$state.facilitiesGatherArray,
+  form: commonStore.facilitiesGatherArray,
 
   rules: {
     department: [{ required: false, message: "请选择所属部门", trigger: ["blur", "change"] }],
@@ -307,16 +307,16 @@ function handleAction(value, array) {
   }
 
   if (value == "设施地址") {
-    commonStore.$state.facilitiesGatherType = "点";
+    commonStore.facilitiesGatherType = "点";
     proxy.$tab.navigateTo("/pages/business/fireIot/facilitiesGather/mapGather");
     return;
   }
 
   if (value == "类型") {
     if (form.value.typeGuise === 2) {
-      commonStore.$state.facilitiesGatherType = "线";
+      commonStore.facilitiesGatherType = "线";
     } else if (form.value.typeGuise === 3) {
-      commonStore.$state.facilitiesGatherType = "面";
+      commonStore.facilitiesGatherType = "面";
     }
     proxy.$tab.navigateTo("/pages/business/fireIot/facilitiesGather/mapGather");
 

+ 4 - 4
src/pages/business/fireIot/facilitiesGather/mapGather.vue

@@ -22,8 +22,8 @@ const { proxy } = getCurrentInstance();
 
 const pages = getCurrentPages();
 
-const dataArray = commonStore.$state.facilitiesGatherArray;
-const dataType = commonStore.$state.facilitiesGatherType;
+const dataArray = commonStore.facilitiesGatherArray;
+const dataType = commonStore.facilitiesGatherType;
 
 // #ifdef APP-PLUS
 setTimeout(() => {
@@ -35,7 +35,7 @@ setTimeout(() => {
 
 function onMessage(e) {
   console.log("父页面:", e.detail.data);
-  commonStore.$state.facilitiesGatherArray = JSON.parse(e.detail.data);
+  commonStore.facilitiesGatherArray = JSON.parse(e.detail.data);
   uni.redirectTo({
     url: "/pages/business/fireIot/facilitiesGather/index",
   });
@@ -56,7 +56,7 @@ setTimeout(() => {
 window.onmessage = function (event) {
   if ("funcName" in event.data) {
     console.log("父页面:", event);
-    commonStore.$state.facilitiesGatherArray = JSON.parse(event.data.param);
+    commonStore.facilitiesGatherArray = JSON.parse(event.data.param);
     uni.redirectTo({
       url: "/pages/business/fireIot/facilitiesGather/index",
     });

+ 1 - 1
src/pages/business/mhxf/needMatter/index.vue

@@ -244,7 +244,7 @@ function handleConfirm() {
 
   let params = {
     reformId: arrayList.value.reformId, //整改单编号
-    reformPerson: useStore.$state.nickName, //整改提交人
+    reformPerson: useStore.nickName, //整改提交人
     reformRemark: textValue.value, //整改备注
     reformPath1: "", //整改相关图片或文件路径1
     reformPath2: "", //整改相关图片或文件路径2

+ 1 - 1
src/pages/common/repairReport/record.vue

@@ -55,7 +55,7 @@ const current = ref(1);
 const total = ref(0);
 
 const data = reactive({
-  phone: getToken() ? useStore.$state.phonenumber : undefined,
+  phone: getToken() ? useStore.phonenumber : undefined,
   verify: undefined,
 });
 const { phone, verify } = toRefs(data);

+ 3 - 3
src/pages/index.vue

@@ -113,9 +113,9 @@ const { dialogFlag } = toRefs(state);
  */
 function init() {
   //#ifdef H5
-  // if (proxy.$common.isWechatMp()) {
-  //   window.location.href = proxy.$BASE_URL + "/service-iot/weChat/getPageAuthorization";
-  // }
+  if (proxy.$common.isWechatMp()) {
+    window.location.href = proxy.$BASE_URL + "/service-iot/weChat/getPageAuthorization";
+  }
   //#endif
 
   nextTick(() => {

+ 10 - 8
src/pages/login.vue

@@ -1,15 +1,15 @@
 <template>
   <view id="login-container" class="login-container">
-    <image class="bgImage" :src="useStore.$state.loginBg" v-if="useStore.$state.loginBg" />
+    <image class="bgImage" :src="useStore.loginBg" v-if="useStore.loginBg" />
 
     <view class="middle">
       <view class="middle-top">
-        <image class="logo" mode="heightFix" :src="useStore.$state.loginLogo" v-if="useStore.$state.loginLogo" />
-        <text class="title" :style="{ color: useStore.$state.loginBg ? '#FFFFFF' : '#000000' }" v-if="useStore.$state.loginTitle">{{ useStore.$state.loginTitle }}</text>
+        <image class="logo" mode="heightFix" :src="useStore.loginLogo" v-if="useStore.loginLogo" />
+        <text class="title" :style="{ color: useStore.loginBg ? '#FFFFFF' : '#000000' }" v-if="useStore.loginTitle">{{ useStore.loginTitle }}</text>
       </view>
 
       <view class="middle-content">
-        <text class="title" :style="{ color: useStore.$state.loginBg ? '#FFFFFF' : '#000000' }">请登录</text>
+        <text class="title" :style="{ color: useStore.loginBg ? '#FFFFFF' : '#000000' }">请登录</text>
 
         <!-- #ifdef APP-PLUS || MP-WEIXIN -->
         <view class="prompt" v-if="!linkUrl">首次账号登录请先配置服务器</view>
@@ -60,7 +60,7 @@
     </view>
 
     <view class="bottom">
-      <div class="title">{{ useStore.$state.loginBottomTitle }}</div>
+      <div class="title">{{ useStore.loginBottomTitle }}</div>
     </view>
   </view>
 </template>
@@ -143,7 +143,7 @@ function init() {
 
   if (window.location.host) {
     linkUrl.value = window.location.host;
-    // linkUrl.value = "172.16.120.165:13200";
+    linkUrl.value = "172.16.120.165:13200";
     // linkUrl.value = "localhost:81";
 
     useStore.GetMobileTenantConfig({ url: linkUrl.value });
@@ -195,7 +195,8 @@ function submitRes() {
     login({
       phone: phone.value,
       verify: verify.value,
-      tenantId: useStore.$state.tenantId,
+      tenantId: useStore.tenantId,
+      cids: proxy.$settingStore.pushClientId,
     });
   } else {
     if (!username.value) {
@@ -210,7 +211,8 @@ function submitRes() {
     login({
       username: username.value,
       password: password.value,
-      tenantId: useStore.$state.tenantId,
+      tenantId: useStore.tenantId,
+      cids: proxy.$settingStore.pushClientId,
     });
   }
 }

+ 3 - 3
src/pages/mine.vue

@@ -174,15 +174,15 @@ const useStore = useStores();
 const { proxy } = getCurrentInstance();
 
 const avatar = computed(() => {
-  return useStore.$state.avatar;
+  return useStore.avatar;
 });
 const themeColor = computed(() => {
   return proxy.$settingStore.themeColor;
 });
 
 const data = reactive({
-  nickName: useStore.$state.nickName,
-  phone: useStore.$state.phonenumber,
+  nickName: useStore.nickName,
+  phone: useStore.phonenumber,
   version: config.appInfo.version,
 
   colorModal: false,

+ 2 - 2
src/pages/mine/about/index.vue

@@ -9,9 +9,9 @@
     </u-navbar>
 
     <view class="oa-header-section text-center">
-      <image style="width: 150rpx; height: 150rpx" mode="heightFix" :src="useStore.$state.loginLogo" v-if="useStore.$state.loginLogo" />
+      <image style="width: 150rpx; height: 150rpx" mode="heightFix" :src="useStore.loginLogo" v-if="useStore.loginLogo" />
       <image style="width: 150rpx; height: 150rpx" mode="heightFix" src="@/static/logo200.png" v-else />
-      <uni-title type="h2" :title="useStore.$state.loginTitle"></uni-title>
+      <uni-title type="h2" :title="useStore.loginTitle"></uni-title>
     </view>
 
     <view class="oa-content-section">

+ 4 - 4
src/pages/mine/avatar/index.vue

@@ -84,7 +84,7 @@ let PAGE_X, // 手按下的x位置
  * 页面的初始数据
  */
 const array = reactive({
-  imageSrc: useStore.$state.avatar,
+  imageSrc: useStore.avatar,
   isShowImg: false,
   // 初始化的宽高
   cropperInitW: SCREEN_WIDTH,
@@ -324,9 +324,9 @@ function getImageInfo() {
         uni.hideLoading();
         let data = { name: "file", filePath: res.tempFilePath };
         uploadAvatar(data).then((response) => {
-          useStore.$state.avatar = response.data.url;
-          useStore.$state.userArr.avatar = response.data.url;
-          updateUserProfile(useStore.$state.userArr).then(() => {});
+          useStore.avatar = response.data.url;
+          useStore.userArr.avatar = response.data.url;
+          updateUserProfile(useStore.userArr).then(() => {});
           uni.showToast({ title: "修改成功", icon: "success" });
           uni.navigateBack();
         });

+ 1 - 1
src/pages/mine/info/index.vue

@@ -151,7 +151,7 @@ const data = reactive({
 });
 
 const { tabsList, tabsCurrent, sexs, modalShow, modalTitle, phone, verify } = toRefs(data);
-const { avatar, user, userArr, postGroup, roleGroup } = toRefs(useStore.$state);
+const { avatar, user, userArr, postGroup, roleGroup } = toRefs(useStore);
 
 function handleUserModal(title) {
   modalShow.value = true;

+ 1 - 1
src/pages/mine/secure/index.vue

@@ -139,7 +139,7 @@ const data = reactive({
 });
 
 const { modalShow, modalTitle, oldPassword, oldPasswordBool, newPassword, newPasswordBool, confirmPassword, confirmPasswordBool, phone, verify } = toRefs(data);
-const { avatar, user, userArr } = toRefs(useStore.$state);
+const { avatar, user, userArr } = toRefs(useStore);
 
 function handleUserModal(title) {
   modalShow.value = true;

+ 1 - 1
src/pages/mine/secure/loginLog/index.vue

@@ -86,7 +86,7 @@ function selectListApi() {
   loginLogList({
     pageNum: current.value,
     pageSize: pageSize.value,
-    userName: useStore.$state.user.userName,
+    userName: useStore.user.userName,
   }).then((requset) => {
     if (requset.status === "SUCCESS") {
       dataList.value = requset.data.rows;

+ 1 - 1
src/pages/register.vue

@@ -108,7 +108,7 @@ function handleSubmit() {
               .Login({
                 username: phone.value,
                 password: newPassword.value,
-                tenantId: useStore.$state.tenantId,
+                tenantId: useStore.tenantId,
               })
               .then(() => {
                 /** 获取用户信息 */

+ 1 - 1
src/plugins/setting.plugins.js

@@ -19,7 +19,7 @@ const formatSize = () => {
       v = (sizeCache / 1073741824).toFixed(2) + "GB";
     }
 
-    settingStores().$state.currentSize = currentSize
+    settingStores().currentSize = currentSize
   });
   return currentSize;
 };

+ 1 - 1
src/store/modules/setting.js

@@ -186,7 +186,7 @@ const settingStore = defineStore("storage-setting", {
             const useStore = useStores();
             let data = { name: "file", filePath: res.tempFilePaths[0] };
             uploadAvatar(data).then((response) => {
-                useStore.$state.avatar = response.data.url;
+                useStore.avatar = response.data.url;
                 updateUserProfile({
                     avatar: response.data.url,
                 }).then(() => { });

+ 1 - 1
src/store/modules/user.js

@@ -301,7 +301,7 @@ const useStores = defineStore("useStores", {
     SET_STORAGE_OBJECT_KEYS(LIST) {
       Object.keys(LIST).forEach(function (key) {
         storage.set(key, LIST[key]);
-        useStores().$state[key] = LIST[key];
+        useStores()[key] = LIST[key];
       });
     },
   },