Просмотр исходного кода

Merge branch 'master' into feature/v4.9.94

yuelujie 7 месяцев назад
Родитель
Сommit
2898445cfd
31 измененных файлов с 218 добавлено и 22 удалено
  1. 1 2
      src/jfw/modules/app/src/app/miniprogram/miniprogram.go
  2. 22 2
      src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/ent_portrait.js
  3. 20 0
      src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/unit_portrayal.js
  4. 2 0
      src/jfw/modules/app/src/web/staticres/jyapp/js/common.js
  5. 3 0
      src/jfw/modules/app/src/web/templates/big-member/page_pro_follow_detail.html
  6. 5 0
      src/jfw/modules/app/src/web/templates/frontRouter/fileRecord/sess/index.html
  7. 4 0
      src/jfw/modules/app/src/web/templates/frontRouter/share/sess/index.html
  8. 1 0
      src/jfw/modules/app/src/web/templates/frontRouter/share/sess/invite-friends.html
  9. 3 2
      src/jfw/modules/bigmember/src/service/analysis/forecastproject.go
  10. 1 1
      src/jfw/modules/publicapply/src/activityday/dao/raffle.go
  11. 1 0
      src/jfw/modules/publicapply/src/detail/config/config.go
  12. 13 0
      src/jfw/modules/publicapply/src/detail/dao/bidding.go
  13. 3 0
      src/jfw/modules/publicapply/src/detail/image.yaml
  14. 7 6
      src/jfw/modules/publicapply/src/detail/service/action.go
  15. 28 0
      src/jfw/modules/publicapply/src/detail/service/service.go
  16. 1 1
      src/jfw/modules/publicapply/src/enterpriseSearch/service/search.go
  17. 4 0
      src/jfw/modules/publicapply/src/filter/sessionfilter.go
  18. 1 1
      src/jfw/modules/publicapply/src/test/http-client.env.json
  19. 11 0
      src/jfw/modules/publicapply/src/test/p532.http
  20. 2 0
      src/jfw/modules/subscribepay/src/service/aiForecastPack.go
  21. 4 2
      src/jfw/modules/subscribepay/src/util/order_channel.go
  22. 4 4
      src/web/staticres/common-module/bidedoc/js/index.js
  23. 4 0
      src/web/staticres/common-module/big-member/js/page_client_follow_detail.js
  24. 4 1
      src/web/staticres/common-module/file-pack/js/index.js
  25. 3 0
      src/web/staticres/common-module/mobile-portrayal-footer/js/mobile-portrayal-footer.js
  26. 3 0
      src/web/staticres/common-module/my_data_export/js/index.js
  27. 34 0
      src/web/staticres/common-module/public/head.js
  28. 15 0
      src/web/staticres/common-module/public/js/utils.js
  29. 3 0
      src/web/staticres/common-module/report-analysis/js/components/downloadpopup.js
  30. 6 0
      src/web/staticres/common-module/share/js/invite-friends.js
  31. 5 0
      src/web/templates/frontRouter/wx/fileRecord/sess/index.html

+ 1 - 2
src/jfw/modules/app/src/app/miniprogram/miniprogram.go

@@ -172,8 +172,7 @@ func (m *MiniProgram) BindPhone() error {
 				if err := jy.Publish(public.Mgo_Log, nsqPath, nsq_topic, jy.Jyapp_phone_register, mgoUserId, jy.Jyapp_node1, nil); err != nil {
 					log.Println("nsq队列写入失败-->", err, jy.Jyapp_phone_register, mgoUserId)
 				}
-			}
-			if createRes == 2 {
+			} else if createRes == 2 {
 				if err := jy.Publish(public.Mgo_Log, nsqPath, nsq_topic, "task", mgoUserId, jy.Jyweb_node2, map[string]interface{}{
 					"code":       1007,
 					"types":      "bindPhone",

+ 22 - 2
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/ent_portrait.js

@@ -351,6 +351,25 @@ var vNode = {
     }
   },
   methods: {
+    doMiniPostMessageShareFn (title) {
+      try {
+        wx.miniProgram.postMessage({ data: {
+            post: 'share',
+            type: 'common',
+            desc: '企业画像',
+            title: title + '画像分析'
+          }})
+      } catch (e) {
+        console.log(e)
+      }
+    },
+    doMiniPostMessageShare (title) {
+      this.doMiniPostMessageShareFn(title)
+      var _that = this
+       window.miniAppInitLoaded = function () {
+        _that.doMiniPostMessageShareFn(title)
+      }
+    },
     restoreTab: function() {
       var tab = utils.getParam('tab') || ''
       if (tab) {
@@ -768,6 +787,7 @@ var vNode = {
           if (res.error_code == 0) {
             if (res.data && Object.keys(res.data).length !== 0) {
               _this.entInfo.name = res.data.entName
+              _this.doMiniPostMessageShare(_this.entInfo.name)
               _this.entBaseInfo._empty = false
               for (var key in res.data) {
                 _this.entBaseInfo[key] = res.data[key]
@@ -1645,11 +1665,11 @@ var vNode = {
       var container = document.querySelector('.sesame-main');
       if(!container) return
       var items = container.getElementsByClassName('sesame-item');
-  
+
       // 获取所有子元素的top值,如果所有子元素的top值相同,则说明只有一行
       var firstItemTop = items[0].offsetTop;
       var isOneRow = true;
-  
+
       for (var i = 1; i < items.length; i++) {
         if (items[i].offsetTop !== firstItemTop) {
           isOneRow = false;

+ 20 - 0
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/unit_portrayal.js

@@ -325,6 +325,7 @@ var vNode = {
   created () {
     this.buyer.name = decodeURIComponent(utils.getParam('entName'))
     this.portraitName = decodeURIComponent(utils.getParam('entName'))
+    this.doMiniPostMessageShare(this.buyer.name)
     this.getUserSimpleInfo()
     this.restore = this.reStoreState()
     setTimeout(() => {
@@ -358,6 +359,25 @@ var vNode = {
     window.removeEventListener("resize", this.init, 20);
   },
   methods: {
+    doMiniPostMessageShareFn (title) {
+      try {
+        wx.miniProgram.postMessage({ data: {
+            post: 'share',
+            type: 'common',
+            desc: '采购单位画像',
+            title: title + '画像分析'
+          }})
+      } catch (e) {
+        console.log(e)
+      }
+    },
+    doMiniPostMessageShare (title) {
+      this.doMiniPostMessageShareFn(title)
+      var _that = this
+      window.miniAppInitLoaded = function () {
+        _that.doMiniPostMessageShareFn(title)
+      }
+    },
     restoreTab: function() {
       var tab = utils.getParam('tab') || ''
       if (tab) {

+ 2 - 0
src/jfw/modules/app/src/web/staticres/jyapp/js/common.js

@@ -355,6 +355,7 @@ window.utilsEnv = {
   },
   getPlatformEnvs: function () {
     var inWX = navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1
+    var inWeiXinMiniApp = navigator.userAgent.toLowerCase().indexOf('miniprogram') !== -1
     var inApp = this.getIsInTheAppContainer()
     var platformOS = this.androidOrIOS()
     var getPlatform = function () {
@@ -374,6 +375,7 @@ window.utilsEnv = {
       platformOS: platformOS,
       platform: platform,
       inApp: inApp,
+      inWxMini: inWeiXinMiniApp, // 微信小程序
       inWX: inWX
     }
   }

+ 3 - 0
src/jfw/modules/app/src/web/templates/big-member/page_pro_follow_detail.html

@@ -1508,6 +1508,9 @@
                 if (!this.isPayedUser) {
                     return this.openVip()
                 }
+                if (utils.$envs.inWxMini) {
+                    return utils.toDownloadApp()
+                }
                 if (this.isRequestIng) {
                     return
                 }

+ 5 - 0
src/jfw/modules/app/src/web/templates/frontRouter/fileRecord/sess/index.html

@@ -422,6 +422,11 @@
   {{include "/big-member/commonjs.html"}}
   <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/jyapp/js/common.js?v={{Msg "seo" "version"}}'></script>
   <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/public/js/china-map-data.js?v={{Msg "seo" "version"}}'></script>
+  <script>
+    var __pageData = {
+        platform: 'app'
+    }
+  </script>
   <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/file-pack/js/index.js?v={{Msg "seo" "version"}}'></script>
 <!--  <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/file-pack/js/rights-box.js?v={{Msg "seo" "version"}}'></script>-->
   {{include "/common/baiducc.html"}}

+ 4 - 0
src/jfw/modules/app/src/web/templates/frontRouter/share/sess/index.html

@@ -454,6 +454,10 @@
       }
 
       $('.save-button').off('click').on('click', function () {
+        if (utils.$envs.inWxMini) {
+          return utils.toDownloadApp()
+        }
+
         if (saveSuccess) {
           console.log('返回')
           return

+ 1 - 0
src/jfw/modules/app/src/web/templates/frontRouter/share/sess/invite-friends.html

@@ -90,6 +90,7 @@
   <script src=//cdn-common.jianyu360.com/cdn/lib/vant/2.12.24/lib/vant.min.js></script>
   <script src=//cdn-common.jianyu360.com/cdn/lib/jquery/3.6.0/jquery.min.js></script>
   <script src="//cdn-common.jianyu360.com/cdn/lib/html2canvas/1.3.3/dist/html2canvas.min.js" crossorigin></script>
+  <script src=//res2.wx.qq.com/open/js/jweixin-1.6.0.js></script>
   <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/jyapp/js/common.js?v={{Msg "seo" "version"}}'></script>
   {{include "/big-member/commonjs.html"}}
   <script>

+ 3 - 2
src/jfw/modules/bigmember/src/service/analysis/forecastproject.go

@@ -177,10 +177,11 @@ func (this *Analysis) ForPContent() {
 		}
 		id = util.DecodeId(id)
 		data, ok := db.Mgo_Ent.FindById(C_FPContent, id, nil)
-		if ok && data != nil && (*data)["results"] != nil {
+		if ok && data != nil {
 			yucetime := (*data)["yucetime"]
 			(*data)["yucetime"] = FormatDateWithObj(&yucetime, "2006/01/02")
-			results := qutil.ObjArrToMapArr((*data)["results"].([]interface{}))
+			resultsTemp, _ := (*data)["results"].([]interface{})
+			results := qutil.ObjArrToMapArr(resultsTemp)
 			resultsArr := []map[string]interface{}{}
 			resultsMap := map[string]interface{}{}
 			if len(results) > 0 {

+ 1 - 1
src/jfw/modules/publicapply/src/activityday/dao/raffle.go

@@ -290,7 +290,7 @@ func (r *RaffleInfo) ActiveInfo() (ai *Lai, err error) {
 
 // 奖品信息
 func (r *RaffleInfo) PrizeInfo() (pi *Lpi, err error) {
-	sql := fmt.Sprintf("SELECT lpi.id ,lpi.active_id ,lpi.jy_prize ,lpi.frequency ,lpi.probability ,lpi.inventory ,lpi.total ,lpi.alarm_switch ,lpi.alarm_threshold ,lpi.target ,lpi.daily_num ,pbi.name ,pbi.attribute ,pbi.draw_pic ,pbi.win_pic ,pbi.notes ,pbi.url ,pbi.label  FROM %s lpi LEFT JOIN %s pbi ON lpi.pb_id = pbi.id  WHERE lpi.active_id = ? AND state = 0", consts.TablePrizeInfo, consts.TablePrizeBaseInfo)
+	sql := fmt.Sprintf("SELECT lpi.id ,lpi.active_id ,lpi.mold,lpi.jy_prize ,lpi.frequency ,lpi.probability ,lpi.inventory ,lpi.total ,lpi.alarm_switch ,lpi.alarm_threshold ,lpi.target ,lpi.daily_num ,pbi.name ,pbi.attribute ,pbi.draw_pic ,pbi.win_pic ,pbi.notes ,pbi.url ,pbi.label  FROM %s lpi LEFT JOIN %s pbi ON lpi.pb_id = pbi.id  WHERE lpi.active_id = ? AND state = 0", consts.TablePrizeInfo, consts.TablePrizeBaseInfo)
 	data := db.BaseMysql.SelectBySql(sql, r.ActiveId)
 	if data != nil && len(*data) > 0 {
 		var (

+ 1 - 0
src/jfw/modules/publicapply/src/detail/config/config.go

@@ -31,4 +31,5 @@ func init() {
 			}
 		}
 	}
+
 }

+ 13 - 0
src/jfw/modules/publicapply/src/detail/dao/bidding.go

@@ -734,3 +734,16 @@ func DescriptionHandle(stype string, obj map[string]interface{}) string {
 	}
 	return description
 }
+
+// IsSubscribe 获取用户是否关注
+func IsSubscribe(mgoId string) bool {
+	user, ok := db.Mgo.FindById("user", mgoId, `{"i_ispush":1}`)
+	if ok && user != nil {
+		if common.IntAll((*user)["i_ispush"]) == 0 {
+			return false
+		} else {
+			return true
+		}
+	}
+	return false
+}

+ 3 - 0
src/jfw/modules/publicapply/src/detail/image.yaml

@@ -0,0 +1,3 @@
+homeShareImg: https://www.qmx.top/upload/2025/01/09/202501091441150013Z21b9dr.png  #首页分享卡片-品宣图
+subImg:  https://www.qmx.top/upload/2025/01/09/202501091440220010477v609.png # 首页-关注按钮图片地址
+stepImg: https://www.qmx.top/upload/2025/01/09/2025010914343000110LM83R3.png # 首页-关注微信公众号步骤图地址

+ 7 - 6
src/jfw/modules/publicapply/src/detail/service/action.go

@@ -3,10 +3,11 @@ package service
 import "app.yhyue.com/moapp/jybase/go-xweb/xweb"
 
 type Detail struct {
-    *xweb.Action
-    preAgent     xweb.Mapper `xweb:"/detail/preAgent"`     //数据处理 前置代理接口返回 有效token ;get 请求
-    baseInfo     xweb.Mapper `xweb:"/detail/baseInfo"`     //招标数据基本信息接口(公告信息、摘要、正文、原文、附件信息、打赏文案)
-    minBaseInfo  xweb.Mapper `xweb:"/detail/minBaseInfo"`  //招标数据基本信息接口
-    advancedInfo xweb.Mapper `xweb:"/detail/advancedInfo"` //招标数据进阶信息(招标/采购进度、投标服务、商机推荐、客户推荐)
-    shareInfo    xweb.Mapper `xweb:"/detail/shareInfo"`    //分享所需要的信息
+	*xweb.Action
+	preAgent       xweb.Mapper `xweb:"/detail/preAgent"`       //数据处理 前置代理接口返回 有效token ;get 请求
+	baseInfo       xweb.Mapper `xweb:"/detail/baseInfo"`       //招标数据基本信息接口(公告信息、摘要、正文、原文、附件信息、打赏文案)
+	minBaseInfo    xweb.Mapper `xweb:"/detail/minBaseInfo"`    //招标数据基本信息接口
+	advancedInfo   xweb.Mapper `xweb:"/detail/advancedInfo"`   //招标数据进阶信息(招标/采购进度、投标服务、商机推荐、客户推荐)
+	shareInfo      xweb.Mapper `xweb:"/detail/shareInfo"`      //分享所需要的信息
+	checkSubscribe xweb.Mapper `xweb:"/detail/checkSubscribe"` //验证用户是否分享
 }

+ 28 - 0
src/jfw/modules/publicapply/src/detail/service/service.go

@@ -5,6 +5,8 @@ import (
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	"encoding/json"
+	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/os/gctx"
 	"jy/src/jfw/modules/publicapply/src/detail/config"
 	"jy/src/jfw/modules/publicapply/src/detail/dao"
 	"jy/src/jfw/modules/publicapply/src/detail/util"
@@ -131,11 +133,13 @@ func (d *Detail) ShareInfo() {
 		if ub.Nickname == "" {
 			ub.Nickname = string(ub.Phone[0:3]) + "****" + string(ub.Phone[len(ub.Phone)-4:])
 		}
+		shareImg := g.Cfg("./detail/image.yaml").MustGet(gctx.New(), "homeShareImg") 
 		shareInfo := map[string]interface{}{
 			"nickname": ub.Nickname,
 			"userId":   encrypt.SE.Encode2Hex(ub.UserId), //加密用户userid
 			"openId":   encrypt.SE.Encode2Hex(ub.OpenId),
 			"avatar":   ub.Avatar,
+			"shareImg": shareImg,
 		}
 		return Result{Data: shareInfo}
 	}()
@@ -187,3 +191,27 @@ func (d *Detail) MinBaseInfo() {
 	}()
 	d.ServeJson(r)
 }
+
+// CheckSubscribe 判断用户是否关注微信公众号
+func (d *Detail) CheckSubscribe() {
+	imgCfg := g.Cfg("./detail/image.yaml")
+
+	data := &map[string]interface{}{
+		"sub_img":      imgCfg.MustGet(gctx.New(), "subImg"),
+		"step_img":     imgCfg.MustGet(gctx.New(), "stepImg"),
+		"is_subscribe": false,
+	}
+	result := Result{Data: data}
+	if d.Session() == nil {
+		d.ServeJson(result)
+		return
+	}
+	ub := util.GetUserBaseInfo(d.Session())
+	if ub.UserId == "" || ub.MgoUserId == "" {
+		d.ServeJson(result)
+		return
+	}
+	(*data)["is_subscribe"] = dao.IsSubscribe(ub.MgoUserId)
+	d.ServeJson(result)
+	return
+}

+ 1 - 1
src/jfw/modules/publicapply/src/enterpriseSearch/service/search.go

@@ -52,7 +52,7 @@ func (esa *EnterpriseSearchAction) DoEntSearch() {
 			entSearch.IsVip = true
 		}
 		//免费用户 无搜索权益
-		if vipData.Data != nil && vipData.Data.Free != nil && vipData.Data.Free.IsFree {
+		if (vipData.Data != nil && vipData.Data.Free != nil && vipData.Data.Free.IsFree) || entSearch.ZhiMa == "{}" {
 			entSearch.ZhiMa = ""
 		}
 		// 存搜索记录

+ 4 - 0
src/jfw/modules/publicapply/src/filter/sessionfilter.go

@@ -27,6 +27,7 @@ var regOriginalText = regexp.MustCompile("^/publicapply/userbase/getOriginalText
 var regActivityDayInfo = regexp.MustCompile("^/publicapply/activity/day/info$")              // p477天天抢会员活动活动信息接口未登录也可以访问
 var regDeatil = regexp.MustCompile("^/publicapply/detail/(preAgent|baseInfo|advancedInfo)$") // p406 详情页改版 部分类型未登录也可以查看 所以在接口里面在处理
 var regMinDeatil = regexp.MustCompile("^/publicapply/detail/minBaseInfo$")                   // p406 详情页改版 部分类型未登录也可以查看 所以在接口里面在处理
+var regCheckSub = regexp.MustCompile("^/publicapply/detail/checkSubscribe$")                 // p532 判断用户是否关注公众号
 func (l *sessionfilter) Do(w http.ResponseWriter, req *http.Request) bool {
 	session := l.App.SessionManager.Session(req, w)
 	getSession := session.GetMultiple()
@@ -57,6 +58,9 @@ func (l *sessionfilter) Do(w http.ResponseWriter, req *http.Request) bool {
 	if regMinDeatil.MatchString(req.URL.Path) {
 		return true
 	}
+	if regCheckSub.MatchString(req.URL.Path) {
+		return true
+	}
 	userId, ok := getSession["userId"].(string)
 	if !ok || userId == "" {
 		R.ServeJson(w, req, &Result{Error_code_1004, Error_msg_1004, nil})

+ 1 - 1
src/jfw/modules/publicapply/src/test/http-client.env.json

@@ -1,7 +1,7 @@
 {
   "dev": {
     "addr": "http://127.0.0.1:828",
-    "session": "4a60ae53625b98cf77942f9f2fb220e5e3bfcccb",
+    "session": "5696788f98bb1cc7e24b9d2e6c4ba58c0ee38ddd",
     "referer": "http://127.0.0.1:828/article/content/ABCY1xFfykFFjg7Amhhc3ISCzAoIyFmYXh1KT8vIy43a3xzei9UCc0%3D.html"
   },
   "dev_mailprivate": {

+ 11 - 0
src/jfw/modules/publicapply/src/test/p532.http

@@ -0,0 +1,11 @@
+GET {{addr}}/publicapply/detail/checkSubscribe
+Accept: application/json
+Cookie: SESSIONID={{session}};
+###
+
+
+### 分享所需要的信息
+POST {{addr}}/publicapply/detail/shareInfo
+Content-Type: application/json
+Cookie: SESSIONID={{session}};
+

+ 2 - 0
src/jfw/modules/subscribepay/src/service/aiForecastPack.go

@@ -60,6 +60,7 @@ func (a *AiForecastPack) CreateOrder() {
 		if entId > 0 {
 			buy_subject = 2
 		}
+		_, way := util.GetJyOrderChannel("", a.UserAgent())
 		order_id := util.Mysql.Insert("dataexport_order", map[string]interface{}{
 			"order_money":    order_money,
 			"order_status":   0,
@@ -74,6 +75,7 @@ func (a *AiForecastPack) CreateOrder() {
 			"audit_status":   3, //默认审核通过
 			"buy_subject":    buy_subject,
 			"ent_id":         entId,
+			"order_channel":  way,
 		})
 		log.Println("AI预测包购买订单", userId, order_id, code)
 		if order_id > 0 {

+ 4 - 2
src/jfw/modules/subscribepay/src/util/order_channel.go

@@ -9,7 +9,7 @@ var mobileReg = regexp.MustCompile("(?i)(Android|Mobile|Phone)")
 
 // GetJyOrderChannel 获取订单销售渠道、下单渠道
 // channel 线上直销-剑鱼平台[x010]、代销-剑鱼伙伴[x032]
-// way 下单渠道 剑鱼PC[xdqd01]、剑鱼微信[xdqd02]、剑鱼APP[xdqd03]、启明星后台销售创建[xdqd04]
+// way 下单渠道 剑鱼PC[xdqd01]、剑鱼微信[xdqd02]、剑鱼APP[xdqd03]、启明星后台销售创建[xdqd04]、剑鱼招标网小程序[xdqd07]
 func GetJyOrderChannel(disWord, userAgent string) (channel, way string) {
 	channel = "x010"
 	if disWord != "" {
@@ -17,7 +17,9 @@ func GetJyOrderChannel(disWord, userAgent string) (channel, way string) {
 	}
 	if userAgent != "" {
 		if mobileReg.MatchString(userAgent) {
-			if strings.Index(strings.ToLower(userAgent), "micromessenger") > -1 {
+			if strings.Index(strings.ToLower(userAgent), "miniprogram") > -1 {
+				way = "xdqd07"
+			} else if strings.Index(strings.ToLower(userAgent), "micromessenger") > -1 {
 				way = "xdqd02"
 			} else {
 				way = "xdqd03"

+ 4 - 4
src/web/staticres/common-module/bidedoc/js/index.js

@@ -12,11 +12,11 @@ var vm = new Vue({
   delimiters: ['{', '}'],
   data: function () {
     return {
-      
+
     }
   },
   created() {
-    
+
   },
   methods: {
     getMsg() {
@@ -31,11 +31,11 @@ var vm = new Vue({
       let wxType = getType()
       if (wxType) {
         const a1 = document.createElement('a')
-        a1.href = 'tel:400-108-6670'
+        a1.href = 'tel:13633811737'
         a1.click()
       } else {
         try {
-          JyObj.callPhone('400-108-6670')
+          JyObj.callPhone('13633811737')
         } catch (error) {
           console.log(error)
         }

+ 4 - 0
src/web/staticres/common-module/big-member/js/page_client_follow_detail.js

@@ -1155,6 +1155,10 @@ var vNode = {
             if (!this.isPayedUser) {
                 return this.openVip()
             }
+            if (utils.$envs.inWxMini) {
+                return utils.toDownloadApp()
+            }
+
             if (this.isRequestIng) {
                 return
             }

+ 4 - 1
src/web/staticres/common-module/file-pack/js/index.js

@@ -314,7 +314,7 @@ var vm = new Vue({
     getDatas () {
       return {
         queryTime: new Date(this.years, this.months-1, 1).pattern('yyyy-MM'),
-        platform: navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1 ? 'WX' : 'APP',
+        platform: __pageData.platform.toUpperCase(),
         productName: '附件下载包',
         pageSize: this.listInfo.pageSize,
         pageNum: this.listInfo.pageNum
@@ -333,6 +333,9 @@ var vm = new Vue({
     },
     downFile (item) {
       //location.href = item.s_downUrl
+      if (utils.$envs.inWxMini) {
+        return utils.toDownloadApp()
+      }
 		   $.ajax({
 		       type: 'post',
 		       url: '/jypay/resourcePack/consumePack',

+ 3 - 0
src/web/staticres/common-module/mobile-portrayal-footer/js/mobile-portrayal-footer.js

@@ -130,6 +130,9 @@ var mobilePortrayalFooter = {
  },
   methods: {
     downLoad(){
+      // if (utils.$envs.inWxMini) {
+      //   return utils.toDownloadApp()
+      // }
       this.$parent.$refs.downloadpopup.show() //触发引用此组件父级组件的下载弹框
     },
     monitorClick: utils.debounce(function(){

+ 3 - 0
src/web/staticres/common-module/my_data_export/js/index.js

@@ -74,6 +74,9 @@ var vm = new Vue({
       }
     },
     downloaded(url, type) {
+      if (utils.$envs.inWxMini) {
+        return utils.toDownloadApp()
+      }
       this.downUrl = url
       if (type == 'app') {
         var isIos = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);

+ 34 - 0
src/web/staticres/common-module/public/head.js

@@ -28,6 +28,8 @@
 })();
 
 ;(function () {
+
+
   function loadJS (url, success) {
     var scripts = document.getElementsByTagName('script')
     for (var i = 0; i < scripts.length; i++) {
@@ -50,6 +52,38 @@
     document.getElementsByTagName('head')[0].appendChild(domScript);
   }
 
+  function initMiniAppInfo () {
+    function setMiniAppInfo () {
+      try {
+        var title = document.title
+        var meta = document.querySelector('meta[name="mini-app-data"]');
+        if (meta) {
+          title = meta.getAttribute('content');
+        }
+        wx.miniProgram.postMessage({ data: {
+            post: 'share',
+            type: 'common',
+            desc: '默认标题',
+            title: title
+          }})
+      } catch (e) {
+        console.log(e)
+      }
+    }
+
+    loadJS('https://res2.wx.qq.com/open/js/jweixin-1.6.0.js', function () {
+      setMiniAppInfo()
+      try {
+        miniAppInitLoaded && miniAppInitLoaded()
+      } catch (error) {}
+    })
+  }
+
+  var inWxMini = navigator.userAgent.toLowerCase().indexOf('miniprogram') !== -1
+  if (inWxMini) {
+    initMiniAppInfo()
+  }
+
   try {
     // 初始化JTrack
     var sdkVersion = 142

+ 15 - 0
src/web/staticres/common-module/public/js/utils.js

@@ -141,6 +141,8 @@ if (!window.utilsEnv) {
     },
     getPlatformEnvs: function () {
       var inWX = navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1
+      var inWeiXinMiniApp = navigator.userAgent.toLowerCase().indexOf('miniprogram') !== -1
+
       var inApp = this.getIsInTheAppContainer()
       var platformOS = this.androidOrIOS()
       var getPlatform = function () {
@@ -160,6 +162,7 @@ if (!window.utilsEnv) {
         platformOS: platformOS,
         platform: platform,
         inApp: inApp,
+        inWxMini: inWeiXinMiniApp, // 微信小程序
         inWX: inWX
       }
     }
@@ -181,6 +184,7 @@ var utils = {
     inApp: window.utilsEnv.platformEnvs.inApp, // 是否在app中
     inAndroid: window.utilsEnv.platformEnvs.platformOS === 'android', // 是否在android中
     inIOS: window.utilsEnv.platformEnvs.platformOS === 'ios', // 是否在android中
+    inWxMini: window.utilsEnv.platformEnvs.inWxMini, // 是否在微信小程序中
   },
   isWeiXinBrowser: navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1,
   isH5: window.location.href.toLowerCase().indexOf('h5') !== -1,
@@ -805,6 +809,17 @@ var utils = {
   toWxGzhProfile: function () {
     window.location.href = 'https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=Mzk0MjIyMzY2Nw==&scene=110#wechat_redirect'
   },
+  // 去下载app页面
+  toDownloadApp: function() {
+    try {
+      wx.miniProgram.navigateTo({
+        url: '/pages/guide/download',
+      })
+    } catch (error) {
+      console.error(error)
+      location.href = 'https://h5.jianyu360.cn/front/downloadapppage/normal'
+    }
+  },
   moneyUnit: function (num, type, lv) {
     if (num === '' || num == null || num == undefined || isNaN(num)) return ''
     var levelArr = ['元', '万元', '亿元', '万亿元']

+ 3 - 0
src/web/staticres/common-module/report-analysis/js/components/downloadpopup.js

@@ -114,6 +114,9 @@ var downloadpopup = {
 
     },
     sampleReport(){ // 下载样例
+      if (utils.$envs.inWxMini) {
+        return utils.toDownloadApp()
+      }
       let url =`${location.origin}/common-module/pdf/【剑鱼标讯】市场分析定制报告样例.pdf`
       const { platform, platformOS } = utils.$env
       if (platform === 'app' && platformOS === 'ios') {

+ 6 - 0
src/web/staticres/common-module/share/js/invite-friends.js

@@ -177,6 +177,9 @@ var shareContent = new Vue({
                 scale: 3,
                 imageTimeout: 30000,
             }).then(function(canvas) {
+                if (utils.$envs.inWxMini) {
+                  return utils.toDownloadApp()
+                }
                 var imgUrl = canvas.toDataURL('image/png');
                 if (goTemplateData.platform === 'app') {
                   _this.doAppSaveImg(imgUrl)
@@ -248,6 +251,9 @@ var shareContent = new Vue({
           }
         },
         doShare: function (item) {
+            if (utils.$envs.inWxMini) {
+                return utils.toDownloadApp()
+            }
             this.doAppShare(item.id)
         },
         swiperChange: function (index) {

+ 5 - 0
src/web/templates/frontRouter/wx/fileRecord/sess/index.html

@@ -429,6 +429,11 @@
   {{include "/big-member/commonjs.html"}}
   <script src='{{Msg "seo" "cdn"}}/common-module/public/js/utils.js'></script>
   <script src='{{Msg "seo" "cdn"}}/common-module/public/js/china-map-data.js?v={{Msg "seo" "version"}}'></script>
+  <script>
+    var __pageData = {
+        platform: 'wx'
+    }
+  </script>
   <script src='{{Msg "seo" "cdn"}}/common-module/file-pack/js/index-wx.js?v={{Msg "seo" "version"}}'></script>
   {{include "/common/baiducc.html"}}
 </body>