duanshenglang 8 hónapja
szülő
commit
a7fb25293c
2 módosított fájl, 127 hozzáadás és 21 törlés
  1. 64 11
      lottery/registrationActivity.html
  2. 63 10
      lottery/signUp.html

+ 64 - 11
lottery/registrationActivity.html

@@ -33,8 +33,7 @@
   .page6 {
     width: 100vw;
     height: 100vh;
-    background: #FFD0D0;
-    background-size: 100vw 100vh;
+    background-size: 100vw 200px;
     background-repeat: no-repeat;
     display: flex;
     justify-content: center;
@@ -271,7 +270,7 @@
         </div>
       </div>
     </div>
-    <div class="page6" v-else>
+    <div class="page6" :style="{'background-image': 'url('+toshopData.banner+')'}" v-else-if="step === 1 || step === 2">
       <div class="activity_content" v-if="step === 1">
         <div class="activity_item">
           <div class="item_title">活动主题:</div>
@@ -300,6 +299,7 @@
             <el-date-picker v-if="item.type === 5" v-model="item.value" type="date" placeholder="选择日期">
             <el-time-picker v-if="item.type === 6" v-model="item.value" placeholder="请选择"></el-time-picker>
             <el-date-picker v-if="item.type === 7" v-model="item.value" type="datetime" placeholder="选择日期时间"></el-date-picker>
+            <el-cascader v-if="item.type === 10" v-model="item.value" :options="transformedData"></el-cascader>
           </el-form-item>
         </el-form>
       </div>
@@ -317,8 +317,8 @@
         httpUrl: '',
         bId: null,
         env: '',
-        openId: '',
         toshopData: {
+          banner: '',
           name: '',
           target: '',
           startTime: '',
@@ -328,6 +328,7 @@
         },
         step: 2,
         verificationCode: '',
+				transformedData: [],
       }
     },
     created() {
@@ -346,6 +347,7 @@
           if (!this.getQueryParam('externalUserid')) {
             this.gerQwAuth(this.bId);
           } else {
+            this.getCityLevel()
             this.lightenShare()
           }
         } else {
@@ -357,16 +359,18 @@
         // 获取url上的code
         let code = this.getQueryParam('code')
         if (code) {
-          fetch(this.httpUrl + `/scrm/v1/mp-client/p/getInfoByh5Code?code=${code}&bId=${this.bId}`)
+          // 判断业务id是否生产环境业务id
+          fetch(this.httpUrl + `/p/insuite/p/isProdId?id=${this.bId}`)
             .then(res => {
               return res.json()
             }).then(result => {
-              let { data, code, msg } = result
-              if (code === 1) {
-                this.openId = data.openId
-                localStorage.setItem('openId', data.openId)
-                this.ifH5Type()
+              let { data, msg } = result
+              if (typeof data === 'boolean' && data) {
+                this.httpUrl = 'https://wlapi.wefanbot.com'
+              } else {
+                this.httpUrl = 'http://test.wefanbot.com:18993'
               }
+              this.getInfoByh5Code(this.getQueryParam('code'))
             })
         } else {
           let redirect_uri = window.location.href
@@ -375,6 +379,18 @@
           window.location.replace(url)
         }
       },
+      getInfoByh5Code(code) {
+        fetch(this.httpUrl + `/scrm/v1/mp-client/p/getInfoByh5Code?code=${code}&bId=${this.bId}`)
+          .then(res => {
+            return res.json()
+          }).then(result => {
+            let { data, code, msg } = result
+            if (code === 1) {
+              localStorage.setItem('openId', data.openId)
+              this.ifH5Type()
+            }
+          })
+      },
       // 企微授权
       gerQwAuth(bId) {
         let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
@@ -393,6 +409,33 @@
             }
           })
       },
+      // 获取城市数据
+      getCityLevel() {
+        fetch('https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/1000/1720161853377/pc-code.json')
+          .then(res => {
+            return res.json()
+          }).then(result => {
+            this.transformedData = this.transformData(result)
+          })
+      },
+      // 省市数据做转换
+      transformData(data) {
+        return data.map(item => {
+          // 创建一个新对象,避免直接修改原始对象
+          const newItem = { ...item };
+          // 重命名 text 为 label
+          if (newItem.text) {
+            newItem.label = newItem.text;
+            newItem.value = newItem.text;
+            delete newItem.text;
+          }
+          // 如果存在 children 数组,则递归处理每个子项
+          if (newItem.children && Array.isArray(newItem.children)) {
+            newItem.children = this.transformData(newItem.children);
+          }
+          return newItem;
+        })
+      },
       lightenShare() {
         let externalUserid = this.getQueryParam('externalUserid')
         let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
@@ -433,6 +476,15 @@
         if (this.step === 1) {
           this.step = 2 
         } else {
+          this.toshopData.formProList.forEach(item => {
+            if (item.isNeed && !item.value) {
+              this.$message({
+                message: '必填项不能为空',
+                type: 'warning' 
+              })
+              return false
+            }
+          })
           let cols = []
           cols = this.toshopData.formProList.map(item => {
             return {
@@ -441,7 +493,8 @@
               value: [item.value]
             } 
           })
-          fetch(this.httpUrl + `/scrm/v1/wxcp-toshop-share/p/formData?openId=${this.openId}`, {
+          let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
+          fetch(this.httpUrl + `/scrm/v1/wxcp-toshop-share/p/formData?openId=${openId}`, {
             method: 'post',
             body: JSON.stringify({
               bid: this.bId,

+ 63 - 10
lottery/signUp.html

@@ -165,8 +165,9 @@
             <el-input v-if="item.type === 1" type="textarea" autosize v-model="item.value" placeholder="请输入"></el-input>
             <el-input v-if="item.type === 2" type="number" v-model="item.value" placeholder="请输入"></el-input>
             <el-date-picker v-if="item.type === 5" v-model="item.value" type="date" placeholder="选择日期">
-              <el-time-picker v-if="item.type === 6" v-model="item.value" placeholder="请选择"></el-time-picker>
-              <el-date-picker v-if="item.type === 7" v-model="item.value" type="datetime" placeholder="选择日期时间"></el-date-picker>
+            <el-time-picker v-if="item.type === 6" v-model="item.value" placeholder="请选择"></el-time-picker>
+            <el-date-picker v-if="item.type === 7" v-model="item.value" type="datetime" placeholder="选择日期时间"></el-date-picker>
+            <el-cascader v-if="item.type === 10" v-model="item.value" :options="transformedData"></el-cascader>
           </el-form-item>
         </el-form>
       </div>
@@ -201,13 +202,13 @@
         httpUrl: '',
         bId: null,
         env: '',
-        openId: '',
         toshopData: {
           name: '',
           formProList: [],
         },
         step: 1,
         verificationCode: '',
+				transformedData: [],
       }
     },
     created() {
@@ -226,6 +227,7 @@
           if (!this.getQueryParam('externalUserid')) {
             this.gerQwAuth(this.bId);
           } else {
+            this.getCityLevel()
             this.lightenShare()
           }
         } else {
@@ -237,16 +239,18 @@
         // 获取url上的code
         let code = this.getQueryParam('code')
         if (code) {
-          fetch(this.httpUrl + `/scrm/v1/mp-client/p/getInfoByh5Code?code=${code}&bId=${this.bId}`)
+          // 判断业务id是否生产环境业务id
+          fetch(this.httpUrl + `/p/insuite/p/isProdId?id=${this.bId}`)
             .then(res => {
               return res.json()
             }).then(result => {
-              let { data, code, msg } = result
-              if (code === 1) {
-                this.openId = data.openId
-                localStorage.setItem('openId', data.openId)
-                this.ifH5Type()
+              let { data, msg } = result
+              if (typeof data === 'boolean' && data) {
+                this.httpUrl = 'https://wlapi.wefanbot.com'
+              } else {
+                this.httpUrl = 'http://test.wefanbot.com:18993'
               }
+              this.getInfoByh5Code(this.getQueryParam('code'))
             })
         } else {
           let redirect_uri = window.location.href
@@ -255,6 +259,18 @@
           window.location.replace(url)
         }
       },
+      getInfoByh5Code(code) {
+        fetch(this.httpUrl + `/scrm/v1/mp-client/p/getInfoByh5Code?code=${code}&bId=${this.bId}`)
+          .then(res => {
+            return res.json()
+          }).then(result => {
+            let { data, code, msg } = result
+            if (code === 1) {
+              localStorage.setItem('openId', data.openId)
+              this.ifH5Type()
+            }
+          })
+      },
       // 企微授权
       gerQwAuth(bId) {
         let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
@@ -273,6 +289,33 @@
             }
           })
       },
+      // 获取城市数据
+      getCityLevel() {
+        fetch('https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/1000/1720161853377/pc-code.json')
+          .then(res => {
+            return res.json()
+          }).then(result => {
+            this.transformedData = this.transformData(result)
+          })
+      },
+      // 省市数据做转换
+      transformData(data) {
+        return data.map(item => {
+          // 创建一个新对象,避免直接修改原始对象
+          const newItem = { ...item };
+          // 重命名 text 为 label
+          if (newItem.text) {
+            newItem.label = newItem.text;
+            newItem.value = newItem.text;
+            delete newItem.text;
+          }
+          // 如果存在 children 数组,则递归处理每个子项
+          if (newItem.children && Array.isArray(newItem.children)) {
+            newItem.children = this.transformData(newItem.children);
+          }
+          return newItem;
+        })
+      },
       lightenShare() {
         let externalUserid = this.getQueryParam('externalUserid')
         let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
@@ -296,6 +339,15 @@
           })
       },
       toSignUp() {
+        this.toshopData.formProList.forEach(item => {
+          if (item.isNeed && !item.value) {
+            this.$message({
+              message: '必填项不能为空',
+              type: 'warning'
+            })
+            return false
+          }
+        })
         let cols = []
         cols = this.toshopData.formProList.map(item => {
           return {
@@ -304,7 +356,8 @@
             value: [item.value]
           }
         })
-        fetch(this.httpUrl + `/scrm/v1/wxcp-toshop-verification/p/formData?openId=${this.openId}`, {
+        let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
+        fetch(this.httpUrl + `/scrm/v1/wxcp-toshop-verification/p/formData?openId=${openId}`, {
           method: 'post',
           body: JSON.stringify({
             bid: this.bId,