diff --git a/libs/Oss/base64.js b/libs/Oss/base64.js new file mode 100644 index 0000000..4535327 --- /dev/null +++ b/libs/Oss/base64.js @@ -0,0 +1,135 @@ +export const Base64 = { + + // private property + _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", + + // public method for encoding + encode : function (input) { + var output = ""; + var chr1, chr2, chr3, enc1, enc2, enc3, enc4; + var i = 0; + + input = Base64._utf8_encode(input); + + while (i < input.length) { + + chr1 = input.charCodeAt(i++); + chr2 = input.charCodeAt(i++); + chr3 = input.charCodeAt(i++); + + enc1 = chr1 >> 2; + enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); + enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); + enc4 = chr3 & 63; + + if (isNaN(chr2)) { + enc3 = enc4 = 64; + } else if (isNaN(chr3)) { + enc4 = 64; + } + + output = output + + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); + + } + + return output; + }, + + // public method for decoding + decode : function (input) { + var output = ""; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + + while (i < input.length) { + + enc1 = this._keyStr.indexOf(input.charAt(i++)); + enc2 = this._keyStr.indexOf(input.charAt(i++)); + enc3 = this._keyStr.indexOf(input.charAt(i++)); + enc4 = this._keyStr.indexOf(input.charAt(i++)); + + chr1 = (enc1 << 2) | (enc2 >> 4); + chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); + chr3 = ((enc3 & 3) << 6) | enc4; + + output = output + String.fromCharCode(chr1); + + if (enc3 != 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 != 64) { + output = output + String.fromCharCode(chr3); + } + + } + + output = Base64._utf8_decode(output); + + return output; + + }, + + // private method for UTF-8 encoding + _utf8_encode : function (string) { + string = string.replace(/\r\n/g,"\n"); + var utftext = ""; + + for (var n = 0; n < string.length; n++) { + + var c = string.charCodeAt(n); + + if (c < 128) { + utftext += String.fromCharCode(c); + } + else if((c > 127) && (c < 2048)) { + utftext += String.fromCharCode((c >> 6) | 192); + utftext += String.fromCharCode((c & 63) | 128); + } + else { + utftext += String.fromCharCode((c >> 12) | 224); + utftext += String.fromCharCode(((c >> 6) & 63) | 128); + utftext += String.fromCharCode((c & 63) | 128); + } + + } + + return utftext; + }, + + // private method for UTF-8 decoding + _utf8_decode : function (utftext) { + var string = ""; + var i = 0; + var c = c1 = c2 = 0; + + while ( i < utftext.length ) { + + c = utftext.charCodeAt(i); + + if (c < 128) { + string += String.fromCharCode(c); + i++; + } + else if((c > 191) && (c < 224)) { + c2 = utftext.charCodeAt(i+1); + string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); + i += 2; + } + else { + c2 = utftext.charCodeAt(i+1); + c3 = utftext.charCodeAt(i+2); + string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); + i += 3; + } + + } + + return string; + } + +} \ No newline at end of file diff --git a/libs/Oss/crypto.js b/libs/Oss/crypto.js new file mode 100644 index 0000000..7807ea4 --- /dev/null +++ b/libs/Oss/crypto.js @@ -0,0 +1,117 @@ +var base64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +let Crypto = {}; +var util = Crypto.util = { + rotl: function (n, b) { + return (n << b) | (n >>> (32 - b)); + }, + rotr: function (n, b) { + return (n << (32 - b)) | (n >>> b); + }, + endian: function (n) { + if (n.constructor == Number) { + return util.rotl(n, 8) & 0x00FF00FF | + util.rotl(n, 24) & 0xFF00FF00; + } + for (var i = 0; i < n.length; i++) + n[i] = util.endian(n[i]); + return n; + }, + randomBytes: function (n) { + for (var bytes = []; n > 0; n--) + bytes.push(Math.floor(Math.random() * 256)); + return bytes; + }, + stringToBytes: function (str) { + var bytes = []; + for (var i = 0; i < str.length; i++) + bytes.push(str.charCodeAt(i)); + return bytes; + }, + bytesToString: function (bytes) { + var str = []; + for (var i = 0; i < bytes.length; i++) + str.push(String.fromCharCode(bytes[i])); + return str.join(""); + }, + stringToWords: function (str) { + var words = []; + for (var c = 0, b = 0; c < str.length; c++, b += 8) + words[b >>> 5] |= str.charCodeAt(c) << (24 - b % 32); + return words; + }, + bytesToWords: function (bytes) { + var words = []; + for (var i = 0, b = 0; i < bytes.length; i++, b += 8) + words[b >>> 5] |= bytes[i] << (24 - b % 32); + return words; + }, + wordsToBytes: function (words) { + var bytes = []; + for (var b = 0; b < words.length * 32; b += 8) + bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF); + return bytes; + }, + bytesToHex: function (bytes) { + var hex = []; + for (var i = 0; i < bytes.length; i++) { + hex.push((bytes[i] >>> 4).toString(16)); + hex.push((bytes[i] & 0xF).toString(16)); + } + return hex.join(""); + }, + hexToBytes: function (hex) { + var bytes = []; + for (var c = 0; c < hex.length; c += 2) + bytes.push(parseInt(hex.substr(c, 2), 16)); + return bytes; + }, + bytesToBase64: function (bytes) { + if (typeof btoa == "function") return btoa(util.bytesToString(bytes)); + var base64 = [], + overflow; + for (var i = 0; i < bytes.length; i++) { + switch (i % 3) { + case 0: + base64.push(base64map.charAt(bytes[i] >>> 2)); + overflow = (bytes[i] & 0x3) << 4; + break; + case 1: + base64.push(base64map.charAt(overflow | (bytes[i] >>> 4))); + overflow = (bytes[i] & 0xF) << 2; + break; + case 2: + base64.push(base64map.charAt(overflow | (bytes[i] >>> 6))); + base64.push(base64map.charAt(bytes[i] & 0x3F)); + overflow = -1; + } + } + if (overflow != undefined && overflow != -1) + base64.push(base64map.charAt(overflow)); + while (base64.length % 4 != 0) base64.push("="); + return base64.join(""); + }, + base64ToBytes: function (base64) { + if (typeof atob == "function") return util.stringToBytes(atob(base64)); + base64 = base64.replace(/[^A-Z0-9+\/]/ig, ""); + var bytes = []; + for (var i = 0; i < base64.length; i++) { + switch (i % 4) { + case 1: + bytes.push((base64map.indexOf(base64.charAt(i - 1)) << 2) | + (base64map.indexOf(base64.charAt(i)) >>> 4)); + break; + case 2: + bytes.push(((base64map.indexOf(base64.charAt(i - 1)) & 0xF) << 4) | + (base64map.indexOf(base64.charAt(i)) >>> 2)); + break; + case 3: + bytes.push(((base64map.indexOf(base64.charAt(i - 1)) & 0x3) << 6) | + (base64map.indexOf(base64.charAt(i)))); + break; + } + } + return bytes; + } +}; +Crypto.mode = {}; +export default Crypto; \ No newline at end of file diff --git a/libs/Oss/hmac.js b/libs/Oss/hmac.js new file mode 100644 index 0000000..1918f4c --- /dev/null +++ b/libs/Oss/hmac.js @@ -0,0 +1,37 @@ +import Crypto from './crypto.js'; +/*! + * Crypto-JS v1.1.0 + * http://code.google.com/p/crypto-js/ + * Copyright (c) 2009, Jeff Mott. All rights reserved. + * http://code.google.com/p/crypto-js/wiki/License + */ +(function(){ + +// Shortcut +var util = Crypto.util; + +Crypto.HMAC = function (hasher, message, key, options) { + + // Allow arbitrary length keys + key = key.length > hasher._blocksize * 4 ? + hasher(key, { asBytes: true }) : + util.stringToBytes(key); + + // XOR keys with pad constants + var okey = key, + ikey = key.slice(0); + for (var i = 0; i < hasher._blocksize * 4; i++) { + okey[i] ^= 0x5C; + ikey[i] ^= 0x36; + } + + var hmacbytes = hasher(util.bytesToString(okey) + + hasher(util.bytesToString(ikey) + message, { asString: true }), + { asBytes: true }); + return options && options.asBytes ? hmacbytes : + options && options.asString ? util.bytesToString(hmacbytes) : + util.bytesToHex(hmacbytes); + +}; + +})(); \ No newline at end of file diff --git a/libs/Oss/sha1.js b/libs/Oss/sha1.js new file mode 100644 index 0000000..5632fd7 --- /dev/null +++ b/libs/Oss/sha1.js @@ -0,0 +1,82 @@ +import Crypto from './crypto.js'; +/*! + * Crypto-JS v1.1.0 + * http://code.google.com/p/crypto-js/ + * Copyright (c) 2009, Jeff Mott. All rights reserved. + * http://code.google.com/p/crypto-js/wiki/License + */ +(function(){ + +// Shortcut +var util = Crypto.util; + +// Public API +var SHA1 = Crypto.SHA1 = function (message, options) { + var digestbytes = util.wordsToBytes(SHA1._sha1(message)); + return options && options.asBytes ? digestbytes : + options && options.asString ? util.bytesToString(digestbytes) : + util.bytesToHex(digestbytes); +}; + +// The core +SHA1._sha1 = function (message) { + + var m = util.stringToWords(message), + l = message.length * 8, + w = [], + H0 = 1732584193, + H1 = -271733879, + H2 = -1732584194, + H3 = 271733878, + H4 = -1009589776; + + // Padding + m[l >> 5] |= 0x80 << (24 - l % 32); + m[((l + 64 >>> 9) << 4) + 15] = l; + + for (var i = 0; i < m.length; i += 16) { + + var a = H0, + b = H1, + c = H2, + d = H3, + e = H4; + + for (var j = 0; j < 80; j++) { + + if (j < 16) w[j] = m[i + j]; + else { + var n = w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16]; + w[j] = (n << 1) | (n >>> 31); + } + + var t = ((H0 << 5) | (H0 >>> 27)) + H4 + (w[j] >>> 0) + ( + j < 20 ? (H1 & H2 | ~H1 & H3) + 1518500249 : + j < 40 ? (H1 ^ H2 ^ H3) + 1859775393 : + j < 60 ? (H1 & H2 | H1 & H3 | H2 & H3) - 1894007588 : + (H1 ^ H2 ^ H3) - 899497514); + + H4 = H3; + H3 = H2; + H2 = (H1 << 30) | (H1 >>> 2); + H1 = H0; + H0 = t; + + } + + H0 += a; + H1 += b; + H2 += c; + H3 += d; + H4 += e; + + } + + return [H0, H1, H2, H3, H4]; + +}; + +// Package private blocksize +SHA1._blocksize = 16; + +})(); \ No newline at end of file diff --git a/libs/Oss/upload.js b/libs/Oss/upload.js new file mode 100644 index 0000000..473055a --- /dev/null +++ b/libs/Oss/upload.js @@ -0,0 +1,65 @@ +import Crypto from './crypto.js'; +import './hmac.js'; +import './sha1.js'; +import Util from '@/libs/util' +import {Base64} from './base64.js'; + +let date=new Date() +date=date.setHours(date.getHours() + 1) +let extime=""+new Date(date).toISOString() +var policyText = { + "expiration": extime, //设置该Policy的失效时间,超过这个失效时间之后,就没有办法通过这个policy上传文件了 + "conditions": [ + ["content-length-range", 0, 1024*1024*100] // 设置上传文件的大小限制 + ] +}; +var config={ + accessid:'LTAI4FzqQHnk4rozqLZ8jCNj', + accesskey:'mveW7B1OyFoKUkHm8WsxmrjHmkJWHq', + osshost:'https://huoran.oss-cn-shenzhen.aliyuncs.com', + policyBase64:Base64.encode(JSON.stringify(policyText)) +} +var message = config.policyBase64; +var bytes = Crypto.HMAC(Crypto.SHA1, message, config.accesskey, { asBytes: true }) ; +var signature = Crypto.util.bytesToBase64(bytes); +var timetamp = new Date().getTime(); +function random_string(len) { +  len = len || 32; +  var chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'; +  var maxPos = chars.length; +  var pwd = ''; +  for (let i = 0; i < len; i++) { +   pwd += chars.charAt(Math.floor(Math.random() * maxPos)); + } + return pwd; +} +var OSS={ + name:'aliyun', + host:config.osshost, + accessid:config.accessid, + signature:signature, + policyBase64:config.policyBase64, +} +export default function(tempFilePaths, callback) { + const fileName = Date.now() + '.' + Util.getFileExt(tempFilePaths) + uni.uploadFile({ +   url: OSS.host, +   filePath: tempFilePaths, + fileType: '', + name: 'file', + formData: { + name: fileName, + key: fileName,//文件名 +  policy: OSS.policyBase64, // 输入你获取的的policy + OSSAccessKeyId: OSS.accessid, // 输入你的AccessKeyId + success_action_status: '200', // 让服务端返回200,不然,默认会返回204 + signature: OSS.signature, // 输入你获取的的signature + }, + success: (res) => { + callback(OSS.host + '/' + fileName) + }, + fail: (res) => { + console.log(res); + } +}) +}; \ No newline at end of file diff --git a/libs/mtj-wx-sdk.config.js b/libs/mtj-wx-sdk.config.js deleted file mode 100644 index e1d7474..0000000 --- a/libs/mtj-wx-sdk.config.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file 百度移动统计配置文件 - */ - -module.exports = { - /** - * 从百度移动统计获取的AppKey - * @type {string} - */ - appKey: 'ce2fa79380', - - /** - * 是否使用了插件 - * @type {boolean} - */ - hasPlugin: false, - - /** - * 是否获取当前的地理位置和速度信息 - * @type {boolean} - */ - getLocation: false, - - /** - * 是否获取组件滚动信息 - * @type {boolean} - */ - getComponentScroll: false, - /** - * 是否开启了A/B 测试 - * @type {boolean} - */ - hasABTest: false, - /** - * 是否开启热力图功能 - * @type {boolean} - */ - hasHeatmap: false, -}; diff --git a/libs/mtj-wx-sdk.js b/libs/mtj-wx-sdk.js deleted file mode 100644 index b908aa2..0000000 --- a/libs/mtj-wx-sdk.js +++ /dev/null @@ -1 +0,0 @@ -var mtjwxsdk=function(t){"use strict";var e,n,r="1.10.23",o="https://hmma.baidu.com/mini.gif",a={app:["onShow","onHide","onError"],page:["onShow","onReady","onHide","onPageScroll"],share:["onShareAppMessage"],behavior:["tap"]},i="mtj_uuid",c="mtj_user",s="mtj_user_property",u="mtj_track_status",f="mtj_remote_config",l="mtj_ab_experiment_list",h="mtj_ab_active_experiment_ids",p={},d={type:1},g={aso:{}},m={},y=function(t){if(!1!==p.trackStatus){var n=t.data.et?{mtj_ii:t.data.uuid||"",mtj_et:t.data.et,mtj_en:t.data.en}:{};return e.request({url:t.url,data:t.data,header:Object.assign({"content-type":"application/json"},n,t.header),method:t.method||"POST",dataType:t.dataType||"json",success:function(e){t.success&&t.success(e)},fail:function(e){t.fail&&t.fail(e)}})}},v=function(){return"undefined"!=typeof crypto&&crypto.getRandomValues?crypto.getRandomValues(new Uint32Array(1))[0]:Math.floor(4294967295*Math.random())},b=function(t,e){return"[object "+e+"]"==={}.toString.call(t)},j=function(t,e,n){var r=(t=t.replace(new RegExp(e+"=[^&]*","g"),"").replace(/(\?|&)&/g,"$1").replace(/(\?|&)$/g,"")).indexOf("?")>0?"&":"?";return t+r+e+"="+encodeURIComponent(n)},S=function t(e){return b(e,"Object")||b(e,"Array")?(Object.keys(e).forEach((function(n){var r=e[n];b(r,"Object")||b(r,"Array")?e[n]=t(r):e[n]=""+r})),e):e},O=function(t){return b(t,"String")&&/^[a-z][a-z0-9_]{0,31}$/.test(t)},w=function(t){return b(t,"String")&&/^[a-z0-9_]{1,32}$/.test(t)},k=function(t){return b(t,"String")||b(t,"Number")},x=function(t){return b(t,"String")&&/^\d{11}$/.test(t)},P=function(t){return b(t,"String")&&28===t.length},_=0,T=function(t){return new Promise((function(e,n){return t.data=t.data||{},p.blacklist&&(p.blacklist.indexOf("all")>-1&&t.data.et||p.blacklist.indexOf("behavior")>-1&&"behavior"===t.data.et)?e():(t.data.v=r,t.data.rqc=++_,o=t.data,JSON.stringify(o).length<=204800?(t.success=function(t){return e(t)},t.fail=function(t){return n(t)},void y(t)):(_--,n(new Error("invalid data"))));var o}))},I=function(t,e){var n=b(e,"Object")?JSON.stringify(e):""+e;T({url:o,dataType:"string",data:Object.assign({},d,{et:"error",en:t,ep:{ex:n},rid:v()})})},A=function(t){t.rid=v(),t.aso=t.aso||{};var e={url:o,dataType:"string",data:Object.assign({},d,t)};T(e),(m.circleToken||m.circleByThreeFingers)&&("page"===t.et&&"show"===t.en||"behavior"===t.et&&"tap"===t.en)&&(e.url="https://hmma.baidu.com/mini.gif?circle=1",e.data.token=m.circleToken,T(e).catch((function(t){return console.error(t)})))};function E(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null==n)return;var r,o,a=[],i=!0,c=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);i=!0);}catch(t){c=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(c)throw o}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return N(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return N(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n>t/4).toString(16)})),q(i,t),p.hasABTest&&(U(l),U(h))),t}))},B=function(t){return new Promise((function(n){if(!t)return n();e.getShareInfo({shareTicket:t,success:function(t){delete t.errMsg,n(t)},fail:function(){n({})}})}))},M=function(){return n||(d.sid=v(),d.rqc=0,n=Promise.all([D(),new Promise((function(t){e.getSystemInfo({success:function(e){delete e.errMsg,t(e)},fail:function(){t({})}})})),new Promise((function(t){e.getNetworkType({success:function(e){delete e.errMsg,t(e)},fail:function(){t({})}})})),Promise.resolve().then((function(){var t=C(c),n=b(t,"Object")?t:{};return new Promise((function(t){e.getSetting({success:function(r){r.authSetting&&r.authSetting["scope.userInfo"]?e.getUserInfo({success:function(e){delete e.userInfo.errMsg,t(Object.assign(n,e.userInfo))},fail:function(){t(n)}}):t(n)},fail:function(){t(n)}})}))})),new Promise((function(t){if(!p.getLocation)return t({});e.getLocation({type:"wgs84",success:function(e){delete e.errMsg,t(e)},fail:function(){t({})}})})),Promise.resolve().then((function(){var t=C(s);return b(t,"Object")?t:{}}))]).then((function(t){var e=E(t,6),n=e[0],o=e[1],a=e[2],i=e[3],c=e[4],s=e[5];d.uuid=n,g.system=S(o),g.network=S(a),Object.keys(i).length>0&&(g.user=S(i)),Object.keys(c).length>0&&(g.location=S(c)),Object.keys(s).length>0&&(g.userProperty=JSON.stringify(s)),"devtools"===g.system.platform&&p.latestVersion&&function(t,e){for(var n=t.split("."),r=e.split("."),o=0;o<3;o++){var a=+n[o]||0,i=+r[o]||0;if(a>i)return 1;if(i>a)return-1}return 0}(r,p.latestVersion)<0&&console.warn("百度移动统计微信小程序SDK已更新,为不影响您的正常使用,请到SDK下载中心 https://mtj.baidu.com/web/sdk/index 下载最新版本")})))},R={onShow:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=(g.aso.query||[]).filter((function(t){return 0===t.key.indexOf("mtj_")}));return g.aso.scene=""+(t.scene||""),t.referrerInfo&&t.referrerInfo.appId?g.aso.referrerInfo=t.referrerInfo:delete g.aso.referrerInfo,g.aso.path=t.path||"",g.aso.query=Object.keys(t.query||{}).map((function(e){return{key:e,value:t.query[e]}})),e.length>0&&!/(^|,)mtj_/.test(Object.keys(t.query||{}).join(","))&&(g.aso.query=g.aso.query.concat(e)),(t.query||{}).mtj_ctoken&&!p.disableCircling&&(m.circleToken=t.query.mtj_ctoken),(t.query||{}).mtj_htoken&&p.hasHeatmap&&(m.heatmapToken=t.query.mtj_htoken),M().then((function(){return B(t.shareTicket)})).then((function(t){t?g.aso.shareInfo=t:delete g.aso.shareInfo,A(Object.assign({et:"app",en:"show"},g))})).catch((function(t){I("app.onShow",t)}))},onHide:function(){A({et:"app",en:"hide"})},onError:function(t){var e=b(t,"Object")?JSON.stringify(S(t)):""+t;A({et:"app",en:"error",ep:{ex:e}})}};function F(){this.options={opacity:100,radius:30,bshadow:1.5,boundVal:15e3,shadowBlur:15,points:{max:100,data:[]},gradient:{.45:"rgb(0,0,255)",.55:"rgb(0,255,255)",.65:"rgb(0,255,0)",.95:"yellow",1:"rgb(255,0,0)"}}}F.prototype={getCanvas:function(t){return new Promise((function(n,r){e.createSelectorQuery().select(t).fields({node:!0,size:!0}).exec((function(t){n(t[0].node)}))}))},getPageClientRect:function(){return new Promise((function(t,n){e.createSelectorQuery().select(".hm-container").boundingClientRect((function(e){t([e.width,e.height])})).exec()}))},init:function(){var t=this;return Promise.all([this.getPageClientRect(),this.getCanvas("#cvs"),this.getCanvas("#cvd")]).then((function(e){var n=E(e,3),r=n[0],o=n[1],a=n[2];t.options.width=r[0],t.options.height=r[1],o.width=t.options.width,o.height=t.options.height,t.options.context.setData({p_width:t.options.width,p_height:t.options.height});var i=o.getContext("2d");t.options.ctx=i,a.width=1,a.height=256;var c=a.getContext("2d");t.options.pctx=c}))},renderShadow:function(t,e,n,r){var o=this.options.ctx,a=this.options.boundVal,i=parseFloat(n/this.options.points.max,10);o.shadowColor="rgba(0, 0, 0, "+i+")",o.shadowOffsetX=a,o.shadowOffsetY=a,o.shadowBlur=this.options.shadowBlur,o.beginPath(),o.arc(t-a,e-a,this.options.radius,0,2*Math.PI,!0),o.closePath(),o.fill(),r||this.cachePoint(t,e,n)},colorize:function(){for(var t=this.options.width,e=this.options.height,n=this.options.ctx,r=n.getImageData(0,0,t,e),o=r.data,a=o.length,i=this.getPalette(),c=this.options.opacity,s=3;sr.max&&(r.max=n),o.push([t,e,n])},addPoint:function(t,e,n){this.options.ctx.clearRect(0,0,this.options.width,this.options.height),this.options.pctx.clearRect(0,0,1,256);for(var r=this.options.points.data,o=r.length,a=0;a0&&A(Object.assign({et:"page",en:"scroll",ep:S(t[0])},a))}))}catch(t){I("page.trackComponentScrollEvent",t)}},onPageScroll:function(t){(!m.pageScrollTop||t.scrollTop>m.pageScrollTop)&&(m.pageScrollTop=t.scrollTop)},onShareAppMessage:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={from:t.from,path:e.path};if(!n.path){var r=d.query.map((function(t){return t.key+"="+t.value})).join("&");n.path=d.path+(r?"?"+r:"")}e.title&&(n.title=""+e.title),t.target&&(n.target=JSON.stringify(t.target)),A(Object.assign({et:"share",en:"action",ep:n},g));var o=g.aso.query.filter((function(t){return"mtj_shuuid"===t.key})),a=o[0]?o[0].value.split("_"):[];d.uuid!==a[a.length-1]&&a.push(d.uuid);var i=a.slice(Math.max(0,a.length-3)).join("_");return e.path=j(n.path,"mtj_shuuid",i),e},onAction:function(t,e){if(t&&t.type&&t.currentTarget){var n="#"+(t.currentTarget.id||e);if("tap"===t.type){var r=[{key:"xpath",value:n}],o=t.detail,a=o.x,i=o.y,c={};return void 0!==a&&void 0!==i&&(c={x:Math.floor(a),y:Math.floor(i)}),void A(Object.assign({et:"behavior",en:"tap",ep:{data:r},posi:c},g))}if("touchmove"===t.type&&-1===J&&t.touches instanceof Array&&3===t.touches.length){if(z+=1,clearTimeout(V),3===z)return m.circleByThreeFingers=!0,m.circleToken=void 0,void A(Object.assign({et:"page",en:"show"},g));J=setTimeout((function(){J=-1,V=setTimeout((function(){z=0}),500)}),1e3)}}}},L={trackEvent:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!O(t))return Promise.reject(new Error("事件名称不合法"));var n=Object.keys(e).filter((function(t){return w(t)&&k(e[t])})).map((function(t){return{key:""+t,value:""+e[t],type:b(e[t],"String")?"string":"number"}}));return M().then((function(){A(Object.assign({et:"event",en:""+t,ep:{data:n}},g))})).catch((function(t){I("trackEvent",t)}))},setTrackStatus:function(t){b(t,"Boolean")&&(p.trackStatus=t,q(u,t))},setUserInfo:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.tel,n=t.openId;return M().then((function(){var t=C(c),r=b(t,"Object")?t:{};x(e)&&(r.tel=g.user.tel=e.substr(e.length-11)),P(n)&&(r.openId=g.user.openId=n),(r.tel||r.openId)&&q(c,r),b(e,"Undefined")||x(e)||console.error("手机号 ".concat(e," 不合法")),b(n,"Undefined")||P(n)||console.error("openid ".concat(n," 不合法"))})).catch((function(t){I("setUserInfo",t)}))},setUserId:function(t){return Promise.resolve().then((function(){if(!(b(t,"String")||b(t,"Number")&&Number.isFinite(t)))return Promise.reject(new Error("userId只能是字符串或数字"));var e=""+t,n=C(s),r=b(n,"Object")?n:{};if(!r.uid_||r.uid_[0]!==e){r.uid_=[e,"1"],q(s,r),g.userProperty=JSON.stringify(r);var o=[{key:"uid",value:e}];return M().then((function(){A(Object.assign({et:"api",en:"setUserId",ep:{data:o}},g))})).catch((function(t){I("setUserId",t)}))}}))},setUserProperty:function(t){return Promise.resolve().then((function(){var e=C(s),n=b(e,"Object")?e:{};if(b(t,"Null"))Object.keys(n).forEach((function(t){"_"!==t.charAt(0)&&"_"!==t.charAt(t.length-1)&&delete n[t]}));else if(!b(t,"Object"))return Promise.reject(new Error("userProperty必须是对象"));var r=Object.keys(n).filter((function(t){return"_"!==t.charAt(0)&&"_"!==t.charAt(t.length-1)})).length;Object.keys(t||{}).forEach((function(e){var o=t[e];""===e||"_"===e.charAt(0)||"_"===e.charAt(e.length-1)&&"ab_"!==e&&"ab_filter_"!==e||(b(o,"Null")?n[e]&&(delete n[e],r--):!(b(o,"String")||b(o,"Number")&&Number.isFinite(o))||e.length>256||(""+o).length>256||!n[e]&&r>=100||(n[e]||r++,n[e]=[o,"1"]))})),q(s,n),g.userProperty=JSON.stringify(n)}))}},$={data:[],init:function(){var t=this,e=d.uuid;e?this.startFetch(e):D().then((function(e){d.uuid=e,t.startFetch(e)}))},startFetch:function(t){console.log("---您的设备ID---",t),this.fetchTest()},getExpDataByParamName:function(t){var e=C(l);if(this.setLocalData(e),!e||!b(e,"Array"))return{};var n=e.find((function(e){return e&&b(e.params,"Object")&&!b(e.params[t],"Undefined")}));return n&&n.params?{expValue:n.params[t],expId:n.e}:{}},fetchTest:function(t,e,n){var r=this,o=d.uuid,a=d.key;y({url:"https://hm.baidu.com/v1/diversion/",data:{cid:o,tid:a},method:"GET",success:function(o){b(o,"Object")&&200===o.statusCode&&b(o.data,"Object")&&0===o.data.status?r.handleFetchResponse(o.data,t,e,n):n&&n(e)},fail:function(){console.error("请求分流实验失败"),n&&n(e)}})},handleFetchResponse:function(t,e,n,r){var o=[];if(b(t,"Object")&&b(t.data,"Object")&&b(t.data.expr,"Array")&&(o=t.data.expr),this.updateStorage(o),this.setLocalData(o),r){var a=this.getExpDataByParamName(e),i=a.expValue,c=a.expId;b(i,"Null")||b(i,"Undefined")?r(n):this.handleInTest(i,c,r)}},handleInTest:function(t,e,n){n(t),this.updateUserProperty(e)},updateStorage:function(t){q(l,t)},setLocalData:function(t){this.data=t||[]},updateUserProperty:function(t){var e=this,n=this.getActiveExpIds(t)||[],r={ab_:null,ab_filter_:null},o={},a=[];if(n.forEach((function(t){var n=e.getExpDataFromId(t);b(n,"Object")&&(o[n.e]=n.g,a.push(n.h||0))})),a.length){var i=0;a.forEach((function(t){i=function(t,e){var n="00000000000000000000000000000000";function r(t){var e=(n+n+Number(t).toString(2)).slice(-64);return[parseInt(e.slice(0,32),2),parseInt(e.slice(-32),2)]}function o(t){return(n+t.toString(2)).slice(-32)}var a=r(t),i=r(e);return parseInt(o((a[0]|i[0])>>>0)+o((a[1]|i[1])>>>0),2)}(i,t)})),r={ab_:JSON.stringify(o),ab_filter_:i}}L.setUserProperty(r)},getExpDataFromId:function(t){return C(l).find((function(e){return String(e.e)===String(t)}))},setActiveExperimentIds:function(t){q(h,t)},getActiveExpIds:function(t){var e=this,n=C(h)||[];return b(t,"Undefined")||-1!==n.indexOf(t)||n.push(t),n=(n=n.filter((function(t){return!!e.getExpDataFromId(t)}))).filter((function(t,e){return n.indexOf(t)===e})),this.setActiveExperimentIds(n),n}},K=function(t){if(p.hasABTest)if(b(t,"Object")){var e=t.paramName;if(null!=e){var n=t.defaultValue;if(b(n,"Undefined"))console.error("请设置参数默认值");else{var r=t.callback;if(b(r,"Function")){var o=$.getExpDataByParamName(e),a=o.expValue,i=o.expId;b(a,"Null")||b(a,"Undefined")?$.fetchTest(e,n,r):$.handleInTest(a,i,r)}else console.error("callback必须为函数")}}else console.error("请设置实验参数名称")}else console.error("传递参数请设置为对象")},Q=function(t,e,n){var r=e[t];e[t]=function(e){if(n.call(this,e,t),r)return r.apply(this,arguments)}},G=App,W=function(t){a.app.forEach((function(e){Q(e,t,R[e])})),t.mtj=L,t.mtj.pageEvent=H,t.mtj.fetchABTest=K,G(t)},X=Page,Y=function(t){a.page.forEach((function(e){Q(e,t,H[e])})),a.share.forEach((function(e){!function(t,e,n){var r=e[t];e[t]=function(t){var e=r&&r.apply(this,arguments);return n.call(this,t,e)}}(e,t,H[e])})),Object.keys(t).forEach((function(e){"function"==typeof t[e]&&-1===a.page.indexOf(e)&&-1===a.share.indexOf(e)&&Q(e,t,H.onAction)})),X(t)},Z=Behavior,tt=function(t){return a.page.forEach((function(e){Q(e,t.methods,H[e])})),Z(t)};tt.prototype.constructor=Behavior;var et=Component,nt=function(t){return a.page.forEach((function(e){Q(e,t.methods,H[e])})),et(t)},rt=function(){var t,n;t=wx,e=t;try{n=require("./mtj-wx-sdk.config")}catch(t){return void console.error("请把mtj-wx-sdk.config.js文件拷贝到utils目录中")}n&&n.appKey?(d.key=n.appKey,p.getLocation=n.getLocation||!1,p.getComponentScroll=n.getComponentScroll||!1,p.disableCircling=n.disableCircling||!1,p.trackStatus=!(!1===C(u)),p.hasABTest=n.hasABTest||!1,p.hasHeatmap=n.hasHeatmap||!1,p.hasABTest&&$.init(),function(){var t=C(f);if(t){Object.keys(t).forEach((function(e){p[e]=t[e]}));var e=t.updateTimestamp||0;if(+new Date-e<864e5)return Promise.resolve()}T({url:"https://hmma.baidu.com/mini.conf",method:"POST",header:{"content-type":"application/x-www-form-urlencoded"},data:{type:"wx",key:d.key}}).then((function(t){if(t&&t.data){var e=t.data;Object.keys(e).forEach((function(t){p[t]=e[t]})),e.updateTimestamp=+new Date,q(f,e)}else I("remoteConfig",t)})).catch((function(t){I("sendRequest",t)}))}(),n.hasPlugin||(App=W,Page=Y),module.exports={App:W,Page:Y,Behavior:tt,Component:nt}):console.error("请设置mtj-wx-sdk.config.js文件中的appKey字段")};return rt(),t.init=rt,Object.defineProperty(t,"__esModule",{value:!0}),t}({}); diff --git a/libs/uma.js b/libs/uma.js deleted file mode 100644 index 2976ca7..0000000 --- a/libs/uma.js +++ /dev/null @@ -1,20 +0,0 @@ - -// #ifdef MP-WEIXIN -import uma from 'umtrack-wx'; -uma.init({ - appKey: '64cc98d5a1a164591b62da3e', // 由友盟分配的APP_KEY - useOpenid: true, - // 使用Openid进行统计,此项为false时将使用友盟+uuid进行用户统计。 - // 使用Openid来统计微信小程序的用户,会使统计的指标更为准确,对系统准确性要求高的应用推荐使用Openid - autoGetOpenid: true, - // 使用openid进行统计时,是否授权友盟自动获取Openid, - // 如若需要,请到友盟后台"设置管理-应用信息"(https://mp.umeng.com/setting/appset)中设置appId及secret - debug: true,// 是否打开调试模式 - uploadUserInfo: true, // 自动上传用户信息,设为false取消上传,默认为false - enableVerify: true -}); -uma.install = function(Vue) { - Vue.prototype.$uma = uma; -} -export default uma; -// #endif diff --git a/libs/util.js b/libs/util.js index c2969a6..a5c4644 100644 --- a/libs/util.js +++ b/libs/util.js @@ -121,4 +121,8 @@ export default { removeTag(str) { return str.replace(/(<[^>]+>)|(( )+)/g , '') }, + // 传入文件名获取文件后缀 + getFileExt(fileName) { + return fileName.substring(fileName.lastIndexOf(".") + 1); + }, } \ No newline at end of file diff --git a/main.js b/main.js index 589448c..d6d640b 100644 --- a/main.js +++ b/main.js @@ -3,13 +3,10 @@ import Vue from 'vue' import App from './App' import util from '@/libs/util' -import uma from './libs/uma' import share from './libs/share' -import mtjWxSdk from './libs/mtj-wx-sdk' Vue.config.productionTip = false Vue.prototype.$util = util -Vue.use(uma) Vue.mixin(share) App.mpType = 'app' diff --git a/order/registeredActivity/registeredActivity.vue b/order/registeredActivity/registeredActivity.vue new file mode 100644 index 0000000..75d82ed --- /dev/null +++ b/order/registeredActivity/registeredActivity.vue @@ -0,0 +1,299 @@ + + + + + diff --git a/pages.json b/pages.json index 7968197..bf2f0ba 100644 --- a/pages.json +++ b/pages.json @@ -69,6 +69,14 @@ "navigationBarTitleText" : "活动详情", "enablePullDownRefresh" : false } + }, + { + "path" : "registeredActivity/registeredActivity", + "style" : + { + "navigationBarTitleText" : "已报名活动", + "enablePullDownRefresh" : true + } } ] }, @@ -130,6 +138,14 @@ "navigationBarTitleText" : "用户名修改", "enablePullDownRefresh" : false } + }, + { + "path" : "auth/auth", + "style" : + { + "navigationBarTitleText" : "企业认证", + "enablePullDownRefresh" : false + } } ] } diff --git a/pages/person/person.vue b/pages/person/person.vue index 4acd622..f93c5d6 100644 --- a/pages/person/person.vue +++ b/pages/person/person.vue @@ -30,7 +30,7 @@ 我的关注 -
  • +
  • @@ -70,7 +70,7 @@ 工作台
      -
    • +
    • diff --git a/team/auth/auth.vue b/team/auth/auth.vue new file mode 100644 index 0000000..0055af2 --- /dev/null +++ b/team/auth/auth.vue @@ -0,0 +1,109 @@ + + + + + diff --git a/team/setting/setting.vue b/team/setting/setting.vue index f4fae57..7d7caa7 100644 --- a/team/setting/setting.vue +++ b/team/setting/setting.vue @@ -1,8 +1,8 @@