diff --git a/App.vue b/App.vue
index f054c17..dae9c17 100644
--- a/App.vue
+++ b/App.vue
@@ -1,13 +1,36 @@
diff --git a/common/SparkMD5.js b/common/SparkMD5.js
new file mode 100644
index 0000000..0e1691c
--- /dev/null
+++ b/common/SparkMD5.js
@@ -0,0 +1 @@
+(function(factory){if(typeof exports==="object"){module.exports=factory()}else if(typeof define==="function"&&define.amd){define(factory)}else{var glob;try{glob=window}catch(e){glob=self}glob.SparkMD5=factory()}})(function(undefined){"use strict";var add32=function(a,b){return a+b&4294967295},hex_chr=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function cmn(q,a,b,x,s,t){a=add32(add32(a,q),add32(x,t));return add32(a<>>32-s,b)}function md5cycle(x,k){var a=x[0],b=x[1],c=x[2],d=x[3];a+=(b&c|~b&d)+k[0]-680876936|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[1]-389564586|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[2]+606105819|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[3]-1044525330|0;b=(b<<22|b>>>10)+c|0;a+=(b&c|~b&d)+k[4]-176418897|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[5]+1200080426|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[6]-1473231341|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[7]-45705983|0;b=(b<<22|b>>>10)+c|0;a+=(b&c|~b&d)+k[8]+1770035416|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[9]-1958414417|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[10]-42063|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[11]-1990404162|0;b=(b<<22|b>>>10)+c|0;a+=(b&c|~b&d)+k[12]+1804603682|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[13]-40341101|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[14]-1502002290|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[15]+1236535329|0;b=(b<<22|b>>>10)+c|0;a+=(b&d|c&~d)+k[1]-165796510|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[6]-1069501632|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[11]+643717713|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[0]-373897302|0;b=(b<<20|b>>>12)+c|0;a+=(b&d|c&~d)+k[5]-701558691|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[10]+38016083|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[15]-660478335|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[4]-405537848|0;b=(b<<20|b>>>12)+c|0;a+=(b&d|c&~d)+k[9]+568446438|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[14]-1019803690|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[3]-187363961|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[8]+1163531501|0;b=(b<<20|b>>>12)+c|0;a+=(b&d|c&~d)+k[13]-1444681467|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[2]-51403784|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[7]+1735328473|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[12]-1926607734|0;b=(b<<20|b>>>12)+c|0;a+=(b^c^d)+k[5]-378558|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[8]-2022574463|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[11]+1839030562|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[14]-35309556|0;b=(b<<23|b>>>9)+c|0;a+=(b^c^d)+k[1]-1530992060|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[4]+1272893353|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[7]-155497632|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[10]-1094730640|0;b=(b<<23|b>>>9)+c|0;a+=(b^c^d)+k[13]+681279174|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[0]-358537222|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[3]-722521979|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[6]+76029189|0;b=(b<<23|b>>>9)+c|0;a+=(b^c^d)+k[9]-640364487|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[12]-421815835|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[15]+530742520|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[2]-995338651|0;b=(b<<23|b>>>9)+c|0;a+=(c^(b|~d))+k[0]-198630844|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[7]+1126891415|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[14]-1416354905|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[5]-57434055|0;b=(b<<21|b>>>11)+c|0;a+=(c^(b|~d))+k[12]+1700485571|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[3]-1894986606|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[10]-1051523|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[1]-2054922799|0;b=(b<<21|b>>>11)+c|0;a+=(c^(b|~d))+k[8]+1873313359|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[15]-30611744|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[6]-1560198380|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[13]+1309151649|0;b=(b<<21|b>>>11)+c|0;a+=(c^(b|~d))+k[4]-145523070|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[11]-1120210379|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[2]+718787259|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[9]-343485551|0;b=(b<<21|b>>>11)+c|0;x[0]=a+x[0]|0;x[1]=b+x[1]|0;x[2]=c+x[2]|0;x[3]=d+x[3]|0}function md5blk(s){var md5blks=[],i;for(i=0;i<64;i+=4){md5blks[i>>2]=s.charCodeAt(i)+(s.charCodeAt(i+1)<<8)+(s.charCodeAt(i+2)<<16)+(s.charCodeAt(i+3)<<24)}return md5blks}function md5blk_array(a){var md5blks=[],i;for(i=0;i<64;i+=4){md5blks[i>>2]=a[i]+(a[i+1]<<8)+(a[i+2]<<16)+(a[i+3]<<24)}return md5blks}function md51(s){var n=s.length,state=[1732584193,-271733879,-1732584194,271733878],i,length,tail,tmp,lo,hi;for(i=64;i<=n;i+=64){md5cycle(state,md5blk(s.substring(i-64,i)))}s=s.substring(i-64);length=s.length;tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i>2]|=s.charCodeAt(i)<<(i%4<<3)}tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(state,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=n*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(state,tail);return state}function md51_array(a){var n=a.length,state=[1732584193,-271733879,-1732584194,271733878],i,length,tail,tmp,lo,hi;for(i=64;i<=n;i+=64){md5cycle(state,md5blk_array(a.subarray(i-64,i)))}a=i-64>2]|=a[i]<<(i%4<<3)}tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(state,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=n*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(state,tail);return state}function rhex(n){var s="",j;for(j=0;j<4;j+=1){s+=hex_chr[n>>j*8+4&15]+hex_chr[n>>j*8&15]}return s}function hex(x){var i;for(i=0;i>16)+(y>>16)+(lsw>>16);return msw<<16|lsw&65535}}if(typeof ArrayBuffer!=="undefined"&&!ArrayBuffer.prototype.slice){(function(){function clamp(val,length){val=val|0||0;if(val<0){return Math.max(val+length,0)}return Math.min(val,length)}ArrayBuffer.prototype.slice=function(from,to){var length=this.byteLength,begin=clamp(from,length),end=length,num,target,targetArray,sourceArray;if(to!==undefined){end=clamp(to,length)}if(begin>end){return new ArrayBuffer(0)}num=end-begin;target=new ArrayBuffer(num);targetArray=new Uint8Array(target);sourceArray=new Uint8Array(this,begin,num);targetArray.set(sourceArray);return target}})()}function toUtf8(str){if(/[\u0080-\uFFFF]/.test(str)){str=unescape(encodeURIComponent(str))}return str}function utf8Str2ArrayBuffer(str,returnUInt8Array){var length=str.length,buff=new ArrayBuffer(length),arr=new Uint8Array(buff),i;for(i=0;i>2]|=buff.charCodeAt(i)<<(i%4<<3)}this._finish(tail,length);ret=hex(this._hash);if(raw){ret=hexToBinaryString(ret)}this.reset();return ret};SparkMD5.prototype.reset=function(){this._buff="";this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this};SparkMD5.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}};SparkMD5.prototype.setState=function(state){this._buff=state.buff;this._length=state.length;this._hash=state.hash;return this};SparkMD5.prototype.destroy=function(){delete this._hash;delete this._buff;delete this._length};SparkMD5.prototype._finish=function(tail,length){var i=length,tmp,lo,hi;tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(this._hash,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=this._length*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(this._hash,tail)};SparkMD5.hash=function(str,raw){return SparkMD5.hashBinary(toUtf8(str),raw)};SparkMD5.hashBinary=function(content,raw){var hash=md51(content),ret=hex(hash);return raw?hexToBinaryString(ret):ret};SparkMD5.ArrayBuffer=function(){this.reset()};SparkMD5.ArrayBuffer.prototype.append=function(arr){var buff=concatenateArrayBuffers(this._buff.buffer,arr,true),length=buff.length,i;this._length+=arr.byteLength;for(i=64;i<=length;i+=64){md5cycle(this._hash,md5blk_array(buff.subarray(i-64,i)))}this._buff=i-64>2]|=buff[i]<<(i%4<<3)}this._finish(tail,length);ret=hex(this._hash);if(raw){ret=hexToBinaryString(ret)}this.reset();return ret};SparkMD5.ArrayBuffer.prototype.reset=function(){this._buff=new Uint8Array(0);this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this};SparkMD5.ArrayBuffer.prototype.getState=function(){var state=SparkMD5.prototype.getState.call(this);state.buff=arrayBuffer2Utf8Str(state.buff);return state};SparkMD5.ArrayBuffer.prototype.setState=function(state){state.buff=utf8Str2ArrayBuffer(state.buff,true);return SparkMD5.prototype.setState.call(this,state)};SparkMD5.ArrayBuffer.prototype.destroy=SparkMD5.prototype.destroy;SparkMD5.ArrayBuffer.prototype._finish=SparkMD5.prototype._finish;SparkMD5.ArrayBuffer.hash=function(arr,raw){var hash=md51_array(new Uint8Array(arr)),ret=hex(hash);return raw?hexToBinaryString(ret):ret};return SparkMD5});
\ No newline at end of file
diff --git a/common/bigc.js b/common/bigc.js
new file mode 100644
index 0000000..11660e7
--- /dev/null
+++ b/common/bigc.js
@@ -0,0 +1 @@
+!function(e){"use strict";var r,i=20,s=1,P=1e6,o=-7,f=21,c="[big.js] ",u=c+"Invalid ",b=u+"decimal places",h=u+"rounding mode",x=c+"Division by zero",l={},D=void 0,a=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function R(e,r,t,n){var i=e.c,s=e.e+r+1;if(s++n&&R(e,t,o.RM),2==r&&(n=e.e+t+1);e.c.length=o.PE))s=s.charAt(0)+(1t)for(i-=t;i--;)s+="0";else ii[s]^r?1:-1;return f==c?0:cw[l]?1:-1;break}if(!(h<0))break;for(c=d==f?i:a;d;){if(w[--d]>=1;)r=r.times(r);return i?t.div(n):n},l.round=function(e,r){var t=this.constructor;if(e===D)e=0;else if(e!==~~e||e<-P||P {
+ let promiseItem = new Promise((resolve, reject) => {
+ let tiemr = new Date();
+ let ext = getFileExtendingName(item.tempFilePath || item);
+ let nameStr = oss.dir + tiemr.getTime() + index + ext;
+
+ uni.uploadFile({
+ url: oss.host,
+ filePath: item.tempFilePath || item,
+ name: 'file',
+ fileType,
+ formData: {
+ 'key': nameStr,
+ "OSSAccessKeyId": oss.accessid,
+ "policy": oss.policy,
+ "Signature": oss.signature,
+ "success_action_status": 200,
+ },
+ success: result => {
+ if (result.statusCode == 200) {
+ let fileUrl = oss.host + '/' + nameStr;
+ resolve(fileUrl);
+ }else{
+ reject(result);
+ }
+ },
+ fail: err => {
+ reject(err);
+ }
+ })
+ })
+ premiseList.push(promiseItem);
+ });
+
+ return Promise.all(premiseList);
+}
+
+// 获取文件后缀
+function getFileExtendingName(filename){
+ var reg = /\.[^\.]+$/;
+ var matches = reg.exec(filename);
+ if (matches) {
+ return matches[0];
+ }
+ return '';
+}
\ No newline at end of file
diff --git a/common/http.interceptor.js b/common/http.interceptor.js
new file mode 100644
index 0000000..cd2e881
--- /dev/null
+++ b/common/http.interceptor.js
@@ -0,0 +1,33 @@
+import { BASE_URL } from "@/config/index.js"
+
+const install = (Vue, vm) => {
+ // 请求全局配置
+ Vue.prototype.$u.http.setConfig({
+ baseUrl: BASE_URL,
+ method: 'POST',
+ dataType: 'json', // 返回数据时自动 JSON.parse()
+ showLoading: false, // 是否显示请求中的loading
+ loadingText: '正在加载',
+ loadingTime: 800 // 延迟800毫秒时显示加载框
+ });
+
+ // 请求前拦截, 现在不做拦截
+ Vue.prototype.$u.http.interceptor.request = config => {
+ return true;
+ };
+
+ // 响应拦截
+ Vue.prototype.$u.http.interceptor.response = res => {
+ if(res.code == 0) {
+ return res;
+ } else {
+ vm.$msg(res.msg);
+ return false;
+ }
+ // res.code == 9998 手机号 res.code == 9999 用户信息
+ }
+}
+
+export default {
+ install
+}
\ No newline at end of file
diff --git a/common/mixin.js b/common/mixin.js
index 167e151..ca4f368 100644
--- a/common/mixin.js
+++ b/common/mixin.js
@@ -8,8 +8,70 @@ export default{
this.pageScrollTop = res.scrollTop;
},
methods: {
- $isRight(val){
- return this.$shared.isRight(val);
+ // 判断对错/是否显示,万能校验
+ $isRight(obj){
+ if (isValueType(obj) === 'string') {
+ obj = obj.trim();
+ if (obj === 'null' || obj === 'undefined') {
+ return false;
+ }
+ } else if (isValueType(obj) === 'number' && (isValueType(obj) === "number" && !isNaN(obj)) && obj !== 0) {
+ return true;
+ } else if (isValueType(obj) === 'boolean') {
+ return obj
+ }
+ for (var key in obj) {
+ return true;
+ }
+ return false;
+ },
+ // 判断一个值所属的类型,返回一个字符串
+ $valueType(value){
+ let str = Object.prototype.toString.call(value);
+ return str.match(/\[object (.*?)\]/)[1].toLowerCase();
+ },
+ $msg(title = '', param = {}) {
+ return new Promise((resolve, reject) => {
+ if(!title){
+ reject();
+ return;
+ }
+ uni.showToast({
+ title,
+ duration: param.duration || 1500,
+ mask: param.mask || true, // 默认应该加mask 禁止提示时操作
+ icon: param.icon || 'none',
+ complete: result => {
+ setTimeout(() => {
+ resolve();
+ }, param.duration || 1500);
+ }
+ });
+ })
+ },
+ $url(url, options = {}){
+ this.$u.throttle(() => {
+ if(options.type && options.type !== ''){
+ if(options.type === 'redirect'){ // 关闭当前,跳转
+ uni.redirectTo({ url })
+ }else if(options.type === 'switch'){ // 跳转
+ uni.switchTab({ url })
+ }else if(options.type === 'launch'){ // 关闭所有,跳转
+ uni.reLaunch({ url })
+ }
+ }else{
+ uni.navigateTo({ url }) // 跳转
+ }
+ }, 100);
+ },
+ $toBack(){
+ let pages = getCurrentPages(); // 当前页
+ let beforePage = pages[pages.length - 2]; // 上个页面
+ if(beforePage && beforePage.route){
+ uni.navigateBack();
+ }else{
+ uni.reLaunch({url:'/pages/index/index'});
+ }
},
$check(str, type) {
switch (type) {
@@ -55,49 +117,6 @@ export default{
default:
return true;
}
- },
- $msg(title = '', param = {}) {
- return new Promise((resolve, reject) => {
- if(!title){
- reject();
- return;
- }
- uni.showToast({
- title,
- duration: param.duration || 1500,
- mask: param.mask || true, // 默认应该加mask 禁止提示时操作
- icon: param.icon || 'none',
- complete: result => {
- setTimeout(() => {
- resolve();
- }, param.duration || 1500);
- }
- });
- })
- },
- $url(url, options = {}){
- this.$u.throttle(() => {
- if(options.type && options.type !== ''){
- if(options.type === 'redirect'){ // 关闭当前,跳转
- uni.redirectTo({ url })
- }else if(options.type === 'switch'){ // 跳转
- uni.switchTab({ url })
- }else if(options.type === 'launch'){ // 关闭所有,跳转
- uni.reLaunch({ url })
- }
- }else{
- uni.navigateTo({ url }) // 跳转
- }
- }, 100);
- },
- $toBack(){
- let pages = getCurrentPages(); // 当前页
- let beforePage = pages[pages.length - 2]; // 上个页面
- if(beforePage && beforePage.route){
- uni.navigateBack();
- }else{
- uni.switchTab({url:'/pages/index/index'});
- }
}
}
}
\ No newline at end of file
diff --git a/common/request.js b/common/request.js
new file mode 100644
index 0000000..f2cb5a0
--- /dev/null
+++ b/common/request.js
@@ -0,0 +1,105 @@
+let sha1 = require("./sha1.min.js");
+let SparkMD5 = require("./SparkMD5.js"); // 签名加密js文件
+
+function getsign(params) {
+ let s_data = "";
+ let keys = [];
+ for (const key in params) {
+ if (params.hasOwnProperty(key)) {
+ const value = params[key];
+ keys.push(key);
+ }
+ }
+ let arr = [];
+ keys.sort();
+ for (let i = 0; i < keys.length; i++) {
+ let k = keys[i];
+ let v = params[k];
+ arr.push(k + '=' + v);
+ }
+ s_data = arr.join('&');
+
+ let sign = sha1(SparkMD5.hash(s_data) + 'Leadfyy@123');
+ params.sign = sign;
+ return params;
+}
+
+export const request = options => {
+ let { url, data, method, showLoading } = options;
+ if(typeof data === 'undefined'){
+ data = {};
+ }
+
+ return new Promise((resolve, reject) => {
+ // 绑定this
+ let that = this;
+ // 获取当前请求来自哪个页面
+ let pages = getCurrentPages();
+ data.create_page = pages[pages.length - 1].route;
+ // 当前请求时间戳
+ if (!data.timestamp) {
+ data.timestamp = Math.round(new Date().getTime() / 1000);
+ }
+ // 当前请求随机数
+ if(!data.rand){
+ data.rand = Math.round(Math.random() * 1000000);
+ }
+ // 当前请求来自的平台
+ data.platform = 'wxmini';
+ // #ifdef APP-PLUS
+ data.platform = 'app'; // 来自app平台,其他平台写法类似
+ // #endif
+ // 当前小程序版本号
+ // data.version = that.API.VERSION;
+ // 获取设备唯一deviceId,如果没有,自动生成一个
+ let sysInfo = uni.getSystemInfoSync();
+ if(typeof sysInfo.deviceId == 'undefined'){
+ let deviceId = uni.getStorageSync('deviceId');
+ if(deviceId){
+ sysInfo.deviceId = deviceId;
+ }else{
+ let date_time = String(new Date().getTime());
+ let md5_deviceId = SparkMD5.hash(date_time);
+ uni.setStorageSync('deviceId', md5_deviceId);
+ sysInfo.deviceId = md5_deviceId;
+ }
+ }
+ if (sysInfo) {
+ data.device_info = JSON.stringify(sysInfo);
+ }
+ // 判断传入用户token和id
+ let userinfo = uni.getStorageSync('userinfo') || {};
+ if(userinfo && userinfo.token && !data.token){
+ data.token = userinfo.token;
+ }
+ if(userinfo && userinfo.id && !data.user_id){
+ data.user_id = userinfo.id;
+ }
+
+ // 获取页面options参数
+ let _mergeParam = that._mergeParam;
+ for (let _keyVar in _mergeParam) {
+ let _k = _keyVar
+ if (data[_k]) {
+ _k = '_' + _k;
+ }
+ data[_k] = _mergeParam[_keyVar];
+ }
+ // 生成sign
+ getsign(data);
+ console.log(url, data);
+
+ // 动态赋值是否显示loading加载框 TODO验证一下是否有问题
+ if(that.$shared.isValueType(showLoading) != 'undefined'){
+ that.$u.http.setConfig({showLoading});
+ }
+
+ let httpData = method == 'get' ? {params: data} : data;
+ // 发起请求
+ that.$u[method](url, httpData).then(res => {
+ resolve(res);
+ }).catch(err => {
+ reject(err);
+ })
+ });
+}
\ No newline at end of file
diff --git a/common/requestMessage.js b/common/requestMessage.js
new file mode 100644
index 0000000..0b97811
--- /dev/null
+++ b/common/requestMessage.js
@@ -0,0 +1,27 @@
+/**
+ * @description token失效时跳转登录页方法
+ * @return { Function }
+ */
+export const httpMessage = (function () {
+ let isTp = true
+ // 返回一个闭包来保证同时间段的多次请求错误都只弹出一个窗口
+ return function (msg) {
+ if (isTp) {
+ isTp = false
+ uni.showModal({
+ title: '提示',
+ content: msg,
+ showCancel: false,
+ confirmText: '确定',
+ success: (res) =>{
+ if (res.confirm) {
+ isTp = true
+ uni.reLaunch({
+ url: '/pages/login/login',
+ })
+ }
+ }
+ })
+ }
+ }
+})()
\ No newline at end of file
diff --git a/common/sha1.min.js b/common/sha1.min.js
new file mode 100644
index 0000000..851855d
--- /dev/null
+++ b/common/sha1.min.js
@@ -0,0 +1,9 @@
+/*
+ * [js-sha1]{@link https://github.com/emn178/js-sha1}
+ *
+ * @version 0.6.0
+ * @author Chen, Yi-Cyuan [emn178@gmail.com]
+ * @copyright Chen, Yi-Cyuan 2014-2017
+ * @license MIT
+ */
+!function(){"use strict";function t(t){t?(f[0]=f[16]=f[1]=f[2]=f[3]=f[4]=f[5]=f[6]=f[7]=f[8]=f[9]=f[10]=f[11]=f[12]=f[13]=f[14]=f[15]=0,this.blocks=f):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}var h="object"==typeof window?window:{},s=!h.JS_SHA1_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;s&&(h=global);var i=!h.JS_SHA1_NO_COMMON_JS&&"object"==typeof module&&module.exports,e="function"==typeof define&&define.amd,r="0123456789abcdef".split(""),o=[-2147483648,8388608,32768,128],n=[24,16,8,0],a=["hex","array","digest","arrayBuffer"],f=[],u=function(h){return function(s){return new t(!0).update(s)[h]()}},c=function(){var h=u("hex");s&&(h=p(h)),h.create=function(){return new t},h.update=function(t){return h.create().update(t)};for(var i=0;i>2]|=t[r]<>2]|=i<>2]|=(192|i>>6)<>2]|=(128|63&i)<=57344?(a[e>>2]|=(224|i>>12)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<=64?(this.block=a[16],this.start=e-64,this.hash(),this.hashed=!0):this.start=e}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},t.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,h=this.lastByteIndex;t[16]=this.block,t[h>>2]|=o[3&h],this.block=t[16],h>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},t.prototype.hash=function(){var t,h,s=this.h0,i=this.h1,e=this.h2,r=this.h3,o=this.h4,n=this.blocks;for(t=16;t<80;++t)h=n[t-3]^n[t-8]^n[t-14]^n[t-16],n[t]=h<<1|h>>>31;for(t=0;t<20;t+=5)s=(h=(i=(h=(e=(h=(r=(h=(o=(h=s<<5|s>>>27)+(i&e|~i&r)+o+1518500249+n[t]<<0)<<5|o>>>27)+(s&(i=i<<30|i>>>2)|~s&e)+r+1518500249+n[t+1]<<0)<<5|r>>>27)+(o&(s=s<<30|s>>>2)|~o&i)+e+1518500249+n[t+2]<<0)<<5|e>>>27)+(r&(o=o<<30|o>>>2)|~r&s)+i+1518500249+n[t+3]<<0)<<5|i>>>27)+(e&(r=r<<30|r>>>2)|~e&o)+s+1518500249+n[t+4]<<0,e=e<<30|e>>>2;for(;t<40;t+=5)s=(h=(i=(h=(e=(h=(r=(h=(o=(h=s<<5|s>>>27)+(i^e^r)+o+1859775393+n[t]<<0)<<5|o>>>27)+(s^(i=i<<30|i>>>2)^e)+r+1859775393+n[t+1]<<0)<<5|r>>>27)+(o^(s=s<<30|s>>>2)^i)+e+1859775393+n[t+2]<<0)<<5|e>>>27)+(r^(o=o<<30|o>>>2)^s)+i+1859775393+n[t+3]<<0)<<5|i>>>27)+(e^(r=r<<30|r>>>2)^o)+s+1859775393+n[t+4]<<0,e=e<<30|e>>>2;for(;t<60;t+=5)s=(h=(i=(h=(e=(h=(r=(h=(o=(h=s<<5|s>>>27)+(i&e|i&r|e&r)+o-1894007588+n[t]<<0)<<5|o>>>27)+(s&(i=i<<30|i>>>2)|s&e|i&e)+r-1894007588+n[t+1]<<0)<<5|r>>>27)+(o&(s=s<<30|s>>>2)|o&i|s&i)+e-1894007588+n[t+2]<<0)<<5|e>>>27)+(r&(o=o<<30|o>>>2)|r&s|o&s)+i-1894007588+n[t+3]<<0)<<5|i>>>27)+(e&(r=r<<30|r>>>2)|e&o|r&o)+s-1894007588+n[t+4]<<0,e=e<<30|e>>>2;for(;t<80;t+=5)s=(h=(i=(h=(e=(h=(r=(h=(o=(h=s<<5|s>>>27)+(i^e^r)+o-899497514+n[t]<<0)<<5|o>>>27)+(s^(i=i<<30|i>>>2)^e)+r-899497514+n[t+1]<<0)<<5|r>>>27)+(o^(s=s<<30|s>>>2)^i)+e-899497514+n[t+2]<<0)<<5|e>>>27)+(r^(o=o<<30|o>>>2)^s)+i-899497514+n[t+3]<<0)<<5|i>>>27)+(e^(r=r<<30|r>>>2)^o)+s-899497514+n[t+4]<<0,e=e<<30|e>>>2;this.h0=this.h0+s<<0,this.h1=this.h1+i<<0,this.h2=this.h2+e<<0,this.h3=this.h3+r<<0,this.h4=this.h4+o<<0},t.prototype.hex=function(){this.finalize();var t=this.h0,h=this.h1,s=this.h2,i=this.h3,e=this.h4;return r[t>>28&15]+r[t>>24&15]+r[t>>20&15]+r[t>>16&15]+r[t>>12&15]+r[t>>8&15]+r[t>>4&15]+r[15&t]+r[h>>28&15]+r[h>>24&15]+r[h>>20&15]+r[h>>16&15]+r[h>>12&15]+r[h>>8&15]+r[h>>4&15]+r[15&h]+r[s>>28&15]+r[s>>24&15]+r[s>>20&15]+r[s>>16&15]+r[s>>12&15]+r[s>>8&15]+r[s>>4&15]+r[15&s]+r[i>>28&15]+r[i>>24&15]+r[i>>20&15]+r[i>>16&15]+r[i>>12&15]+r[i>>8&15]+r[i>>4&15]+r[15&i]+r[e>>28&15]+r[e>>24&15]+r[e>>20&15]+r[e>>16&15]+r[e>>12&15]+r[e>>8&15]+r[e>>4&15]+r[15&e]},t.prototype.toString=t.prototype.hex,t.prototype.digest=function(){this.finalize();var t=this.h0,h=this.h1,s=this.h2,i=this.h3,e=this.h4;return[t>>24&255,t>>16&255,t>>8&255,255&t,h>>24&255,h>>16&255,h>>8&255,255&h,s>>24&255,s>>16&255,s>>8&255,255&s,i>>24&255,i>>16&255,i>>8&255,255&i,e>>24&255,e>>16&255,e>>8&255,255&e]},t.prototype.array=t.prototype.digest,t.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(20),h=new DataView(t);return h.setUint32(0,this.h0),h.setUint32(4,this.h1),h.setUint32(8,this.h2),h.setUint32(12,this.h3),h.setUint32(16,this.h4),t};var y=c();i?module.exports=y:(h.sha1=y,e&&define(function(){return y}))}();
\ No newline at end of file
diff --git a/config/index.js b/config/index.js
new file mode 100644
index 0000000..d978039
--- /dev/null
+++ b/config/index.js
@@ -0,0 +1,25 @@
+module.exports = (() => {
+ const config = exports = {}
+ config.mode = {
+ app: '/app', //APP功能模块
+ }
+ config.tenantId = "000000" // 管理组租户编号
+ config.tokenHeader = 'Blade-Auth'
+ config.clientId = 'weixin' // 客户端id
+ config.clientSecret = 'weixin_secret' // 客户端密钥
+ config.Authorization = 'c2FiZXI6c2FiZXJfc2VjcmV0' // 客户端id和客户端密钥联合进行base64转码生成的加密字符串
+ config.Timeout = 10000 // 请求超时时间,单位 ms
+ // 基础服务器地址
+
+ // config.BASE_URL = '' // 开发环境
+ // config.BASE_URL = '' // 生产环境
+
+
+ if(process.env.NODE_ENV === 'production'){
+ config.BASE_URL = ''; // 发行时固定生产环境
+ }
+
+ return {
+ ...config
+ }
+})()
\ No newline at end of file
diff --git a/main.js b/main.js
index faf978f..090681d 100644
--- a/main.js
+++ b/main.js
@@ -1,26 +1,23 @@
+import Vue from 'vue'
import App from './App'
import uView from '@/uni_modules/uview-ui'
import mixin from '@/common/mixin.js';
+import httpInterceptor from '@/common/http.interceptor.js';
+
+Vue.config.productionTip = false;
+App.mpType = 'app'
Vue.mixin(mixin);
+Vue.use(uView);
+
+// 线上模式禁用 console.log
+if(process.env.NODE_ENV === 'production') console.log = () => {};
-// #ifndef VUE3
-import Vue from 'vue'
-Vue.config.productionTip = false
-Vue.use(uView)
-App.mpType = 'app'
const app = new Vue({
...App
-})
-app.$mount()
-// #endif
+});
+
+// 引入http拦截器 TODO 待请求测试
+// Vue.use(httpInterceptor, app);
-// #ifdef VUE3
-import { createSSRApp } from 'vue'
-export function createApp() {
- const app = createSSRApp(App)
- return {
- app
- }
-}
-// #endif
\ No newline at end of file
+app.$mount();
\ No newline at end of file
diff --git a/pages.json b/pages.json
index b47df91..50deeae 100644
--- a/pages.json
+++ b/pages.json
@@ -58,6 +58,13 @@
"navigationBarTitleText": "评卡查询",
"enablePullDownRefresh": false
}
+ },
+ {
+ "path": "pages/login/login",
+ "style": {
+ "navigationBarTitleText": "用户登录",
+ "enablePullDownRefresh": false
+ }
}
],
"subPackages": [{
diff --git a/pages/login/login.vue b/pages/login/login.vue
new file mode 100644
index 0000000..ec8f27d
--- /dev/null
+++ b/pages/login/login.vue
@@ -0,0 +1,176 @@
+
+
+
+
+
+
+ {{ userInfo.nickname || '游客用户' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 请认真阅读并同意
+ 《{{ agreement.title }}》
+ ,在小程序下单购买即表示您已默认同意
+ 《{{ agreement.title }}》
+ 的所有条款。
+
+
+
+
+
+
+
+
+
diff --git a/service/oss.js b/service/oss.js
new file mode 100644
index 0000000..1903766
--- /dev/null
+++ b/service/oss.js
@@ -0,0 +1,13 @@
+import request from '@/common/request.js'
+
+/**
+ * @description 获取oss权限
+ * @param { Object } params API参数
+ * @return { Promise }
+ */
+export async function getOssToken() {
+ return await request({
+ url: '/blade-resource/oss/endpoint/getUploadId',
+ method: 'get',
+ })
+}
\ No newline at end of file