测试版
This commit is contained in:
15
.hbuilderx/launch.json
Normal file
15
.hbuilderx/launch.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"version" : "1.0",
|
||||
"configurations" : [
|
||||
{
|
||||
"default" : {
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"h5" : {
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"provider" : "aliyun",
|
||||
"type" : "uniCloud"
|
||||
}
|
||||
]
|
||||
}
|
||||
172
App.vue
Normal file
172
App.vue
Normal file
@@ -0,0 +1,172 @@
|
||||
<script>
|
||||
import { iap } from "@/utils/myIapCheck.js";
|
||||
import store from "@/store/index.js";
|
||||
import socket from "@/config/socket";
|
||||
// #ifdef H5
|
||||
import { h5Login } from "@/config/html5Utils";
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
import updata from "@/uni_modules/uni-upgrade-center-app/utils/check-update";
|
||||
// #endif
|
||||
|
||||
import Vue from "vue";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
platform: null, // 系统
|
||||
appRegisterMap: undefined,
|
||||
};
|
||||
},
|
||||
onLaunch: function() {
|
||||
// #ifdef APP-PLUS
|
||||
// 注册事件
|
||||
plus.globalEvent.addEventListener("plusMessage", this.plusMessageHandler);
|
||||
// #endif
|
||||
// 禁止横屏
|
||||
// #ifdef APP-PLUS
|
||||
plus.screen.lockOrientation("portrait-primary");
|
||||
// 检测自动更新
|
||||
updata();
|
||||
// #endif
|
||||
uni.getSystemInfo({
|
||||
success(res) {
|
||||
Vue.prototype.winWidth = res.screenWidth;
|
||||
Vue.prototype.winHeight = res.screenHeight;
|
||||
Vue.prototype.statusBarHeight = res.statusBarHeight;
|
||||
},
|
||||
});
|
||||
|
||||
//取出缓存数据
|
||||
store.commit("setCacheData");
|
||||
// #ifdef MP-WEIXIN
|
||||
if (store.state.userInfo.token) {
|
||||
socket.init();
|
||||
}
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
if (store.state.userInfo.token) {
|
||||
socket.init();
|
||||
} else {
|
||||
h5Login("force", () => {
|
||||
socket.init();
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
if (store.state.userInfo.token) {
|
||||
socket.init();
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
onShow: function(e) {
|
||||
// #ifdef APP-PLUS
|
||||
plus.screen.lockOrientation("portrait-primary");
|
||||
// 检测是否有未关闭苹果内购订单
|
||||
iap.getChannels()
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
//获取二维码携带的参数
|
||||
let scene = decodeURIComponent(e.query.scene);
|
||||
scene = scene.split("&");
|
||||
let data = {
|
||||
//场景值
|
||||
scene: e.scene,
|
||||
};
|
||||
scene.forEach((item) => {
|
||||
let arr = item.split("=");
|
||||
if (arr.length == 2) {
|
||||
data[arr[0]] = arr[1];
|
||||
}
|
||||
});
|
||||
store.commit("setChatScenesInfo", Object.assign(e.query, data));
|
||||
// #endif
|
||||
},
|
||||
onHide: function() {
|
||||
console.log('App Hide')
|
||||
},
|
||||
//页面销毁
|
||||
destroyed() {
|
||||
store.commit("setUserInfo", {
|
||||
playFlag: true,
|
||||
});
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import "@/uni_modules/uview-ui/index.scss";
|
||||
@import "@/uni_modules/uni-scss/index.scss";
|
||||
/* #ifndef APP-PLUS-NVUE */
|
||||
/* uni.css - 通用组件、模板样式库,可以当作一套ui库应用 */
|
||||
@import "@/static/uni.css";
|
||||
@import "@/static/customicons.css";
|
||||
@import "@/static/common.scss";
|
||||
|
||||
/* H5 兼容 pc 所需 */
|
||||
/* #ifdef H5 */
|
||||
@media screen and (min-width: 768px) {
|
||||
body {
|
||||
overflow-y: scroll;
|
||||
}
|
||||
}
|
||||
/deep/uni-page-body {
|
||||
background-color: $themeBgColor;
|
||||
min-height: 100% !important;
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
.uni-top-window uni-tabbar .uni-tabbar {
|
||||
background-color: #fff !important;
|
||||
}
|
||||
|
||||
.uni-app--showleftwindow .hideOnPc {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
/* 以下样式用于 hello uni-app 演示所需 */
|
||||
page {
|
||||
background-color: #eff5f8;
|
||||
height: 100%;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.fix-pc-padding {
|
||||
padding: 0 50px;
|
||||
}
|
||||
|
||||
.uni-header-logo {
|
||||
padding: 30rpx;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.uni-header-image {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.uni-hello-text {
|
||||
color: #7a7e83;
|
||||
}
|
||||
|
||||
.uni-hello-addfile {
|
||||
text-align: center;
|
||||
line-height: 300rpx;
|
||||
background: #fff;
|
||||
padding: 50rpx;
|
||||
margin-top: 10px;
|
||||
font-size: 38rpx;
|
||||
color: #808080;
|
||||
}
|
||||
|
||||
/* #endif*/
|
||||
|
||||
/deep/ .uni-tabbar__label {
|
||||
font-size: 12px !important; /* 修改 tabBar 文字大小 */
|
||||
}
|
||||
</style>
|
||||
|
||||
3
androidPrivacy.json
Normal file
3
androidPrivacy.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"prompt" : "template"
|
||||
}
|
||||
15
api/ip.js
Normal file
15
api/ip.js
Normal file
@@ -0,0 +1,15 @@
|
||||
export function getIP (data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: 'https://logger-data.csslcloud.net/api/detection',
|
||||
data,
|
||||
success: (res) => {
|
||||
if (res.error) {
|
||||
reject(res.data)
|
||||
} else {
|
||||
resolve(res.data)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
92
api/list.js
Normal file
92
api/list.js
Normal file
@@ -0,0 +1,92 @@
|
||||
import { baseInfo } from '../store/index.js'
|
||||
const localDataList = [{
|
||||
videoId: '7CDB7C3805062F7E753C612EB38A8D5A',
|
||||
videoTitle: '7CDB7C3805062F7E753C612EB38A8D5A',
|
||||
videoCover: 'https://4-img.bokecc.com/comimage/391E6E3340A00767/2019-05-13/2477AD327B256E5C9C33DC5901307461-1.jpg'
|
||||
|
||||
},{
|
||||
videoId: '17E1B738D75F78C63835A29B2A11961',
|
||||
videoTitle: '17E1B738D75F78C63835A29B2A11961',
|
||||
videoCover: 'https://4-img.bokecc.com/comimage/391E6E3340A00767/2019-05-13/2477AD327B256E5C9C33DC5901307461-1.jpg'
|
||||
},{
|
||||
videoId: '5D03190EE9C3F78CFC9558351D509E7C',
|
||||
videoTitle: '5D03190EE9C3F78CFC9558351D509E7C',
|
||||
videoCover: 'https://4-img.bokecc.com/comimage/391E6E3340A00767/2019-05-13/2477AD327B256E5C9C33DC5901307461-1.jpg'
|
||||
},
|
||||
{
|
||||
videoId: 'DDD7F00E720A8D8713358DE27D943A99',
|
||||
videoTitle: 'DDD7F00E720A8D8713358DE27D943A99',
|
||||
videoCover: 'https://4-img.bokecc.com/comimage/391E6E3340A00767/2019-05-13/2477AD327B256E5C9C33DC5901307461-1.jpg'
|
||||
}]
|
||||
|
||||
const listWidthUserId = [
|
||||
{
|
||||
userId: '2661F9756E5C832E',
|
||||
videoId: '67835AFD5375A87E7E6C9CEE8B422289',
|
||||
videoTitle: '数字人产品介绍视频',
|
||||
videoCover: 'http://5-img.bokecc.com/comimage/2661F9756E5C832E/2023-08-08/67835AFD5375A87E7E6C9CEE8B422289-1.jpg'
|
||||
},
|
||||
{
|
||||
userId: '2661F9756E5C832E',
|
||||
videoId: '016A4748BCF3EEF22BBA984E86119800',
|
||||
videoTitle: '3步PPT',
|
||||
videoCover: 'http://5-img.bokecc.com/comimage/2661F9756E5C832E/2023-11-24/016A4748BCF3EEF22BBA984E86119800-1.jpg'
|
||||
},
|
||||
{
|
||||
userId: '2661F9756E5C832E',
|
||||
videoId: '8D80E1FDDD31C8E52BBA984E86119800',
|
||||
videoTitle: 'ppt基础版合成-无音乐',
|
||||
videoCover: 'http://5-img.bokecc.com/comimage/2661F9756E5C832E/2024-02-27/8D80E1FDDD31C8E52BBA984E86119800-1.jpg'
|
||||
},
|
||||
{
|
||||
userId: '2661F9756E5C832E',
|
||||
videoId: '30CF0072C1E791DE63835A29B2A11961',
|
||||
videoTitle: '板书',
|
||||
videoCover: 'http://4-img.bokecc.com/comimage/2661F9756E5C832E/2023-11-24/30CF0072C1E791DE63835A29B2A11961-1.jpg'
|
||||
}
|
||||
]
|
||||
|
||||
const listWidthUserId2 = [
|
||||
{
|
||||
userId: '169A751C6B4BE3F6',
|
||||
videoId: '617B49BE28A32D61FC9558351D509E7C',
|
||||
videoTitle: '飞天·逐梦',
|
||||
videoCover: 'http://5-img.bokecc.com/comimage/169A751C6B4BE3F6/2023-11-17/617B49BE28A32D61FC9558351D509E7C-1.jpg'
|
||||
},
|
||||
{
|
||||
userId: '169A751C6B4BE3F6',
|
||||
videoId: '617B49BE28A32D610498CE5AAF1F53F5',
|
||||
videoTitle: '年度最走心广告',
|
||||
videoCover: 'http://5-img.bokecc.com/comimage/169A751C6B4BE3F6/2023-11-17/617B49BE28A32D610498CE5AAF1F53F5-1.jpg'
|
||||
},
|
||||
{
|
||||
userId: '169A751C6B4BE3F6',
|
||||
videoId: '617B49BE28A32D61B463AB73BD4C026B',
|
||||
videoTitle: '年少有为',
|
||||
videoCover: 'http://5-img.bokecc.com/comimage/169A751C6B4BE3F6/2023-11-17/617B49BE28A32D61B463AB73BD4C026B-1.jpg'
|
||||
},
|
||||
{
|
||||
userId: '169A751C6B4BE3F6',
|
||||
videoId: '8F1AF45ACE7571CBB463AB73BD4C026B',
|
||||
videoTitle: '少年-梦然',
|
||||
videoCover: 'http://5-img.bokecc.com/comimage/169A751C6B4BE3F6/2023-11-17/8F1AF45ACE7571CBB463AB73BD4C026B-1.jpg'
|
||||
}
|
||||
]
|
||||
|
||||
export function getList (callback) {
|
||||
uni.request({
|
||||
url: 'https://p.bokecc.com/demo/videoinfo.json',
|
||||
success: (res) => {
|
||||
if (res.statusCode === 200) {
|
||||
// ========== mock start ==========
|
||||
res.data = [].concat(listWidthUserId, listWidthUserId2)
|
||||
// ========== mock end ===========
|
||||
callback(res.data);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.errMsg
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
16
api/sid copy.js
Normal file
16
api/sid copy.js
Normal file
@@ -0,0 +1,16 @@
|
||||
export function getSid (data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: 'https://spark.bokecc.com/demo/app-api/sdk-sid.bo',
|
||||
data,
|
||||
success: (res) => {
|
||||
if (res.error) {
|
||||
reject(res.data)
|
||||
} else {
|
||||
console.log('request getSid', data, res)
|
||||
resolve(res.data)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
16
api/sid.js
Normal file
16
api/sid.js
Normal file
@@ -0,0 +1,16 @@
|
||||
export function getSid (data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: 'https://spark.bokecc.com/demo/app-api/sdk-sid.bo',
|
||||
data,
|
||||
success: (res) => {
|
||||
if (res.error) {
|
||||
reject(res.data)
|
||||
} else {
|
||||
console.log('request getSid', data, res)
|
||||
resolve(res.data)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
262
common/airport.js
Normal file
262
common/airport.js
Normal file
@@ -0,0 +1,262 @@
|
||||
export default {
|
||||
"list": [{
|
||||
"letter": "A",
|
||||
"data": [
|
||||
"阿克苏机场",
|
||||
"阿拉山口机场",
|
||||
"阿勒泰机场",
|
||||
"阿里昆莎机场",
|
||||
"安庆天柱山机场",
|
||||
"澳门国际机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "B",
|
||||
"data": [
|
||||
"保山机场",
|
||||
"包头机场",
|
||||
"北海福成机场",
|
||||
"北京南苑机场",
|
||||
"北京首都国际机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "C",
|
||||
"data": [
|
||||
"长白山机场",
|
||||
"长春龙嘉国际机场",
|
||||
"常德桃花源机场",
|
||||
"昌都邦达机场",
|
||||
"长沙黄花国际机场",
|
||||
"长治王村机场",
|
||||
"常州奔牛机场",
|
||||
"成都双流国际机场",
|
||||
"赤峰机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "D",
|
||||
"data": [
|
||||
"大理机场",
|
||||
"大连周水子国际机场",
|
||||
"大庆萨尔图机场",
|
||||
"大同东王庄机场",
|
||||
"达州河市机场",
|
||||
"丹东浪头机场",
|
||||
"德宏芒市机场",
|
||||
"迪庆香格里拉机场",
|
||||
"东营机场",
|
||||
"敦煌机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "E",
|
||||
"data": [
|
||||
"鄂尔多斯机场",
|
||||
"恩施许家坪机场",
|
||||
"二连浩特赛乌苏国际机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "F",
|
||||
"data": [
|
||||
"阜阳西关机场",
|
||||
"福州长乐国际机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "G",
|
||||
"data": [
|
||||
"赣州黄金机场",
|
||||
"格尔木机场",
|
||||
"固原六盘山机场",
|
||||
"广元盘龙机场",
|
||||
"广州白云国际机场",
|
||||
"桂林两江国际机场",
|
||||
"贵阳龙洞堡国际机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "H",
|
||||
"data": [
|
||||
"哈尔滨太平国际机场",
|
||||
"哈密机场",
|
||||
"海口美兰国际机场",
|
||||
"海拉尔东山国际机场",
|
||||
"邯郸机场",
|
||||
"汉中机场",
|
||||
"杭州萧山国际机场",
|
||||
"合肥骆岗国际机场",
|
||||
"和田机场",
|
||||
"黑河机场",
|
||||
"呼和浩特白塔国际机场",
|
||||
"淮安涟水机场",
|
||||
"黄山屯溪国际机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "I",
|
||||
"data": []
|
||||
}, {
|
||||
"letter": "J",
|
||||
"data": [
|
||||
"济南遥墙国际机场",
|
||||
"济宁曲阜机场",
|
||||
"鸡西兴凯湖机场",
|
||||
"佳木斯东郊机场",
|
||||
"嘉峪关机场",
|
||||
"锦州小岭子机场",
|
||||
"景德镇机场",
|
||||
"井冈山机场",
|
||||
"九江庐山机场",
|
||||
"九寨黄龙机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "K",
|
||||
"data": [
|
||||
"喀什机场",
|
||||
"克拉玛依机场",
|
||||
"库车龟兹机场",
|
||||
"库尔勒机场",
|
||||
"昆明巫家坝国际机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "L",
|
||||
"data": [
|
||||
"拉萨贡嘎机场",
|
||||
"兰州中川机场",
|
||||
"丽江三义机场",
|
||||
"黎平机场",
|
||||
"连云港白塔埠机场",
|
||||
"临沧机场",
|
||||
"临沂机场",
|
||||
"林芝米林机场",
|
||||
"柳州白莲机场",
|
||||
"龙岩冠豸山机场",
|
||||
"泸州蓝田机场",
|
||||
"洛阳北郊机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "M",
|
||||
"data": [
|
||||
"满洲里西郊机场",
|
||||
"绵阳南郊机场",
|
||||
"漠河古莲机场",
|
||||
"牡丹江海浪机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "N",
|
||||
"data": [
|
||||
"南昌昌北国际机场",
|
||||
"南充高坪机场",
|
||||
"南京禄口国际机场",
|
||||
"南宁吴圩机场",
|
||||
"南通兴东机场",
|
||||
"南阳姜营机场",
|
||||
"宁波栎社国际机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "O",
|
||||
"data": []
|
||||
}, {
|
||||
"letter": "P",
|
||||
"data": [
|
||||
"普洱思茅机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "Q",
|
||||
"data": [
|
||||
"齐齐哈尔三家子机场",
|
||||
"秦皇岛山海关机场",
|
||||
"青岛流亭国际机场",
|
||||
"衢州机场",
|
||||
"泉州晋江机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "R",
|
||||
"data": [
|
||||
"日喀则和平机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "S",
|
||||
"data": [
|
||||
"三亚凤凰国际机场",
|
||||
"汕头外砂机场",
|
||||
"上海虹桥国际机场",
|
||||
"上海浦东国际机场",
|
||||
"深圳宝安国际机场",
|
||||
"沈阳桃仙国际机场",
|
||||
"石家庄正定国际机场",
|
||||
"苏南硕放国际机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "T",
|
||||
"data": [
|
||||
"塔城机场",
|
||||
"太原武宿国际机场",
|
||||
"台州路桥机场 (黄岩机场)",
|
||||
"唐山三女河机场",
|
||||
"腾冲驼峰机场",
|
||||
"天津滨海国际机场",
|
||||
"通辽机场",
|
||||
"铜仁凤凰机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "U",
|
||||
"data": []
|
||||
}, {
|
||||
"letter": "V",
|
||||
"data": []
|
||||
}, {
|
||||
"letter": "W",
|
||||
"data": [
|
||||
"万州五桥机场",
|
||||
"潍坊机场",
|
||||
"威海大水泊机场",
|
||||
"文山普者黑机场",
|
||||
"温州永强国际机场",
|
||||
"乌海机场",
|
||||
"武汉天河国际机场",
|
||||
"乌兰浩特机场",
|
||||
"乌鲁木齐地窝堡国际机场",
|
||||
"武夷山机场",
|
||||
"梧州长洲岛机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "X",
|
||||
"data": [
|
||||
"西安咸阳国际机场",
|
||||
"西昌青山机场",
|
||||
"锡林浩特机场",
|
||||
"西宁曹家堡机场",
|
||||
"西双版纳嘎洒机场",
|
||||
"厦门高崎国际机场",
|
||||
"香港国际机场",
|
||||
"襄阳刘集机场",
|
||||
"兴义机场",
|
||||
"徐州观音机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "Y",
|
||||
"data": [
|
||||
"延安二十里堡机场",
|
||||
"盐城机场",
|
||||
"延吉朝阳川机场",
|
||||
"烟台莱山国际机场",
|
||||
"宜宾菜坝机场",
|
||||
"宜昌三峡机场",
|
||||
"伊春林都机场",
|
||||
"伊宁机场",
|
||||
"义乌机场",
|
||||
"银川河东机场",
|
||||
"永州零陵机场",
|
||||
"榆林榆阳机场",
|
||||
"玉树巴塘机场",
|
||||
"运城张孝机场"
|
||||
]
|
||||
}, {
|
||||
"letter": "Z",
|
||||
"data": [
|
||||
"湛江机场",
|
||||
"昭通机场",
|
||||
"郑州新郑国际机场",
|
||||
"芷江机场",
|
||||
"重庆江北国际机场",
|
||||
"中卫香山机场",
|
||||
"舟山朱家尖机场",
|
||||
"珠海三灶机场"
|
||||
]
|
||||
}]
|
||||
}
|
||||
142
common/commonJS.js
Normal file
142
common/commonJS.js
Normal file
@@ -0,0 +1,142 @@
|
||||
|
||||
import uniCopy from '@/js_sdk/xb-copy/uni-copy.js'
|
||||
import $http from '@/config/requestConfig'
|
||||
import { mapState, mapMutations } from "vuex";
|
||||
|
||||
export default {
|
||||
...mapMutations(["setUserInfo"]),
|
||||
|
||||
showToast(title, icon) {
|
||||
return uni.showToast({
|
||||
title: title,
|
||||
icon: icon ? icon : 'none'
|
||||
})
|
||||
},
|
||||
//拨打电话
|
||||
handleMakingPhoneCalls(value, title) {
|
||||
uni.showModal({
|
||||
title: title ? title : '联系我们',
|
||||
content: value,
|
||||
confirmText: '确认',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: value, //电话号码
|
||||
success: function (e) {
|
||||
console.log(e);
|
||||
},
|
||||
fail: function (e) {
|
||||
console.log(e);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//复制内容
|
||||
handleCopy(value, title) {
|
||||
uniCopy({
|
||||
content: value,
|
||||
success: (res) => {
|
||||
uni.showToast({
|
||||
title: title + '复制成功',
|
||||
icon: 'none'
|
||||
})
|
||||
},
|
||||
error: (e) => {
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
//用户协议
|
||||
async getAgreement(id) {
|
||||
console.log('id at line 56:', id)
|
||||
var data = {
|
||||
id: id
|
||||
}
|
||||
var result = {
|
||||
title:'',
|
||||
content:''
|
||||
}
|
||||
await $http
|
||||
.request({
|
||||
url: "sys/agreement/getAgreement",
|
||||
method: "POST",
|
||||
data: data,
|
||||
header: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}).then((res) => {
|
||||
console.log('res at line 111:', res)
|
||||
if (res.code == 0) {
|
||||
result = res.agreement
|
||||
}
|
||||
|
||||
})
|
||||
return result
|
||||
},
|
||||
async getCheckCourseStatus(data) {
|
||||
var result
|
||||
await $http
|
||||
.post('app/phone.do?getCheckCourseStatus', {
|
||||
customerType
|
||||
:
|
||||
"D",
|
||||
token
|
||||
: uni.getStorageSync("token")
|
||||
,
|
||||
customerOid
|
||||
: uni.getStorageSync("customerOid"),
|
||||
oid: data.oid
|
||||
})
|
||||
.then(async res => {
|
||||
result = res.obj
|
||||
})
|
||||
return result
|
||||
},
|
||||
// 退出登录
|
||||
signOut() {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "确定要退出当前账户吗?",
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
setUserInfo({ token: null });
|
||||
uni.reLaunch({
|
||||
url: "/pages/user/login",
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
// 取消操作
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
// 注销账户
|
||||
logout() {
|
||||
let that = this;
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "确定要注销当前账户吗?",
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
showCancel: false,
|
||||
content: `注销申请已提交成功,请联系客服进行后续操作:022-24142321`,
|
||||
success: function (res1) {
|
||||
if (res1.confirm) {
|
||||
that.signOut();
|
||||
}
|
||||
},
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
// 取消操作
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
|
||||
29
common/debounce.js
Normal file
29
common/debounce.js
Normal file
@@ -0,0 +1,29 @@
|
||||
let timeout = null
|
||||
|
||||
/**
|
||||
* 防抖原理:一定时间内,只有最后一次操作,再过wait毫秒后才执行函数
|
||||
*
|
||||
* @param {Function} func 要执行的回调函数
|
||||
* @param {Number} wait 延时的时间
|
||||
* @param {Boolean} immediate 是否立即执行
|
||||
* @return null
|
||||
*/
|
||||
function debounce(func, wait = 500, immediate = false) {
|
||||
// 清除定时器
|
||||
if (timeout !== null) clearTimeout(timeout)
|
||||
// 立即执行,此类情况一般用不到
|
||||
if (immediate) {
|
||||
const callNow = !timeout
|
||||
timeout = setTimeout(() => {
|
||||
timeout = null
|
||||
}, wait)
|
||||
if (callNow) typeof func === 'function' && func()
|
||||
} else {
|
||||
// 设置定时器,当最后一次操作后,timeout不会再被清除,所以在延时wait毫秒后执行func回调方法
|
||||
timeout = setTimeout(() => {
|
||||
typeof func === 'function' && func()
|
||||
}, wait)
|
||||
}
|
||||
}
|
||||
|
||||
export default debounce
|
||||
97
common/graceChecker.js
Normal file
97
common/graceChecker.js
Normal file
@@ -0,0 +1,97 @@
|
||||
/**
|
||||
数据验证(表单验证)
|
||||
来自 grace.hcoder.net
|
||||
作者 hcoder 深海
|
||||
*/
|
||||
export default {
|
||||
error:'',
|
||||
check : function (data, rule){
|
||||
for(var i = 0; i < rule.length; i++){
|
||||
if (!rule[i].checkType){return true;}
|
||||
if (!rule[i].name) {return true;}
|
||||
if (!rule[i].errorMsg) {return true;}
|
||||
if (!data[rule[i].name]) {this.error = rule[i].errorMsg; return false;}
|
||||
switch (rule[i].checkType){
|
||||
case 'string':
|
||||
var reg = new RegExp('^.{' + rule[i].checkRule + '}$');
|
||||
if(!reg.test(data[rule[i].name])) {this.error = rule[i].errorMsg; return false;}
|
||||
break;
|
||||
case 'int':
|
||||
var reg = new RegExp('^(-[1-9]|[1-9])[0-9]{' + rule[i].checkRule + '}$');
|
||||
if(!reg.test(data[rule[i].name])) {this.error = rule[i].errorMsg; return false;}
|
||||
break;
|
||||
break;
|
||||
case 'between':
|
||||
if (!this.isNumber(data[rule[i].name])){
|
||||
this.error = rule[i].errorMsg;
|
||||
return false;
|
||||
}
|
||||
var minMax = rule[i].checkRule.split(',');
|
||||
minMax[0] = Number(minMax[0]);
|
||||
minMax[1] = Number(minMax[1]);
|
||||
if (data[rule[i].name] > minMax[1] || data[rule[i].name] < minMax[0]) {
|
||||
this.error = rule[i].errorMsg;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'betweenD':
|
||||
var reg = /^-?[1-9][0-9]?$/;
|
||||
if (!reg.test(data[rule[i].name])) { this.error = rule[i].errorMsg; return false; }
|
||||
var minMax = rule[i].checkRule.split(',');
|
||||
minMax[0] = Number(minMax[0]);
|
||||
minMax[1] = Number(minMax[1]);
|
||||
if (data[rule[i].name] > minMax[1] || data[rule[i].name] < minMax[0]) {
|
||||
this.error = rule[i].errorMsg;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'betweenF':
|
||||
var reg = /^-?[0-9][0-9]?.+[0-9]+$/;
|
||||
if (!reg.test(data[rule[i].name])){this.error = rule[i].errorMsg; return false;}
|
||||
var minMax = rule[i].checkRule.split(',');
|
||||
minMax[0] = Number(minMax[0]);
|
||||
minMax[1] = Number(minMax[1]);
|
||||
if (data[rule[i].name] > minMax[1] || data[rule[i].name] < minMax[0]) {
|
||||
this.error = rule[i].errorMsg;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'same':
|
||||
if (data[rule[i].name] != rule[i].checkRule) { this.error = rule[i].errorMsg; return false;}
|
||||
break;
|
||||
case 'notsame':
|
||||
if (data[rule[i].name] == rule[i].checkRule) { this.error = rule[i].errorMsg; return false; }
|
||||
break;
|
||||
case 'email':
|
||||
var reg = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
|
||||
if (!reg.test(data[rule[i].name])) { this.error = rule[i].errorMsg; return false; }
|
||||
break;
|
||||
case 'phoneno':
|
||||
var reg = /^1[0-9]{10,10}$/;
|
||||
if (!reg.test(data[rule[i].name])) { this.error = rule[i].errorMsg; return false; }
|
||||
break;
|
||||
case 'zipcode':
|
||||
var reg = /^[0-9]{6}$/;
|
||||
if (!reg.test(data[rule[i].name])) { this.error = rule[i].errorMsg; return false; }
|
||||
break;
|
||||
case 'reg':
|
||||
var reg = new RegExp(rule[i].checkRule);
|
||||
if (!reg.test(data[rule[i].name])) { this.error = rule[i].errorMsg; return false; }
|
||||
break;
|
||||
case 'in':
|
||||
if(rule[i].checkRule.indexOf(data[rule[i].name]) == -1){
|
||||
this.error = rule[i].errorMsg; return false;
|
||||
}
|
||||
break;
|
||||
case 'notnull':
|
||||
if(data[rule[i].name] == null || data[rule[i].name].length < 1){this.error = rule[i].errorMsg; return false;}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
isNumber : function (checkVal){
|
||||
var reg = /^-?[1-9][0-9]?.?[0-9]*$/;
|
||||
return reg.test(checkVal);
|
||||
}
|
||||
}
|
||||
352
common/html-parser.js
Normal file
352
common/html-parser.js
Normal file
@@ -0,0 +1,352 @@
|
||||
/*
|
||||
* HTML5 Parser By Sam Blowes
|
||||
*
|
||||
* Designed for HTML5 documents
|
||||
*
|
||||
* Original code by John Resig (ejohn.org)
|
||||
* http://ejohn.org/blog/pure-javascript-html-parser/
|
||||
* Original code by Erik Arvidsson, Mozilla Public License
|
||||
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
* License
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* This code is triple licensed using Apache Software License 2.0,
|
||||
* Mozilla Public License or GNU Public License
|
||||
*
|
||||
* ////////////////////////////////////////////////////////////////////////////
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* ////////////////////////////////////////////////////////////////////////////
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Simple HTML Parser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Erik Arvidsson.
|
||||
* Portions created by Erik Arvidssson are Copyright (C) 2004. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
* ////////////////////////////////////////////////////////////////////////////
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
* Usage
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* // Use like so:
|
||||
* HTMLParser(htmlString, {
|
||||
* start: function(tag, attrs, unary) {},
|
||||
* end: function(tag) {},
|
||||
* chars: function(text) {},
|
||||
* comment: function(text) {}
|
||||
* });
|
||||
*
|
||||
* // or to get an XML string:
|
||||
* HTMLtoXML(htmlString);
|
||||
*
|
||||
* // or to get an XML DOM Document
|
||||
* HTMLtoDOM(htmlString);
|
||||
*
|
||||
* // or to inject into an existing document/DOM node
|
||||
* HTMLtoDOM(htmlString, document);
|
||||
* HTMLtoDOM(htmlString, document.body);
|
||||
*
|
||||
*/
|
||||
// Regular Expressions for parsing tags and attributes
|
||||
var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
|
||||
var endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/;
|
||||
var attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; // Empty Elements - HTML 5
|
||||
|
||||
var empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr'); // Block Elements - HTML 5
|
||||
// fixed by xxx 将 ins 标签从块级名单中移除
|
||||
|
||||
var block = makeMap('a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video'); // Inline Elements - HTML 5
|
||||
|
||||
var inline = makeMap('abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'); // Elements that you can, intentionally, leave open
|
||||
// (and which close themselves)
|
||||
|
||||
var closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'); // Attributes that have their values filled in disabled="disabled"
|
||||
|
||||
var fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'); // Special Elements (can contain anything)
|
||||
|
||||
var special = makeMap('script,style');
|
||||
function HTMLParser(html, handler) {
|
||||
var index;
|
||||
var chars;
|
||||
var match;
|
||||
var stack = [];
|
||||
var last = html;
|
||||
|
||||
stack.last = function () {
|
||||
return this[this.length - 1];
|
||||
};
|
||||
|
||||
while (html) {
|
||||
chars = true; // Make sure we're not in a script or style element
|
||||
|
||||
if (!stack.last() || !special[stack.last()]) {
|
||||
// Comment
|
||||
if (html.indexOf('<!--') == 0) {
|
||||
index = html.indexOf('-->');
|
||||
|
||||
if (index >= 0) {
|
||||
if (handler.comment) {
|
||||
handler.comment(html.substring(4, index));
|
||||
}
|
||||
|
||||
html = html.substring(index + 3);
|
||||
chars = false;
|
||||
} // end tag
|
||||
|
||||
} else if (html.indexOf('</') == 0) {
|
||||
match = html.match(endTag);
|
||||
|
||||
if (match) {
|
||||
html = html.substring(match[0].length);
|
||||
match[0].replace(endTag, parseEndTag);
|
||||
chars = false;
|
||||
} // start tag
|
||||
|
||||
} else if (html.indexOf('<') == 0) {
|
||||
match = html.match(startTag);
|
||||
|
||||
if (match) {
|
||||
html = html.substring(match[0].length);
|
||||
match[0].replace(startTag, parseStartTag);
|
||||
chars = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (chars) {
|
||||
index = html.indexOf('<');
|
||||
var text = index < 0 ? html : html.substring(0, index);
|
||||
html = index < 0 ? '' : html.substring(index);
|
||||
|
||||
if (handler.chars) {
|
||||
handler.chars(text);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
html = html.replace(new RegExp('([\\s\\S]*?)<\/' + stack.last() + '[^>]*>'), function (all, text) {
|
||||
text = text.replace(/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g, '$1$2');
|
||||
|
||||
if (handler.chars) {
|
||||
handler.chars(text);
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
parseEndTag('', stack.last());
|
||||
}
|
||||
|
||||
if (html == last) {
|
||||
throw 'Parse Error: ' + html;
|
||||
}
|
||||
|
||||
last = html;
|
||||
} // Clean up any remaining tags
|
||||
|
||||
|
||||
parseEndTag();
|
||||
|
||||
function parseStartTag(tag, tagName, rest, unary) {
|
||||
tagName = tagName.toLowerCase();
|
||||
|
||||
if (block[tagName]) {
|
||||
while (stack.last() && inline[stack.last()]) {
|
||||
parseEndTag('', stack.last());
|
||||
}
|
||||
}
|
||||
|
||||
if (closeSelf[tagName] && stack.last() == tagName) {
|
||||
parseEndTag('', tagName);
|
||||
}
|
||||
|
||||
unary = empty[tagName] || !!unary;
|
||||
|
||||
if (!unary) {
|
||||
stack.push(tagName);
|
||||
}
|
||||
|
||||
if (handler.start) {
|
||||
var attrs = [];
|
||||
rest.replace(attr, function (match, name) {
|
||||
var value = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : fillAttrs[name] ? name : '';
|
||||
attrs.push({
|
||||
name: name,
|
||||
value: value,
|
||||
escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') // "
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
if (handler.start) {
|
||||
handler.start(tagName, attrs, unary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function parseEndTag(tag, tagName) {
|
||||
// If no tag name is provided, clean shop
|
||||
if (!tagName) {
|
||||
var pos = 0;
|
||||
} // Find the closest opened tag of the same type
|
||||
else {
|
||||
for (var pos = stack.length - 1; pos >= 0; pos--) {
|
||||
if (stack[pos] == tagName) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pos >= 0) {
|
||||
// Close all the open elements, up the stack
|
||||
for (var i = stack.length - 1; i >= pos; i--) {
|
||||
if (handler.end) {
|
||||
handler.end(stack[i]);
|
||||
}
|
||||
} // Remove the open elements from the stack
|
||||
|
||||
|
||||
stack.length = pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function makeMap(str) {
|
||||
var obj = {};
|
||||
var items = str.split(',');
|
||||
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
obj[items[i]] = true;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function removeDOCTYPE(html) {
|
||||
return html.replace(/<\?xml.*\?>\n/, '').replace(/<!doctype.*>\n/, '').replace(/<!DOCTYPE.*>\n/, '');
|
||||
}
|
||||
|
||||
function parseAttrs(attrs) {
|
||||
return attrs.reduce(function (pre, attr) {
|
||||
var value = attr.value;
|
||||
var name = attr.name;
|
||||
|
||||
if (pre[name]) {
|
||||
pre[name] = pre[name] + " " + value;
|
||||
} else {
|
||||
pre[name] = value;
|
||||
}
|
||||
|
||||
return pre;
|
||||
}, {});
|
||||
}
|
||||
|
||||
function parseHtml(html) {
|
||||
html = removeDOCTYPE(html);
|
||||
var stacks = [];
|
||||
var results = {
|
||||
node: 'root',
|
||||
children: []
|
||||
};
|
||||
HTMLParser(html, {
|
||||
start: function start(tag, attrs, unary) {
|
||||
var node = {
|
||||
name: tag
|
||||
};
|
||||
|
||||
if (attrs.length !== 0) {
|
||||
node.attrs = parseAttrs(attrs);
|
||||
}
|
||||
|
||||
if (unary) {
|
||||
var parent = stacks[0] || results;
|
||||
|
||||
if (!parent.children) {
|
||||
parent.children = [];
|
||||
}
|
||||
|
||||
parent.children.push(node);
|
||||
} else {
|
||||
stacks.unshift(node);
|
||||
}
|
||||
},
|
||||
end: function end(tag) {
|
||||
var node = stacks.shift();
|
||||
if (node.name !== tag) console.error('invalid state: mismatch end tag');
|
||||
|
||||
if (stacks.length === 0) {
|
||||
results.children.push(node);
|
||||
} else {
|
||||
var parent = stacks[0];
|
||||
|
||||
if (!parent.children) {
|
||||
parent.children = [];
|
||||
}
|
||||
|
||||
parent.children.push(node);
|
||||
}
|
||||
},
|
||||
chars: function chars(text) {
|
||||
var node = {
|
||||
type: 'text',
|
||||
text: text
|
||||
};
|
||||
|
||||
if (stacks.length === 0) {
|
||||
results.children.push(node);
|
||||
} else {
|
||||
var parent = stacks[0];
|
||||
|
||||
if (!parent.children) {
|
||||
parent.children = [];
|
||||
}
|
||||
|
||||
parent.children.push(node);
|
||||
}
|
||||
},
|
||||
comment: function comment(text) {
|
||||
var node = {
|
||||
node: 'comment',
|
||||
text: text
|
||||
};
|
||||
var parent = stacks[0];
|
||||
|
||||
if (!parent.children) {
|
||||
parent.children = [];
|
||||
}
|
||||
|
||||
parent.children.push(node);
|
||||
}
|
||||
});
|
||||
return results.children;
|
||||
}
|
||||
|
||||
export default parseHtml;
|
||||
245
common/permission.js
Normal file
245
common/permission.js
Normal file
@@ -0,0 +1,245 @@
|
||||
/// null = 未请求,1 = 已允许,0 = 拒绝|受限, 2 = 系统未开启
|
||||
|
||||
var isIOS
|
||||
|
||||
function album() {
|
||||
var result = 0;
|
||||
var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary");
|
||||
var authStatus = PHPhotoLibrary.authorizationStatus();
|
||||
if (authStatus === 0) {
|
||||
result = null;
|
||||
} else if (authStatus == 3) {
|
||||
result = 1;
|
||||
} else {
|
||||
result = 0;
|
||||
}
|
||||
plus.ios.deleteObject(PHPhotoLibrary);
|
||||
return result;
|
||||
}
|
||||
|
||||
function camera() {
|
||||
var result = 0;
|
||||
var AVCaptureDevice = plus.ios.import("AVCaptureDevice");
|
||||
var authStatus = AVCaptureDevice.authorizationStatusForMediaType('vide');
|
||||
if (authStatus === 0) {
|
||||
result = null;
|
||||
} else if (authStatus == 3) {
|
||||
result = 1;
|
||||
} else {
|
||||
result = 0;
|
||||
}
|
||||
plus.ios.deleteObject(AVCaptureDevice);
|
||||
return result;
|
||||
}
|
||||
|
||||
function location() {
|
||||
var result = 0;
|
||||
var cllocationManger = plus.ios.import("CLLocationManager");
|
||||
var enable = cllocationManger.locationServicesEnabled();
|
||||
var status = cllocationManger.authorizationStatus();
|
||||
if (!enable) {
|
||||
result = 2;
|
||||
} else if (status === 0) {
|
||||
result = null;
|
||||
} else if (status === 3 || status === 4) {
|
||||
result = 1;
|
||||
} else {
|
||||
result = 0;
|
||||
}
|
||||
plus.ios.deleteObject(cllocationManger);
|
||||
return result;
|
||||
}
|
||||
|
||||
function push() {
|
||||
var result = 0;
|
||||
var UIApplication = plus.ios.import("UIApplication");
|
||||
var app = UIApplication.sharedApplication();
|
||||
var enabledTypes = 0;
|
||||
if (app.currentUserNotificationSettings) {
|
||||
var settings = app.currentUserNotificationSettings();
|
||||
enabledTypes = settings.plusGetAttribute("types");
|
||||
if (enabledTypes == 0) {
|
||||
result = 0;
|
||||
console.log("推送权限没有开启");
|
||||
} else {
|
||||
result = 1;
|
||||
console.log("已经开启推送功能!")
|
||||
}
|
||||
plus.ios.deleteObject(settings);
|
||||
} else {
|
||||
enabledTypes = app.enabledRemoteNotificationTypes();
|
||||
if (enabledTypes == 0) {
|
||||
result = 3;
|
||||
console.log("推送权限没有开启!");
|
||||
} else {
|
||||
result = 4;
|
||||
console.log("已经开启推送功能!")
|
||||
}
|
||||
}
|
||||
plus.ios.deleteObject(app);
|
||||
plus.ios.deleteObject(UIApplication);
|
||||
return result;
|
||||
}
|
||||
|
||||
function contact() {
|
||||
var result = 0;
|
||||
var CNContactStore = plus.ios.import("CNContactStore");
|
||||
var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0);
|
||||
if (cnAuthStatus === 0) {
|
||||
result = null;
|
||||
} else if (cnAuthStatus == 3) {
|
||||
result = 1;
|
||||
} else {
|
||||
result = 0;
|
||||
}
|
||||
plus.ios.deleteObject(CNContactStore);
|
||||
return result;
|
||||
}
|
||||
|
||||
function record() {
|
||||
var result = null;
|
||||
var avaudiosession = plus.ios.import("AVAudioSession");
|
||||
var avaudio = avaudiosession.sharedInstance();
|
||||
var status = avaudio.recordPermission();
|
||||
console.log("permissionStatus:" + status);
|
||||
if (status === 1970168948) {
|
||||
result = null;
|
||||
} else if (status === 1735552628) {
|
||||
result = 1;
|
||||
} else {
|
||||
result = 0;
|
||||
}
|
||||
plus.ios.deleteObject(avaudiosession);
|
||||
return result;
|
||||
}
|
||||
|
||||
function calendar() {
|
||||
var result = null;
|
||||
var EKEventStore = plus.ios.import("EKEventStore");
|
||||
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0);
|
||||
if (ekAuthStatus == 3) {
|
||||
result = 1;
|
||||
console.log("日历权限已经开启");
|
||||
} else {
|
||||
console.log("日历权限没有开启");
|
||||
}
|
||||
plus.ios.deleteObject(EKEventStore);
|
||||
return result;
|
||||
}
|
||||
|
||||
function memo() {
|
||||
var result = null;
|
||||
var EKEventStore = plus.ios.import("EKEventStore");
|
||||
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1);
|
||||
if (ekAuthStatus == 3) {
|
||||
result = 1;
|
||||
console.log("备忘录权限已经开启");
|
||||
} else {
|
||||
console.log("备忘录权限没有开启");
|
||||
}
|
||||
plus.ios.deleteObject(EKEventStore);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
function requestIOS(permissionID) {
|
||||
return new Promise((resolve, reject) => {
|
||||
switch (permissionID) {
|
||||
case "push":
|
||||
resolve(push());
|
||||
break;
|
||||
case "location":
|
||||
resolve(location());
|
||||
break;
|
||||
case "record":
|
||||
resolve(record());
|
||||
break;
|
||||
case "camera":
|
||||
resolve(camera());
|
||||
break;
|
||||
case "album":
|
||||
resolve(album());
|
||||
break;
|
||||
case "contact":
|
||||
resolve(contact());
|
||||
break;
|
||||
case "calendar":
|
||||
resolve(calendar());
|
||||
break;
|
||||
case "memo":
|
||||
resolve(memo());
|
||||
break;
|
||||
default:
|
||||
resolve(0);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function requestAndroid(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);
|
||||
},
|
||||
function(error) {
|
||||
console.log('result error: ' + error.message)
|
||||
resolve({
|
||||
code: error.code,
|
||||
message: error.message
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function gotoAppPermissionSetting() {
|
||||
if (permission.isIOS) {
|
||||
var UIApplication = plus.ios.import("UIApplication");
|
||||
var application2 = UIApplication.sharedApplication();
|
||||
var NSURL2 = plus.ios.import("NSURL");
|
||||
var setting2 = NSURL2.URLWithString("app-settings:");
|
||||
application2.openURL(setting2);
|
||||
plus.ios.deleteObject(setting2);
|
||||
plus.ios.deleteObject(NSURL2);
|
||||
plus.ios.deleteObject(application2);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
const permission = {
|
||||
get isIOS(){
|
||||
return typeof isIOS === 'boolean' ? isIOS : (isIOS = uni.getSystemInfoSync().platform === 'ios')
|
||||
},
|
||||
requestIOS: requestIOS,
|
||||
requestAndroid: requestAndroid,
|
||||
gotoAppSetting: gotoAppPermissionSetting
|
||||
}
|
||||
|
||||
export default permission
|
||||
136
common/uni-nvue.css
Normal file
136
common/uni-nvue.css
Normal file
@@ -0,0 +1,136 @@
|
||||
/* #ifndef APP-PLUS-NVUE */
|
||||
page {
|
||||
min-height: 100%;
|
||||
height: auto;
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
/* 解决头条小程序字体图标不显示问题,因为头条运行时自动插入了span标签,且有全局字体 */
|
||||
/* #ifdef MP-TOUTIAO */
|
||||
/* text :not(view) {
|
||||
font-family: uniicons;
|
||||
} */
|
||||
/* #endif */
|
||||
|
||||
.uni-icon {
|
||||
font-family: uniicons;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.uni-container {
|
||||
padding: 15px;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
.uni-header-logo {
|
||||
/* #ifdef H5 */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
padding: 15px 15px;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.uni-header-image {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
.uni-hello-text {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.hello-text {
|
||||
color: #7A7E83;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.hello-link {
|
||||
color: #7A7E83;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.uni-panel {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.uni-panel-h {
|
||||
/* #ifdef H5 */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
background-color: #ffffff;
|
||||
flex-direction: row !important;
|
||||
/* justify-content: space-between !important; */
|
||||
align-items: center !important;
|
||||
padding: 12px;
|
||||
/* #ifdef H5 */
|
||||
cursor: pointer;
|
||||
/* #endif */
|
||||
}
|
||||
/*
|
||||
.uni-panel-h:active {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
*/
|
||||
.uni-panel-h-on {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.uni-panel-text {
|
||||
flex: 1;
|
||||
color: #000000;
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.uni-panel-icon {
|
||||
margin-left: 15px;
|
||||
color: #999999;
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
transform: rotate(0deg);
|
||||
transition-duration: 0s;
|
||||
transition-property: transform;
|
||||
}
|
||||
|
||||
.uni-panel-icon-on {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.uni-navigate-item {
|
||||
/* #ifdef H5 */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
background-color: #FFFFFF;
|
||||
border-top-style: solid;
|
||||
border-top-color: #f5f5f5;
|
||||
border-top-width: 1px;
|
||||
padding: 12px;
|
||||
/* #ifdef H5 */
|
||||
cursor: pointer;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.uni-navigate-item:active {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
.uni-navigate-text {
|
||||
flex: 1;
|
||||
color: #000000;
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.uni-navigate-icon {
|
||||
margin-left: 15px;
|
||||
color: #999999;
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
}
|
||||
1458
common/uni.css
Normal file
1458
common/uni.css
Normal file
File diff suppressed because it is too large
Load Diff
75
common/util.js
Normal file
75
common/util.js
Normal file
@@ -0,0 +1,75 @@
|
||||
|
||||
|
||||
function formatTime(time) {
|
||||
if (typeof time !== 'number' || time < 0) {
|
||||
return time
|
||||
}
|
||||
|
||||
var hour = parseInt(time / 3600)
|
||||
time = time % 3600
|
||||
var minute = parseInt(time / 60)
|
||||
time = time % 60
|
||||
var second = time
|
||||
|
||||
return ([hour, minute, second]).map(function (n) {
|
||||
n = n.toString()
|
||||
return n[1] ? n : '0' + n
|
||||
}).join(':')
|
||||
}
|
||||
|
||||
function formatLocation(longitude, latitude) {
|
||||
if (typeof longitude === 'string' && typeof latitude === 'string') {
|
||||
longitude = parseFloat(longitude)
|
||||
latitude = parseFloat(latitude)
|
||||
}
|
||||
|
||||
longitude = longitude.toFixed(2)
|
||||
latitude = latitude.toFixed(2)
|
||||
|
||||
return {
|
||||
longitude: longitude.toString().split('.'),
|
||||
latitude: latitude.toString().split('.')
|
||||
}
|
||||
}
|
||||
var dateUtils = {
|
||||
UNITS: {
|
||||
'年': 31557600000,
|
||||
'月': 2629800000,
|
||||
'天': 86400000,
|
||||
'小时': 3600000,
|
||||
'分钟': 60000,
|
||||
'秒': 1000
|
||||
},
|
||||
humanize: function (milliseconds) {
|
||||
var humanize = '';
|
||||
for (var key in this.UNITS) {
|
||||
if (milliseconds >= this.UNITS[key]) {
|
||||
humanize = Math.floor(milliseconds / this.UNITS[key]) + key + '前';
|
||||
break;
|
||||
}
|
||||
}
|
||||
return humanize || '刚刚';
|
||||
},
|
||||
format: function (dateStr) {
|
||||
var date = this.parse(dateStr)
|
||||
var diff = Date.now() - date.getTime();
|
||||
if (diff < this.UNITS['天']) {
|
||||
return this.humanize(diff);
|
||||
}
|
||||
var _format = function (number) {
|
||||
return (number < 10 ? ('0' + number) : number);
|
||||
};
|
||||
return date.getFullYear() + '/' + _format(date.getMonth() + 1) + '/' + _format(date.getDate()) + '-' +
|
||||
_format(date.getHours()) + ':' + _format(date.getMinutes());
|
||||
},
|
||||
parse: function (str) { //将"yyyy-mm-dd HH:MM:ss"格式的字符串,转化为一个Date对象
|
||||
var a = str.split(/[^0-9]/);
|
||||
return new Date(a[0], a[1] - 1, a[2], a[3], a[4], a[5]);
|
||||
}
|
||||
};
|
||||
|
||||
export {
|
||||
formatTime,
|
||||
formatLocation,
|
||||
dateUtils
|
||||
}
|
||||
52
config/baseUrl.js
Normal file
52
config/baseUrl.js
Normal file
@@ -0,0 +1,52 @@
|
||||
let baseUrl = "";
|
||||
let socketUrl = "";
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// 开发环境
|
||||
//baseUrl = "http://192.168.110.100:9200/pb/"; // 张川川
|
||||
baseUrl = "https://api.nuttyreading.com/"; //线上正式
|
||||
} else if (process.env.NODE_ENV === 'production') {
|
||||
//baseUrl = "http://192.168.110.100:9200/pb/"; // 张川川
|
||||
baseUrl = "https://api.nuttyreading.com/"; //线上正式
|
||||
}
|
||||
const courtConfig = {
|
||||
//微信公众号APPID
|
||||
publicAppId: "",
|
||||
//请求接口
|
||||
baseUrl: baseUrl,
|
||||
//webSocket地址
|
||||
socketUrl: socketUrl,
|
||||
//平台名称
|
||||
platformName: "uniApp-案例",
|
||||
//项目logo
|
||||
logoUrl: "https://qn.kemean.cn/upload/201906/19/3f3b4751f3ed4a97be804450c3ec4c79",
|
||||
//页面分享配置
|
||||
share: {
|
||||
title: 'uniApp-案例',
|
||||
// #ifdef MP-WEIXIN
|
||||
path: '/pages/home/home', //小程序分享路径
|
||||
// #endif
|
||||
// #ifdef H5 || APP-PLUS
|
||||
//公众号||APP分享
|
||||
desc: "uniApp-案例", // 分享描述
|
||||
link: "https://www.kemean.com/sameCity/18031201/index.html", // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
|
||||
imgUrl: "http://qn.kemean.cn/upload/201901/28/23bedfc34597482292ecd6dc107f6342", // 分享图标
|
||||
// #endif
|
||||
}
|
||||
};
|
||||
//手机号验证正则表达式
|
||||
// (中国大陆)
|
||||
// const phoneRegular = /^1\d{10}$/;
|
||||
const phoneRegular = /^1([358][0-9]|4[579]|66|7[0135678]|9[89])\d{8}$/;
|
||||
// const phoneRegular = /^[1][3-8]\d{9}$|^([6|9])\d{7}$|^[0][9]\d{8}$|^[6]([8|6])\d{5}$/;
|
||||
// 手机号码验证 支持港澳台 大陆
|
||||
// const phoneRegular = /^[1][3-8]\d{9}$|^([6|9])\d{7}$|^[0][9]\d{8}$|^[6]([8|6])\d{5}$|^(00){0,1}(65){1}[13689]\d{6,7}$/;
|
||||
//邮箱验证正则表达式
|
||||
const mailRegular = /^\w+([-+._']\w+)*@\w+(\.[a-zA-Z]{2,3}){1,2}$/;
|
||||
//密码验证正则表达式
|
||||
// const passwordRegular = /^[a-zA-Z0-9]{4,10}$/;
|
||||
const passwordRegular = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/;
|
||||
export default Object.assign({
|
||||
phoneRegular,
|
||||
mailRegular,
|
||||
passwordRegular
|
||||
}, courtConfig);
|
||||
76
config/componentConfig.js
Normal file
76
config/componentConfig.js
Normal file
@@ -0,0 +1,76 @@
|
||||
import $http from '@/config/requestConfig'
|
||||
const platform = uni.getSystemInfoSync().platform;
|
||||
export default {
|
||||
/****************以下是z-nav-bar插件配置*******************/
|
||||
// 主页页面的页面路径
|
||||
// 关联功能:打开的页面只有一个的时候右上角自动显示返回首页按钮,下面这个数组是排除显示返回首页的页面。
|
||||
// 主页使用场景:小程序分享出去的页面,用户点击开是分享页面,很多情况下是没有返回首页按钮的
|
||||
mainPagePath: ['pages/home/index'],
|
||||
//返回首页的地址
|
||||
homePath: '/pages/home/index',
|
||||
|
||||
/****************以下是zhouWei-APPUpdate插件配置*******************/
|
||||
// 发起ajax请求获取服务端版本号
|
||||
getServerNo: (version, isPrompt = false, callback) => {
|
||||
let httpData = {
|
||||
version: version.versionCode,
|
||||
// 版本名称
|
||||
versionName: version.versionName,
|
||||
// setupPage参数说明(判断用户是不是从设置页面点击的更新,如果是设置页面点击的更新,有不要用静默更新了,不然用户点击没反应很奇怪的)
|
||||
setupPage: isPrompt
|
||||
};
|
||||
if (platform == "android") {
|
||||
httpData.type = 1101;
|
||||
} else {
|
||||
httpData.type = 1102;
|
||||
}
|
||||
/* 接口入参说明
|
||||
* version: 应用当前版本号(已自动获取)
|
||||
* versionName: 应用当前版本名称(已自动获取)
|
||||
* type:平台(1101是安卓,1102是IOS)
|
||||
*/
|
||||
/****************以下是示例*******************/
|
||||
// 可以用自己项目的请求方法
|
||||
$http.get("api/common/v1/app_version", httpData,{
|
||||
isPrompt: isPrompt
|
||||
}).then(res => {
|
||||
/* res的数据说明
|
||||
* | 参数名称 | 一定返回 | 类型 | 描述
|
||||
* | -------------|--------- | --------- | ------------- |
|
||||
* | versionCode | y | int | 版本号 |
|
||||
* | versionName | y | String | 版本名称 |
|
||||
* | versionInfo | y | String | 版本信息 |
|
||||
* | updateType | y | String | forcibly = 强制更新, solicit = 弹窗确认更新, silent = 静默更新 |
|
||||
* | downloadUrl | y | String | 版本下载链接(IOS安装包更新请放跳转store应用商店链接,安卓apk和wgt文件放文件下载链接) |
|
||||
*/
|
||||
if (res && res.downloadUrl) {
|
||||
// 判断用户是不是从设置页面点击的更新,如果是设置页面点击的更新,无视接口给的更新类型,强制修改为弹窗确认更新
|
||||
if(isPrompt){
|
||||
res.updateType = "solicit";
|
||||
}
|
||||
|
||||
// 兼容之前的版本(updateType是新版才有的参数)
|
||||
if(res.updateType){
|
||||
callback && callback(res);
|
||||
} else {
|
||||
if(res.forceUpdate){
|
||||
res.updateType = "forcibly";
|
||||
} else {
|
||||
res.updateType = "solicit";
|
||||
}
|
||||
callback && callback(res);
|
||||
}
|
||||
} else if (isPrompt) {
|
||||
uni.showToast({
|
||||
title: "暂无新版本",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
});
|
||||
/****************以上是示例*******************/
|
||||
},
|
||||
// 弹窗主颜色(不填默认粉色)
|
||||
appUpdateColor: "f00",
|
||||
// 弹窗图标(不填显示默认图标,链接配置示例如: '/static/demo/ic_attention.png')
|
||||
appUpdateIcon: ''
|
||||
}
|
||||
268
config/html5Utils.js
Normal file
268
config/html5Utils.js
Normal file
@@ -0,0 +1,268 @@
|
||||
import base from '@/config/baseUrl';
|
||||
import store from '@/store';
|
||||
import $http from '@/config/requestConfig'
|
||||
import { getLocation, setShare } from '@/plugins/wxJsSDK';
|
||||
|
||||
/**
|
||||
* APP内嵌网页 -- 安卓IOS交互
|
||||
* 交互区分名称:shangChengView
|
||||
* 示例:appMutual("方法名称", "传递的参数")
|
||||
* 相当与安卓交互:window.shangChengView["方法名称"]("传递的参数");
|
||||
*/
|
||||
export const appMutual = (name, query = null, errCallback) => {
|
||||
if (/android/i.test(navigator.userAgent)) {
|
||||
if (window.shangChengView) {
|
||||
if (typeof(query) == "object") {
|
||||
query = JSON.stringify(query);
|
||||
}
|
||||
window.shangChengView[name](query);
|
||||
} else {
|
||||
errCallback && errCallback();
|
||||
}
|
||||
} else if (/ios|iphone|ipod|pad/i.test(navigator.userAgent)) {
|
||||
if (window.webkit) {
|
||||
window.webkit.messageHandlers[name].postMessage(query)
|
||||
} else {
|
||||
errCallback && errCallback();
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 获取url中的参数
|
||||
*/
|
||||
export const getUrlData = () => {
|
||||
var strs;
|
||||
var url = window.location.href; //获取url中"?"符后的字串
|
||||
var theRequest = new Object();
|
||||
if (url.indexOf("?") != -1) {
|
||||
url = url.substr(url.indexOf("?"));
|
||||
var str = url.substr(1);
|
||||
strs = str.split("&");
|
||||
for (var i = 0; i < strs.length; i++) {
|
||||
var index = strs[i].indexOf("=");
|
||||
theRequest[strs[i].slice(0, index)] = unescape(strs[i].slice(index + 1, strs[i].length));
|
||||
}
|
||||
}
|
||||
|
||||
return theRequest;
|
||||
}
|
||||
//公众号微信支付
|
||||
export const wxPublicPay = (payInfo, callback) => {
|
||||
$http.get("api/pay/v1/pay_public_wx", {
|
||||
orderNo: payInfo.orderNo
|
||||
}).then(data => {
|
||||
let wxConfigObj = {
|
||||
appId: data.appId,
|
||||
timeStamp: data.timeStamp,
|
||||
nonceStr: data.nonceStr,
|
||||
package: data.package,
|
||||
signType: data.signType,
|
||||
paySign: data.sign
|
||||
};
|
||||
function onBridgeReady() {
|
||||
window.WeixinJSBridge.invoke("getBrandWCPayRequest", wxConfigObj, function(
|
||||
res
|
||||
) {
|
||||
if (res.err_msg == "get_brand_wcpay_request:ok") {
|
||||
callback && callback(res);
|
||||
} else // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回 ok,但并不保证它绝对可靠。
|
||||
if (res.err_msg == "get_brand_wcpay_request:cancel") {
|
||||
// common.loadWarn('支付遇到问题,您取消了支付');
|
||||
} else
|
||||
if (res.err_msg == "get_brand_wcpay_request:fail") {
|
||||
// common.myConfirm('支付遇到问题,您可能需要重新登录', '', function () {
|
||||
// obj.wxLoginOAuth();
|
||||
// });
|
||||
}
|
||||
});
|
||||
}
|
||||
if (typeof window.WeixinJSBridge == "undefined") {
|
||||
if (document.addEventListener) {
|
||||
document.addEventListener("WeixinJSBridgeReady", onBridgeReady, false);
|
||||
} else if (document.attachEvent) {
|
||||
document.attachEvent("WeixinJSBridgeReady", onBridgeReady);
|
||||
document.attachEvent("onWeixinJSBridgeReady", onBridgeReady);
|
||||
}
|
||||
} else {
|
||||
onBridgeReady();
|
||||
}
|
||||
});
|
||||
};
|
||||
// 浏览器判断
|
||||
export const getBrowser = () => {
|
||||
let ua = navigator.userAgent.toLowerCase();
|
||||
if (ua.match(/MicroMessenger/i) == "micromessenger") {
|
||||
return "微信";
|
||||
}
|
||||
return "其他";
|
||||
};
|
||||
// 获取地址信息(公众号获取 或 内嵌APP获取)
|
||||
export const getLatLonH5 = function(successCallback, errCallback) {
|
||||
if (getBrowser() == '微信') {
|
||||
getLocation().then(res => {
|
||||
successCallback(res);
|
||||
}, err => {
|
||||
console.log("位置信息错误", err);
|
||||
errCallback("位置信息获取失败");
|
||||
});
|
||||
} else {
|
||||
let clearTime = setTimeout(() => {
|
||||
errCallback("获取经纬度超时");
|
||||
}, 5000);
|
||||
window.getAppLatLon = function(res) {
|
||||
clearTimeout(clearTime);
|
||||
successCallback(res);
|
||||
}
|
||||
appMutual("getAppLatLon", true);
|
||||
}
|
||||
};
|
||||
// 公众号分享
|
||||
export const publicShareFun = function (info = {},callback) {
|
||||
if (getBrowser() == "微信") {
|
||||
let shareInfo = {
|
||||
title: info.shareTitle || info.title || base.share.title,
|
||||
desc: info.desc || info.shareContent || base.share.desc,
|
||||
imgUrl: info.imgUrl || info.shareImg || base.share.imgUrl,
|
||||
link: info.link || info.shareUrl || base.share.link,
|
||||
};
|
||||
if (store.state.userInfo.token) {
|
||||
if (shareInfo.link.indexOf("?") >= 0) {
|
||||
shareInfo.link += "&recommendCode=" + store.state.userInfo.uid;
|
||||
} else {
|
||||
shareInfo.link += "?recommendCode=" + store.state.userInfo.uid;
|
||||
}
|
||||
}
|
||||
setShare(shareInfo, callback);
|
||||
}
|
||||
}
|
||||
|
||||
//公众号获取code
|
||||
function getLogin(type) {
|
||||
let urlNow = encodeURIComponent(window.location.href);
|
||||
let url =
|
||||
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${
|
||||
base.publicAppId
|
||||
}&redirect_uri=${urlNow}&response_type=code&scope=snsapi_userinfo&state=${type}#wechat_redirect`;
|
||||
window.location.replace(url);
|
||||
}
|
||||
//判断是否登录,登录处理
|
||||
let isGetOpenId = true;
|
||||
function getRecommendCode() {
|
||||
var url = window.location.href;
|
||||
let codeIndex = url.indexOf("recommendCode=");
|
||||
if (codeIndex >= 0) {
|
||||
let recommendCode = url.substr(codeIndex + 14);
|
||||
if (recommendCode.indexOf("&") >= 0) {
|
||||
return recommendCode.substr(0, recommendCode.indexOf("&"));
|
||||
} else if (recommendCode.indexOf("?") >= 0) {
|
||||
return recommendCode.substr(0, recommendCode.indexOf("?"));
|
||||
} else if (recommendCode.indexOf("/") >= 0) {
|
||||
return recommendCode.substr(0, recommendCode.indexOf("/"));
|
||||
} else if (recommendCode.indexOf("#") >= 0) {
|
||||
return recommendCode.substr(0, recommendCode.indexOf("#"));
|
||||
}
|
||||
return recommendCode;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
function getRecommend() {
|
||||
var url = window.location.href;
|
||||
let codeIndex = url.indexOf("recommend=");
|
||||
if (codeIndex >= 0) {
|
||||
let recommend = url.substr(codeIndex + 10);
|
||||
if (recommend.indexOf("&") >= 0) {
|
||||
return recommend.substr(0, recommend.indexOf("&"));
|
||||
} else if (recommend.indexOf("?") >= 0) {
|
||||
return recommend.substr(0, recommend.indexOf("?"));
|
||||
} else if (recommend.indexOf("/") >= 0) {
|
||||
return recommend.substr(0, recommend.indexOf("/"));
|
||||
} else if (recommend.indexOf("#") >= 0) {
|
||||
return recommend.substr(0, recommend.indexOf("#"));
|
||||
}
|
||||
return recommend;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
export const h5Login = function(type = "judge", callback) {
|
||||
var getRequest = getUrlData();
|
||||
let recommendCode = getRecommendCode();
|
||||
if (recommendCode && recommendCode !== "null" && recommendCode !== "undefined") {
|
||||
uni.setStorageSync("recommendCode", recommendCode);
|
||||
} else {
|
||||
let recommend = getRecommend();
|
||||
if(recommend && recommend !== "null" && recommend !== "undefined"){
|
||||
uni.setStorageSync("recommendCode", recommend);
|
||||
}
|
||||
}
|
||||
if (getBrowser() == "微信") {
|
||||
if (getRequest.code) {
|
||||
if(isGetOpenId){
|
||||
isGetOpenId = false;
|
||||
let httpData = {
|
||||
code: getRequest.code
|
||||
};
|
||||
let recommendCode = uni.getStorageSync("recommendCode");
|
||||
if(recommendCode){
|
||||
httpData.recommendUid = recommendCode;
|
||||
store.commit("setChatScenesInfo", {
|
||||
recommendCode: recommendCode
|
||||
});
|
||||
uni.removeStorageSync("recommendCode");
|
||||
}
|
||||
$http.get("api/open/v2/get_public_login", httpData)
|
||||
.then(result => {
|
||||
store.commit('setUserInfo', result);
|
||||
//publicShare();
|
||||
callback && callback();
|
||||
uni.showToast({
|
||||
title: "欢迎回来",
|
||||
icon: "none"
|
||||
});
|
||||
},() => {
|
||||
isGetOpenId = true;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
getLogin(type);
|
||||
}
|
||||
} else {
|
||||
if (getRequest.userToken) {
|
||||
store.commit('setUserInfo', {
|
||||
token: getRequest.userToken
|
||||
});
|
||||
$http.get("api/mime/v1/info").then(res => {
|
||||
store.commit('setUserInfo', res);
|
||||
callback && callback();
|
||||
});
|
||||
} else {
|
||||
appMutual("jumpLogin", null, function() {
|
||||
if (type == "force") {
|
||||
// 没登录跳转回登录页
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '用户信息失效,请重新登陆。'
|
||||
})
|
||||
uni.navigateTo({
|
||||
url: "/pages/user/login"
|
||||
});
|
||||
}else{
|
||||
uni.showModal({
|
||||
title:"提示",
|
||||
content:"您还未登录,请先登录~",
|
||||
confirmText: "去登录",
|
||||
cancelText: "再逛会",
|
||||
success: (res) => {
|
||||
if(res.confirm){
|
||||
uni.navigateTo({
|
||||
url: "/pages/user/login"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
126
config/iap.js
Normal file
126
config/iap.js
Normal file
@@ -0,0 +1,126 @@
|
||||
// uni iap
|
||||
|
||||
const ProviderType = {
|
||||
IAP: 'iap'
|
||||
}
|
||||
|
||||
const IapTransactionState = {
|
||||
purchasing: "0", // A transaction that is being processed by the App Store.
|
||||
purchased: "1", // A successfully processed transaction.
|
||||
failed: "2", // A failed transaction.
|
||||
restored: "3", // A transaction that restores content previously purchased by the user.
|
||||
deferred: "4" // A transaction that is in the queue, but its final status is pending external action such as Ask to Buy.
|
||||
};
|
||||
|
||||
class Iap {
|
||||
|
||||
_channel = null;
|
||||
_channelError = null;
|
||||
_productIds = [];
|
||||
|
||||
_ready = false;
|
||||
|
||||
constructor({
|
||||
products
|
||||
}) {
|
||||
this._productIds = products;
|
||||
}
|
||||
|
||||
init() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.getChannels((channel) => {
|
||||
this._ready = true;
|
||||
resolve(channel);
|
||||
}, (err) => {
|
||||
reject(err);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
getProduct(productIds) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this._channel.requestProduct(productIds || this._productIds, (res) => {
|
||||
resolve(res);
|
||||
}, (err) => {
|
||||
reject(err);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
requestPayment(orderInfo) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.requestPayment({
|
||||
provider: 'appleiap',
|
||||
orderInfo: orderInfo,
|
||||
success: (res) => {
|
||||
resolve(res);
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
restoreCompletedTransactions(username) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this._channel.restoreCompletedTransactions({
|
||||
manualFinishTransaction: true,
|
||||
username
|
||||
}, (res) => {
|
||||
resolve(res);
|
||||
}, (err) => {
|
||||
reject(err);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
finishTransaction(transaction) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this._channel.finishTransaction(transaction, (res) => {
|
||||
resolve(res);
|
||||
}, (err) => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getChannels(success, fail) {
|
||||
if (this._channel !== null) {
|
||||
success(this._channel)
|
||||
return
|
||||
}
|
||||
|
||||
if (this._channelError !== null) {
|
||||
fail(this._channelError)
|
||||
return
|
||||
}
|
||||
|
||||
uni.getProvider({
|
||||
service: 'payment',
|
||||
success: (res) => {
|
||||
this._channel = res.providers.find((channel) => {
|
||||
return (channel.id === 'appleiap')
|
||||
})
|
||||
|
||||
if (this._channel) {
|
||||
success(this._channel)
|
||||
} else {
|
||||
this._channelError = {
|
||||
errMsg: 'paymentContext:fail iap service not found'
|
||||
}
|
||||
fail(this._channelError)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get channel() {
|
||||
return this._channel;
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
Iap,
|
||||
IapTransactionState
|
||||
}
|
||||
133
config/login.js
Normal file
133
config/login.js
Normal file
@@ -0,0 +1,133 @@
|
||||
import store from '@/store';
|
||||
import $http from '@/config/requestConfig'
|
||||
import base from '@/config/baseUrl';
|
||||
// #ifdef H5
|
||||
import { h5Login } from '@/config/html5Utils';
|
||||
// #endif
|
||||
let code = "";
|
||||
let loginStart = true;
|
||||
let userInfo = {
|
||||
token: ""
|
||||
};
|
||||
let lastPageUrl = "";
|
||||
// 微信小程序登录
|
||||
function onLogin(type = "judge",callback) {
|
||||
//判断登录状态
|
||||
if (loginStart) {
|
||||
loginStart = false;
|
||||
const _this = this;
|
||||
let platform;
|
||||
// #ifdef MP-WEIXIN
|
||||
platform = 'weixin';
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
platform = 'alipay';
|
||||
// #endif
|
||||
// #ifdef MP-BAIDU
|
||||
platform = 'baidu';
|
||||
// #endif
|
||||
uni.login({
|
||||
provider: platform,
|
||||
success: function(loginRes) {
|
||||
if (loginRes.errMsg == 'login:ok') {
|
||||
// 获取用户信息
|
||||
uni.getUserInfo({
|
||||
provider: platform,
|
||||
success: function(infoRes) {
|
||||
let httpData = {
|
||||
wxSmallCode: loginRes.code, //小程序code
|
||||
iv: infoRes.iv, //小程序加密算法的初始向量
|
||||
encryptedData: infoRes.encryptedData //包括敏感数据在内的完整用户信息的加密数据
|
||||
};
|
||||
// store.state.chatScenesInfo里面是小程序二维码附带的信息
|
||||
if(store.state.chatScenesInfo.invite){
|
||||
// 推荐码
|
||||
httpData.invite = store.state.chatScenesInfo.invite;
|
||||
}
|
||||
$http.post('api/open/v1/login', httpData).then(res => {
|
||||
loginStart = true;
|
||||
store.commit('setUserInfo', res);
|
||||
callback && callback();
|
||||
if (res.nullUserInfo) {
|
||||
// 没有绑定过微信的头像或者昵称弹出授权获取头像昵称的弹窗
|
||||
store.commit('setBindUserInfoShow', true);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "登录成功"
|
||||
});
|
||||
}
|
||||
}, err => {
|
||||
loginStart = true;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
//判断是否登录(所有端)
|
||||
function judgeLogin(callback, type = "judge"){
|
||||
if(store.state.chatScenesInfo.scene == 1154){
|
||||
uni.showToast({
|
||||
title: '请前往小程序使用完整服务',
|
||||
icon: "none"
|
||||
});
|
||||
} else {
|
||||
let storeUserInfo = store.state.userInfo;
|
||||
if(!storeUserInfo.token){ // nvue页面读取不到vuex里面数据,将取缓存
|
||||
storeUserInfo = uni.getStorageSync("userInfo");
|
||||
}
|
||||
if (type != "force" && storeUserInfo.token) {
|
||||
callback();
|
||||
} else if (storeUserInfo.token && !storeUserInfo.phone) {
|
||||
if (type == "force") {
|
||||
uni.navigateTo({
|
||||
url: ''
|
||||
});
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "您还未绑定手机号,请先绑定~",
|
||||
confirmText: "去绑定",
|
||||
cancelText: "再逛会",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
url: ''
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// #ifdef MP
|
||||
onLogin(type, callback);
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
uni.showModal({
|
||||
title: "登录提示",
|
||||
content: "此时此刻需要您登录喔~",
|
||||
confirmText: "去登录",
|
||||
cancelText: "再逛会",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/user/login"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
h5Login(type, () => {
|
||||
callback();
|
||||
});
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
}
|
||||
export {
|
||||
onLogin,
|
||||
judgeLogin
|
||||
}
|
||||
291
config/requestConfig.js
Normal file
291
config/requestConfig.js
Normal file
@@ -0,0 +1,291 @@
|
||||
import request from "@/uni_modules/zhouWei-request/js_sdk/request";
|
||||
import store from '@/store';
|
||||
import base from '@/config/baseUrl';
|
||||
// #ifdef H5
|
||||
import {
|
||||
h5Login
|
||||
} from '@/config/html5Utils';
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
import {
|
||||
onLogin
|
||||
} from '@/config/login';
|
||||
// #endif
|
||||
let version_code = '';
|
||||
// #ifdef APP-PLUS
|
||||
import {
|
||||
getCurrentNo
|
||||
} from '@/uni_modules/zhouWei-APPUpdate/js_sdk/appUpdate';
|
||||
setTimeout(() => {
|
||||
getCurrentNo(function (res) {
|
||||
console.log("版本号", res);
|
||||
version_code = res.versionCode;
|
||||
});
|
||||
}, 200);
|
||||
// #endif
|
||||
|
||||
//可以new多个request来支持多个域名请求
|
||||
let $http = new request({
|
||||
//接口请求地址
|
||||
baseUrl: base.baseUrl,
|
||||
//服务器本地上传文件地址
|
||||
fileUrl: base.baseUrl,
|
||||
// 服务器上传图片默认url
|
||||
defaultUploadUrl: "api/common/v1/upload_image",
|
||||
// 服务器上传文件名称
|
||||
defaultFileName: "file",
|
||||
//设置请求头(如果使用报错跨域问题,可能是content-type请求类型和后台那边设置的不一致)
|
||||
header: {
|
||||
// 'Content-Type': 'application/json;charset=UTF-8',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
}
|
||||
});
|
||||
// 添加获取七牛云token的方法
|
||||
$http.getQnToken = function (callback) {
|
||||
//该地址需要开发者自行配置(每个后台的接口风格都不一样)
|
||||
$http.get("api/common/v1/qn_upload").then(data => {
|
||||
/*
|
||||
*接口返回参数:
|
||||
*visitPrefix:访问文件的域名
|
||||
*token:七牛云上传token
|
||||
*folderPath:上传的文件夹
|
||||
*region: 地区 默认为:SCN
|
||||
*/
|
||||
callback({
|
||||
visitPrefix: data.visitPrefix,
|
||||
token: data.token,
|
||||
folderPath: data.folderPath
|
||||
});
|
||||
});
|
||||
}
|
||||
// 添加获取阿里云token的方法
|
||||
$http.getAliToken = function (callback) {
|
||||
//该地址需要开发者自行配置(每个后台的接口风格都不一样)
|
||||
$http.get("api/open/v1/ali_oss_upload").then(data => {
|
||||
/*
|
||||
*接口返回参数:
|
||||
*visitPrefix:访问文件的域名
|
||||
*folderPath:上传的文件夹
|
||||
*accessKeyId: 您的oss的访问ID
|
||||
*accessKeySecret: 您的oss的访问密钥
|
||||
*timeout: 签名过期时间(毫秒)默认1800000
|
||||
*/
|
||||
callback({
|
||||
accessKeyId: data.accessKeyId,
|
||||
accessKeySecret: data.accessKeySecret,
|
||||
visitPrefix: data.visitPrefix,
|
||||
folderPath: data.folderPath,
|
||||
timeout: 1800000
|
||||
});
|
||||
});
|
||||
}
|
||||
//请求开始拦截器
|
||||
$http.requestStart = function (options) {
|
||||
// console.log("请求开始", options);
|
||||
if (options.load && options.data.loadAnimate != 'none') {
|
||||
//打开加载动画
|
||||
store.commit("setLoadingShow", true);
|
||||
}
|
||||
if (options.data.loadAnimate == 'none') {
|
||||
delete options.data.loadAnimate
|
||||
}
|
||||
// 图片、视频上传大小限制
|
||||
if (options.method == "FILE") {
|
||||
// 文件最大字节: options.maxSize 可以在调用方法的时候加入参数
|
||||
let maxSize = options.maxSize || '';
|
||||
for (let item of options.files) {
|
||||
if (item.fileType == 'image') {
|
||||
if (maxSize && item.size > maxSize) {
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: "图片过大,请重新上传",
|
||||
icon: "none"
|
||||
});
|
||||
}, 500);
|
||||
return false;
|
||||
}
|
||||
} else if (item.fileType == "video") {
|
||||
if (item.duration < 3) {
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: "视频长度不足3秒,请重新上传",
|
||||
icon: "none"
|
||||
});
|
||||
}, 500);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// #ifdef APP-PLUS
|
||||
// 添加当前版本号
|
||||
if (version_code) {
|
||||
options.header['version_code'] = version_code;
|
||||
}
|
||||
// #endif
|
||||
//请求前加入token
|
||||
let storeUserInfo = store.state.userInfo;
|
||||
if (!storeUserInfo) { // nvue页面读取不到vuex里面数据,将取缓存
|
||||
storeUserInfo = uni.getStorageSync("userInfo");
|
||||
}
|
||||
if (storeUserInfo.token) {
|
||||
options.header['token'] = storeUserInfo.token;
|
||||
};
|
||||
options.header['appType'] = 'psyche';
|
||||
return options;
|
||||
}
|
||||
//请求结束
|
||||
$http.requestEnd = function (options) {
|
||||
//判断当前接口是否需要加载动画
|
||||
if (options.load) {
|
||||
// 关闭加载动画
|
||||
store.commit("setLoadingShow", false);
|
||||
}
|
||||
}
|
||||
let loginPopupNum = 0;
|
||||
//所有接口数据处理(此方法需要开发者根据各自的接口返回类型修改,以下只是模板)
|
||||
$http.dataFactory = async function (res) {
|
||||
if (res.response.statusCode && res.response.statusCode == 200) {
|
||||
let httpData = res.response.data;
|
||||
if (typeof (httpData) == "string") {
|
||||
httpData = JSON.parse(httpData);
|
||||
}
|
||||
/*********以下只是模板(及共参考),需要开发者根据各自的接口返回类型修改*********/
|
||||
|
||||
//判断数据是否请求成功
|
||||
if (httpData.success || httpData.code == 0) {
|
||||
// 返回正确的结果(then接受数据)
|
||||
return Promise.resolve(httpData);
|
||||
} else if (httpData.code == "401") {
|
||||
if (uni.getStorageSync('guidePages') == 2) {
|
||||
var jump = uni.getStorageSync('isJump') //以下解决多次跳转登录页的重点
|
||||
if (!jump) {
|
||||
//以下做token失效的操作
|
||||
uni.showToast({
|
||||
title: '登录失效,请重新登录',
|
||||
icon: 'none'
|
||||
});
|
||||
uni.setStorageSync('userInfo', {})
|
||||
uni.setStorageSync('token', null)
|
||||
setTimeout(() => {
|
||||
uni.redirectTo({
|
||||
url: "/pages/user/login",
|
||||
success: function () {
|
||||
setTimeout(() => {
|
||||
uni.setStorageSync('isJump', null)
|
||||
}, 1000)
|
||||
},
|
||||
});
|
||||
}, 100);
|
||||
uni.setStorageSync('isJump', 'true')
|
||||
}
|
||||
}
|
||||
|
||||
} else if (httpData.code == "500" && !httpData.msg) {
|
||||
//500
|
||||
uni.showToast({
|
||||
title: '系统错误,请联系管理员',
|
||||
icon: 'none'
|
||||
});
|
||||
|
||||
|
||||
} else if (httpData.code == "1000" || httpData.code == "1001" || httpData.code == 1100 || httpData
|
||||
.code == 402) {
|
||||
|
||||
store.commit("emptyUserInfo");
|
||||
// #ifdef MP-WEIXIN
|
||||
onLogin();
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
h5Login("force");
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
var content = '此时此刻需要您登录喔~';
|
||||
if (httpData.code == "1000") {
|
||||
content = '此时此刻需要您登录喔';
|
||||
}
|
||||
if (loginPopupNum <= 0) {
|
||||
loginPopupNum++;
|
||||
uni.showModal({
|
||||
title: '温馨提示',
|
||||
content: content,
|
||||
confirmText: "去登录",
|
||||
cancelText: "再逛会",
|
||||
success: function (res) {
|
||||
loginPopupNum--;
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/user/login"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
// 返回错误的结果(catch接受数据)
|
||||
return Promise.reject({
|
||||
statusCode: 0,
|
||||
errMsg: "【request】" + (httpData.info || httpData.msg),
|
||||
data: res.data
|
||||
});
|
||||
} else if (httpData.code == "1004") {
|
||||
if (loginPopupNum <= 0) {
|
||||
loginPopupNum++;
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "您还未绑定手机号,请先绑定~",
|
||||
confirmText: "去绑定",
|
||||
cancelText: "再逛会",
|
||||
success: (res) => {
|
||||
loginPopupNum--;
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
url: ''
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// 返回错误的结果(catch接受数据)
|
||||
return Promise.reject({
|
||||
statusCode: 0,
|
||||
errMsg: "【request】" + (httpData.info || httpData.msg),
|
||||
data: res.data
|
||||
});
|
||||
} else { //其他错误提示
|
||||
if (res.isPrompt && res.data.loadAnimate != 'none') {
|
||||
uni.showToast({
|
||||
title: httpData.info || httpData.msg,
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
// 返回错误的结果(catch接受数据)
|
||||
return Promise.reject({
|
||||
statusCode: 0,
|
||||
errMsg: "【request】" + (httpData.info || httpData.msg),
|
||||
data: res.data
|
||||
});
|
||||
}
|
||||
|
||||
/*********以上只是模板(及共参考),需要开发者根据各自的接口返回类型修改*********/
|
||||
|
||||
} else {
|
||||
// 返回错误的结果(catch接受数据)
|
||||
return Promise.reject({
|
||||
statusCode: res.response.statusCode,
|
||||
errMsg: "【request】数据工厂验证不通过",
|
||||
data: res.data
|
||||
});
|
||||
}
|
||||
};
|
||||
// 错误回调
|
||||
$http.requestError = function (e) {
|
||||
// e.statusCode === 0 是参数效验错误抛出的
|
||||
if (e.statusCode === 0) {
|
||||
throw e;
|
||||
} else {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
export default $http;
|
||||
103
config/socket.js
Normal file
103
config/socket.js
Normal file
@@ -0,0 +1,103 @@
|
||||
import base from '@/config/baseUrl';
|
||||
import store from '@/store';
|
||||
class socket {
|
||||
constructor(options) {
|
||||
//地址
|
||||
this.socketUrl = base.socketUrl;
|
||||
this.socketStart = false;
|
||||
this.monitorSocketError();
|
||||
this.monitorSocketClose();
|
||||
this.socketReceive();
|
||||
}
|
||||
init(callback) {
|
||||
const _this = this;
|
||||
if (base.socketUrl) {
|
||||
if(this.socketStart){
|
||||
console.log('webSocket已经启动了');
|
||||
}else{
|
||||
uni.connectSocket({
|
||||
url: this.socketUrl,
|
||||
method: 'GET'
|
||||
});
|
||||
uni.onSocketOpen((res) => {
|
||||
this.socketStart = true;
|
||||
callback && callback();
|
||||
console.log('WebSocket连接已打开!');
|
||||
});
|
||||
setTimeout(() => {
|
||||
_this.getHeartbeat();
|
||||
}, 5000);
|
||||
}
|
||||
}else{
|
||||
console.log('config/baseUrl socketUrl为空');
|
||||
}
|
||||
}
|
||||
//Socket给服务器发送消息
|
||||
send(data, callback) {
|
||||
const _this = this;
|
||||
if (store.state.userInfo.uid) {
|
||||
data.userUid = store.state.userInfo.uid;
|
||||
}
|
||||
console.log(data);
|
||||
uni.sendSocketMessage({
|
||||
data: JSON.stringify(data),
|
||||
success: () => {
|
||||
callback && callback(true);
|
||||
},
|
||||
fail: () => {
|
||||
callback && callback(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
//Socket接收服务器发送过来的消息
|
||||
socketReceive() {
|
||||
const _this = this;
|
||||
uni.onSocketMessage(function(res) {
|
||||
let data = JSON.parse(res.data);
|
||||
console.log('收到服务器内容:', data);
|
||||
_this.acceptMessage && _this.acceptMessage(data);
|
||||
});
|
||||
}
|
||||
//关闭Socket
|
||||
closeSocket() {
|
||||
uni.closeSocket();
|
||||
_this.socketStart = false;
|
||||
}
|
||||
//监听Socket关闭
|
||||
monitorSocketClose() {
|
||||
const _this = this;
|
||||
uni.onSocketClose(function(res) {
|
||||
console.log('WebSocket 已关闭!');
|
||||
_this.socketStart = false;
|
||||
setTimeout(function() {
|
||||
_this.init();
|
||||
}, 3000);
|
||||
});
|
||||
}
|
||||
//监听Socket错误
|
||||
monitorSocketError() {
|
||||
const _this = this;
|
||||
uni.onSocketError(function(res) {
|
||||
_this.socketStart = false;
|
||||
console.log('WebSocket连接打开失败,请检查!');
|
||||
});
|
||||
}
|
||||
//心跳
|
||||
getHeartbeat() {
|
||||
const _this = this;
|
||||
this.send({
|
||||
type: "心跳",
|
||||
userUid: store.state.userInfo.userUid
|
||||
}, (val) => {
|
||||
setTimeout(() => {
|
||||
if (val) {
|
||||
_this.getHeartbeat();
|
||||
} else {
|
||||
_this.init();
|
||||
}
|
||||
}, 10000);
|
||||
});
|
||||
}
|
||||
};
|
||||
const mySocket = new socket();
|
||||
export default mySocket;
|
||||
316
config/utils.js
Normal file
316
config/utils.js
Normal file
@@ -0,0 +1,316 @@
|
||||
import $http from '@/config/requestConfig'
|
||||
import store from '@/store';
|
||||
import base from '@/config/baseUrl';
|
||||
import {
|
||||
getAppWxLatLon
|
||||
} from '@/plugins/utils';
|
||||
// #ifdef H5
|
||||
import {
|
||||
getLatLonH5,
|
||||
publicShareFun,
|
||||
wxPublicPay,
|
||||
getBrowser,
|
||||
appMutual
|
||||
} from '@/config/html5Utils';
|
||||
// 公众号分享
|
||||
export const publicShare = publicShareFun;
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
import appShareFun, {
|
||||
closeShare
|
||||
} from '@/uni_modules/zhouWei-APPshare/js_sdk/appShare';
|
||||
// APP分享
|
||||
export const appShare = function(data, callbcak) {
|
||||
let userInfo = store.state.userInfo;
|
||||
if (!(userInfo && userInfo.uid)) {
|
||||
userInfo = uni.getStorageSync("userInfo");
|
||||
}
|
||||
let shareData = {
|
||||
shareTitle: data.shareTitle || base.share.title,
|
||||
shareUrl: data.shareUrl || base.share.link,
|
||||
shareContent: data.shareContent || base.share.desc,
|
||||
shareImg: data.shareImg || base.share.imgUrl,
|
||||
}
|
||||
if (userInfo && userInfo.uid) {
|
||||
if (data.shareUrl) {
|
||||
if (data.shareUrl.indexOf("?") >= 0) {
|
||||
shareData.shareUrl = data.shareUrl + "&recommend=" + userInfo.uid
|
||||
} else {
|
||||
shareData.shareUrl = data.shareUrl + "?recommend=" + userInfo.uid
|
||||
}
|
||||
} else if (base.share && base.share.link) {
|
||||
if (base.share.link.indexOf("?") >= 0) {
|
||||
shareData.shareUrl = base.share.link + "&recommend=" + userInfo.uid
|
||||
} else {
|
||||
shareData.shareUrl = base.share.link + "?recommend=" + userInfo.uid
|
||||
}
|
||||
}
|
||||
}
|
||||
return appShareFun({
|
||||
shareTitle: data.shareTitle || base.share.title,
|
||||
shareUrl: data.shareUrl || base.share.link,
|
||||
shareContent: data.shareContent || base.share.desc,
|
||||
shareImg: data.shareImg || base.share.imgUrl,
|
||||
}, callbcak);
|
||||
};
|
||||
export const closeAppShare = closeShare;
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
// 微信小程序分享
|
||||
export const wxShare = function(data = {}) {
|
||||
let shareInfo = {
|
||||
title: data.title || base.share.title,
|
||||
};
|
||||
if (data.path && typeof(data.path) == "string") {
|
||||
shareInfo.path = data.path;
|
||||
} else if (data.path != 1) {
|
||||
shareInfo.path = "pages/home/index";
|
||||
}
|
||||
if (data.imageUrl) {
|
||||
shareInfo.imageUrl = data.imageUrl;
|
||||
}
|
||||
let userInfo = store.state.userInfo;
|
||||
if (!(userInfo && userInfo.uid)) {
|
||||
userInfo = uni.getStorageSync("userInfo");
|
||||
}
|
||||
if (userInfo && userInfo.uid) {
|
||||
if (data.query && typeof(data.query) == "object") {
|
||||
data.query.recommendCode = userInfo.uid;
|
||||
} else {
|
||||
data.query = {
|
||||
recommendCode: userInfo.uid
|
||||
};
|
||||
}
|
||||
}
|
||||
if (data.query && typeof(data.query) == "object") {
|
||||
Object.keys(data.query).forEach((key, index) => {
|
||||
if (index > 0 && shareInfo.query) {
|
||||
shareInfo.query += "&" + key + "=" + data.query[key];
|
||||
shareInfo.path += "&" + key + "=" + data.query[key];
|
||||
} else {
|
||||
shareInfo.query = key + "=" + data.query[key];
|
||||
shareInfo.path += "?" + key + "=" + data.query[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
return shareInfo;
|
||||
}
|
||||
// #endif
|
||||
|
||||
//支付(APP微信支付、APP支付宝支付、微信小程序支付)
|
||||
export const setPay = function(payInfo, callback) {
|
||||
console.log(payInfo)
|
||||
payInfo.customerId = store.state.userInfo.id
|
||||
let httpUrl = "";
|
||||
if (payInfo.typePay == 'wxpay') {
|
||||
// APP微信支付
|
||||
httpUrl = '/v3/pay/placeAnOrder/app'
|
||||
} else if (payInfo.typePay == 'alipay') {
|
||||
// APP支付宝支付
|
||||
httpUrl = 'pay/aliPay/pay'
|
||||
} else if (payInfo.typePay == 'smallPay') {
|
||||
// 微信小程序支付
|
||||
httpUrl = 'api/pay/v1/small_pay_sign_wx'
|
||||
} else if (payInfo.typePay == 'appleiap') {
|
||||
// 苹果支付
|
||||
}
|
||||
$http.post(httpUrl, payInfo).then(data => {
|
||||
console.log(data, 'data')
|
||||
let payData = {
|
||||
success: function(res) {
|
||||
callback && callback({
|
||||
success: true,
|
||||
data: res
|
||||
});
|
||||
console.log('success:' + JSON.stringify(res));
|
||||
},
|
||||
fail: function(err) {
|
||||
|
||||
callback && callback({
|
||||
success: false,
|
||||
data: err
|
||||
});
|
||||
|
||||
console.log('fail:' + JSON.stringify(err));
|
||||
}
|
||||
};
|
||||
if (payInfo.typePay == 'smallPay') {
|
||||
// 小程序
|
||||
payData.provider = 'wxpay';
|
||||
payData.timeStamp = data.timeStamp;
|
||||
payData.nonceStr = data.nonceStr;
|
||||
payData.package = data.package;
|
||||
// payData.package = "prepay_id=" + data.prepayid;
|
||||
payData.signType = "MD5";
|
||||
payData.paySign = data.sign;
|
||||
} else if (payInfo.typePay == 'wxpay') {
|
||||
// app微信
|
||||
payData.provider = 'wxpay';
|
||||
payData.orderInfo = data;
|
||||
} else if (payInfo.typePay == 'alipay') {
|
||||
// app 支付宝
|
||||
payData.provider = 'alipay';
|
||||
payData.orderInfo = data.orderInfo;
|
||||
} else if (payInfo.typePay == 'baidu') {
|
||||
payData.provider = 'baidu';
|
||||
payData.orderInfo = data;
|
||||
}
|
||||
|
||||
if (payData.orderInfo != '' && payData.orderInfo != undefined) {
|
||||
console.log("支付参数", payData);
|
||||
// let EnvUtils = plus.android.importClass('com.alipay.sdk.app.EnvUtils');
|
||||
// EnvUtils.setEnv(EnvUtils.EnvEnum.SANDBOX);
|
||||
uni.requestPayment(payData);
|
||||
}
|
||||
|
||||
}, err => {
|
||||
callback && callback({
|
||||
success: false,
|
||||
data: err
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 支付统一分配
|
||||
export const setPayAssign = function(orderInfo, callback) {
|
||||
orderInfo.price = orderInfo.price || orderInfo.pricePay;
|
||||
orderInfo.title = orderInfo.title || orderInfo.orderTitle;
|
||||
//支付
|
||||
// #ifdef APP-PLUS
|
||||
uni.navigateTo({
|
||||
url: '/pages/home/weChatPay?orderNo=' + orderInfo.orderNo + '&price=' + orderInfo.price +
|
||||
'&title=' + orderInfo.title
|
||||
});
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
setPay({
|
||||
...orderInfo,
|
||||
type: "smallPay"
|
||||
}, res => {
|
||||
if (res.success) {
|
||||
uni.redirectTo({
|
||||
url: "/pages/shopCar/paySuccess?orderNo=" + orderInfo.orderNo
|
||||
});
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
if (getBrowser() === '微信') {
|
||||
wxPublicPay({
|
||||
orderNo: orderInfo.orderNo
|
||||
}, function() {
|
||||
uni.redirectTo({
|
||||
url: "/pages/shopCar/paySuccess?orderNo=" + orderInfo.orderNo
|
||||
});
|
||||
});
|
||||
} else {
|
||||
appMutual('setJumpPay', orderInfo);
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
// 获取地址信息 (微信小程序、APP、公众号)
|
||||
export const getLatLon = function(tip) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const successProcess = function(res) {
|
||||
store.commit("setCurrentAddress", {
|
||||
latitude: res.latitude,
|
||||
longitude: res.longitude
|
||||
});
|
||||
resolve(res);
|
||||
};
|
||||
const errProcess = function(err) {
|
||||
reject(err);
|
||||
if (tip) {
|
||||
uni.showToast({
|
||||
title: err,
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
};
|
||||
// #ifdef H5
|
||||
getLatLonH5(successProcess, errProcess);
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
getAppWxLatLon(successProcess, errProcess);
|
||||
// #endif
|
||||
});
|
||||
}
|
||||
|
||||
// 查看是否有某本书的权限
|
||||
export const checkBookRight = function(data, callback) {
|
||||
console.log('接受的值', data)
|
||||
$http.request({
|
||||
url: "/book/user/checkUserBook",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data: data,
|
||||
header: { //默认 无 说明:请求头1
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
// console.log(res,'checkBookRight')
|
||||
if (res.code === 0) {
|
||||
callback && callback({
|
||||
success: true,
|
||||
data: '有权限'
|
||||
});
|
||||
}
|
||||
}).catch(e => {
|
||||
callback && callback({
|
||||
success: false,
|
||||
data: '无权限'
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
// 单独微信支付
|
||||
export const setWXPay = function(payInfo, callback) {
|
||||
$http.request({
|
||||
url: "pay/placeAnOrder/shoppingPay",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data: {
|
||||
...payInfo,
|
||||
appName: 'xlkj'
|
||||
},
|
||||
header: { //默认 无 说明:请求头1
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
console.log(res, 'resshoppingPay')
|
||||
if (res.code === 0) {
|
||||
console.log('接下来走微信接口啦')
|
||||
let payData = {
|
||||
provider: 'wxpay',
|
||||
orderInfo: {
|
||||
"appid": res.paramMap.appid, // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
|
||||
"noncestr": res.Map.noncestr, // 随机字符串
|
||||
"package": res.Map.package, // 固定值
|
||||
"partnerid": res.paramMap.mchid, // 微信支付商户号
|
||||
"prepayid": res.Map.prepayid, // 统一下单订单号
|
||||
"timestamp": res.Map.timestamp, // 时间戳(单位:秒)
|
||||
"signType": "SHA256-RSA",
|
||||
"sign": res.Map.sign
|
||||
},
|
||||
success(res) {
|
||||
callback && callback({
|
||||
success: true,
|
||||
data: res
|
||||
});
|
||||
console.log('success:' + JSON.stringify(res));
|
||||
},
|
||||
fail(err) {
|
||||
callback && callback({
|
||||
success: false,
|
||||
data: err
|
||||
});
|
||||
console.log('微信错误fail:' + JSON.stringify(err));
|
||||
|
||||
}
|
||||
}
|
||||
// console.log(payData)
|
||||
if (payData.orderInfo.prepayid != '' && payData.orderInfo.prepayid != undefined) {
|
||||
uni.requestPayment(payData);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
20
index.html
Normal file
20
index.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script>
|
||||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
|
||||
CSS.supports('top: constant(a)'))
|
||||
document.write(
|
||||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
|
||||
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||
</script>
|
||||
<title></title>
|
||||
<!--preload-links-->
|
||||
<!--app-context-->
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"><!--app-html--></div>
|
||||
<script type="module" src="/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
405
js_sdk/wa-permission/permission.js
Normal file
405
js_sdk/wa-permission/permission.js
Normal file
@@ -0,0 +1,405 @@
|
||||
/**
|
||||
* 本模块封装了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.split(","),
|
||||
// [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
|
||||
}
|
||||
}
|
||||
|
||||
let permissionMap = {
|
||||
"android": {
|
||||
"CAMERA_EXTERNAL_STORAGE": {
|
||||
"name": "android.permission.READ_EXTERNAL_STORAGE,android.permission.WRITE_EXTERNAL_STORAGE,android.permission.CAMERA",
|
||||
"title": "相机/相册权限说明",
|
||||
"content": "便于您使用该功能上传您的照片/图片用于上传用户头像、留言上传图片、申诉反馈上传图片等场景中读取和写入相册和文件内容"
|
||||
},
|
||||
"CAMERA": {
|
||||
"name": "android.permission.CAMERA",
|
||||
"title": "相机权限说明",
|
||||
"content": "便于您使用该功能上传您的照片/图片用于上传用户头像、留言上传图片、申诉反馈上传图片等场景中拍摄图片"
|
||||
},
|
||||
// "EXTERNAL_STORAGE": {
|
||||
// "name": "android.permission.READ_EXTERNAL_STORAGE,android.permission.WRITE_EXTERNAL_STORAGE",
|
||||
// "title": "相册权限说明",
|
||||
// "content": "便于您使用该功能上传您的照片/图片/视频及用于上传工单故障、维修图片、扫码识别设备等信息、意见反馈上传图片、上传设备、客户、设备图片等场景中读取和写入相册和文件内容"
|
||||
// },
|
||||
// "LOCATION": {
|
||||
// "name": "android.location.LocationManager",
|
||||
// "title": "定位权限说明",
|
||||
// "content": "便于您使用该功能定位您当前的位置,并上报当前位置给服务器,来智能得按照当前位置给您分配距离您最近的工单信息等功能"
|
||||
// },
|
||||
"CALLPHONE": {
|
||||
"name": "android.permission.CALL_PHONE",
|
||||
"title": "拨打电话权限说明",
|
||||
"content": "便于您使用该功能能够快速和提交工单信息的客户进行联系并进行及时处理"
|
||||
},
|
||||
},
|
||||
"ios": {}
|
||||
}
|
||||
|
||||
let view = null;
|
||||
let viewShow = false;
|
||||
|
||||
function showViewDesc(permission) {
|
||||
let plat = isIos ? "ios" : "android";
|
||||
view = new plus.nativeObj.View('per-modal', {
|
||||
top: '0px',
|
||||
left: '0px',
|
||||
width: '100%',
|
||||
backgroundColor: 'rgba(0,0,0,0.4)',
|
||||
//opacity: '.9'
|
||||
})
|
||||
view.drawRect({
|
||||
color: '#fff',
|
||||
radius: '5px'
|
||||
}, {
|
||||
top: '170px',
|
||||
left: '5%',
|
||||
width: '90%',
|
||||
height: "150px",
|
||||
})
|
||||
view.drawText(permissionMap[plat][permission]["title"], {
|
||||
top: '180px',
|
||||
left: "8%",
|
||||
height: "30px"
|
||||
}, {
|
||||
align: "left",
|
||||
color: "#000",
|
||||
}, {
|
||||
onClick: function(e) {
|
||||
console.log(e);
|
||||
}
|
||||
})
|
||||
view.drawText(permissionMap[plat][permission]["content"], {
|
||||
top: '210px',
|
||||
height: "80px",
|
||||
left: "8%",
|
||||
width: "84%"
|
||||
}, {
|
||||
whiteSpace: 'normal',
|
||||
size: "14px",
|
||||
align: "left",
|
||||
color: "#656563"
|
||||
})
|
||||
setTimeout(() => {
|
||||
view.show()
|
||||
}, 200)
|
||||
}
|
||||
|
||||
function premissionCheck(permission) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let plat = isIos ? "ios" : "android";
|
||||
if (isIos) { // ios
|
||||
// const camera = permission.judgeIosPermission("camera");//判断ios是否给予摄像头权限
|
||||
// //ios相册没权限,系统会自动弹出授权框
|
||||
// //let photoLibrary = permission.judgeIosPermission("photoLibrary");//判断ios是否给予相册权限
|
||||
// if(camera){
|
||||
// resolve();
|
||||
// }else{
|
||||
// reject('需要开启相机使用权限');
|
||||
// }
|
||||
resolve(1)
|
||||
} else { // android
|
||||
let permission_arr = permissionMap[plat][permission]["name"].split(",");
|
||||
|
||||
let flag = true;
|
||||
for (let i = 0; i < permission_arr.length; i++) {
|
||||
let status = plus.navigator.checkPermission(permission_arr[i]);
|
||||
if (status == "undetermined") {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
if (flag == false) { // 未完全授权
|
||||
showViewDesc(permission);
|
||||
requestAndroidPermission(permissionMap[plat][permission]["name"]).then((res) => {
|
||||
viewShow = false;
|
||||
setTimeout(() => {
|
||||
viewShow = true;
|
||||
}, 120)
|
||||
view.close();
|
||||
// if (res == -1) {
|
||||
// uni.showModal({
|
||||
// title: '提示',
|
||||
// content: '操作权限已被拒绝,请手动前往设置',
|
||||
// confirmText: "立即设置",
|
||||
// success: (res) => {
|
||||
// if (res.confirm) {
|
||||
// gotoAppPermissionSetting()
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
resolve(res)
|
||||
})
|
||||
} else {
|
||||
resolve(1)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
judgeIosPermission: judgeIosPermission,
|
||||
requestAndroidPermission: requestAndroidPermission,
|
||||
checkSystemEnableLocation: checkSystemEnableLocation,
|
||||
gotoAppPermissionSetting: gotoAppPermissionSetting,
|
||||
premissionCheck: premissionCheck
|
||||
}
|
||||
272
js_sdk/wa-permission/permission11.js
Normal file
272
js_sdk/wa-permission/permission11.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
|
||||
}
|
||||
272
js_sdk/wa-permission11/permission.js
Normal file
272
js_sdk/wa-permission11/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
|
||||
}
|
||||
42
js_sdk/xb-copy/uni-copy.js
Normal file
42
js_sdk/xb-copy/uni-copy.js
Normal file
@@ -0,0 +1,42 @@
|
||||
export default function uniCopy({content,success,error}) {
|
||||
if(!content) return error('复制的内容不能为空 !')
|
||||
content = typeof content === 'string' ? content : content.toString() // 复制内容,必须字符串,数字需要转换为字符串
|
||||
/**
|
||||
* 小程序端 和 app端的复制逻辑
|
||||
*/
|
||||
//#ifndef H5
|
||||
uni.setClipboardData({
|
||||
data: content,
|
||||
success: function() {
|
||||
success("复制成功~")
|
||||
console.log('success');
|
||||
},
|
||||
fail:function(){
|
||||
success("复制失败~")
|
||||
}
|
||||
});
|
||||
//#endif
|
||||
|
||||
/**
|
||||
* H5端的复制逻辑
|
||||
*/
|
||||
// #ifdef H5
|
||||
if (!document.queryCommandSupported('copy')) { //为了兼容有些浏览器 queryCommandSupported 的判断
|
||||
// 不支持
|
||||
error('浏览器不支持')
|
||||
}
|
||||
let textarea = document.createElement("textarea")
|
||||
textarea.value = content
|
||||
textarea.readOnly = "readOnly"
|
||||
document.body.appendChild(textarea)
|
||||
textarea.select() // 选择对象
|
||||
textarea.setSelectionRange(0, content.length) //核心
|
||||
let result = document.execCommand("copy") // 执行浏览器复制命令
|
||||
if(result){
|
||||
success("复制成功~")
|
||||
}else{
|
||||
error("复制失败,请检查h5中调用该方法的方式,是不是用户点击的方式调用的,如果不是请改为用户点击的方式触发该方法,因为h5中安全性,不能js直接调用!")
|
||||
}
|
||||
textarea.remove()
|
||||
// #endif
|
||||
}
|
||||
78
main.js
Normal file
78
main.js
Normal file
@@ -0,0 +1,78 @@
|
||||
import Vue from 'vue'
|
||||
import App from './App'
|
||||
import qs from 'qs'
|
||||
|
||||
// uView组件库
|
||||
import uView from '@/uni_modules/uview-ui'
|
||||
Vue.use(uView)
|
||||
|
||||
//挂载全局http请求
|
||||
import http from '@/config/requestConfig.js';
|
||||
Vue.prototype.$http = http
|
||||
import commonJS from '@/common/commonJS.js'
|
||||
Vue.prototype.$commonJS = commonJS
|
||||
//数据管理中心
|
||||
import store from '@/store'
|
||||
Vue.prototype.$store = store;
|
||||
//权限配置中心
|
||||
import base from '@/config/baseUrl'
|
||||
Vue.prototype.$base = base;
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
//判断是否登录
|
||||
import { judgeLogin } from '@/config/login';
|
||||
Vue.prototype.judgeLogin = judgeLogin;
|
||||
Vue.prototype.isShowHtml = store.state.loadingShow;
|
||||
|
||||
//判断手机型号
|
||||
uni.getSystemInfo({
|
||||
success: function (res) {
|
||||
Vue.prototype.$platform = res.platform;
|
||||
Vue.prototype.iosHidden = true;
|
||||
if (res.platform == 'ios') {
|
||||
Vue.prototype.iosHidden = false; //ios临时隐藏听书
|
||||
Vue.prototype.iosHide = true;
|
||||
} else {
|
||||
Vue.prototype.iosHide = true;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
import commonList from '@/pages/component/commonComponents/list.vue'
|
||||
Vue.component('common-list', commonList);
|
||||
import commonVideoAliyun from '@/pages/component/commonComponents/video/AliPlayer.vue'
|
||||
Vue.component('common-list-aliyun', commonVideoAliyun);
|
||||
import commonVideoAudio from '@/pages/component/commonComponents/video/audio.vue'
|
||||
Vue.component('common-list-audio', commonVideoAudio);
|
||||
import commonVideo from '@/pages/component/commonComponents/video/index.vue'
|
||||
Vue.component('common-video', commonVideo);
|
||||
import commonGoodsList from '@/pages/component/commonComponents/goodsList.vue'
|
||||
Vue.component('common-goods-list', commonGoodsList);
|
||||
import commonCurriculumList from '@/pages/component/commonComponents/curriculum.vue'
|
||||
Vue.component('common-curriculum-list', commonCurriculumList);
|
||||
import commonRichDetail from '@/pages/component/commonComponents/richDetail.vue'
|
||||
Vue.component('common-rich-detail', commonRichDetail);
|
||||
import commonCurriculumVideo from '@/pages/component/commonComponents/curriculumVideo.vue'
|
||||
Vue.component('common-curriculum-video', commonCurriculumVideo);
|
||||
import commonCurriculumVideoInfo from '@/pages/component/commonComponents/video.vue'
|
||||
Vue.component('common-curriculum-video-info', commonCurriculumVideoInfo);
|
||||
import commonSticky from '@/pages/component/commonComponents/sticky.vue'
|
||||
Vue.component('common-sticky', commonSticky);
|
||||
import commonGoodsNav from '@/pages/component/commonComponents/goodsNav.vue'
|
||||
Vue.component('common-goods-nav', commonGoodsNav);
|
||||
import commonAddress from '@/pages/component/commonComponents/address/index.vue'
|
||||
Vue.component('common-address', commonAddress);
|
||||
import commonSelectGoods from '@/pages/component/commonComponents/selectGoods.vue'
|
||||
Vue.component('common-select-goods', commonSelectGoods);
|
||||
import commonAnchorLink from '@/pages/component/commonComponents/anchorLink.vue'
|
||||
Vue.component('common-anchor-link', commonAnchorLink);
|
||||
|
||||
|
||||
App.mpType = 'app'
|
||||
const app = new Vue({
|
||||
store,
|
||||
...App
|
||||
})
|
||||
app.$mount()
|
||||
155
manifest.json
Normal file
155
manifest.json
Normal file
@@ -0,0 +1,155 @@
|
||||
{
|
||||
"name" : "心灵空间",
|
||||
"appid" : "__UNI__BBBDFD2",
|
||||
"description" : "心灵空间",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
"usingComponents" : true,
|
||||
"nvueStyleCompiler" : "uni-app",
|
||||
"compilerVersion" : 3,
|
||||
"splashscreen" : {
|
||||
"alwaysShowBeforeRender" : true,
|
||||
"waiting" : true,
|
||||
"autoclose" : true,
|
||||
"delay" : 0
|
||||
},
|
||||
/* 模块配置 */
|
||||
"modules" : {
|
||||
"Camera" : {},
|
||||
"VideoPlayer" : {},
|
||||
"Payment" : {},
|
||||
"Share" : {}
|
||||
},
|
||||
/* 应用发布信息 */
|
||||
"distribute" : {
|
||||
/* android打包配置 */
|
||||
"android" : {
|
||||
"permissions" : [
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.INSTALL_PACKAGES\"/>",
|
||||
"<uses-permission android:name=\"android.permission.INTERNET\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\"/>",
|
||||
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
|
||||
"<uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\"/>",
|
||||
"<uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
],
|
||||
"minSdkVersion" : 21,
|
||||
"targetSdkVersion" : 30,
|
||||
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ]
|
||||
},
|
||||
/* ios打包配置 */
|
||||
"ios" : {
|
||||
"urlschemewhitelist" : "nuttyreading,medicine",
|
||||
"dSYMs" : false,
|
||||
"capabilities" : {
|
||||
"entitlements" : {
|
||||
"com.apple.developer.associated-domains" : [
|
||||
"applinks:static-mp-3614b80b-2d75-4462-a481-4998f8187274.next.bspapp.com",
|
||||
"applinks:verification.nuttyreading.com"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs" : {
|
||||
"payment" : {
|
||||
"appleiap" : {},
|
||||
"alipay" : {
|
||||
"__platform__" : [ "ios", "android" ]
|
||||
},
|
||||
"weixin" : {
|
||||
"__platform__" : [ "ios", "android" ],
|
||||
"appid" : "wxd6bfeec65bc7abee",
|
||||
"UniversalLinks" : "https://verification.nuttyreading.com/uni-universallinks/__UNI__BBBDFD2/"
|
||||
}
|
||||
},
|
||||
"share" : {
|
||||
"weixin" : {
|
||||
"appid" : "wxd6bfeec65bc7abee",
|
||||
"UniversalLinks" : "https://verification.nuttyreading.com/uni-universallinks/__UNI__BBBDFD2/"
|
||||
}
|
||||
}
|
||||
},
|
||||
"splashscreen" : {
|
||||
"useOriginalMsgbox" : true
|
||||
},
|
||||
"icons" : {
|
||||
"android" : {
|
||||
"hdpi" : "unpackage/res/icons/72x72.png",
|
||||
"xhdpi" : "unpackage/res/icons/96x96.png",
|
||||
"xxhdpi" : "unpackage/res/icons/144x144.png",
|
||||
"xxxhdpi" : "unpackage/res/icons/192x192.png"
|
||||
},
|
||||
"ios" : {
|
||||
"appstore" : "unpackage/res/icons/1024x1024.png",
|
||||
"ipad" : {
|
||||
"app" : "unpackage/res/icons/76x76.png",
|
||||
"app@2x" : "unpackage/res/icons/152x152.png",
|
||||
"notification" : "unpackage/res/icons/20x20.png",
|
||||
"notification@2x" : "unpackage/res/icons/40x40.png",
|
||||
"proapp@2x" : "unpackage/res/icons/167x167.png",
|
||||
"settings" : "unpackage/res/icons/29x29.png",
|
||||
"settings@2x" : "unpackage/res/icons/58x58.png",
|
||||
"spotlight" : "unpackage/res/icons/40x40.png",
|
||||
"spotlight@2x" : "unpackage/res/icons/80x80.png"
|
||||
},
|
||||
"iphone" : {
|
||||
"app@2x" : "unpackage/res/icons/120x120.png",
|
||||
"app@3x" : "unpackage/res/icons/180x180.png",
|
||||
"notification@2x" : "unpackage/res/icons/40x40.png",
|
||||
"notification@3x" : "unpackage/res/icons/60x60.png",
|
||||
"settings@2x" : "unpackage/res/icons/58x58.png",
|
||||
"settings@3x" : "unpackage/res/icons/87x87.png",
|
||||
"spotlight@2x" : "unpackage/res/icons/80x80.png",
|
||||
"spotlight@3x" : "unpackage/res/icons/120x120.png"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
/* 快应用特有相关 */
|
||||
"quickapp" : {},
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin" : {
|
||||
"appid" : "",
|
||||
"setting" : {
|
||||
"urlCheck" : false
|
||||
},
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-baidu" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-toutiao" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"uniStatistics" : {
|
||||
"enable" : false
|
||||
},
|
||||
"vueVersion" : "2",
|
||||
"_spaceID" : "mp-3614b80b-2d75-4462-a481-4998f8187274"
|
||||
}
|
||||
1
node_modules/.bin/nanoid
generated
vendored
Symbolic link
1
node_modules/.bin/nanoid
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../nanoid/bin/nanoid.cjs
|
||||
2
node_modules/babel-runtime/.npmignore
generated
vendored
Normal file
2
node_modules/babel-runtime/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
scripts
|
||||
node_modules
|
||||
2
node_modules/babel-runtime/README.md
generated
vendored
Normal file
2
node_modules/babel-runtime/README.md
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# babel-runtime
|
||||
|
||||
4
node_modules/babel-runtime/core-js.js
generated
vendored
Normal file
4
node_modules/babel-runtime/core-js.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
"default": require("core-js/library"),
|
||||
__esModule: true
|
||||
};
|
||||
1
node_modules/babel-runtime/core-js/array/concat.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/concat.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/concat"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/copy-within.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/copy-within.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/copy-within"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/entries.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/entries.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/entries"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/every.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/every.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/every"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/fill.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/fill.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/fill"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/filter.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/filter.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/filter"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/find-index.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/find-index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/find-index"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/find.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/find.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/find"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/for-each.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/for-each.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/for-each"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/from.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/from.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/from"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/includes.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/includes.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/includes"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/index-of.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/index-of.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/index-of"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/join.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/join.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/join"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/keys.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/keys.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/keys"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/last-index-of.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/last-index-of.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/last-index-of"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/map.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/map.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/map"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/of.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/of.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/of"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/pop.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/pop.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/pop"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/push.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/push.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/push"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/reduce-right.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/reduce-right.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/reduce-right"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/reduce.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/reduce.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/reduce"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/reverse.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/reverse.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/reverse"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/shift.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/shift.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/shift"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/slice.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/slice.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/slice"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/some.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/some.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/some"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/sort.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/sort.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/sort"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/splice.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/splice.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/splice"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/unshift.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/unshift.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/unshift"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/array/values.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/array/values.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/array/values"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/asap.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/asap.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/asap"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/clear-immediate.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/clear-immediate.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/clear-immediate"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/error/is-error.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/error/is-error.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/error/is-error"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/get-iterator.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/get-iterator.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/get-iterator"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/is-iterable.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/is-iterable.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/is-iterable"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/json/stringify.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/json/stringify.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/json/stringify"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/map.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/map.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/map"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/acosh.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/acosh.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/acosh"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/asinh.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/asinh.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/asinh"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/atanh.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/atanh.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/atanh"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/cbrt.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/cbrt.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/cbrt"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/clz32.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/clz32.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/clz32"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/cosh.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/cosh.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/cosh"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/expm1.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/expm1.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/expm1"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/fround.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/fround.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/fround"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/hypot.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/hypot.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/hypot"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/iaddh.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/iaddh.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/iaddh"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/imul.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/imul.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/imul"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/imulh.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/imulh.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/imulh"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/isubh.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/isubh.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/isubh"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/log10.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/log10.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/log10"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/log1p.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/log1p.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/log1p"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/log2.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/log2.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/log2"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/sign.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/sign.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/sign"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/sinh.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/sinh.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/sinh"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/tanh.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/tanh.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/tanh"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/trunc.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/trunc.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/trunc"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/math/umulh.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/math/umulh.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/math/umulh"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/number/epsilon.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/number/epsilon.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/number/epsilon"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/number/is-finite.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/number/is-finite.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/number/is-finite"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/number/is-integer.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/number/is-integer.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/number/is-integer"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/number/is-nan.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/number/is-nan.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/number/is-nan"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/number/is-safe-integer.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/number/is-safe-integer.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/number/is-safe-integer"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/number/max-safe-integer.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/number/max-safe-integer.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/number/max-safe-integer"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/number/min-safe-integer.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/number/min-safe-integer.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/number/min-safe-integer"), __esModule: true };
|
||||
1
node_modules/babel-runtime/core-js/number/parse-float.js
generated
vendored
Normal file
1
node_modules/babel-runtime/core-js/number/parse-float.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { "default": require("core-js/library/fn/number/parse-float"), __esModule: true };
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user