浏览代码

Merge branch 'dev/v4.9.57_yf' of qmx/jy into feature/v4.9.57

yangfeng 9 月之前
父节点
当前提交
d8a6962a27

+ 44 - 9
src/jfw/modules/app/src/web/templates/areaPack/page_set_area.html

@@ -158,7 +158,9 @@
                 popupTip: false,
                 noAreaFreeType: false, // 免费用户未设置地区时显示弹窗
                 backTipShowCount: 0, // 离开页面展示弹窗次数
-                successBack: false
+                successBack: false,
+                keywords: '',
+                wordsMode: ''
             },
             computed: {
                 moreThanSubCount: function () {
@@ -216,6 +218,8 @@
             mounted: function () {
                 var type = utils.getParam('type')
                 var url = utils.getParam('url')
+                this.keywords = utils.getParam('keywords')
+                this.wordsMode = utils.getParam('wordsMode')
                 if (url) {
                   this.params.url = decodeURIComponent(url)
                 }
@@ -331,14 +335,16 @@
                         success: function (res) {
                             if (res && res.success) {
                                 sessionStorage.setItem('needPlayClick', 'true')
-                                if (history.state) {
-                                  _this.successBack = true
-                                }
-                                if (_this.params.url) {
-                                  location.replace(_this.params.url)
-                                } else {
-                                  history.back()
-                                }
+                                _this.freeSubscribeKeys(function() {
+                                  if (history.state) {
+                                    _this.successBack = true
+                                  }
+                                  if (_this.params.url) {
+                                    location.replace(_this.params.url)
+                                  } else {
+                                    history.back()
+                                  }
+                                })
                             } else {
                                 if (res.errMsg) {
                                     _this.$toast(res.errMsg)
@@ -389,6 +395,35 @@
                     }
                     sessionStorage.setItem(this.sessKey, JSON.stringify(data))
                 },
+                // P611需求:用户点击一键订阅,没有设置地区跳到地区设置,地区订阅成功后 要将一键订阅的关键词同步设置上
+                freeSubscribeKeys: function(callback) {
+                  var _this = this
+                  if (_this.keywords) {
+                    try {
+                      $.ajax({
+                        url: '/jyapp/member/swordfish/ajaxReq',
+                        type: 'POST',
+                        data: {
+                          keys: _this.keywords,
+                          reqType: 'subscribe',
+                          match_way: _this.wordsMode
+                        },
+                        success: function (res) {
+                          // flag === 'o' '您已经超过订阅关键字上限'
+                          // flag === 'y' '订阅成功'
+                          callback && callback()
+                        },
+                        error: function (error) {
+                          callback && callback()
+                        }
+                      })
+                    } catch (error) {
+                      callback && callback()
+                    }
+                  } else {
+                    callback && callback()
+                  }
+                }
             }
         })
 

+ 37 - 2
src/web/templates/areaPack/wx/page_set_area.html

@@ -158,7 +158,9 @@
                 popupTip: false,
                 noAreaFreeType: false, // 免费用户未设置地区时显示弹窗
                 backTipShowCount: 0, // 离开页面展示弹窗次数
-                successBack: false
+                successBack: false,
+                keywords: '',
+                wordsMode: ''
             },
             computed: {
                 moreThanSubCount: function () {
@@ -216,6 +218,8 @@
             mounted: function () {
                 var type = utils.getParam('type')
                 var url = utils.getParam('url')
+                this.keywords = utils.getParam('keywords')
+                this.wordsMode = utils.getParam('wordsMode')
                 if (url) {
                   this.params.url = decodeURIComponent(url)
                 }
@@ -331,7 +335,8 @@
                         success: function (res) {
                             if (res && res.success) {
                               sessionStorage.setItem('needPlayClick', 'true')
-                              if (history.state) {
+                              _this.freeSubscribeKeys(function() {
+                                if (history.state) {
                                   _this.successBack = true
                                 }
                                 var wlh = window.location.href
@@ -340,6 +345,7 @@
                                   return
                                 }
                                 history.back()
+                              })
                             } else {
                                 if (res.errMsg) {
                                     _this.$toast(res.errMsg)
@@ -390,6 +396,35 @@
                     }
                     sessionStorage.setItem(this.sessKey, JSON.stringify(data))
                 },
+                // P611需求:用户点击一键订阅,没有设置地区跳到地区设置,地区订阅成功后 要将一键订阅的关键词同步设置上
+                freeSubscribeKeys: function(callback) {
+                  var _this = this
+                  if (_this.keywords) {
+                    try {
+                      $.ajax({
+                        url: '/member/swordfish/ajaxReq',
+                        type: 'POST',
+                        data: {
+                          keys: _this.keywords,
+                          reqType: 'subscribe',
+                          match_way: _this.wordsMode
+                        },
+                        success: function (res) {
+                          // flag === 'o' '您已经超过订阅关键字上限'
+                          // flag === 'y' '订阅成功'
+                          callback && callback()
+                        },
+                        error: function (error) {
+                          callback && callback()
+                        }
+                      })
+                    } catch (error) {
+                      callback && callback()
+                    }
+                  } else {
+                    callback && callback()
+                  }
+                }
             }
         })