zs 1 tahun lalu
induk
melakukan
22e7100cf8
2 mengubah file dengan 31 tambahan dan 7 penghapusan
  1. 15 3
      pages/index/index.vue
  2. 16 4
      unpackage/dist/dev/mp-weixin/pages/index/index.js

+ 15 - 3
pages/index/index.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="content">
-		<image class="logo" :src="config.logoUrl||'/static/logo.png'"></image>
+		<image class="logo" :src="config.logo[0].url||'/static/logo.png'"></image>
 	</view>
 </template>
 
@@ -13,14 +13,26 @@
 	const $app = getCurrentInstance()?.appContext.config.globalProperties.$app;
 	const $config = getCurrentInstance()?.appContext.config.globalProperties.$config;
 	// 基本信息
-	const config = ref({ logoUrl: [] });
+	const config = ref({ logo: [] });
 	onLoad(async () => {
 		await searchConfig();
 		await search();
 	})
 	// config信息
 	const searchConfig = async () => {
-		config.value = uni.getStorageSync('config');
+		let res = await $api(`config`, 'GET', {});
+		if (res.errcode == 0) {
+			config.value = res.data
+			uni.setStorage({
+				key: 'config',
+				data: res.data,
+				success: function (arr) {
+				},
+				fail: function (err) {
+					console.log(err);
+				}
+			})
+		}
 	};
 	// 查询
 	const search = async () => {

+ 16 - 4
unpackage/dist/dev/mp-weixin/pages/index/index.js

@@ -4,16 +4,28 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
   __name: "index",
   setup(__props) {
     var _a, _b, _c;
-    (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
+    const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
     (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$app;
     (_c = common_vendor.getCurrentInstance()) == null ? void 0 : _c.appContext.config.globalProperties.$config;
-    const config = common_vendor.ref({ logoUrl: [] });
+    const config = common_vendor.ref({ logo: [] });
     common_vendor.onLoad(async () => {
       await searchConfig();
       await search();
     });
     const searchConfig = async () => {
-      config.value = common_vendor.index.getStorageSync("config");
+      let res = await $api(`config`, "GET", {});
+      if (res.errcode == 0) {
+        config.value = res.data;
+        common_vendor.index.setStorage({
+          key: "config",
+          data: res.data,
+          success: function(arr) {
+          },
+          fail: function(err) {
+            console.log(err);
+          }
+        });
+      }
     };
     const search = async () => {
       common_vendor.index.getStorage({
@@ -43,7 +55,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
     };
     return (_ctx, _cache) => {
       return {
-        a: config.value.logoUrl || "/static/logo.png"
+        a: config.value.logo[0].url || "/static/logo.png"
       };
     };
   }