第一次提交
This commit is contained in:
105
common/agoraRtc.js
Normal file
105
common/agoraRtc.js
Normal file
@ -0,0 +1,105 @@
|
||||
const AgoraRtcEngineModule = uni.requireNativePlugin('AgoraView');
|
||||
var agoraRtc = {
|
||||
create(params, callback) {
|
||||
console.log('appid==='+params.appid);
|
||||
this.callMethod('create', {
|
||||
config: {
|
||||
appId: params.appid,
|
||||
areaCode: 0,
|
||||
logConfig: 0
|
||||
},
|
||||
appType: 14
|
||||
}, callback);
|
||||
},
|
||||
enableVideo(callback) {
|
||||
this.callMethod('enableVideo', null, callback);
|
||||
},
|
||||
setBeautyEffectOptions(beautyOptions) {
|
||||
this.callMethod('setBeautyEffectOptions', {
|
||||
enabled: true,
|
||||
options: beautyOptions
|
||||
});
|
||||
},
|
||||
setVideoEncoderConfiguration(config, callback) {
|
||||
this.callMethod('setVideoEncoderConfiguration', {
|
||||
config: config
|
||||
}, callback);
|
||||
},
|
||||
startPreview(callback) {
|
||||
this.callMethod('startPreview', null, callback);
|
||||
},
|
||||
switchCamera(callback) {
|
||||
this.callMethod('switchCamera', null, callback);
|
||||
},
|
||||
enableVirtualBackground(config, callback){
|
||||
this.callMethod('enableVirtualBackground', {
|
||||
enabled: config.enabled,
|
||||
config: config
|
||||
}, callback);
|
||||
},
|
||||
stopPreview(callback) {
|
||||
this.callMethod('stopPreview', null, callback);
|
||||
},
|
||||
setChannelProfile(profile, callback){
|
||||
this.callMethod('setChannelProfile', {
|
||||
profile: profile,
|
||||
}, callback);
|
||||
},
|
||||
setClientRole(role, callback){
|
||||
this.callMethod('setClientRole', {
|
||||
role: role,
|
||||
}, callback);
|
||||
},
|
||||
joinChannel(params, callback){
|
||||
this.callMethod('joinChannel', {
|
||||
token: params.token,
|
||||
channelName: params.channelName,
|
||||
optionalInfo: null,
|
||||
optionalUid: params.uid,
|
||||
options: null
|
||||
}, callback);
|
||||
},
|
||||
stopAudioMixing(callback){
|
||||
this.callMethod('stopAudioMixing', null, callback);
|
||||
},
|
||||
startAudioMixing(params, callback){
|
||||
this.callMethod('startAudioMixing', {
|
||||
filePath: params.filePath,
|
||||
loopback: params.loopback,
|
||||
replace: params.replace,
|
||||
cycle: params.cycle,
|
||||
startPos: params.startPos
|
||||
}, callback);
|
||||
},
|
||||
leaveChannel(callback){
|
||||
this.callMethod('leaveChannel', null, callback);
|
||||
},
|
||||
disableAudio(callback){
|
||||
this.callMethod('disableAudio', null, callback);
|
||||
},
|
||||
enableAudio(callback){
|
||||
this.callMethod('enableAudio', null, callback);
|
||||
},
|
||||
destroy(){
|
||||
this.callMethod('destroy', null);
|
||||
},
|
||||
callMethod(method, args, callback){
|
||||
return new Promise((resolve, reject) => {
|
||||
AgoraRtcEngineModule.callMethod({
|
||||
method: method,
|
||||
args: args
|
||||
}, res => {
|
||||
console.log(res);
|
||||
if (res && res.code) {
|
||||
console.log('-------rtc reject--------method='+method);
|
||||
reject(res);
|
||||
} else {
|
||||
console.log('-------rtc resolve--------method='+method);
|
||||
resolve(res);
|
||||
callback && callback(res);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
export default agoraRtc;
|
||||
66
common/agoraRtm.js
Normal file
66
common/agoraRtm.js
Normal file
@ -0,0 +1,66 @@
|
||||
const AgoraRtmClientModule = uni.requireNativePlugin('AgoraRtm');
|
||||
var agoraRtm = {
|
||||
createInstance(params, callback) {
|
||||
this.callMethod('createInstance', {
|
||||
appId: params.appid
|
||||
}, callback);
|
||||
},
|
||||
login(params, callback){
|
||||
this.callMethod('login', {
|
||||
token: params.token,
|
||||
uid: params.uid
|
||||
}, callback);
|
||||
},
|
||||
join(callback){
|
||||
this.callMethod('join', null, callback);
|
||||
},
|
||||
createChannel(params, callback) {
|
||||
this.callMethod('createChannel', {
|
||||
channelId: params.channelId
|
||||
}, callback);
|
||||
},
|
||||
sendMessage(params, callback) {
|
||||
this.callMethod('sendMessage', {
|
||||
message: params.message
|
||||
}, callback);
|
||||
},
|
||||
getChannelMemberCount(params, callback) {
|
||||
this.callMethod('getChannelMemberCount', {
|
||||
channelIds: params.channelIds
|
||||
}, callback);
|
||||
},
|
||||
getMembers(callback){
|
||||
this.callMethod('getMembers', null, callback);
|
||||
},
|
||||
setupRemoteVideo(callback){
|
||||
this.callMethod('setupRemoteVideo', null, callback);
|
||||
},
|
||||
logout(){
|
||||
this.callMethod('logout', null);
|
||||
},
|
||||
release(params){
|
||||
this.callMethod('release', {
|
||||
channelId: params.channelId
|
||||
});
|
||||
},
|
||||
callMethod(method, args, callback){
|
||||
return new Promise((resolve, reject) => {
|
||||
AgoraRtmClientModule.callMethod({
|
||||
method: method,
|
||||
args: args
|
||||
}, res => {
|
||||
console.log(res);
|
||||
if (res && res.code) {
|
||||
console.log('-------rtm reject--------method='+method);
|
||||
reject(res);
|
||||
} else {
|
||||
console.log('-------rtm resolve--------method='+method);
|
||||
resolve(res);
|
||||
let resJson = JSON.parse(res);
|
||||
callback && callback(resJson);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
export default agoraRtm;
|
||||
16
common/directive.js
Normal file
16
common/directive.js
Normal 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(', ')
|
||||
}
|
||||
})
|
||||
91
common/gotopage.js
Normal file
91
common/gotopage.js
Normal file
@ -0,0 +1,91 @@
|
||||
import config from '../config.js'
|
||||
/*导航菜单白名单*/
|
||||
const tabBarLinks = [
|
||||
'/pages/index/index',
|
||||
'/pages/product/category',
|
||||
'/pages/shop/middle',
|
||||
'/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'
|
||||
]
|
||||
|
||||
/*
|
||||
* 跳转页面
|
||||
*/
|
||||
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) {
|
||||
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
|
||||
});
|
||||
}
|
||||
}
|
||||
599
common/iconfont.css
Normal file
599
common/iconfont.css
Normal file
@ -0,0 +1,599 @@
|
||||
@font-face {
|
||||
font-family: 'iconfont'; /* Project id 2184879 */
|
||||
src: url('https://at.alicdn.com/t/c/font_2184879_q181kg43f8n.woff2?t=1685608298895') format('woff2'),
|
||||
url('https://at.alicdn.com/t/c/font_2184879_q181kg43f8n.woff?t=1685608298895') format('woff'),
|
||||
url('https://at.alicdn.com/t/c/font_2184879_q181kg43f8n.ttf?t=1685608298895') format('truetype');
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
font-family: "iconfont" !important;
|
||||
font-size: 16px;
|
||||
font-style: normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-31paishe:before {
|
||||
content: "\e66b";
|
||||
}
|
||||
|
||||
.icon-shangchuanshipin:before {
|
||||
content: "\e66c";
|
||||
}
|
||||
|
||||
.icon-liangdu_o:before {
|
||||
content: "\eb66";
|
||||
}
|
||||
|
||||
.icon-qingxidu:before {
|
||||
content: "\e667";
|
||||
}
|
||||
|
||||
.icon-lizhirenyuan:before {
|
||||
content: "\e674";
|
||||
}
|
||||
|
||||
.icon-guanghua:before {
|
||||
content: "\e675";
|
||||
}
|
||||
|
||||
.icon-Vlian:before {
|
||||
content: "\e677";
|
||||
}
|
||||
|
||||
.icon-jinyan-audiostatic:before {
|
||||
content: "\e678";
|
||||
}
|
||||
|
||||
.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-jiantouxia-copy:before {
|
||||
content: "\e9cf";
|
||||
}
|
||||
|
||||
.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
152
common/mixin.scss
Normal 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
2
common/myIcon.css
Normal file
@ -0,0 +1,2 @@
|
||||
/*自定义iconfont文件,请将你的iconfont.css内容复制拷贝到这里就可以直接在项目里直接引用*/
|
||||
/*参考上面的iconfont.css内容和使用方法*/
|
||||
98
common/onfire.js
Normal file
98
common/onfire.js
Normal 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
143
common/pay.js
Normal 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);
|
||||
});
|
||||
},
|
||||
});
|
||||
// #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);
|
||||
});
|
||||
} else {
|
||||
self.showError('订单未支付成功', () => {
|
||||
payError(result, fail);
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
}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);
|
||||
return;
|
||||
// #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');
|
||||
div.innerHTML = result.data.payment;
|
||||
document.body.appendChild(div);
|
||||
document.forms[0].submit();
|
||||
div.remove();
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
|
||||
/*跳到支付成功页*/
|
||||
function paySuccess(result, self, success) {
|
||||
if(success){
|
||||
success(result);
|
||||
return;
|
||||
}
|
||||
gotoSuccess(result);
|
||||
}
|
||||
/*跳到支付成功页*/
|
||||
function gotoSuccess(result) {
|
||||
uni.reLaunch({
|
||||
url: '/pages/order/pay-success/pay-success?order_id=' + result.data.order_id
|
||||
});
|
||||
}
|
||||
|
||||
/*支付失败跳订单详情*/
|
||||
function payError(result, fail) {
|
||||
if(fail){
|
||||
fail(result);
|
||||
return;
|
||||
}
|
||||
uni.redirectTo({
|
||||
url: '/pages/order/order-detail?order_id=' + result.data.order_id
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
272
common/permission.js
Normal file
272
common/permission.js
Normal file
@ -0,0 +1,272 @@
|
||||
/**
|
||||
* 本模块封装了Android、iOS的应用权限判断、打开应用权限设置界面、以及位置系统服务是否开启
|
||||
*/
|
||||
|
||||
var isIos
|
||||
// #ifdef APP-PLUS
|
||||
isIos = (plus.os.name == "iOS")
|
||||
// #endif
|
||||
|
||||
// 判断推送权限是否开启
|
||||
function judgeIosPermissionPush() {
|
||||
var result = false;
|
||||
var UIApplication = plus.ios.import("UIApplication");
|
||||
var app = UIApplication.sharedApplication();
|
||||
var enabledTypes = 0;
|
||||
if (app.currentUserNotificationSettings) {
|
||||
var settings = app.currentUserNotificationSettings();
|
||||
enabledTypes = settings.plusGetAttribute("types");
|
||||
console.log("enabledTypes1:" + enabledTypes);
|
||||
if (enabledTypes == 0) {
|
||||
console.log("推送权限没有开启");
|
||||
} else {
|
||||
result = true;
|
||||
console.log("已经开启推送功能!")
|
||||
}
|
||||
plus.ios.deleteObject(settings);
|
||||
} else {
|
||||
enabledTypes = app.enabledRemoteNotificationTypes();
|
||||
if (enabledTypes == 0) {
|
||||
console.log("推送权限没有开启!");
|
||||
} else {
|
||||
result = true;
|
||||
console.log("已经开启推送功能!")
|
||||
}
|
||||
console.log("enabledTypes2:" + enabledTypes);
|
||||
}
|
||||
plus.ios.deleteObject(app);
|
||||
plus.ios.deleteObject(UIApplication);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 判断定位权限是否开启
|
||||
function judgeIosPermissionLocation() {
|
||||
var result = false;
|
||||
var cllocationManger = plus.ios.import("CLLocationManager");
|
||||
var status = cllocationManger.authorizationStatus();
|
||||
result = (status != 2)
|
||||
console.log("定位权限开启:" + result);
|
||||
// 以下代码判断了手机设备的定位是否关闭,推荐另行使用方法 checkSystemEnableLocation
|
||||
/* var enable = cllocationManger.locationServicesEnabled();
|
||||
var status = cllocationManger.authorizationStatus();
|
||||
console.log("enable:" + enable);
|
||||
console.log("status:" + status);
|
||||
if (enable && status != 2) {
|
||||
result = true;
|
||||
console.log("手机定位服务已开启且已授予定位权限");
|
||||
} else {
|
||||
console.log("手机系统的定位没有打开或未给予定位权限");
|
||||
} */
|
||||
plus.ios.deleteObject(cllocationManger);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 判断麦克风权限是否开启
|
||||
function judgeIosPermissionRecord() {
|
||||
var result = false;
|
||||
var avaudiosession = plus.ios.import("AVAudioSession");
|
||||
var avaudio = avaudiosession.sharedInstance();
|
||||
var permissionStatus = avaudio.recordPermission();
|
||||
console.log("permissionStatus:" + permissionStatus);
|
||||
if (permissionStatus == 1684369017 || permissionStatus == 1970168948) {
|
||||
console.log("麦克风权限没有开启");
|
||||
} else {
|
||||
result = true;
|
||||
console.log("麦克风权限已经开启");
|
||||
}
|
||||
plus.ios.deleteObject(avaudiosession);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 判断相机权限是否开启
|
||||
function judgeIosPermissionCamera() {
|
||||
var result = false;
|
||||
var AVCaptureDevice = plus.ios.import("AVCaptureDevice");
|
||||
var authStatus = AVCaptureDevice.authorizationStatusForMediaType('vide');
|
||||
console.log("authStatus:" + authStatus);
|
||||
if (authStatus == 3) {
|
||||
result = true;
|
||||
console.log("相机权限已经开启");
|
||||
} else {
|
||||
console.log("相机权限没有开启");
|
||||
}
|
||||
plus.ios.deleteObject(AVCaptureDevice);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 判断相册权限是否开启
|
||||
function judgeIosPermissionPhotoLibrary() {
|
||||
var result = false;
|
||||
var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary");
|
||||
var authStatus = PHPhotoLibrary.authorizationStatus();
|
||||
console.log("authStatus:" + authStatus);
|
||||
if (authStatus == 3) {
|
||||
result = true;
|
||||
console.log("相册权限已经开启");
|
||||
} else {
|
||||
console.log("相册权限没有开启");
|
||||
}
|
||||
plus.ios.deleteObject(PHPhotoLibrary);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 判断通讯录权限是否开启
|
||||
function judgeIosPermissionContact() {
|
||||
var result = false;
|
||||
var CNContactStore = plus.ios.import("CNContactStore");
|
||||
var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0);
|
||||
if (cnAuthStatus == 3) {
|
||||
result = true;
|
||||
console.log("通讯录权限已经开启");
|
||||
} else {
|
||||
console.log("通讯录权限没有开启");
|
||||
}
|
||||
plus.ios.deleteObject(CNContactStore);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 判断日历权限是否开启
|
||||
function judgeIosPermissionCalendar() {
|
||||
var result = false;
|
||||
var EKEventStore = plus.ios.import("EKEventStore");
|
||||
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0);
|
||||
if (ekAuthStatus == 3) {
|
||||
result = true;
|
||||
console.log("日历权限已经开启");
|
||||
} else {
|
||||
console.log("日历权限没有开启");
|
||||
}
|
||||
plus.ios.deleteObject(EKEventStore);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 判断备忘录权限是否开启
|
||||
function judgeIosPermissionMemo() {
|
||||
var result = false;
|
||||
var EKEventStore = plus.ios.import("EKEventStore");
|
||||
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1);
|
||||
if (ekAuthStatus == 3) {
|
||||
result = true;
|
||||
console.log("备忘录权限已经开启");
|
||||
} else {
|
||||
console.log("备忘录权限没有开启");
|
||||
}
|
||||
plus.ios.deleteObject(EKEventStore);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Android权限查询
|
||||
function requestAndroidPermission(permissionID) {
|
||||
return new Promise((resolve, reject) => {
|
||||
plus.android.requestPermissions(
|
||||
[permissionID], // 理论上支持多个权限同时查询,但实际上本函数封装只处理了一个权限的情况。有需要的可自行扩展封装
|
||||
function(resultObj) {
|
||||
var result = 0;
|
||||
for (var i = 0; i < resultObj.granted.length; i++) {
|
||||
var grantedPermission = resultObj.granted[i];
|
||||
console.log('已获取的权限:' + grantedPermission);
|
||||
result = 1
|
||||
}
|
||||
for (var i = 0; i < resultObj.deniedPresent.length; i++) {
|
||||
var deniedPresentPermission = resultObj.deniedPresent[i];
|
||||
console.log('拒绝本次申请的权限:' + deniedPresentPermission);
|
||||
result = 0
|
||||
}
|
||||
for (var i = 0; i < resultObj.deniedAlways.length; i++) {
|
||||
var deniedAlwaysPermission = resultObj.deniedAlways[i];
|
||||
console.log('永久拒绝申请的权限:' + deniedAlwaysPermission);
|
||||
result = -1
|
||||
}
|
||||
resolve(result);
|
||||
// 若所需权限被拒绝,则打开APP设置界面,可以在APP设置界面打开相应权限
|
||||
// if (result != 1) {
|
||||
// gotoAppPermissionSetting()
|
||||
// }
|
||||
},
|
||||
function(error) {
|
||||
console.log('申请权限错误:' + error.code + " = " + error.message);
|
||||
resolve({
|
||||
code: error.code,
|
||||
message: error.message
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// 使用一个方法,根据参数判断权限
|
||||
function judgeIosPermission(permissionID) {
|
||||
if (permissionID == "location") {
|
||||
return judgeIosPermissionLocation()
|
||||
} else if (permissionID == "camera") {
|
||||
return judgeIosPermissionCamera()
|
||||
} else if (permissionID == "photoLibrary") {
|
||||
return judgeIosPermissionPhotoLibrary()
|
||||
} else if (permissionID == "record") {
|
||||
return judgeIosPermissionRecord()
|
||||
} else if (permissionID == "push") {
|
||||
return judgeIosPermissionPush()
|
||||
} else if (permissionID == "contact") {
|
||||
return judgeIosPermissionContact()
|
||||
} else if (permissionID == "calendar") {
|
||||
return judgeIosPermissionCalendar()
|
||||
} else if (permissionID == "memo") {
|
||||
return judgeIosPermissionMemo()
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// 跳转到**应用**的权限页面
|
||||
function gotoAppPermissionSetting() {
|
||||
if (isIos) {
|
||||
var UIApplication = plus.ios.import("UIApplication");
|
||||
var application2 = UIApplication.sharedApplication();
|
||||
var NSURL2 = plus.ios.import("NSURL");
|
||||
// var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
|
||||
var setting2 = NSURL2.URLWithString("app-settings:");
|
||||
application2.openURL(setting2);
|
||||
|
||||
plus.ios.deleteObject(setting2);
|
||||
plus.ios.deleteObject(NSURL2);
|
||||
plus.ios.deleteObject(application2);
|
||||
} else {
|
||||
// console.log(plus.device.vendor);
|
||||
var Intent = plus.android.importClass("android.content.Intent");
|
||||
var Settings = plus.android.importClass("android.provider.Settings");
|
||||
var Uri = plus.android.importClass("android.net.Uri");
|
||||
var mainActivity = plus.android.runtimeMainActivity();
|
||||
var intent = new Intent();
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
|
||||
intent.setData(uri);
|
||||
mainActivity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
// 检查系统的设备服务是否开启
|
||||
// var checkSystemEnableLocation = async function () {
|
||||
function checkSystemEnableLocation() {
|
||||
if (isIos) {
|
||||
var result = false;
|
||||
var cllocationManger = plus.ios.import("CLLocationManager");
|
||||
var result = cllocationManger.locationServicesEnabled();
|
||||
console.log("系统定位开启:" + result);
|
||||
plus.ios.deleteObject(cllocationManger);
|
||||
return result;
|
||||
} else {
|
||||
var context = plus.android.importClass("android.content.Context");
|
||||
var locationManager = plus.android.importClass("android.location.LocationManager");
|
||||
var main = plus.android.runtimeMainActivity();
|
||||
var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
|
||||
var result = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER);
|
||||
console.log("系统定位开启:" + result);
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
judgeIosPermission: judgeIosPermission,
|
||||
requestAndroidPermission: requestAndroidPermission,
|
||||
checkSystemEnableLocation: checkSystemEnableLocation,
|
||||
gotoAppPermissionSetting: gotoAppPermissionSetting
|
||||
}
|
||||
41
common/specSelect.js
Normal file
41
common/specSelect.js
Normal 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;
|
||||
}
|
||||
1578
common/style.css
Normal file
1578
common/style.css
Normal file
File diff suppressed because it is too large
Load Diff
1668
common/style.scss
Normal file
1668
common/style.scss
Normal file
File diff suppressed because it is too large
Load Diff
1458
common/uni.css
Normal file
1458
common/uni.css
Normal file
File diff suppressed because it is too large
Load Diff
171
common/utils.js
Normal file
171
common/utils.js
Normal 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;
|
||||
Reference in New Issue
Block a user