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

feat:SEO之js语法兼容

yangfeng 2 жил өмнө
parent
commit
bcc0507a14

+ 9 - 9
src/web/staticres/common-module/ad/js/index.js

@@ -7,29 +7,29 @@
 // url转base64 方法
 // base64 编码
 function getBase64Image(img) {
-  const canvas = document.createElement('canvas')
+  var canvas = document.createElement('canvas')
   canvas.width = img.width
   canvas.height = img.height
-  const ctx = canvas.getContext('2d')
+  var ctx = canvas.getContext('2d')
   ctx.drawImage(img, 0, 0, img.width, img.height)
-  const dataURL = canvas.toDataURL('image/png')
+  var dataURL = canvas.toDataURL('image/png')
   return dataURL
 }
 
 function getImage64Url(url, ref) {
 
   // var that = this
-  const image = document.createElement('img')
+  var image = document.createElement('img')
   image.setAttribute('crossorigin', 'anonymous')
   image.src = url + '?v=' + Math.random() // 处理缓存
   image.crossOrigin = 'anonymous'
   image.onload = function () {
-    const base64 = getBase64Image(image)
+    var base64 = getBase64Image(image)
     console.log(base64);
   }
 }
 
-// const ua = window.navigator.userAgent
+// var ua = window.navigator.userAgent
 // let _isIOS     = -1;
 // function isIOS() {
 //   if (_isIOS === -1) {
@@ -100,7 +100,7 @@ var getActive = {
                     scale: 3,
                     imageTimeout: 30000,
                     allowTaint: true, // 允许跨域图片
-                }).then(canvas => {
+                }).then(function(canvas) {
                     var imgUrl = imgsrcArr.base64 || canvas.toDataURL('image/png')
                     console.log(imgUrl)
                     // $(".active-tip-group img").attr('src', imgUrl)
@@ -110,7 +110,7 @@ var getActive = {
                     try {
                       window.JyObj.savePic(imgUrl)
 
-                      setTimeout(() => {
+                      setTimeout(function() {
                           weui.toast('图片已保存,快去扫码识别吧', {
                             duration: 800,
                             className: 'text-overflow100'
@@ -128,7 +128,7 @@ var getActive = {
                 })
             }else {
                 window.JyObj.savePic(window.picImgUrl)
-                setTimeout(() => {
+                setTimeout(function() {
                   weui.toast('图片已保存,快去扫码识别吧', {
                     duration: 800,
                     className: 'text-overflow100'

+ 1 - 2
src/web/staticres/js/index/index.js

@@ -81,8 +81,7 @@ function rgbToHsl(rgb) {
   }
   s = Math.round(s * 100 * 1.5)+ '%'; //转换成百分比的形式
   l = Math.round(l * 100 * 0.8)+ '%';
-  const str = "hsl(" + h + "," + s + "," + l + ")";
-  console.log('str', str)
+  var str = "hsl(" + h + "," + s + "," + l + ")";
   return str
 }
 

+ 2 - 2
src/web/staticres/js/login.js

@@ -436,7 +436,7 @@ function checkMenuForEnt () {
 }
 var msgTimer = null
 function toReaded(ids, type, url) {
-    const _this = this
+    var _this = this
     $.ajax({
         type: 'POST',
         url:'/jymessageCenter/markRead',
@@ -772,7 +772,7 @@ var afterSignoutClearCookit = function(){
 }
 
 var afterLoginSetCookit = function(name,value,time){
-	let expires = new Date(time)
+	var expires = new Date(time)
 	try{
 		$.cookie(name,value,{expires:expires.toGMTString(),path:"/",domain:document.domain.replace(/[^.]+/,"")});
 	}catch(e){

+ 3 - 3
src/web/staticres/js/pc-message-index.js

@@ -17,7 +17,7 @@ var vmMesg = new Vue({
   },
   methods: {
     getList: function() {
-      const _this = this
+      var _this = this
       $.ajax({
         type: 'POST',
         url: '/jymessageCenter/latestNews',
@@ -45,7 +45,7 @@ var vmMesg = new Vue({
       })
     },
     readed: function(ids, type, url) {
-      const _this = this
+      var _this = this
       $.ajax({
         type: 'POST',
         url:'/jymessageCenter/markRead',
@@ -72,7 +72,7 @@ var vmMesg = new Vue({
       }
     },
     checkCounts: function() {
-      const _this = this
+      var _this = this
       Notification.requestPermission(function(status) {
         console.info(status, '----------')
         if(status === 'granted'){

+ 32 - 32
src/web/staticres/js/pur-search-index-pc.js

@@ -1,8 +1,8 @@
 function getRandomString (len) {
     let randomString = ''
     if (len) {
-      const $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'
-      const maxPos = $chars.length
+      var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'
+      var maxPos = $chars.length
       for (let i = 0; i < len; i++) {
         randomString += $chars.charAt(Math.floor(Math.random() * maxPos))
       }
@@ -27,7 +27,7 @@ function toastFn (text, duration = 1000) {
 function formatKeywordsList (res) {
     // if (!res || !res.a_items) return
     // const data = res.a_items
-    const newArr = []
+    var newArr = []
     res.forEach((v) => {
       if (v.a_key) {
         v.a_key.forEach((s) => {
@@ -364,21 +364,21 @@ var vm = new Vue({
         },
         // 整理数据列表
         initIndustryMap () {
-            const industryListMap = []
+            var industryListMap = []
             // 全部
-            const all = JSON.parse(JSON.stringify(this.industryExp))
+            var all = JSON.parse(JSON.stringify(this.industryExp))
             all.selected = true
             all.id = `lv0-${getRandomString(8).toLowerCase()}`
             industryListMap.push(all)
-            for (const key in this.industryListMapExp) {
-                const level1 = JSON.parse(JSON.stringify(this.industryExp))
+            for (var key in this.industryListMapExp) {
+                var level1 = JSON.parse(JSON.stringify(this.industryExp))
                 level1.name = key
                 level1.level = 1
                 level1.id = `lv1-${getRandomString(8).toLowerCase()}`
 
-                const level2Arr = []
+                var level2Arr = []
                 this.industryListMapExp[key].forEach(item => {
-                    const level2 = JSON.parse(JSON.stringify(this.industryExp))
+                    var level2 = JSON.parse(JSON.stringify(this.industryExp))
                     level2.name = item
                     level2.level = 2
                     level2.id = `lv2-${getRandomString(8).toLowerCase()}`
@@ -390,13 +390,13 @@ var vm = new Vue({
             }
 
             this.industryListMap = industryListMap
-            const tempArr = []
+            var tempArr = []
             this.industryListMap.forEach(v => {
-                const tempNode = v
+                var tempNode = v
                 tempNode.zindex = 1
                 tempArr.push(tempNode)
                 tempNode?.children.forEach(s => {
-                    const tempS = s
+                    var tempS = s
                     tempS.zindex = 2
                     tempArr.push(tempS)
                 })
@@ -426,7 +426,7 @@ var vm = new Vue({
 
               // 找到当前点击的父级元素
               this.industryListMap.forEach(level1 => {
-                const selectedStateArr = []
+                var selectedStateArr = []
                 if (item.level !== 0) {
                   level1.children.forEach(level2 => {
                     selectedStateArr.push(level2.selected)
@@ -448,7 +448,7 @@ var vm = new Vue({
           }
 
           if (item.level !== 0) {
-            const allSelected = this.checkAllSelectedState()
+            var allSelected = this.checkAllSelectedState()
             if (allSelected.allSelected || allSelected.allNotSelected) {
               this.setIndustryState()
             }
@@ -463,9 +463,9 @@ var vm = new Vue({
         // 检查是否全部选中了/全部不选中
         checkAllSelectedState () {
           // 一级标签选中状态(如果一级标签全部被选中,则说明,全部按钮被选中)
-          const level1StateArr = []
+          var level1StateArr = []
           // 所有标签选中状态
-          const allSelectedArr = []
+          var allSelectedArr = []
 
           this.industryListMap.forEach(level1 => {
             if (level1.level !== 0) {
@@ -521,9 +521,9 @@ var vm = new Vue({
         },
         // 获取选中的数据
         getSelected () {
-            const map = {}
+            var map = {}
             this.industryListMap.forEach(item => {
-                const mapArr = []
+                var mapArr = []
                 if (item.level !== 0) {
                     item.children.forEach(iitem => {
                     if (iitem.selected) {
@@ -535,9 +535,9 @@ var vm = new Vue({
                     map[item.name] = mapArr
                 }
             })
-            const tempArr = []
+            var tempArr = []
             Object.keys(map).forEach(v => {
-                const tempItem = map[v]
+                var tempItem = map[v]
                 if (Array.isArray(tempItem)) {
                 tempItem.forEach(vv => {
                     tempArr.push(`${v}_${vv}`)
@@ -678,9 +678,9 @@ var vm = new Vue({
         },
         // 全选
         allChange() {
-            const str1 = $('.check-all').prop('checked')
-            const str2 = $('.custom-checkbox:not(".check-all")')
-            const arr = $('.custom-checkbox:not(".check-all"):checked')
+            var str1 = $('.check-all').prop('checked')
+            var str2 = $('.custom-checkbox:not(".check-all")')
+            var arr = $('.custom-checkbox:not(".check-all"):checked')
             let arrs1 = [], arrs2 = [], arrs3= []
             if (str1) {
                 str2.prop('checked', true)
@@ -692,7 +692,7 @@ var vm = new Vue({
                 selectDataIds = this.unique(selectDataIds.concat(arrs1))
             } else {
               $('.custom-checkbox:not(".check-all"):checked').each(function(){
-                const dataName = $(this).attr('dataname')
+                var dataName = $(this).attr('dataname')
                 selectDataIds.forEach(function(item) {
                   if(dataName == item) {
                     selectDataIds.remove(item)
@@ -752,12 +752,12 @@ var vm = new Vue({
         },
         // 数组去重
         unique(arr) {
-          const res = new Map();
+          var res = new Map();
           return arr.filter((arr) => !res.has(arr) && res.set(arr, 1));
         },
         // 是否关注企业
         attentionCheck(arrs, item) {
-            const _this = this
+            var _this = this
             $.ajax({
                 url: '/entnicheNew/customer/check',
                 method: 'POST',
@@ -809,13 +809,13 @@ var vm = new Vue({
                     this.listState.list = arrs
                     this.listState.loading = false
                     this.$nextTick(function() {
-                      let checkNum = 0
-                      const inputs = $('.custom-checkbox:not(".check-all")')
+                      var checkNum = 0
+                      var inputs = $('.custom-checkbox:not(".check-all")')
                       $('.check-all').prop('checked', false)
                       $('.custom-checkbox:not(".check-all")').each(function(){
                         $(this).prop('checked', false)
-                        const that = this
-                        const dataName = $(this).attr('dataname')
+                        var that = this
+                        var dataName = $(this).attr('dataname')
                         selectDataIds.forEach(function(item) {
                           if(dataName == item) {
                             checkNum++
@@ -1071,7 +1071,7 @@ var vm = new Vue({
             this.doSearch()
         },
         jobRange() {
-            const decide = window.localStorage.getItem('bus-key-group-SCOPE')
+            var decide = window.localStorage.getItem('bus-key-group-SCOPE')
             if (decide) {
                 this.jobData = JSON.parse(decide)
             } else {
@@ -1122,7 +1122,7 @@ var vm = new Vue({
             this.filterShow = !this.filterShow
         },
         moneyUnit (m, type = 'string', lv = 0) {
-            const mUnit = {
+            var mUnit = {
               levelArr: ['元', '万元', '亿元', '万亿元'],
               test (num, type, lv) {
                 if (num === 0) {

+ 1 - 1
src/web/staticres/public-pc/js/pc-bottom.js

@@ -250,7 +250,7 @@ $(function () {
     $('.right-side-box .kf-phone').show()
   },function() {
     $('.right-side-box .kf-phone').hide()
-  },)
+  })
 });
 ;(function(){
   // 动态设置copyright

+ 2 - 2
src/web/templates/common/pchead.html

@@ -173,8 +173,8 @@
 <!-- defer表示最后执行 -->
 <script defer src='{{Msg "seo" "cdn"}}/common-module/ad/js/msgbuoy.js?v={{Msg "seo" "version"}}'></script>
 <script>
-  var Activedatastring = `register`
-  var ActivedataType = `jy-pc-${Activedatastring}-login`
+  var Activedatastring = 'register'
+  var ActivedataType = 'jy-pc-'+ Activedatastring+ '-login'
   var Activedata= JSON.stringify({codes:[ActivedataType] })
   // 获取广告位图片
   /**

+ 2 - 2
src/web/templates/site/common/pc-school-head.html

@@ -74,8 +74,8 @@
 <script src='{{Msg "seo" "cdn"}}/common-module/ad/js/index.js?v={{Msg "seo" "version"}}'></script>
 
 <script>
-  var Activedatastring = `register`
-  var ActivedataType = `jy-pc-${Activedatastring}-login`
+  var Activedatastring = 'register'
+  var ActivedataType = 'jy-pc-' + Activedatastring + '-login'
   var Activedata = JSON.stringify({
     codes: [ActivedataType]
   })