Эх сурвалжийг харах

feat: 移动端市场分析报告增加匹配方式选项

cuiyalong 2 жил өмнө
parent
commit
1778b081e8

+ 37 - 0
src/jfw/modules/app/src/web/templates/big-member/page_report_analysis.html

@@ -92,6 +92,7 @@
                         </div>
                         <van-cell-group class="filters-list">
                             <van-cell center title="分析内容" is-link value-class="ellipsis" :value="resolveSelected('keys')" @click="clickCell('keys')"></van-cell>
+                            <van-cell center title="匹配方式" is-link value-class="ellipsis" :value="resolveSelected('matchway')" @click="clickCell('matchway')"></van-cell>
                             <van-cell center title="区域" is-link value-class="ellipsis" :value="resolveSelected('area')" @click="clickCell('area')"></van-cell>
                             <van-cell center title="行业" is-link value-class="ellipsis" :value="resolveSelected('industry')" @click="clickCell('industry')"></van-cell>
                             <van-cell center title="采购单位类型" value-class="ellipsis" is-link :value="resolveSelected('buyerclass')" @click="clickCell('buyerclass')"></van-cell>
@@ -551,6 +552,42 @@
                 </div>
             </div>
         </van-popup>
+        <van-popup
+            v-model="filterDialogShow.matchway"
+            closeable
+            round
+            position="bottom"
+            close-icon="clear"
+            class="j-popup collection"
+            overlay-class="j-overlay"
+            :lazy-render="false"
+            :style="{ height: '36%' }"
+            get-container="body">
+            <div class="j-container matchway-popup">
+                <div class="popup-header header-title">请选择匹配方式</div>
+                <div class="j-main">
+                    <van-radio-group v-model="filtersCache.matchway">
+                        <van-cell-group>
+                          <van-cell
+                            v-for="item in matchWayList"
+                            :key="item.label"
+                            :title="item.name"
+                            clickable
+                            @click="filtersCache.matchway = item.label">
+                            <template #right-icon>
+                              <van-radio checked-color="#2ABED1" :name="item.label" />
+                            </template>
+                          </van-cell>
+                    </van-radio-group>
+                </div>
+                <div class="j-footer">
+                    <div class="j-button-group">
+                        <button class="j-button-cancel" @click="filtersCache.matchway = 'title'">重置</button>
+                        <button class="j-button-confirm" @click="filters.matchway = filtersCache.matchway;filterDialogShow.matchway = false">确认</button>
+                      </div>
+                </div>
+            </div>
+        </van-popup>
         <van-popup
             v-model="filterDialogShow.area"
             closeable

+ 8 - 0
src/web/staticres/common-module/collection/js/keyword-mobile.js

@@ -349,12 +349,20 @@ var keywordComponent = {
             _this.setInitList(_this.tablist)
           }
           _this.checkNoKey()
+          _this.emitRequestRes(res)
         },
         error: function(err){
           console.log(err)
         }
       })
     },
+    emitRequestRes: function (res) {
+      try {
+        if (res && res.data) {
+          subscribeRequestSuccess && subscribeRequestSuccess(res.data)
+        }
+      } catch (error) {}
+    },
     setInitList: function(arr) {
       arr.forEach((v) => {
         const ownKey = {

+ 15 - 0
src/web/staticres/common-module/diy-report/js/report-list.js

@@ -31,6 +31,13 @@ var reportListTemplate = `
                             v-html="formatKeys(item.keysItems, item.open)">
                         </div>
                     </div>
+                    <div class="info-flex-r-box filters">
+                        <span class="info-content-label">匹配方式:</span>
+                        <div class="info-content-box"
+                            :class="{'van-ellipsis': !item.open}"
+                            v-html="formatMatchWay(item.matchingMode, item.open)">
+                        </div>
+                    </div>
                     <div class="info-flex-r-box filters">
                         <span class="info-content-label">时间:</span>
                         <div class="info-content-box" :class="{'van-ellipsis': !item.open}">
@@ -187,6 +194,14 @@ var reportListMobileComponent = {
                 }.bind(this)
             })
         },
+        formatMatchWay: function (m, open) {
+            var map = {
+                title: '按标题匹配',
+                content: '按全文匹配'
+            }
+            const text = map[m] || map.content
+            return text
+        },
         formatKeys: function (keys, open) {
             var tempStr = '-'
             if (!keys) return tempStr

+ 51 - 1
src/web/staticres/common-module/report-analysis/js/report_analysis.js

@@ -1,6 +1,10 @@
 function dateFormatter (date, pattern) {
   return new Date(date).pattern(pattern)
 }
+function subscribeRequestSuccess (res) {
+  vm.subscribeInfo = res
+}
+
 var vm = new Vue({
   delimiters: ['${', '}'],
   el: '#analysis',
@@ -25,6 +29,7 @@ var vm = new Vue({
   data: {
     sessStorageKey: '$data-report_analysis',
     tabActiveName: 'analysis', // analysis/history
+    subscribeInfo: {},
     tabList: [
       {
         label: '市场分析报告',
@@ -35,6 +40,16 @@ var vm = new Vue({
         name: 'history'
       }
     ],
+    matchWayList: [
+      {
+        name: '按标题匹配',
+        label: 'title'
+      },
+      {
+        name: '按全文匹配',
+        label: 'content'
+      }
+    ],
     tabConf: {
       titleActiveColor: '#2ABED1',
       titleInactiveColor: '#5F5E64',
@@ -70,8 +85,12 @@ var vm = new Vue({
     ],
     scrollTop: 0,
     filtersPageShow: true,
+    filtersCache: {
+      matchway: 'title'
+    },
     filters: {
       selectKeysArr: [], // 关键词简单数组,用于恢复选择状态
+      matchway: 'title',
       keys: [], // 关键词详细数组,用于提交数据
       area: {},
       industry: [],
@@ -85,6 +104,7 @@ var vm = new Vue({
     },
     filterDialogShow: {
       keys: false,
+      matchway: false,
       area: false,
       industry: false,
       buyerclass: false,
@@ -343,7 +363,12 @@ var vm = new Vue({
           this.calcStickyOffset()
         }
       }
-    }
+    },
+    subscribeInfo (n) {
+      if (!this.rid && n && n.member_jy && n.member_jy.i_matchway) {
+        this.setDefaultMatchWay(n.member_jy.i_matchway)
+      }
+    },
   },
   created () {
     this.calcLastTimeText()
@@ -373,6 +398,17 @@ var vm = new Vue({
     utils.iosBackRefresh()
   },
   methods: {
+    setDefaultMatchWay: function (matchWay) {
+      // matchWay 1按标题匹配title 2按全文匹配content
+      var map = {
+        1: 'title',
+        2: 'content'
+      }
+      var defaultMatchWay = map[matchWay]
+      if (defaultMatchWay) {
+        this.filters.matchway = defaultMatchWay
+      }
+    },
     // 设置排序方式
     setsortType (data) {
       this.sections.areaScatter.sortType = data
@@ -622,9 +658,18 @@ var vm = new Vue({
         text = this.resolveSelectIndustryText(filters.industryDetail)
       } else if (type === 'buyerclass') {
         text = this.resolveSelectBuyerclassText(filters.buyerclass)
+      } else if (type === 'matchway') {
+        text = this.resolveSelectMatchWayText(filters.matchway)
       }
       return prefix + text
     },
+    resolveSelectMatchWayText: function (m) {
+      var map = {
+        title: '按标题匹配',
+        content: '按全文匹配'
+      }
+      return map[m]
+    },
     resolveSelectKeysText: function (keys) {
       if (Array.isArray(keys)) {
         if (keys.length === 0) {
@@ -748,6 +793,8 @@ var vm = new Vue({
         setTimeout(function () {
           _this.$refs.industrySelector.setState()
         }, 0)
+      } else if (key = 'matchway') {
+        this.filtersCache[key] = this.filters[key]
       }
       dialog[key] = true
     },
@@ -800,6 +847,7 @@ var vm = new Vue({
 
       const query = {
         keysItems: this.getSelectedKeys(),
+        matchingMode: this.filters.matchway,
         rangeTime: `${parseInt(this.filters.rangeTime.start / 1000)}-${parseInt(this.filters.rangeTime.end / 1000)}`,
         rangeTimeExtra: this.filters.rangeTime.exact,
         area: JSON.stringify(this.filters.area),
@@ -1067,6 +1115,8 @@ var vm = new Vue({
         this.reportFilters.buyerclass = data.buyerclass.split(',')
         this.filters.buyerclass = this.reportFilters.buyerclass
       }
+      console.log(data)
+      this.filters.matchway = data.matchingMode || 'content'
     },
     // 市场概况
     sortMarketOverview (profile) {

+ 37 - 0
src/web/templates/big-member/wx/page_report_analysis.html

@@ -100,6 +100,7 @@
                       </div>
                       <van-cell-group class="filters-list">
                           <van-cell center title="分析内容" is-link value-class="ellipsis" :value="resolveSelected('keys')" @click="clickCell('keys')"></van-cell>
+                          <van-cell center title="匹配方式" is-link value-class="ellipsis" :value="resolveSelected('matchway')" @click="clickCell('matchway')"></van-cell>
                           <van-cell center title="区域" is-link value-class="ellipsis" :value="resolveSelected('area')" @click="clickCell('area')"></van-cell>
                           <van-cell center title="行业" is-link value-class="ellipsis" :value="resolveSelected('industry')" @click="clickCell('industry')"></van-cell>
                           <van-cell center title="采购单位类型" value-class="ellipsis" is-link :value="resolveSelected('buyerclass')" @click="clickCell('buyerclass')"></van-cell>
@@ -559,6 +560,42 @@
               </div>
           </div>
       </van-popup>
+      <van-popup
+            v-model="filterDialogShow.matchway"
+            closeable
+            round
+            position="bottom"
+            close-icon="clear"
+            class="j-popup collection"
+            overlay-class="j-overlay"
+            :lazy-render="false"
+            :style="{ height: '36%' }"
+            get-container="body">
+            <div class="j-container matchway-popup">
+                <div class="popup-header header-title">请选择匹配方式</div>
+                <div class="j-main">
+                    <van-radio-group v-model="filtersCache.matchway">
+                        <van-cell-group>
+                          <van-cell
+                            v-for="item in matchWayList"
+                            :key="item.label"
+                            :title="item.name"
+                            clickable
+                            @click="filtersCache.matchway = item.label">
+                            <template #right-icon>
+                              <van-radio checked-color="#2ABED1" :name="item.label" />
+                            </template>
+                          </van-cell>
+                    </van-radio-group>
+                </div>
+                <div class="j-footer">
+                    <div class="j-button-group">
+                        <button class="j-button-cancel" @click="filtersCache.matchway = 'title'">重置</button>
+                        <button class="j-button-confirm" @click="filters.matchway = filtersCache.matchway;filterDialogShow.matchway = false">确认</button>
+                      </div>
+                </div>
+            </div>
+      </van-popup>
       <van-popup
           v-model="filterDialogShow.area"
           closeable