feat:v1.4前端更新
This commit is contained in:
@@ -1,4 +1,14 @@
|
||||
const arrTemp = ["beforePay","afterPay","refundApply", "beforeRecharge", "createBargain","pink"];
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
const arrTemp = ["beforePay","afterPay", "createBargain","pink"];
|
||||
|
||||
// export function auth() {
|
||||
// let tmplIds = {};
|
||||
@@ -34,27 +44,12 @@ export function openOrderSubscribe() {
|
||||
// return subscribe(tmplIds);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 订单退款
|
||||
*/
|
||||
export function openOrderRefundSubscribe() {
|
||||
let tmplIds = uni.getStorageSync('tempID' + arrTemp[2]);
|
||||
return subscribe(tmplIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值成功
|
||||
*/
|
||||
export function openRechargeSubscribe() {
|
||||
let tmplIds = uni.getStorageSync('tempID' + arrTemp[3]);
|
||||
return subscribe(tmplIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价成功
|
||||
*/
|
||||
export function openBargainSubscribe() {
|
||||
let tmplIds = uni.getStorageSync('tempID' + arrTemp[4]);
|
||||
let tmplIds = uni.getStorageSync('tempID' + arrTemp[2]);
|
||||
return subscribe(tmplIds);
|
||||
}
|
||||
|
||||
@@ -63,7 +58,7 @@ export function openBargainSubscribe() {
|
||||
* 拼团成功
|
||||
*/
|
||||
export function openPinkSubscribe() {
|
||||
let tmplIds = uni.getStorageSync('tempID' + arrTemp[5]);
|
||||
let tmplIds = uni.getStorageSync('tempID' + arrTemp[3]);
|
||||
return subscribe(tmplIds);
|
||||
}
|
||||
// /**
|
||||
|
||||
26
app/utils/animationType.js
Normal file
26
app/utils/animationType.js
Normal file
@@ -0,0 +1,26 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
module.exports = {
|
||||
/*
|
||||
-----仅在APP生效-----
|
||||
slide-in-right 新窗体从右侧进入
|
||||
slide-in-left 新窗体从左侧进入
|
||||
slide-in-top 新窗体从顶部进入
|
||||
slide-in-bottom 新窗体从底部进入
|
||||
pop-in 新窗体从左侧进入,且老窗体被挤压而出
|
||||
fade-in 新窗体从透明到不透明逐渐显示
|
||||
zoom-out 新窗体从小到大缩放显示
|
||||
zoom-fade-out 新窗体从小到大逐渐放大并且从透明到不透明逐渐显示
|
||||
none 无动画
|
||||
*/
|
||||
type:'zoom-fade-out',
|
||||
duration:200
|
||||
}
|
||||
23
app/utils/ase.js
Normal file
23
app/utils/ase.js
Normal file
@@ -0,0 +1,23 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
import CryptoJS from './crypto-js.js'
|
||||
/**
|
||||
* @word 要加密的内容
|
||||
* @keyWord String 服务器随机返回的关键字
|
||||
* */
|
||||
export function aesEncrypt(word, keyWord = "XwKsGlMcdPMEhR1B") {
|
||||
var key = CryptoJS.enc.Utf8.parse(keyWord);
|
||||
var srcs = CryptoJS.enc.Utf8.parse(word);
|
||||
var encrypted = CryptoJS.AES.encrypt(srcs, key, {
|
||||
mode: CryptoJS.mode.ECB,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
});
|
||||
return encrypted.toString();
|
||||
}
|
||||
@@ -1,23 +1,33 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
const fsm = wx.getFileSystemManager ? wx.getFileSystemManager() : null;
|
||||
const FILE_BASE_NAME = 'tmp_base64src'; //自定义文件名
|
||||
|
||||
export function base64src(base64data, cb) {
|
||||
const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64data) || [];
|
||||
if (!format) {
|
||||
return (new Error('ERROR_BASE64SRC_PARSE'));
|
||||
}
|
||||
const filePath = `${wx.env.USER_DATA_PATH}/${FILE_BASE_NAME}.${format}`;
|
||||
const buffer = wx.base64ToArrayBuffer(bodyData);
|
||||
fsm.writeFile({
|
||||
filePath,
|
||||
data: buffer,
|
||||
encoding: 'binary',
|
||||
success() {
|
||||
cb(filePath);
|
||||
},
|
||||
fail() {
|
||||
return (new Error('ERROR_BASE64SRC_WRITE'));
|
||||
},
|
||||
});
|
||||
export function base64src(base64data, dateminutes, cb) {
|
||||
const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64data) || [];
|
||||
if (!format) {
|
||||
return (new Error('ERROR_BASE64SRC_PARSE'));
|
||||
}
|
||||
const filePath = `${wx.env.USER_DATA_PATH}/${dateminutes+FILE_BASE_NAME}.${format}`;
|
||||
const buffer = wx.base64ToArrayBuffer(bodyData);
|
||||
fsm.writeFile({
|
||||
filePath,
|
||||
data: buffer,
|
||||
encoding: 'binary',
|
||||
success() {
|
||||
cb(filePath);
|
||||
},
|
||||
fail() {
|
||||
return (new Error('ERROR_BASE64SRC_WRITE'));
|
||||
},
|
||||
});
|
||||
};
|
||||
//module.exports = base64src;
|
||||
//module.exports = base64src;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
15
app/utils/checkOverdue.js
Normal file
15
app/utils/checkOverdue.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import {HTTP_REQUEST_URL,HEADER,TOKENNAME,HEADERPARAMS} from '@/config/app';
|
||||
import store from "../store";
|
||||
export function checkOverdue(data) {
|
||||
let Url = HTTP_REQUEST_URL,header = HEADER;
|
||||
uni.request({
|
||||
url: Url + '/api/front/user',
|
||||
method: 'GET',
|
||||
header: header,
|
||||
success:(res) =>{
|
||||
if([410000, 410001, 410002, 401].indexOf(res.data.code) !== -1){
|
||||
store.commit("LOGOUT");
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
6191
app/utils/crypto-js.js
Normal file
6191
app/utils/crypto-js.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1 +1,11 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
let app = getApp();
|
||||
@@ -1,3 +1,13 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
export default [
|
||||
"em-smile",
|
||||
"em-laughing",
|
||||
|
||||
@@ -1,19 +1,27 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
import { spread } from "@/api/user";
|
||||
import Cache from "@/utils/cache";
|
||||
import { getCity } from '@/api/api.js';
|
||||
|
||||
/**
|
||||
* 静默授权绑定上下级,使用在已经登录后扫描了别人的推广二维码
|
||||
* @param {Object} puid
|
||||
*/
|
||||
export function silenceBindingSpread() {
|
||||
|
||||
|
||||
//#ifdef H5 || APP
|
||||
//#ifdef H5
|
||||
let puid = Cache.get('spread');
|
||||
//#endif
|
||||
|
||||
//#ifdef MP
|
||||
let puid = getApp().globalData.spid;
|
||||
//#endif
|
||||
//#ifdef MP || APP-PLUS
|
||||
let puid = getApp().globalData.spread;
|
||||
//#endif
|
||||
|
||||
puid = parseInt(puid);
|
||||
@@ -21,15 +29,15 @@ export function silenceBindingSpread() {
|
||||
puid = 0;
|
||||
}
|
||||
if (puid) {
|
||||
spread(puid).then(res => {}).catch(res => {});
|
||||
//#ifdef H5
|
||||
Cache.clear('spread');
|
||||
//#endif
|
||||
|
||||
//#ifdef MP
|
||||
getApp().globalData.spid = 0;
|
||||
getApp().globalData.code = 0;
|
||||
//#endif
|
||||
spread(puid).then(res => {}).catch(res => {
|
||||
//#ifdef H5
|
||||
Cache.clear("spread");
|
||||
//#endif
|
||||
|
||||
//#ifdef MP || APP-PLUS
|
||||
getApp().globalData.spread = 0;
|
||||
//#endif
|
||||
});
|
||||
} else {
|
||||
Cache.set('spread', 0);
|
||||
}
|
||||
@@ -74,6 +82,19 @@ export {
|
||||
}
|
||||
// #endif
|
||||
|
||||
|
||||
// 获取地址数据
|
||||
export function getCityList() {
|
||||
return new Promise((resolve, reject) => {
|
||||
getCity().then(res => {
|
||||
resolve(res.data);
|
||||
let oneDay = 24 * 3600 * 1000;
|
||||
Cache.setItem({
|
||||
name: 'cityList',
|
||||
value: res.data,
|
||||
expires: oneDay * 7
|
||||
}); //设置七天过期时间
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
export default parseQuery;
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
/// null = 未请求,1 = 已允许,0 = 拒绝|受限, 2 = 系统未开启
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
/// null = 未请求,1 = 已允许,0 = 拒绝|受限, 2 = 系统未开启
|
||||
var isIOS
|
||||
|
||||
function album() {
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
import {
|
||||
HTTP_REQUEST_URL,
|
||||
HEADER,
|
||||
@@ -17,7 +27,7 @@ import store from '../store';
|
||||
function baseRequest(url, method, data, {
|
||||
noAuth = false,
|
||||
noVerify = false
|
||||
}, params) {
|
||||
}, params,prefix) {
|
||||
let Url = HTTP_REQUEST_URL,header = HEADER
|
||||
if (params != undefined) {
|
||||
header = HEADERPARAMS;
|
||||
@@ -33,9 +43,8 @@ function baseRequest(url, method, data, {
|
||||
}
|
||||
if (store.state.app.token) header[TOKENNAME] = store.state.app.token;
|
||||
return new Promise((reslove, reject) => {
|
||||
Url=HTTP_REQUEST_URL||'http://api.front.hdq.xbdzz.cn'
|
||||
uni.request({
|
||||
url: Url + '/api/front/' + url,
|
||||
url: Url + `${prefix?'/api/public/':'/api/front/'}` + url,
|
||||
method: method || 'GET',
|
||||
header: header,
|
||||
data: data || {},
|
||||
@@ -44,9 +53,17 @@ function baseRequest(url, method, data, {
|
||||
reslove(res.data, res);
|
||||
else if (res.data.code == 200)
|
||||
reslove(res.data, res);
|
||||
else if ([410000, 410001, 410002, 401].indexOf(res.data.code) !== -1) {
|
||||
else if ([410000, 410001, 410002, 401,402].indexOf(res.data.code) !== -1) {
|
||||
toLogin();
|
||||
reject(res.data);
|
||||
}else if (res.data.code == 500){
|
||||
reject(res.data.message || '系统异常');
|
||||
}else if (res.data.code == 400){
|
||||
reject(res.data.message || '参数校验失败');
|
||||
}else if (res.data.code == 404){
|
||||
reject(res.data.message || '没有找到相关数据');
|
||||
}else if (res.data.code == 403){
|
||||
reject(res.data.message || '没有相关权限');
|
||||
} else
|
||||
reject(res.data.message || '系统错误');
|
||||
},
|
||||
@@ -60,7 +77,7 @@ function baseRequest(url, method, data, {
|
||||
const request = {};
|
||||
|
||||
['options', 'get', 'post', 'put', 'head', 'delete', 'trace', 'connect'].forEach((method) => {
|
||||
request[method] = (api, data, opt, params) => baseRequest(api, method, data, opt || {}, params)
|
||||
request[method] = (api, data, opt, params,prefix) => baseRequest(api, method, data, opt || {}, params,prefix)
|
||||
});
|
||||
|
||||
|
||||
|
||||
30
app/utils/setTheme.js
Normal file
30
app/utils/setTheme.js
Normal file
@@ -0,0 +1,30 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
let app = getApp();
|
||||
export function setThemeColor(){
|
||||
switch (app.globalData.theme) {
|
||||
case 'theme1':
|
||||
return '#e93323';
|
||||
break;
|
||||
case 'theme2':
|
||||
return '#FE5C2D';
|
||||
break;
|
||||
case 'theme3':
|
||||
return '#42CA4D';
|
||||
break;
|
||||
case 'theme4':
|
||||
return '#1DB0FC';
|
||||
break;
|
||||
case 'theme5':
|
||||
return '#FF448F';
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,69 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
import animationType from '@/utils/animationType.js'
|
||||
import {
|
||||
TOKENNAME,
|
||||
HTTP_REQUEST_URL
|
||||
} from '../config/app.js';
|
||||
import {HTTP_ADMIN_URL} from '@/config/app.js';
|
||||
import store from '../store';
|
||||
import {
|
||||
pathToBase64
|
||||
} from '@/plugin/image-tools/index.js';
|
||||
import util from 'utils/util'
|
||||
// #ifdef APP-PLUS
|
||||
import permision from "./permission.js"
|
||||
// #endif
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 链接地址跳转
|
||||
* @param {Object} url 链接地址
|
||||
*/
|
||||
navigateTo(url) {
|
||||
if (url.indexOf("http") !== -1) {
|
||||
// #ifdef H5
|
||||
location.href = url
|
||||
// #endif
|
||||
// #ifdef APP-PLUS || MP
|
||||
uni.navigateTo({
|
||||
url: '/pages/users/web_page/index?webUel=' + encodeURIComponent(url)
|
||||
})
|
||||
// #endif
|
||||
} else {
|
||||
if (['/pages/goods_cate/goods_cate', '/pages/order_addcart/order_addcart', '/pages/user/index',
|
||||
'/pages/discover_index/index', '/pages/index/index'
|
||||
].indexOf(url) == -1) {
|
||||
uni.navigateTo({
|
||||
animationType: animationType.type,
|
||||
animationDuration: animationType.duration,
|
||||
url: url
|
||||
})
|
||||
} else {
|
||||
uni.switchTab({
|
||||
animationType: animationType.type,
|
||||
animationDuration: animationType.duration,
|
||||
url: url
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 对象转数组
|
||||
* @param data 对象
|
||||
* @returns {*[]}
|
||||
*/
|
||||
objToArr(data) {
|
||||
let obj = Object.keys(data).sort();
|
||||
let m = obj.map(key => data[key]);
|
||||
return m;
|
||||
},
|
||||
/**
|
||||
* opt object | string
|
||||
* to_url object | string
|
||||
@@ -324,7 +380,7 @@ export default {
|
||||
* @param string count 剩余人数
|
||||
* @param function successFn 回调函数
|
||||
*/
|
||||
activityCanvas: function(arrImages, storeName, price, people, count,num,successFn) {
|
||||
activityCanvas: function(arrImages, storeName, price, people, count, num, successFn) {
|
||||
let that = this;
|
||||
let rain = 2;
|
||||
const context = uni.createCanvasContext('activityCanvas');
|
||||
@@ -339,33 +395,34 @@ export default {
|
||||
src: arrImages[0],
|
||||
success: function(res) {
|
||||
context.drawImage(arrImages[0], 0, 0, 594, 850);
|
||||
context.setFontSize(14*rain);
|
||||
context.setFontSize(14 * rain);
|
||||
context.setFillStyle('#333333');
|
||||
that.canvasWraptitleText(context, storeName, 110*rain, 110*rain, 230*rain, 30*rain, 1)
|
||||
context.drawImage(arrImages[2], 68*rain, 194*rain, 160*rain, 160*rain);
|
||||
that.canvasWraptitleText(context, storeName, 110 * rain, 110 * rain, 230 * rain, 30 *
|
||||
rain, 1)
|
||||
context.drawImage(arrImages[2], 68 * rain, 194 * rain, 160 * rain, 160 * rain);
|
||||
context.save();
|
||||
|
||||
context.setFontSize(14*rain);
|
||||
context.setFontSize(14 * rain);
|
||||
context.setFillStyle('#fc4141');
|
||||
context.fillText('¥', 157*rain, 145*rain);
|
||||
context.fillText('¥', 157 * rain, 145 * rain);
|
||||
|
||||
context.setFontSize(24*rain);
|
||||
context.setFontSize(24 * rain);
|
||||
context.setFillStyle('#fc4141');
|
||||
context.fillText(price, 170*rain, 145*rain);
|
||||
context.fillText(price, 170 * rain, 145 * rain);
|
||||
|
||||
context.setFontSize(10*rain);
|
||||
context.setFontSize(10 * rain);
|
||||
context.setFillStyle('#fff');
|
||||
context.fillText(people, 118*rain, 143*rain);
|
||||
context.fillText(people, 118 * rain, 143 * rain);
|
||||
|
||||
|
||||
context.setFontSize(12*rain);
|
||||
context.setFontSize(12 * rain);
|
||||
context.setFillStyle('#666666');
|
||||
context.setTextAlign('center');
|
||||
context.fillText( count , (167-num)*rain, 166*rain);
|
||||
context.fillText(count, (167 - num) * rain, 166 * rain);
|
||||
|
||||
that.handleBorderRect(context, 27*rain, 94*rain, 75*rain, 75*rain, 6*rain);
|
||||
that.handleBorderRect(context, 27 * rain, 94 * rain, 75 * rain, 75 * rain, 6 * rain);
|
||||
context.clip();
|
||||
context.drawImage(arrImages[1], 27*rain, 94*rain, 75*rain, 75*rain);
|
||||
context.drawImage(arrImages[1], 27 * rain, 94 * rain, 75 * rain, 75 * rain);
|
||||
context.draw(true, function() {
|
||||
uni.canvasToTempFilePath({
|
||||
canvasId: 'activityCanvas',
|
||||
@@ -422,6 +479,71 @@ export default {
|
||||
ctx.closePath();
|
||||
},
|
||||
|
||||
/**
|
||||
* 小程序头像获取上传
|
||||
* @param uploadUrl 上传接口地址
|
||||
* @param filePath 上传文件路径
|
||||
* @param successCallback success回调
|
||||
* @param errorCallback err回调
|
||||
*/
|
||||
uploadImgs(filePath, opt, successCallback, errorCallback) {
|
||||
let that = this;
|
||||
if (typeof opt === 'string') {
|
||||
let url = opt;
|
||||
opt = {};
|
||||
opt.url = url;
|
||||
}
|
||||
let count = opt.count || 1,
|
||||
sizeType = opt.sizeType || ['compressed'],
|
||||
sourceType = opt.sourceType || ['album', 'camera'],
|
||||
is_load = opt.is_load || true,
|
||||
uploadUrl = opt.url || '',
|
||||
inputName = opt.name || 'pics',
|
||||
pid = opt.pid,
|
||||
model = opt.model;
|
||||
let urlPath = HTTP_REQUEST_URL + '/api/front/upload/image' + "?model=" + model +
|
||||
"&pid=" + pid
|
||||
uni.uploadFile({
|
||||
url: urlPath,
|
||||
filePath: filePath,
|
||||
name: inputName,
|
||||
formData: {
|
||||
'filename': inputName
|
||||
},
|
||||
header: {
|
||||
// #ifdef MP
|
||||
"Content-Type": "multipart/form-data",
|
||||
// #endif
|
||||
[TOKENNAME]: store.state.app.token
|
||||
},
|
||||
success: function(res) {
|
||||
uni.hideLoading();
|
||||
if (res.statusCode == 403) {
|
||||
that.Tips({
|
||||
title: res.data
|
||||
});
|
||||
} else {
|
||||
let data = res.data ? JSON.parse(res.data) : {};
|
||||
if (data.code == 200) {
|
||||
successCallback && successCallback(data)
|
||||
} else {
|
||||
errorCallback && errorCallback(data);
|
||||
that.Tips({
|
||||
title: data.message
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: function(res) {
|
||||
console.log('res', res)
|
||||
uni.hideLoading();
|
||||
that.Tips({
|
||||
title: '上传图片失败'
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/*
|
||||
* 单图上传
|
||||
* @param object opt
|
||||
@@ -453,7 +575,8 @@ export default {
|
||||
uni.showLoading({
|
||||
title: '图片上传中',
|
||||
});
|
||||
let urlPath = HTTP_ADMIN_URL + '/api/admin/upload/image' + "?model=" + model + "&pid=" + pid
|
||||
let urlPath = HTTP_REQUEST_URL + '/api/front/upload/image' + "?model=" + model +
|
||||
"&pid=" + pid
|
||||
let localPath = res.tempFilePaths[0];
|
||||
uni.uploadFile({
|
||||
url: urlPath,
|
||||
@@ -492,14 +615,12 @@ export default {
|
||||
});
|
||||
}
|
||||
})
|
||||
// pathToBase64(res.tempFilePaths[0])
|
||||
// .then(imgBase64 => {
|
||||
// console.log(imgBase64);
|
||||
|
||||
// })
|
||||
// .catch(error => {
|
||||
// console.error(error)
|
||||
// })
|
||||
},
|
||||
fail: function(err) {
|
||||
that.Tips({
|
||||
title: err.errMsg
|
||||
});
|
||||
console.log('选择图片失败:', err);
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -536,24 +657,24 @@ export default {
|
||||
/**根据格式组装公共参数
|
||||
* @param {Object} value
|
||||
*/
|
||||
formatMpQrCodeData(value){
|
||||
formatMpQrCodeData(value) {
|
||||
let values = value.split(',');
|
||||
let result = {};
|
||||
if(values.length === 2){
|
||||
if (values.length === 2) {
|
||||
let v1 = values[0].split(":");
|
||||
if (v1[0] === 'pid') {
|
||||
result.spread = v1[1];
|
||||
} else{
|
||||
} else {
|
||||
result.id = v1[1];
|
||||
}
|
||||
let v2 = values[1].split(":");
|
||||
if (v2[0] === 'pid') {
|
||||
result.spread = v2[1];
|
||||
}else{
|
||||
} else {
|
||||
result.id = v2[1];
|
||||
}
|
||||
}else{
|
||||
result = values[0].split(":")[1];
|
||||
} else {
|
||||
result.spread = values[0].split(":")[1];
|
||||
}
|
||||
return result;
|
||||
},
|
||||
@@ -657,44 +778,80 @@ export default {
|
||||
},
|
||||
// 获取地理位置;
|
||||
$L: {
|
||||
async getLocation() {
|
||||
// #ifdef MP-WEIXIN || MP-TOUTIAO || MP-QQ
|
||||
let status = await this.getSetting();
|
||||
if (status === 2) {
|
||||
this.openSetting();
|
||||
return;
|
||||
}
|
||||
// #endif
|
||||
getLocation() {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
// #ifdef APP-PLUS
|
||||
let status = await this.checkPermission();
|
||||
if (status !== 1) {
|
||||
uni.removeStorageSync('user_latitude');
|
||||
uni.removeStorageSync('user_longitude');
|
||||
resolve(status);
|
||||
return;
|
||||
}
|
||||
// #endif
|
||||
|
||||
this.doGetLocation();
|
||||
// #ifdef MP
|
||||
let status = await this.getSetting();
|
||||
if (status === 2) {
|
||||
uni.removeStorageSync('user_latitude');
|
||||
uni.removeStorageSync('user_longitude');
|
||||
this.Tips({
|
||||
title: '获取当前定位遇到困难,如需定位请开启权限'
|
||||
});
|
||||
//this.openSetting();
|
||||
resolve(status);
|
||||
return;
|
||||
}
|
||||
// #endif
|
||||
|
||||
let Location = await this.doGetLocation();
|
||||
resolve(Location);
|
||||
});
|
||||
},
|
||||
doGetLocation() {
|
||||
uni.getLocation({
|
||||
success: (res) => {
|
||||
uni.removeStorageSync('CACHE_LONGITUDE');
|
||||
uni.removeStorageSync('CACHE_LATITUDE');
|
||||
uni.setStorageSync('CACHE_LONGITUDE', res.longitude);
|
||||
uni.setStorageSync('CACHE_LATITUDE', res.latitude);
|
||||
},
|
||||
fail: (err) => {
|
||||
// #ifdef MP-BAIDU
|
||||
if (err.errCode === 202 || err.errCode === 10003) { // 202模拟器 10003真机 user deny
|
||||
this.openSetting();
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
// altitude: true,
|
||||
// geocode: true,
|
||||
success: (res) => {
|
||||
uni.setStorageSync('user_latitude', res.latitude);
|
||||
uni.setStorageSync('user_longitude', res.longitude);
|
||||
resolve(res);
|
||||
},
|
||||
complete: (res) => {
|
||||
uni.setStorageSync('user_latitude', res.latitude);
|
||||
uni.setStorageSync('user_longitude', res.longitude);
|
||||
resolve(res);
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.removeStorageSync('user_latitude');
|
||||
uni.removeStorageSync('user_longitude');
|
||||
reject(err);
|
||||
// #ifdef MP-BAIDU
|
||||
if (err.errCode === 202 || err.errCode ===
|
||||
10003) { // 202模拟器 10003真机 user deny
|
||||
this.openSetting();
|
||||
}
|
||||
// #endif
|
||||
// #ifndef MP-BAIDU
|
||||
if (err.errMsg.indexOf("auth deny") >= 0) {
|
||||
uni.showToast({
|
||||
title: '访问位置被拒绝',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: err.errMsg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
// #endif
|
||||
// #ifndef MP-BAIDU
|
||||
if (err.errMsg.indexOf("auth deny") >= 0) {
|
||||
uni.showToast({
|
||||
title: "访问位置被拒绝"
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: err.errMsg
|
||||
})
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
},
|
||||
getSetting: function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -713,6 +870,9 @@ export default {
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 开启权限提示
|
||||
*/
|
||||
openSetting: function() {
|
||||
uni.openSetting({
|
||||
success: (res) => {
|
||||
@@ -726,30 +886,34 @@ export default {
|
||||
async checkPermission() {
|
||||
let status = permision.isIOS ? await permision.requestIOS('location') :
|
||||
await permision.requestAndroid('android.permission.ACCESS_FINE_LOCATION');
|
||||
|
||||
let pages = getCurrentPages();
|
||||
let prePage = pages[pages.length - 1].route;
|
||||
if (status === null || status === 1) {
|
||||
status = 1;
|
||||
} else if (status === 2) {
|
||||
uni.showModal({
|
||||
content: "系统定位已关闭",
|
||||
confirmText: "确定",
|
||||
showCancel: false,
|
||||
success: function(res) {}
|
||||
})
|
||||
if (prePage === 'pages/users/user_address/index')
|
||||
uni.showModal({
|
||||
content: "系统定位已关闭",
|
||||
confirmText: "确定",
|
||||
showCancel: false,
|
||||
success: function(res) {}
|
||||
})
|
||||
} else if (status.code) {
|
||||
uni.showModal({
|
||||
content: status.message
|
||||
})
|
||||
if (prePage === 'pages/users/user_address/index')
|
||||
uni.showModal({
|
||||
content: status.message
|
||||
})
|
||||
} else {
|
||||
uni.showModal({
|
||||
content: "需要定位权限",
|
||||
confirmText: "设置",
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
permision.gotoAppSetting();
|
||||
if (prePage === 'pages/users/user_address/index')
|
||||
uni.showModal({
|
||||
content: "需要定位权限",
|
||||
confirmText: "设置",
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
permision.gotoAppSetting();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
return status;
|
||||
},
|
||||
@@ -790,4 +954,4 @@ export default {
|
||||
return str.substr(0, 1) + new Array(str.length).join('*');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,37 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 验证小数点后两位及多个小数
|
||||
* money 金额
|
||||
*/
|
||||
*/
|
||||
export function isMoney(money) {
|
||||
var reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
|
||||
if (reg.test(money)) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
var reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
|
||||
if (reg.test(money)) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证手机号码
|
||||
* money 金额
|
||||
*/
|
||||
*/
|
||||
export function checkPhone(phone) {
|
||||
var reg = /^1(3|4|5|6|7|8|9)\d{9}$/
|
||||
if (reg.test(phone)) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
var reg = /^1(3|4|5|6|7|8|9)\d{9}$/
|
||||
if (reg.test(phone)) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,18 +42,32 @@ export function checkPhone(phone) {
|
||||
* @constructor
|
||||
*/
|
||||
export const Debounce = (fn, t) => {
|
||||
const delay = t || 500
|
||||
let timer
|
||||
return function() {
|
||||
const args = arguments
|
||||
if (timer) {
|
||||
clearTimeout(timer)
|
||||
}
|
||||
timer = setTimeout(() => {
|
||||
timer = null
|
||||
fn.apply(this, args)
|
||||
}, delay)
|
||||
}
|
||||
const delay = t || 500
|
||||
let timer
|
||||
return function() {
|
||||
const args = arguments
|
||||
if (timer) {
|
||||
clearTimeout(timer)
|
||||
}
|
||||
timer = setTimeout(() => {
|
||||
timer = null
|
||||
fn.apply(this, args)
|
||||
}, delay)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 节流函数
|
||||
export function throttle(fn, delay) {
|
||||
var lastArgs;
|
||||
var timer;
|
||||
var delay = delay || 200;
|
||||
return function(...args) {
|
||||
lastArgs = args;
|
||||
if(!timer){
|
||||
timer = setTimeout(()=>{
|
||||
timer = null;
|
||||
fn.apply(this, lastArgs);
|
||||
}, delay);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user