first commit

This commit is contained in:
wangxiaowei
2025-10-22 22:56:36 +08:00
commit 90c54df48b
302 changed files with 54312 additions and 0 deletions

16
common/directive.js Normal file
View File

@ -0,0 +1,16 @@
import Vue from 'vue'
let defaultImg=require("@/static/default.png");
/*指令测试*/
Vue.directive('demo', {
bind: function (el, binding, vnode) {
var s = JSON.stringify
el.innerHTML =
'name: ' + s(binding.name) + '<br>' +
'value: ' + s(binding.value) + '<br>' +
'expression: ' + s(binding.expression) + '<br>' +
'argument: ' + s(binding.arg) + '<br>' +
'modifiers: ' + s(binding.modifiers) + '<br>' +
'vnode keys: ' + Object.keys(vnode).join(', ')
}
})

93
common/gotopage.js Normal file
View File

@ -0,0 +1,93 @@
import config from '../config.js'
/*导航菜单白名单*/
const tabBarLinks = [
'/pages/index/index',
'/pages/product/category',
'/pages/cart/cart',
'/pages/user/index/index'
];
/*分享页面白名单*/
const shareLinks = [
'/pages/plus/assemble/fight-group-detail/fight-group-detail',
'/pages/plus/bargain/haggle/haggle',
'/pages/user/invite/invite',
'/pages/product/detail/detail',
'/pages/plus/seckill/detail/detail',
'/pages/plus/assemble/detail/detail',
'/pages/plus/bargain/detail/detail',
'/pages/plus/points/detail/detail'
]
/*
* 跳转页面
*/
export const gotopage = (url, type) => {
if (!url || url.length == 0) {
return false;
}
if (url.substr(0, 1) !== '/') {
url = '/' + url;
}
let p = url;
if (url.indexOf('?') != -1) {
p = url.substr(0, url.indexOf('?'));
// #ifdef H5
if (url.search("app_id") == -1) {
url = url + '&app_id=' + config.app_id;
}
// #endif
} else {
// #ifdef H5
if (url.search("app_id") == -1) {
url = url + '?app_id=' + config.app_id;
}
// #endif
}
let diyTabBarLinks = uni.getStorageSync('TabBar').list;
let res = diyTabBarLinks.some(item => {
if (item.link_url == p) {
return true
}
})
if (res) {
uni.reLaunch({
url: url
});
return
}
// tabBar页面
if (tabBarLinks.indexOf(p) > -1 && diyTabBarLinks.length <= 0) {
uni.reLaunch({
url: url
});
} else {
if (process.env.NODE_ENV === 'production') {
//判断是否分享页面
if (shareLinks.indexOf(p) > -1) {
//公众号
// #ifdef H5
window.location.href = config.app_url + config.h5_addr + url;
return;
// #endif
}
}
if (type == 'redirect') {
uni.redirectTo({
url: url
});
return
}
if (type == 'reLaunch') {
uni.reLaunch({
url: url
});
return
}
// 普通页面
uni.navigateTo({
url: url
});
}
}

562
common/iconfont.css Normal file
View File

@ -0,0 +1,562 @@
@font-face {
font-family: 'iconfont'; /* Project id 2184879 */
src: url('https://at.alicdn.com/t/c/font_2184879_mbnal3qd448.woff2?t=1667804032010') format('woff2'),
url('https://at.alicdn.com/t/c/font_2184879_mbnal3qd448.woff?t=1667804032010') format('woff'),
url('https://at.alicdn.com/t/c/font_2184879_mbnal3qd448.ttf?t=1667804032010') format('truetype');
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-fenxiang3:before {
content: "\e8b0";
}
.icon-shoucang1:before {
content: "\e8b9";
}
.icon-shoucang2:before {
content: "\e8c6";
}
.icon-remarks:before {
content: "\e666";
}
.icon-address-none:before {
content: "\e665";
}
.icon-yinhangka:before {
content: "\e6d2";
}
.icon-shouye1:before {
content: "\e662";
}
.icon-fenxiang2:before {
content: "\e661";
}
.icon-daoda1:before {
content: "\e664";
}
.icon-gouwuche1:before {
content: "\e65e";
}
.icon-kefu:before {
content: "\e65f";
}
.icon-shouye:before {
content: "\e660";
}
.icon-daojishi:before {
content: "\e663";
}
.icon-icon1:before {
content: "\e670";
}
.icon-right_arrow:before {
content: "\e672";
}
.icon-lianhefenhong:before {
content: "\e66a";
}
.icon-zhuanruyue:before {
content: "\e673";
}
.icon-ziyuan2:before {
content: "\e65d";
}
.icon-yuyue1:before {
content: "\e656";
}
.icon-zhifubao:before {
content: "\e653";
}
.icon-zhifubao1:before {
content: "\e68b";
}
.icon-saoyisao1:before {
content: "\e652";
}
.icon-saoyisao:before {
content: "\e651";
}
.icon-share1:before {
content: "\e64f";
}
.icon-huatong:before {
content: "\e650";
}
.icon-caidan:before {
content: "\e6e8";
}
.icon-gouwu:before {
content: "\e86e";
}
.icon-biaoqing:before {
content: "\e69f";
}
.icon-fasong:before {
content: "\e743";
}
.icon-jinbi:before {
content: "\e782";
}
.icon-chongzhi:before {
content: "\e66f";
}
.icon-jifen:before {
content: "\e64d";
}
.icon-duihuan1:before {
content: "\e64e";
}
.icon-qq:before {
content: "\e64c";
}
.icon-zhanghumingcheng:before {
content: "\e669";
}
.icon-mima:before {
content: "\e64a";
}
.icon-start:before {
content: "\e648";
}
.icon-start1:before {
content: "\e649";
}
.icon-yanzhengma:before {
content: "\e646";
}
.icon-ziyuan1:before {
content: "\e657";
}
.icon-qiye:before {
content: "\e642";
}
.icon-dianpu1:before {
content: "\e6be";
}
.icon-dianpu:before {
content: "\e671";
}
.icon-sanjiao2:before {
content: "\e600";
}
.icon-sanjiao1:before {
content: "\e601";
}
.icon-jiantou:before {
content: "\e61f";
}
.icon-jiantoushang:before {
content: "\e62d";
}
.icon-kefu2:before {
content: "\e602";
}
.icon-gouwuche:before {
content: "\e63f";
}
.icon-sousuo:before {
content: "\e608";
}
.icon-icon_xianshi-xian:before {
content: "\e658";
}
.icon-tuikuan:before {
content: "\e636";
}
.icon-dizhi:before {
content: "\e61e";
}
.icon-lajitong:before {
content: "\e622";
}
.icon-jian:before {
content: "\e643";
}
.icon-quan:before {
content: "\e623";
}
.icon-icon:before {
content: "\e668";
}
.icon-fenxiao:before {
content: "\e620";
}
.icon-jia:before {
content: "\e659";
}
.icon-yue:before {
content: "\e65a";
}
.icon-bangzhu:before {
content: "\e77c";
}
.icon-pintuangou:before {
content: "\e635";
}
.icon-diliweizhi:before {
content: "\e6c1";
}
.icon-yue1:before {
content: "\e647";
}
.icon-qianbao:before {
content: "\e61b";
}
.icon-daishouhuo:before {
content: "\e604";
}
.icon-integral:before {
content: "\e62b";
}
.icon-kanjia:before {
content: "\e61c";
}
.icon-weixin:before {
content: "\e621";
}
.icon-youhuiquan:before {
content: "\e63d";
}
.icon-guanbi:before {
content: "\e629";
}
.icon-quanbudingdan:before {
content: "\e640";
}
.icon-pintuan:before {
content: "\e76a";
}
.icon-gantanhao:before {
content: "\e685";
}
.icon-dizhi1:before {
content: "\e734";
}
.icon-xuanze:before {
content: "\e627";
}
.icon-edit:before {
content: "\e60a";
}
.icon-pingjiachaping:before {
content: "\e634";
}
.icon-pingjiazhongping:before {
content: "\e637";
}
.icon-pingjiahaoping:before {
content: "\e616";
}
.icon-xiangji:before {
content: "\e61d";
}
.icon-shaixuanpaixu:before {
content: "\e676";
}
.icon-shaixuan:before {
content: "\e626";
}
.icon-fenxiang:before {
content: "\e617";
}
.icon-guanzhu:before {
content: "\e624";
}
.icon-chakan:before {
content: "\e68a";
}
.icon-002dianhua:before {
content: "\e603";
}
.icon-phone:before {
content: "\e630";
}
.icon-erweima:before {
content: "\e631";
}
.icon-tuandui:before {
content: "\e605";
}
.icon-fenxiaodingdan:before {
content: "\e645";
}
.icon-wait:before {
content: "\e641";
}
.icon-zijinmingxi:before {
content: "\e607";
}
.icon-share:before {
content: "\e60f";
}
.icon-jingmeihaibao:before {
content: "\e606";
}
.icon-shoucang:before {
content: "\e610";
}
.icon-dianzan:before {
content: "\e697";
}
.icon-hongbao:before {
content: "\e644";
}
.icon-xiaoxi:before {
content: "\e69d";
}
.icon-libao:before {
content: "\e609";
}
.icon-ic_check:before {
content: "\e60b";
}
.icon-tijiaochenggong:before {
content: "\e614";
}
.icon-queren:before {
content: "\e618";
}
.icon-Homehomepagemenu:before {
content: "\e9ce";
}
.icon-wenjian:before {
content: "\e654";
}
.icon-step:before {
content: "\e611";
}
.icon-laba:before {
content: "\e60c";
}
.icon-youhuiquan1:before {
content: "\e60d";
}
.icon-fenxiao1:before {
content: "\e639";
}
.icon-youhuiquan-:before {
content: "\e60e";
}
.icon-bofang:before {
content: "\e619";
}
.icon-ziyuan:before {
content: "\e632";
}
.icon-xingzhuang:before {
content: "\e612";
}
.icon-daipingjia:before {
content: "\e772";
}
.icon-guanzhu1:before {
content: "\e613";
}
.icon-31guanzhu1xuanzhong:before {
content: "\e655";
}
.icon-tubiaozhizuo-:before {
content: "\e615";
}
.icon-fenxiang1:before {
content: "\e72f";
}
.icon-shipinwenjianhuise:before {
content: "\e61a";
}
.icon-shezhi:before {
content: "\e781";
}
.icon-shezhi1:before {
content: "\e625";
}
.icon-paixing:before {
content: "\e628";
}
.icon-huodongtuiguang:before {
content: "\e62a";
}
.icon-01:before {
content: "\e62c";
}
.icon-shangchuan:before {
content: "\e65b";
}
.icon-zhuanshutequan:before {
content: "\e62e";
}
.icon-zhibo:before {
content: "\e8c1";
}
.icon-paihangbang:before {
content: "\e64b";
}
.icon-dingdan:before {
content: "\e62f";
}
.icon-dilanxianxingiconyihuifu_huabanfuben:before {
content: "\e633";
}
.icon-gengduo:before {
content: "\e638";
}
.icon-meiyan:before {
content: "\e65c";
}
.icon-meibai:before {
content: "\e63a";
}
.icon-iconset0243:before {
content: "\e68e";
}
.icon-zhuangxiushangjia-:before {
content: "\e63b";
}
.icon-yuyue:before {
content: "\e63c";
}
.icon-htmal5icon24:before {
content: "\e63e";
}

152
common/mixin.scss Normal file
View File

@ -0,0 +1,152 @@
/*圆角*/
@mixin border-radius($radius...) {
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
-o-border-radius: $radius;
border-radius: $radius;
}
/*阴影*/
@mixin box-shadow($shadows...) {
-moz-box-shadow: $shadows;
-webkit-box-shadow: $shadows;
box-shadow: $shadows;
}
/*文字阴影*/
@mixin text-shadow($shadows...){
text-shadow:$shadows;
}
/*线性渐变*/
@mixin linear-gradient($val...){
background: -webkit-linear-gradient($val); /* Safari 5.1 - 6.0 */
background: -o-linear-gradient($val); /* Opera 11.1 - 12.0 */
background: -moz-linear-gradient($val); /* Firefox 3.6 - 15 */
background: linear-gradient($val); /* 标准的语法 */
}
/*垂直居中*/
@mixin vertical-center() {
display: -webkit-flex;
display: flex;
-webkit-align-items: center;
align-items: center;
-webkit-justify-content: center;
justify-content: center;
}
/*去除padding 宽度*/
@mixin box-sizing-border() {
box-sizing: border-box;
-moz-box-sizing: border-box;
/* Firefox */
-webkit-box-sizing: border-box;
/* Safari */
}
/*css3盒子
* flex-direction: row row-reverse column column-reverse
* flex-wrap: nowrap wrap wrap-reverse
* justify-content: flex-start flex-end center space-between space-around
* align-items: stretch flex-start flex-end center beseline
* align-content: stretch flex-start flex-end center space-between space-around
* */
@mixin display-flex() {
display: -webkit-flex;
display: flex;
}
@mixin flex-direction($value) {
@include display-flex();
-webkit-flex-direction: $value;
flex-direction: $value;
}
@mixin flex-wrap($value) {
@include display-flex();
-webkit-flex-wrap: $value;
flex-wrap: $value;
}
@mixin justify-content($value) {
@include display-flex();
-webkit-justify-content: $value;
justify-content: $value;
}
@mixin align-items($value) {
@include display-flex();
-webkit-align-items: $value;
align-items: $value;
}
@mixin align-content($value) {
@include display-flex();
-webkit-align-content: $value;
align-content: $value;
}
/*设置flex*/
@mixin flex-num($num) {
-webkit-box-flex: $num;
-ms-flex: $num;
flex: $num;
}
/*一行截取*/
@mixin ellipsis() {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/*多行截取*/
@mixin ellipsis-clamp($num) {
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: $num;
-webkit-box-orient: vertical;
word-break: break-all;
}
/*旋转角度x,y位移*/
@mixin rotate-origin($num, $x, $y) {
transform: rotate($num);
transform-origin: $x $y;
-ms-transform: rotate($num);
/* IE 9 */
-ms-transform-origin: $x $y;
/* IE 9 */
-webkit-transform: rotate($num);
/* Safari and Chrome */
-webkit-transform-origin: $x $y;
/* Safari and Chrome */
}
/*旋转*/
@mixin transform-rotate($deg){
transform: rotate($deg);
-ms-transform: rotate($deg); /* IE 9 */
-webkit-transform: rotate($deg); /* Safari and Chrome */
}
/*过度*/
@mixin transition($val...){
transition: $val;
-webkit-transition: $val; /* Safari */
}
/*模糊*/
@mixin filter($val...){
-webkit-filter: blur($val);
filter:progid:DXImageTransform.Microsoft.Blur(PixelRadius='1');
}

2
common/myIcon.css Normal file
View File

@ -0,0 +1,2 @@
/*自定义iconfont文件请将你的iconfont.css内容复制拷贝到这里就可以直接在项目里直接引用*/
/*参考上面的iconfont.css内容和使用方法*/

98
common/onfire.js Normal file
View File

@ -0,0 +1,98 @@
"use strict";
/**
* mini (~300 b) version for event-emitter.
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* const ee = new OnFire();
*
* ee.on('click', () => {});
*
* ee.on('mouseover', () => {});
*
* ee.emit('click', 1, 2, 3);
* ee.fire('mouseover', {}); // same with emit
*
* ee.off();
*/
var OnFire =
/** @class */
function () {
function OnFire() {
// 所有事件的监听器
this.es = {}; // cname of fire
this.emit = this.fire;
}
OnFire.prototype.on = function (eventName, cb, once) {
if (once === void 0) {
once = false;
}
if (!this.es[eventName]) {
this.es[eventName] = [];
}
this.es[eventName].push({
cb: cb,
once: once
});
};
OnFire.prototype.once = function (eventName, cb) {
this.on(eventName, cb, true);
};
OnFire.prototype.fire = function (eventName) {
var params = [];
for (var _i = 1; _i < arguments.length; _i++) {
params[_i - 1] = arguments[_i];
}
var listeners = this.es[eventName] || [];
for (var i = 0; i < listeners.length; i++) {
var _a = listeners[i],
cb = _a.cb,
once = _a.once;
cb.apply(this, params);
if (once) {
listeners.splice(i, 1);
i--;
}
}
};
OnFire.prototype.off = function (eventName, cb) {
// clean all
if (eventName === undefined) {
this.es = {};
} else {
if (cb === undefined) {
// clean the eventName's listeners
delete this.es[eventName];
} else {
var listeners = this.es[eventName] || []; // clean the event and listener
for (var i = 0; i < listeners.length; i++) {
if (listeners[i].cb === cb) {
listeners.splice(i, 1);
i--;
}
}
}
}
};
OnFire.ver = "2.0.0";
return OnFire;
}();
exports.default = OnFire;

143
common/pay.js Normal file
View File

@ -0,0 +1,143 @@
/*
* 支付
*/
export const pay = (result, self, success, fail) => {
if (result.code === -10) {
self.showError(result.msg);
return false;
}
// 发起微信支付
if (result.data.pay_type == 20) {
//小程序支付
// #ifdef MP-WEIXIN
uni.requestPayment({
provider: 'wxpay',
timeStamp: result.data.payment.timeStamp,
nonceStr: result.data.payment.nonceStr,
package: 'prepay_id=' + result.data.payment.prepay_id,
signType: 'MD5',
paySign: result.data.payment.paySign,
success: res => {
paySuccess(result, self, success);
},
fail: res => {
self.showError('订单未支付成功', () => {
payError(result, fail, self);
});
},
});
// #endif
//公众号支付
// #ifdef H5
if (self.isWeixin()) {
WeixinJSBridge.invoke('getBrandWCPayRequest', JSON.parse(result.data.payment),
function(res) {
if (res.err_msg == "get_brand_wcpay_request:ok") {
paySuccess(result, self, success);
} else if (res.err_msg == "get_brand_wcpay_request:cancel") {
self.showSuccess('支付取消', () => {
payError(result, fail, self);
});
} else {
self.showError('订单未支付成功', () => {
payError(result, fail, self);
});
}
}
);
} else {
window.location.href = result.data.payment.mweb_url + '&redirect_url=' + result.data.return_Url;
return;
}
// #endif
// #ifdef APP-PLUS
//微信支付
wxAppPay(result, self, success, fail);
// #endif
}
// 余额支付
if (result.data.pay_type == 10) {
paySuccess(result, self, success);
}
// 支付宝支付
if (result.data.pay_type == 30) {
// #ifdef APP-PLUS
aliAppPay(result, self, success, fail);
// #endif
// #ifdef H5
const div = document.createElement('formdiv');
// 参数格式化处理
//let start = result.data.payment.indexOf("{\"");
//let end = result.data.payment.indexOf("\"}");
//let params = result.data.payment.substr(start, (end - start + 1));
//let new_params = params.replace(/\"/g,"&quot;");
div.innerHTML = result.data.payment;//.substr(0,start)+new_params+result.data.payment.substr(end+1);
document.body.appendChild(div);
document.forms[0].submit();
div.remove();
// #endif
}
}
/*跳到支付成功页*/
function paySuccess(result, self, success) {
if (success) {
success(result);
return;
}
gotoSuccess(result, self);
}
/*跳到支付成功页*/
function gotoSuccess(result, self) {
self.gotoPage('/pages/order/pay-success/pay-success?order_id=' + result.data.order_id, 'reLaunch');
}
/*支付失败跳订单详情*/
function payError(result, fail, self) {
if (fail) {
fail(result);
return;
}
self.gotoPage('/pages/order/order-detail?order_id=' + result.data.order_id, 'redirect');
}
function wxAppPay(result, self, success, fail) {
// 获取支付通道
plus.payment.getChannels(function(channels) {
self.channel = channels[0];
console.log(self.channel);
uni.requestPayment({
provider: 'wxpay',
orderInfo: result.data.payment,
success(res) {
paySuccess(result, self, success);
},
fail(error) {
console.log(error);
self.showError('订单未支付成功', () => {
payError(result, fail);
});
},
});
}, function(e) {
console.log("获取支付通道失败:" + e.message);
});
}
function aliAppPay(result, self, success, fail) {
console.log(result.data.payment);
uni.requestPayment({
provider: 'alipay',
orderInfo: result.data.payment,
success(res) {
paySuccess(result, self, success);
},
fail(error) {
console.log(error);
self.showError('订单未支付成功', () => {
payError(result, fail, self);
});
},
});
}

41
common/specSelect.js Normal file
View File

@ -0,0 +1,41 @@
/*判断哪些规格可以选*/
export const judgeSelect = (list,_index,productSpecArr,productSku) => {
/*大类*/
for (let i = 0, count = list.length; i < count; i++) {
/*小类*/
for (let j = 0; j < list[i].spec_items.length; j++) {
let item = list[i].spec_items[j];
if(i!=_index){
item.disabled = hasSpecId(i,item.item_id,productSpecArr,productSku);
}
}
}
}
/*判断有没有规格ID*/
function hasSpecId(index,id,productSpecArr,productSku){
let disabled=false;
let reg='';
for(let p=0;p<productSpecArr.length;p++){
if(p!=index){
if(productSpecArr[p]!=null){
reg+=productSpecArr[p]+'_';
}else{
reg+='[0-9]*_';
}
}else{
reg+=id+'_';
}
}
reg=reg.substr(0,reg.length-1);
let re=new RegExp(reg,'g');
for (let s = 0; s < productSku.length; s++) {
let ids=productSku[s].join('_');
disabled=re.test(ids);
if(disabled){
break;
}
}
return !disabled;
}

1613
common/style.css Normal file

File diff suppressed because it is too large Load Diff

1721
common/style.scss Normal file

File diff suppressed because it is too large Load Diff

1458
common/uni.css Normal file

File diff suppressed because it is too large Load Diff

171
common/utils.js Normal file
View File

@ -0,0 +1,171 @@
/**
* 工具类
*/
var utils = {
/**
* scene解码
*/
scene_decode(e) {
if (e === undefined)
return {};
let scene = decodeURIComponent(e),
params = scene.split(','),
data = {};
for (let i in params) {
var val = params[i].split(':');
val.length > 0 && val[0] && (data[val[0]] = val[1] || null)
}
return data;
},
/**
* 格式化日期格式 (用于兼容ios Date对象)
*/
format_date(time) {
// 将xxxx-xx-xx的时间格式转换为 xxxx/xx/xx的格式
return time.replace(/\-/g, "/");
},
/**
* 格式化详情内容,去除图片之间的间隙图片宽度最大100%
*/
format_content(str) {
return str.replace(/\<img/gi, '<img style="display:block; margin:0 auto; max-width:100%;" ');
},
/**
* 对象转URL
*/
urlEncode(data) {
var _result = [];
for (var key in data) {
var value = data[key];
if (value.constructor == Array) {
value.forEach(_value => {
_result.push(key + "=" + _value);
});
} else {
_result.push(key + '=' + value);
}
}
return _result.join('&');
},
/**
* 遍历对象
*/
objForEach(obj, callback) {
Object.keys(obj).forEach((key) => {
callback(obj[key], key);
});
},
/**
* 是否在数组内
*/
inArray(search, array) {
for (var i in array) {
if (array[i] == search) {
return true;
}
}
return false;
},
/**
* 判断是否为正整数
*/
isPositiveInteger(value) {
return /(^[0-9]\d*$)/.test(value);
},
/**
* 获取场景值(scene)
*/
getSceneData(query) {
return query.scene ? this.scene_decode(query.scene) : {};
},
// 判断是否为身份证
isVail(value) {
if (!/^\d{17}(\d|x)$/i.test(value)) {
return false;
}
var now = new Date();
var yYear = Number(value.substr(6, 4));
var yMonth = Number(value.substr(10, 2)) + 1;
var yDay = Number(value.substr(12, 2));
var birthFlag = false;
if (yYear <= Number(now.getFullYear()) && yYear > 0) {
if (yMonth <= 12 && yMonth > 0) {
// 获取当月天数
var preMonth = new Date(yYear, yMonth - 1, 0);
if (yDay <= preMonth.getDate() && yDay > 0) {
birthFlag = true;
}
}
}
if (!birthFlag) {
return false;
}
var iSum = 0;
value = value.replace(/x$/i, "a");
for (var i = 17; i >= 0; i--) {
iSum += (Math.pow(2, i) % 11) * parseInt(value.charAt(17 - i), 11);
}
if (iSum % 11 != 1) {
return false;
}
return true
},
// 判断是否为手机号
isPoneAvailable(pone) {
var myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
if (!myreg.test(pone)) {
return false;
} else {
return true;
}
},
// 判断是否为座机或者手机号
isTelAvailable(tel) {
var myreg = /^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/;
var myregs = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
var flag = false;
if (myreg.test(tel)) {
flag = true;
}
if (myregs.test(tel)) {
flag = true;
}
if(flag){
return true
}else{
return false
}
},
// 判断是否为电子邮箱
isMail(mail) {
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(mail)){
return true;
} else {
return false;
}
},
// 判断是否为数字
isNum(num) {
var filter = /^[0-9]*$/;
if (filter.test(num)){
return true;
} else {
return false;
}
}
};
export default utils;