JXDS18FUJT 1 éve
szülő
commit
699c71ee74

+ 0 - 2
src/api/modules/open.js

@@ -9,8 +9,6 @@ const open = {
             url: openApi + "/open-api/question/info/selectFreeQuestionInfo",
             params
         })
-
-
     },
     //获取免费的题库(新)
     question2InfoSelectFreeQuestionInfo(params) {

+ 6 - 6
src/pages/forecast/index.vue

@@ -179,8 +179,8 @@
 </template>
 
 <script>
-
-export default{
+import responseDecorator from '@/utils/responseDecorator'
+export default {
     data() {
         return {
             title: '国学',
@@ -403,17 +403,17 @@ export default{
 
             }
         }
+    },
+    methods: {
+
     },
     onLoad() {
         api.openApi.openApiGanZhiGet8ziByDate(this.form).then(res => {
             this.userData = responseDecorator.get8ziByDateDecorator(res.data.data)
             console.log(this.userData)
         })
-
     },
-    methods: {
 
-    }
 };
 </script>
 
@@ -514,7 +514,7 @@ export default{
             }
 
             .result-desc_limit {
-               
+
                 display: -webkit-box;
                 -webkit-box-orient: vertical;
                 -webkit-line-clamp: 3;

+ 56 - 0
src/utils/responseDecorator.js

@@ -0,0 +1,56 @@
+
+
+// 
+// type openApiGanZhiGet8ziByDate = openApiRes.openApiGanZhiGet8ziByDate["data"]
+// interface ganZhiGet8ziByDate extends openApiGanZhiGet8ziByDate {
+//     ganZhiProRowVoList: openApiGanZhiGet8ziByDate["ganZhiRowVoList"][]
+// }
+
+const textSwitchColor = (text) => {
+    let color = '#333'
+    switch (text) {
+        case '棕':
+            color = '#9C4B08'
+            break;
+        case '红':
+            color = '#CB2C00'
+            break;
+        case '绿':
+            color = '#53996B'
+            break;
+        case '蓝':
+            color = '#006494'
+            break;
+        case '黄':
+            color = '#D19C03'
+            break;
+        default:
+            color = '#333'
+    }
+    return color
+
+
+}
+const get8ziByDateDecorator = function (responseData) {
+    const respData = {
+        ...responseData,
+        ganZhiProRowVoList: []
+
+    }
+    for (let index = 0; index < (respData.ganZhiRowVoList.length / 2); index++) {
+        const element1 = respData.ganZhiRowVoList[index * 2];
+        const element2 = respData.ganZhiRowVoList[index * 2 + 1];
+        element1.textColor = textSwitchColor(element1.color)
+        element2.textColor = textSwitchColor(element2.color)
+        respData.ganZhiProRowVoList.push([element1, element2])
+
+
+    }
+    return respData
+
+
+}
+
+export default {
+    get8ziByDateDecorator
+}