Ver Fonte

图集胶囊

duanshenglang há 2 dias atrás
pai
commit
ab75e8757d
2 ficheiros alterados com 37 adições e 20 exclusões
  1. 1 1
      lottery/index.html
  2. 36 19
      lottery/qwMaterial.html

+ 1 - 1
lottery/index.html

@@ -100,7 +100,7 @@
 						})
 				},
 				ifH5Type () {
-					 if(this.h5Type == 4) {
+					 if(this.h5Type == 4 || this.h5Type == 48) {
 						// 素材库(胶囊)
 						var currentQueryParams = window.location.search;
 						window.location.replace('qwMaterial.html' + currentQueryParams)

+ 36 - 19
lottery/qwMaterial.html

@@ -468,6 +468,7 @@
         httpUrl: '',
         bId: null,
         env: '',
+        h5Type: null,
         albumData: null,
         memberId: null,
         tenancyId: null,
@@ -527,12 +528,6 @@
     created() {
       this.bId = this.getQueryParam('bId')
       this.env = this.getQueryParam('env')
-      if (this.getQueryParam('contentType')) {
-        this.contentType = Number(this.getQueryParam('contentType'))
-        this.albumData = {
-          id: this.getQueryParam('groupId')
-        }
-      }
       if (!this.env || this.env === 'prod') {
         this.httpUrl = 'https://wlapi.wefanbot.com'
       } else {
@@ -541,6 +536,7 @@
       if (this.getQueryParam('memberId')) {
         // 已授权
         this.memberId = this.getQueryParam('memberId')
+        this.h5Type = Number(this.getQueryParam('h5Type'))
         this.getCpH5Login()
       } else {
         // 授权
@@ -557,10 +553,7 @@
             if (code === 1) {
               window.location.replace(data)
             } else {
-              this.$message({
-                message: msg,
-                type: 'warning'
-              })
+              vant.Toast.fail(msg)
             }
           })
       },
@@ -580,13 +573,36 @@
           let { data, code, msg } = result
           if (code === 1) {
             this.tenancyId = data.tenancyId
-            this.getTreeData()
             this.getQyWxSign()
+            if (this.h5Type === 48) {
+              this.getBiz()
+            } else {
+              this.getTreeData()
+            }
           } else {
             vant.Toast.fail(msg)
           }
         })
       },
+      // 获取特定的contentType和id
+      getBiz() {
+        fetch(this.httpUrl + `/p/insuite/p/getBiz?bid=${this.bId}`)
+          .then(res => {
+            return res.json()
+          }).then(result => {
+            let { data, code, msg } = result
+            if (code === 1) {
+              this.contentType = data.raffleType
+              this.albumData = {
+                id: data.businessId
+              }
+            } else {
+              vant.Toast.fail(msg)
+            }
+          }).finally(() => {
+            this.getTreeData()
+          })
+      },
       getQyWxSign() {
         fetch(this.httpUrl + '/scrm/v1/wxcp-corp/p/getJsSDK', {
           method: 'post',
@@ -663,7 +679,7 @@
           let { data, code, msg } = result
           if (code === 1) {
             this.allTreeData = this.flattenTreeData(data, true)
-            if (this.getQueryParam('contentType')) {
+            if (this.h5Type === 48) {
               this.getMaterData(this.albumData)
             } else {
               this.treeData = data || []
@@ -673,11 +689,12 @@
           }
         }).finally(() => {
           this.loading = false
+          this.h5Type = null // 重置h5Type
         })
       },
       handlePathClick (item) {
         // 找到目标元素的索引
-        const index = this.pathList.findIndex(arr => arr.id === item.id)
+        const index = this.pathList.findIndex(arr => arr.id == item.id)
         // 如果找到了该元素
         if (index !== -1) {
           // 从该索引位置开始删除到数组末尾
@@ -725,8 +742,8 @@
           let { data, code, msg } = result
           if (code === 1) {
             this.itemList = data.records || []
-            if (this.keyword === '' && this.allTreeData.filter(all => all.id === item.id)[0] && this.allTreeData.filter(all => all.id === item.id)[0].children) {
-              this.treeData = this.allTreeData.filter(all => all.id === item.id)[0].children
+            if (this.keyword === '' && this.allTreeData.filter(all => all.id == item.id)[0] && this.allTreeData.filter(all => all.id == item.id)[0].children) {
+              this.treeData = this.allTreeData.filter(all => all.id == item.id)[0].children
             } else {
               this.treeData = []
             }
@@ -781,7 +798,7 @@
         }
       },
       handleVideoType () {
-        let obj = this.itemList.filter(item => item.id === this.materialData)[0]
+        let obj = this.itemList.filter(item => item.id == this.materialData)[0]
         if (this.filterIndex === 0) {
           // 发送视频链接
           this.sendNews(obj)
@@ -792,7 +809,7 @@
       // 勾选图集项图片
       handleSelect(data) {
         this.imgList.forEach(item => {
-          if (item.id === data.id) {
+          if (item.id == data.id) {
             this.$set(item, 'selected', true)
           } else {
             this.$set(item, 'selected', false)
@@ -807,7 +824,7 @@
       },
       // 点击图集类型
       handleImgType() {
-        let obj = this.itemList.filter(item => item.id === this.materialData)[0]
+        let obj = this.itemList.filter(item => item.id == this.materialData)[0]
         if (this.filterIndex === 0) {
           this.sendNews(obj)
         } else {
@@ -908,7 +925,7 @@
       },
       handleConfirm() {
         let obj = {}
-        obj = this.itemList.filter(item => item.id === this.materialData)[0]
+        obj = this.itemList.filter(item => item.id == this.materialData)[0]
         // 文章,表单,外部链接, 视频链接
         if (this.contentType === 0 || this.contentType === 2 || this.contentType === 4 || this.contentType === 15) {
           this.sendNews(obj)