Browse Source

Merge branch 'feature/yc-batchSeek-0326'

# Conflicts:
#	nuxt.config.js
yangc 7 years ago
parent
commit
0b8e22c339

+ 2 - 0
app.html

@@ -54,6 +54,7 @@
         var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
         g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
       <!-- End Piwik Code -->
+/*
       if (/(iPhone|iPad|Opera Mini|Android.*Mobile|NetFront|PSP|BlackBerry|Windows Phone)/ig.test(w.navigator.userAgent) || w.location.pathname.indexOf('mobile/share') > -1) {
         var docEl = d.documentElement
         var resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize'
@@ -71,6 +72,7 @@
         w.addEventListener(resizeEvt, recalc, false)
         d.addEventListener('DOMContentLoaded', recalc, false)
       }
+*/
     })(window, document)
   </script>
   <script type="text/javascript">

+ 5 - 0
assets/scss/mobileCommon.scss

@@ -17,6 +17,11 @@ body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fiel
   padding: 0;
 }
 
+/* 设置顶层fontSize */
+html, body {
+  font-size: calc(100vw / 750 * 100) !important;
+}
+
 input, select, textarea {
   font-size: 100%;
 }

File diff suppressed because it is too large
+ 804 - 396
components/applyPurchase/BatchPublish.vue


+ 2 - 45
components/applyPurchase/PublishApply.vue

@@ -143,49 +143,7 @@
   </div>
 </template>
 <script>
-  let getRealLen = function (str) {
-    let len = 0
-    for (let i = 0; i < str.length; i++) {
-      if (str.charCodeAt(i) > 127 || str.charCodeAt(i) === 94) {
-        len += 2
-      } else {
-        len++
-      }
-    }
-    return len
-  }
-  let cutOutString = function (str, length) {
-    for (let i = 1; i <= str.length; i++) {
-      if (getRealLen(str.substr(0, i)) > length) {
-        str = str.substr(0, i - 1)
-        break
-      }
-    }
-    return str
-  }
-  let formatDate = function (date, fmt) {
-    if (typeof date === 'string') {
-      date = new Date(Date.parse(date.replace(/-/g, '/')))
-    }
-    let o = {
-      'M+': date.getMonth() + 1, // 月份
-      'd+': date.getDate(), // 日
-      'h+': 23, // 小时
-      'm+': 59, // 分
-      's+': 59, // 秒
-      'q+': Math.floor((date.getMonth() + 3) / 3), // 季度
-      'S': date.getMilliseconds() // 毫秒
-    }
-    if (/(y+)/.test(fmt)) {
-      fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
-    }
-    for (let k in o) {
-      if (new RegExp('(' + k + ')').test(fmt)) {
-        fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
-      }
-    }
-    return fmt
-  }
+  import { getRealLen, cutOutString, formatDate } from '~utils/baseUtils'
   export default {
     data () {
       return {
@@ -423,9 +381,8 @@
           }
         } else if (this.applyObj.brand && getRealLen(this.applyObj.brand) > 50) {
           this.applyObj.brand = cutOutString(this.applyObj.brand, 50)
-        } else {
-          this.getSimilarBrand()
         }
+        this.getSimilarBrand()
       },
       onAmountInput: function () {
         if (!(/^[0-9]*$/).test(this.applyObj.amount)) {

+ 3 - 73
components/common/buyOrCar/buyComponent.vue

@@ -6,6 +6,7 @@
 </template>
 
 <script>
+  import { enidfilter } from '~utils/baseUtils'
   export default {
     props: ['item', 'disabledFlag'],
     methods: {
@@ -30,19 +31,17 @@
                 minPackQty: this.item.minPackQty
               }])
                 .then(response => {
-          //        window.location.href = '/user#/order/pay/' + this.enidfilter(response.data.orderid)
                   if (response.data.success) {
                     if (response.data.message) {
                       this.$message({
                         message: response.data.message,
                         type: 'success'
                       })
-                      let _self = this
                       window.setTimeout(function () {
-                        window.location.href = '/user#/order/pay/' + _self.enidfilter(response.data.data.orderid)
+                        window.location.href = '/user#/order/pay/' + enidfilter(response.data.data.orderid)
                       }, 1000)
                     } else {
-                      window.location.href = '/user#/order/pay/' + this.enidfilter(response.data.data.orderid)
+                      window.location.href = '/user#/order/pay/' + enidfilter(response.data.data.orderid)
                     }
                   } else {
                     if (response.data.data && response.data.data.unvailable === 1) {
@@ -58,7 +57,6 @@
                   }
                 })
             } else {
-              // this.$store.dispatch('user/addCar', {uuid: item.uuid, batchCode: item.batchCode, number: item.minBuyQty})
               this.$http.post('trade/cart/add', {
                 uuid: this.item.uuid,
                 batchCode: this.item.batchCode,
@@ -94,74 +92,6 @@
             }
           }
         }
-        // window.location.href = 'user#/order/pay/' + this.enidfilter(this.buy_info.orderid)
-      },
-      enidfilter: function (str) {
-        if (str) {
-          let encryptStr = '' // 最终返回的加密后的字符串
-          // 产生三位随机数
-          let num = ''
-          for (let i = 0; i < 3; i++) {
-            num += Math.floor(Math.random() * 10)
-          }
-          encryptStr += num // 产生3位随机数
-
-          // 16位加密
-          let tempspit = ''
-          let strspit = str.toString().toLowerCase()
-          if (strspit.match(/^[-+]?\d*$/) === null) { // 非整数字符,对每一个字符都转换成16进制,然后拼接
-            /**
-             * Unicode汉字、英文字母、数字的unicode范围
-             *汉字:[0x4e00,0x9fa5](或十进制[19968,40869])
-             *数字:[0x30,0x39](或十进制[48, 57])
-             *小写字母:[0x61,0x7a](或十进制[97, 122])
-             *大写字母:[0x41,0x5a](或十进制[65, 90]
-             * 'a'的Unicode编码:'&#97;',charCodeAt()的值是97
-             * '码'的Unicode编码:'\u7801', new String('码').charCodeAt()的值是30721,30721的16进制表示是7801
-             */
-            let s = strspit.split('')
-            for (let i = 0; i < s.length; i++) {
-              s[i] = s[i].charCodeAt() // 先转换成Unicode编码
-              s[i] = s[i].toString(16)
-              // 因为在服务器是每两位当做一个字符进行解析的,所以这里每个字符的Unicode编码范围必须在0——255之间。数字和大小写满足该要求,特殊字符则不一定,如果后续有特殊字符的要求,需要重写编码器和解码器
-              if (s[i].length === 1) {
-                s[i] = '0' + s[i]
-              }
-              tempspit = tempspit + s[i]
-            }
-            tempspit = tempspit + '{' + 1 // 1代表字符
-          } else { // 数字直接转换成16进制
-            strspit = parseInt(strspit)
-              .toString(16)
-            tempspit = strspit + '{' + 0 // 0代表纯数字
-          }
-
-          let temp = tempspit.split('{') // 对要加密的字符转换成16进制
-          let numLength = temp[0].length // 转换后的字符长度
-          numLength = numLength.toString(16) // 字符长度换算成16进制
-          if (numLength.length === 1) { // 如果是1,补一个0
-            numLength = '0' + numLength
-          } else if (numLength.length > 3) { // 转换后的16进制字符长度如果大于2位数,则返回,不支持
-            return ''
-          }
-          encryptStr += numLength
-          if (temp[1] === '0') {
-            encryptStr += 0
-          } else if (temp[1] === '1') {
-            encryptStr += 1
-          }
-          encryptStr += temp[0]
-          if (encryptStr.length < 20) { // 如果小于20位,补上随机数
-            // 产生三位随机数
-            let numtwo = ''
-            for (let i = 0; i < 20 - encryptStr.length; i++) {
-              numtwo += Math.floor(Math.random() * 10)
-            }
-            let ran = numtwo // 产生3位随机数
-            encryptStr += ran
-          }
-          return encryptStr
-        }
       }
     }
   }

+ 1 - 20
components/mobile/share/store/StoreHeader.vue

@@ -12,26 +12,7 @@
   </div>
 </template>
 <script>
-  let getRealLen = function (str) {
-    let len = 0
-    for (let i = 0; i < str.length; i++) {
-      if (str.charCodeAt(i) > 127 || str.charCodeAt(i) === 94) {
-        len += 2
-      } else {
-        len++
-      }
-    }
-    return len
-  }
-  let cutOutString = function (str, len) {
-    for (let i = 1; i <= str.length; i++) {
-      if (getRealLen(str.substr(0, i)) > len) {
-        str = str.substr(0, i - 1)
-        break
-      }
-    }
-    return str
-  }
+  import { getRealLen, cutOutString } from '~utils/baseUtils'
   export default {
     computed: {
       storeInfo () {

+ 3 - 73
components/store/CommodityInfo.vue

@@ -167,7 +167,7 @@
       }
     }
   }
-
+  import { enidfilter } from '~utils/baseUtils'
   export default {
     name: 'commodity-info',
     data () {
@@ -380,19 +380,17 @@
                 minPackQty: item.minPackQty
               }])
                 .then(response => {
-                  //        window.location.href = '/user#/order/pay/' + this.enidfilter(response.data.orderid)
                   if (response.data.success) {
                     if (response.data.message) {
                       this.$message({
                         message: response.data.message,
                         type: 'success'
                       })
-                      let _self = this
                       window.setTimeout(function () {
-                        window.location.href = '/user#/order/pay/' + _self.enidfilter(response.data.data.orderid)
+                        window.location.href = '/user#/order/pay/' + enidfilter(response.data.data.orderid)
                       }, 1000)
                     } else {
-                      window.location.href = '/user#/order/pay/' + this.enidfilter(response.data.data.orderid)
+                      window.location.href = '/user#/order/pay/' + enidfilter(response.data.data.orderid)
                     }
                   } else {
                     if (response.data.data && response.data.data.unvailable === 1) {
@@ -442,74 +440,6 @@
             }
           }
         }
-        // window.location.href = 'user#/order/pay/' + this.enidfilter(this.buy_info.orderid)
-      },
-      enidfilter: function (str) {
-        if (str) {
-          let encryptStr = '' // 最终返回的加密后的字符串
-          // 产生三位随机数
-          let num = ''
-          for (let i = 0; i < 3; i++) {
-            num += Math.floor(Math.random() * 10)
-          }
-          encryptStr += num // 产生3位随机数
-
-          // 16位加密
-          let tempspit = ''
-          let strspit = str.toString().toLowerCase()
-          if (strspit.match(/^[-+]?\d*$/) === null) { // 非整数字符,对每一个字符都转换成16进制,然后拼接
-            /**
-             * Unicode汉字、英文字母、数字的unicode范围
-             *汉字:[0x4e00,0x9fa5](或十进制[19968,40869])
-             *数字:[0x30,0x39](或十进制[48, 57])
-             *小写字母:[0x61,0x7a](或十进制[97, 122])
-             *大写字母:[0x41,0x5a](或十进制[65, 90]
-             * 'a'的Unicode编码:'&#97;',charCodeAt()的值是97
-             * '码'的Unicode编码:'\u7801', new String('码').charCodeAt()的值是30721,30721的16进制表示是7801
-             */
-            let s = strspit.split('')
-            for (let i = 0; i < s.length; i++) {
-              s[i] = s[i].charCodeAt() // 先转换成Unicode编码
-              s[i] = s[i].toString(16)
-              // 因为在服务器是每两位当做一个字符进行解析的,所以这里每个字符的Unicode编码范围必须在0——255之间。数字和大小写满足该要求,特殊字符则不一定,如果后续有特殊字符的要求,需要重写编码器和解码器
-              if (s[i].length === 1) {
-                s[i] = '0' + s[i]
-              }
-              tempspit = tempspit + s[i]
-            }
-            tempspit = tempspit + '{' + 1 // 1代表字符
-          } else { // 数字直接转换成16进制
-            strspit = parseInt(strspit)
-              .toString(16)
-            tempspit = strspit + '{' + 0 // 0代表纯数字
-          }
-
-          let temp = tempspit.split('{') // 对要加密的字符转换成16进制
-          let numLength = temp[0].length // 转换后的字符长度
-          numLength = numLength.toString(16) // 字符长度换算成16进制
-          if (numLength.length === 1) { // 如果是1,补一个0
-            numLength = '0' + numLength
-          } else if (numLength.length > 3) { // 转换后的16进制字符长度如果大于2位数,则返回,不支持
-            return ''
-          }
-          encryptStr += numLength
-          if (temp[1] === '0') {
-            encryptStr += 0
-          } else if (temp[1] === '1') {
-            encryptStr += 1
-          }
-          encryptStr += temp[0]
-          if (encryptStr.length < 20) { // 如果小于20位,补上随机数
-            // 产生三位随机数
-            let numtwo = ''
-            for (let i = 0; i < 20 - encryptStr.length; i++) {
-              numtwo += Math.floor(Math.random() * 10)
-            }
-            let ran = numtwo // 产生3位随机数
-            encryptStr += ran
-          }
-          return encryptStr
-        }
       },
       toAttach: function (url) {
         if (this.user.logged) {

+ 3 - 71
components/store/RecommendProduct.vue

@@ -34,6 +34,7 @@
 </template>
 <script>
   import Buy from '~components/common/buyOrCar/buyComponent.vue'
+  import { enidfilter } from '~utils/baseUtils'
   export default {
     name: 'recommend-product',
     components: {
@@ -97,19 +98,17 @@
                 minPackQty: item.minPackQty ? item.minPackQty : item.minBuyQty
               }])
                 .then(response => {
-                  //        window.location.href = '/user#/order/pay/' + this.enidfilter(response.data.orderid)
                   if (response.data.success) {
                     if (response.data.message) {
                       this.$message({
                         message: response.data.message,
                         type: 'success'
                       })
-                      let _self = this
                       window.setTimeout(function () {
-                        window.location.href = '/user#/order/pay/' + _self.enidfilter(response.data.data.orderid)
+                        window.location.href = '/user#/order/pay/' + enidfilter(response.data.data.orderid)
                       }, 1000)
                     } else {
-                      window.location.href = '/user#/order/pay/' + this.enidfilter(response.data.data.orderid)
+                      window.location.href = '/user#/order/pay/' + enidfilter(response.data.data.orderid)
                     }
                   } else {
                     if (response.data.data && response.data.data.unvailable === 1) {
@@ -159,73 +158,6 @@
             }
           }
         }
-      },
-      enidfilter: function (str) {
-        if (str) {
-          let encryptStr = '' // 最终返回的加密后的字符串
-          // 产生三位随机数
-          let num = ''
-          for (let i = 0; i < 3; i++) {
-            num += Math.floor(Math.random() * 10)
-          }
-          encryptStr += num // 产生3位随机数
-
-          // 16位加密
-          let tempspit = ''
-          let strspit = str.toString().toLowerCase()
-          if (strspit.match(/^[-+]?\d*$/) === null) { // 非整数字符,对每一个字符都转换成16进制,然后拼接
-            /**
-             * Unicode汉字、英文字母、数字的unicode范围
-             *汉字:[0x4e00,0x9fa5](或十进制[19968,40869])
-             *数字:[0x30,0x39](或十进制[48, 57])
-             *小写字母:[0x61,0x7a](或十进制[97, 122])
-             *大写字母:[0x41,0x5a](或十进制[65, 90]
-             * 'a'的Unicode编码:'&#97;',charCodeAt()的值是97
-             * '码'的Unicode编码:'\u7801', new String('码').charCodeAt()的值是30721,30721的16进制表示是7801
-             */
-            let s = strspit.split('')
-            for (let i = 0; i < s.length; i++) {
-              s[i] = s[i].charCodeAt() // 先转换成Unicode编码
-              s[i] = s[i].toString(16)
-              // 因为在服务器是每两位当做一个字符进行解析的,所以这里每个字符的Unicode编码范围必须在0——255之间。数字和大小写满足该要求,特殊字符则不一定,如果后续有特殊字符的要求,需要重写编码器和解码器
-              if (s[i].length === 1) {
-                s[i] = '0' + s[i]
-              }
-              tempspit = tempspit + s[i]
-            }
-            tempspit = tempspit + '{' + 1 // 1代表字符
-          } else { // 数字直接转换成16进制
-            strspit = parseInt(strspit)
-              .toString(16)
-            tempspit = strspit + '{' + 0 // 0代表纯数字
-          }
-
-          let temp = tempspit.split('{') // 对要加密的字符转换成16进制
-          let numLength = temp[0].length // 转换后的字符长度
-          numLength = numLength.toString(16) // 字符长度换算成16进制
-          if (numLength.length === 1) { // 如果是1,补一个0
-            numLength = '0' + numLength
-          } else if (numLength.length > 3) { // 转换后的16进制字符长度如果大于2位数,则返回,不支持
-            return ''
-          }
-          encryptStr += numLength
-          if (temp[1] === '0') {
-            encryptStr += 0
-          } else if (temp[1] === '1') {
-            encryptStr += 1
-          }
-          encryptStr += temp[0]
-          if (encryptStr.length < 20) { // 如果小于20位,补上随机数
-            // 产生三位随机数
-            let numtwo = ''
-            for (let i = 0; i < 20 - encryptStr.length; i++) {
-              numtwo += Math.floor(Math.random() * 10)
-            }
-            let ran = numtwo // 产生3位随机数
-            encryptStr += ran
-          }
-          return encryptStr
-        }
       }
     }
   }

+ 3 - 0
components/store/common/StoreHeader.vue

@@ -225,6 +225,9 @@ export default {
         .then(response => {
           if (response.data.success) {
             newTab.location.href = 'https://im.ubtob.com/chat/visit?gid=' + response.data.content
+          } else {
+            newTab.close()
+            this.$message.error(response.data.message)
           }
         })
     },

+ 1 - 0
pages/applyPurchase/_id.vue

@@ -6,6 +6,7 @@
 <script>
   import { BatchPublish } from '~components/applyPurchase'
   export default {
+    middleware: 'authenticated',
     components: {
       BatchPublish
     },

+ 12 - 4
pages/applyPurchase/result.vue

@@ -6,7 +6,7 @@
       <h1>发布成功</h1>
       <h2>成功发布 <span>{{count}}</span> 条求购</h2>
       <div class="footer1">前往 <a href="/user#/seekPurchase">买家中心-我的求购</a> <span>{{timer}}s</span></div>
-      <div class="footer2">返回 <nuxt-link to="/">商城首页</nuxt-link> | <nuxt-link to="/applyPurchase">求购首页</nuxt-link></div>
+      <div class="footer2">返回 <a @click="go('/')">商城首页</a> | <a  @click="go('/applyPurchase')">求购首页</a></div>
     </div>
     <div class="container" v-else>
       <p>发布求购</p>
@@ -27,15 +27,19 @@
   export default {
     data () {
       return {
-        timer: 5
+        timer: 5,
+        isChange: false
       }
     },
     mounted () {
       if (this.state === 'success') {
-        setInterval(() => {
+        let interval = setInterval(() => {
           this.timer--
-          if (this.timer === 0) {
+          if (this.timer === 0 && !this.isChange) {
+            clearInterval(interval)
             window.location.href = '/user#/seekPurchase'
+          } else if (this.timer < 0) {
+            clearInterval(interval)
           }
         }, 1000)
       }
@@ -77,6 +81,10 @@
               }
             })
         }
+      },
+      go: function (url) {
+        this.isChange = true
+        this.$router.push(url)
       }
     }
   }

BIN
static/images/all/select-icon-full.png


BIN
static/images/applyPurchase/batch-icon.png


BIN
static/images/applyPurchase/link-buyer.png


BIN
static/images/applyPurchase/select2.png


+ 22 - 0
store/applyPurchase.js

@@ -27,6 +27,17 @@ import axios from '~plugins/axios'
 //   })
 // }
 
+// 获取商城现货
+let getSpotGoods = function ({commit}, params = {}) {
+  return axios.get('/seek/getMallGoodsList', {params: {brand: params.brand, code: params.code}})
+    .then(response => {
+      params.spotGoods = response.data
+      // commit('bomMaterial/ADD_BOM_MATERIAL_BY_SPOT_GOODS', params)
+    }, err => {
+      console.log(err)
+    })
+}
+
 export const actions = {
 // 采购商列表
   loadPurchaseManList ({ commit }, params = {}) {
@@ -70,6 +81,17 @@ export const actions = {
     commit('bomMaterial/REQUEST_BOM_MATERIAL')
     return axios.get('/seek/getSeekPurchaseByBatchPageInfo', {params: params})
       .then(response => {
+        let list = response.data.content
+        if (list && list.length) {
+          let promises = []
+          for (let i = 0; i < list.length; i++) {
+            list[i].$index = i
+            promises.push(getSpotGoods({commit}, list[i]))
+          }
+          return Promise.all(promises).then(() => {
+            commit('bomMaterial/GET_BOM_MATERIAL_SUCCESS', response.data)
+          })
+        }
         commit('bomMaterial/GET_BOM_MATERIAL_SUCCESS', response.data)
       }, err => {
         commit('bomMaterial/GET_BOM_MATERIAL_FAILURE', err)

+ 6 - 0
store/applyPurchase/bomMaterial.js

@@ -20,6 +20,12 @@ export const mutations = {
     state.bomList.fetching = false
     state.bomList.data = result
   },
+  ADD_BOM_MATERIAL_BY_SPOT_GOODS (state, result) {
+    if (result.$index === 0) {
+      state.bomList.data.content = []
+    }
+    state.bomList.data.content.push(result)
+  },
   REQUEST_BOM_INFO (state) {
     state.bomNumber.fetching = true
   },

+ 122 - 0
utils/baseUtils.js

@@ -0,0 +1,122 @@
+let getRealLength = function (str) {
+  let len = 0
+  for (let i = 0; i < str.length; i++) {
+    if (str.charCodeAt(i) > 127 || str.charCodeAt(i) === 94) {
+      len += 2
+    } else {
+      len++
+    }
+  }
+  return len
+}
+
+// 订单号转换
+export const enidfilter = (str) => {
+  if (str) {
+    let encryptStr = '' // 最终返回的加密后的字符串
+    // 产生三位随机数
+    let num = ''
+    for (let i = 0; i < 3; i++) {
+      num += Math.floor(Math.random() * 10)
+    }
+    encryptStr += num // 产生3位随机数
+
+    // 16位加密
+    let tempspit = ''
+    let strspit = str.toString().toLowerCase()
+    if (strspit.match(/^[-+]?\d*$/) === null) { // 非整数字符,对每一个字符都转换成16进制,然后拼接
+      /**
+       * Unicode汉字、英文字母、数字的unicode范围
+       *汉字:[0x4e00,0x9fa5](或十进制[19968,40869])
+       *数字:[0x30,0x39](或十进制[48, 57])
+       *小写字母:[0x61,0x7a](或十进制[97, 122])
+       *大写字母:[0x41,0x5a](或十进制[65, 90]
+       * 'a'的Unicode编码:'&#97;',charCodeAt()的值是97
+       * '码'的Unicode编码:'\u7801', new String('码').charCodeAt()的值是30721,30721的16进制表示是7801
+       */
+      let s = strspit.split('')
+      for (let i = 0; i < s.length; i++) {
+        s[i] = s[i].charCodeAt() // 先转换成Unicode编码
+        s[i] = s[i].toString(16)
+        // 因为在服务器是每两位当做一个字符进行解析的,所以这里每个字符的Unicode编码范围必须在0——255之间。数字和大小写满足该要求,特殊字符则不一定,如果后续有特殊字符的要求,需要重写编码器和解码器
+        if (s[i].length === 1) {
+          s[i] = '0' + s[i]
+        }
+        tempspit = tempspit + s[i]
+      }
+      tempspit = tempspit + '{' + 1 // 1代表字符
+    } else { // 数字直接转换成16进制
+      strspit = parseInt(strspit)
+        .toString(16)
+      tempspit = strspit + '{' + 0 // 0代表纯数字
+    }
+
+    let temp = tempspit.split('{') // 对要加密的字符转换成16进制
+    let numLength = temp[0].length // 转换后的字符长度
+    numLength = numLength.toString(16) // 字符长度换算成16进制
+    if (numLength.length === 1) { // 如果是1,补一个0
+      numLength = '0' + numLength
+    } else if (numLength.length > 3) { // 转换后的16进制字符长度如果大于2位数,则返回,不支持
+      return ''
+    }
+    encryptStr += numLength
+    if (temp[1] === '0') {
+      encryptStr += 0
+    } else if (temp[1] === '1') {
+      encryptStr += 1
+    }
+    encryptStr += temp[0]
+    if (encryptStr.length < 20) { // 如果小于20位,补上随机数
+      // 产生三位随机数
+      let numtwo = ''
+      for (let i = 0; i < 20 - encryptStr.length; i++) {
+        numtwo += Math.floor(Math.random() * 10)
+      }
+      let ran = numtwo // 产生3位随机数
+      encryptStr += ran
+    }
+    return encryptStr
+  }
+}
+
+// 获取字符串字符长度
+export const getRealLen = getRealLength
+
+// 根据字符长度剪切字符
+export const cutOutString = (str, length) => {
+  for (let i = 1; i <= str.length; i++) {
+    if (getRealLength(str.substr(0, i)) > length) {
+      str = str.substr(0, i - 1)
+      break
+    }
+  }
+  return str
+}
+
+// 格式化日期,返回字符串
+export const formatDate = (date, fmt) => {
+  if (!date) {
+    return null
+  }
+  if (typeof date === 'string') {
+    date = new Date(Date.parse(date.replace(/-/g, '/')))
+  }
+  let o = {
+    'M+': date.getMonth() + 1, // 月份
+    'd+': date.getDate(), // 日
+    'h+': 23, // 小时
+    'm+': 59, // 分
+    's+': 59, // 秒
+    'q+': Math.floor((date.getMonth() + 3) / 3), // 季度
+    'S': date.getMilliseconds() // 毫秒
+  }
+  if (/(y+)/.test(fmt)) {
+    fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
+  }
+  for (let k in o) {
+    if (new RegExp('(' + k + ')').test(fmt)) {
+      fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
+    }
+  }
+  return fmt
+}

Some files were not shown because too many files changed in this diff