zaijin 1 rok temu
rodzic
commit
70958edb8e
1 zmienionych plików z 21 dodań i 32 usunięć
  1. 21 32
      pages/center/index.vue

+ 21 - 32
pages/center/index.vue

@@ -101,21 +101,16 @@ export default {
     /**
      * 获取客服电话字典
      */
-    getDict() {
-      this.$u.api
-        .getDictApi({
-          type: 'customer_service_phone'
-        })
-        .then((res) => {
-          if (res.code === 200) {
-            this.callPhoneList = res.data.map((item) => {
-              return {
-                value: item.dictValue,
-                label: item.dictLabel
-              };
-            });
-          }
+    async getDict() {
+      const { code, data } = await this.$u.api.getDictApi({ type: 'customer_service_phone' });
+      if (code === 200) {
+        this.callPhoneList = data.map((item) => {
+          return {
+            value: item.dictValue,
+            label: item.dictLabel
+          };
         });
+      }
     },
     /**
      * 打开新页面
@@ -134,25 +129,19 @@ export default {
       }
     },
     // 获取消息未读条数
-    getMsgNum() {
-      this.$u.api.getIndexData().then((res) => {
-        if (res.code === 200) {
-          let num = 0;
-          if (res.data.news) {
-            res.data.news.forEach((item) => {
-              if (item.readFlag == 0) {
-                num += 1;
-              }
-            });
-          }
-          this.messageNum = num;
-        } else {
-          this.$refs.uToast.show({
-            title: res.msg,
-            type: 'error'
+    async getMsgNum() {
+      const { code, data } = await this.$u.api.getIndexData();
+      if (code === 200) {
+        let num = 0;
+        if (data.news) {
+          data.news.forEach((item) => {
+            if (item.readFlag == 0) {
+              num += 1;
+            }
           });
         }
-      });
+        this.messageNum = num;
+      }
     },
     // tabbar 返回
     customBack() {
@@ -164,7 +153,7 @@ export default {
     // 拨打电话
     phoneCall(phone) {
       uni.makePhoneCall({
-        phoneNumber: phone[0].value || '0851-38222696'
+        phoneNumber: phone[0].value
       });
     },
     // 登出