18 changed files with 445 additions and 338 deletions
-
119common/iconfont.css
-
BINcommon/iconfont.ttf
-
2main.js
-
16manifest.json
-
14network/base.js
-
32network/http.js
-
19network/login.js
-
24pages.json
-
43pages/bind/bind.vue
-
1pages/header.vue
-
4pages/index/index.vue
-
67pages/login/login.vue
-
49pages/show/show.vue
-
1pages/show/show2.vue
-
53utils/common.js
-
148utils/global.js
-
26utils/music.js
-
165utils/validate.js
@ -1,119 +0,0 @@ |
|||
@font-face { |
|||
font-family: "iconfont"; /* Project id 3202838 */ |
|||
src: url('iconfont.woff2?t=1649236110191') format('woff2'), |
|||
url('iconfont.woff?t=1649236110191') format('woff'), |
|||
url('iconfont.ttf?t=1649236110191') format('truetype'); |
|||
} |
|||
|
|||
.iconfont { |
|||
font-family: "iconfont" !important; |
|||
font-size: 16px; |
|||
font-style: normal; |
|||
-webkit-font-smoothing: antialiased; |
|||
-moz-osx-font-smoothing: grayscale; |
|||
} |
|||
|
|||
.icon-a-Group1:before { |
|||
content: "\e602"; |
|||
} |
|||
|
|||
.icon-a-xinzeng:before { |
|||
content: "\e601"; |
|||
} |
|||
|
|||
.icon-jigouxinxi:before { |
|||
content: "\e649"; |
|||
} |
|||
|
|||
.icon-quanxianguanli-fanbai:before { |
|||
content: "\e64a"; |
|||
} |
|||
|
|||
.icon-guanbi1:before { |
|||
content: "\e64b"; |
|||
} |
|||
|
|||
.icon-guanbi2:before { |
|||
content: "\e64c"; |
|||
} |
|||
|
|||
.icon-quanxianguanli:before { |
|||
content: "\e64d"; |
|||
} |
|||
|
|||
.icon-neirongguanli:before { |
|||
content: "\e64e"; |
|||
} |
|||
|
|||
.icon-xuanze-moren:before { |
|||
content: "\e64f"; |
|||
} |
|||
|
|||
.icon-wenjianjia:before { |
|||
content: "\e650"; |
|||
} |
|||
|
|||
.icon-xuanze:before { |
|||
content: "\e651"; |
|||
} |
|||
|
|||
.icon-shebeishuju:before { |
|||
content: "\e652"; |
|||
} |
|||
|
|||
.icon-fabuliucheng:before { |
|||
content: "\e653"; |
|||
} |
|||
|
|||
.icon-shouye:before { |
|||
content: "\e654"; |
|||
} |
|||
|
|||
.icon-xiala2:before { |
|||
content: "\e655"; |
|||
} |
|||
|
|||
.icon-bianji:before { |
|||
content: "\e656"; |
|||
} |
|||
|
|||
.icon-xuanzhong:before { |
|||
content: "\e657"; |
|||
} |
|||
|
|||
.icon-shouye-fanbai:before { |
|||
content: "\e658"; |
|||
} |
|||
|
|||
.icon-shebeiguanli:before { |
|||
content: "\e659"; |
|||
} |
|||
|
|||
.icon-xialaxuanze:before { |
|||
content: "\e65a"; |
|||
} |
|||
|
|||
.icon-xiala1:before { |
|||
content: "\e65b"; |
|||
} |
|||
|
|||
.icon-guanbi3:before { |
|||
content: "\e65c"; |
|||
} |
|||
|
|||
.icon-neirongguanli-fanbai:before { |
|||
content: "\e65d"; |
|||
} |
|||
|
|||
.icon-shebeiguanli-fanbai:before { |
|||
content: "\e65e"; |
|||
} |
|||
|
|||
.icon-bangzhu:before { |
|||
content: "\e647"; |
|||
} |
|||
|
|||
.icon-guanbi:before { |
|||
content: "\e648"; |
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
let baseURL = ''; |
|||
// 是否在控制台显示接口请求日志,本地环境启用,打包环境禁用
|
|||
let showHttpLog = false; |
|||
// 测试环境
|
|||
// 刘力
|
|||
baseURL = 'http://192.168.99.103:7000'; |
|||
// 许镇
|
|||
// baseURL = 'http://192.168.99.84:7000';
|
|||
// 正式环境
|
|||
// baseURL = 'https://yxkadmin.aiyxlib.com';
|
|||
module.exports = { |
|||
baseURL: baseURL, |
|||
showHttpLog: showHttpLog |
|||
}; |
@ -0,0 +1,32 @@ |
|||
import { |
|||
baseURL |
|||
} from './base.js'; //导入接口的前缀地址
|
|||
|
|||
export const myRequest = (options) => { |
|||
return new Promise((resolve, reject) => { |
|||
uni.request({ |
|||
url: baseURL + options.url, //接口地址:前缀+方法中传入的地址
|
|||
method: options.method || 'GET', //请求方法:传入的方法或者默认是“GET”
|
|||
data: options.data || {}, //传递参数:传入的参数或者默认传递空集合
|
|||
headers: { |
|||
'Authorization ': window.localStorage.getItem('token') //自定义请求头信息
|
|||
}, |
|||
success: (res) => { |
|||
//返回的数据(不固定,看后端接口,这里是做了一个判断,如果不为true,用uni.showToast方法提示获取数据失败)
|
|||
// if (res.data.success != true) {
|
|||
// return uni.showToast({
|
|||
// title: '获取数据失败',
|
|||
// icon: 'none'
|
|||
// })
|
|||
// }
|
|||
// 如果不满足上述判断就输出数据
|
|||
resolve(res); |
|||
}, |
|||
// 这里的接口请求,如果出现问题就输出接口请求失败
|
|||
fail: (err) => { |
|||
console.log(err); |
|||
reject(err); |
|||
} |
|||
}); |
|||
}); |
|||
}; |
@ -0,0 +1,19 @@ |
|||
import {myRequest} from './http.js'; |
|||
|
|||
// 登录
|
|||
export function login (config) { |
|||
return myRequest({ |
|||
url:'/login', |
|||
method:'post', |
|||
data:config |
|||
}); |
|||
} |
|||
|
|||
// 授权绑定
|
|||
export function deviceBind (config) { |
|||
return myRequest({ |
|||
url:'/deviceBind', |
|||
method:'post', |
|||
data:config |
|||
}); |
|||
} |
@ -1,53 +0,0 @@ |
|||
const utils = {}; |
|||
var audio = uni.createInnerAudioContext() |
|||
var isPause = false //是否在暂停状态
|
|||
var previousSrc = '' //上一个音频的地址,如果和现在的播放地址一样就进入暂停
|
|||
|
|||
utils.playAudios = function (src) { |
|||
if(isPause){ //在暂停状态
|
|||
if(previousSrc == src){ |
|||
audio.play() |
|||
}else{ |
|||
audio.stop() |
|||
audio.src = src |
|||
previousSrc = src |
|||
audio.onCanplay(()=> { |
|||
audio.play() |
|||
}) |
|||
} |
|||
}else{ //不在暂停状态
|
|||
if(previousSrc == src){ |
|||
audio.pause() |
|||
isPause = true |
|||
}else{ |
|||
audio.stop() |
|||
audio.src = src |
|||
previousSrc = src |
|||
audio.onCanplay(()=> { |
|||
audio.play() |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
utils.stopAudios = function () { |
|||
audio.stop() |
|||
} |
|||
utils.pauseAudios = function () { |
|||
audio.pause() |
|||
} |
|||
|
|||
audio.onPlay(() => { //播放监听事件
|
|||
console.log('开始播放'); |
|||
isPause = false |
|||
}); |
|||
audio.onPause(() => {//暂停监听
|
|||
console.log('暂停'); |
|||
isPause = true |
|||
}); |
|||
|
|||
audio.onEnded(() => {// 自然播放结束监听也需要更改isPause 开关状态
|
|||
console.log('音频自然播放结束事件'); |
|||
isPause = true |
|||
}); |
|||
|
|||
export default utils |
@ -1,26 +0,0 @@ |
|||
// const bgm = uni.createInnerAudioContext();
|
|||
// bgm.src = 'https://qiniu.aiyxlib.com/yuekan-BGM20-Chinap.mp3'
|
|||
// bgm.loop = true;
|
|||
|
|||
// var music = {
|
|||
// //mute 表示是否是静音,,默认不静音
|
|||
// playBgm({mute=false}){
|
|||
// if (!bgm) return;
|
|||
// if(mute){
|
|||
// bgm.pause()
|
|||
// }else{
|
|||
// bgm.play()
|
|||
// }
|
|||
// bgm.onPause(()=>{
|
|||
// console.log('暂停背景音乐');
|
|||
// })
|
|||
// bgm.onPlay(() => {
|
|||
// console.log('开始播放音乐#######');
|
|||
// })
|
|||
// bgm.onError((res) => {
|
|||
// console.log(res)
|
|||
// })
|
|||
// }
|
|||
// }
|
|||
// module.exports = music
|
|||
|
@ -0,0 +1,165 @@ |
|||
|
|||
/** |
|||
* @param {string} path |
|||
* @returns {Boolean} |
|||
*/ |
|||
export function isExternal(path) { |
|||
return /^(https?:|mailto:|tel:)/.test(path); |
|||
} |
|||
|
|||
/** |
|||
* @param {string} str |
|||
* @returns {Boolean} |
|||
*/ |
|||
export function validUsername(str) { |
|||
const valid_map = ['admin', 'editor']; |
|||
return valid_map.indexOf(str.trim()) >= 0; |
|||
} |
|||
|
|||
/** |
|||
* @param {string} url |
|||
* @returns {Boolean} |
|||
*/ |
|||
export function validURL(url) { |
|||
const reg = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/; |
|||
return reg.test(url); |
|||
} |
|||
|
|||
/** |
|||
* @param {string} str |
|||
* @returns {Boolean} |
|||
*/ |
|||
export function validLowerCase(str) { |
|||
const reg = /^[a-z]+$/; |
|||
return reg.test(str); |
|||
} |
|||
|
|||
/** |
|||
* @param {string} str |
|||
* @returns {Boolean} |
|||
*/ |
|||
export function validUpperCase(str) { |
|||
const reg = /^[A-Z]+$/; |
|||
return reg.test(str); |
|||
} |
|||
|
|||
/** |
|||
* @param {string} str |
|||
* @returns {Boolean} |
|||
*/ |
|||
export function validAlphabets(str) { |
|||
const reg = /^[A-Za-z]+$/; |
|||
return reg.test(str); |
|||
} |
|||
|
|||
/** |
|||
* @param {string} email |
|||
* @returns {Boolean} |
|||
*/ |
|||
export function validEmail(email) { |
|||
const reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; |
|||
return reg.test(email); |
|||
} |
|||
|
|||
export function isvalidPhone(phone) { |
|||
const reg = /^1[3|4|5|7|8][0-9]\d{8}$/; |
|||
return reg.test(phone); |
|||
} |
|||
|
|||
/** |
|||
* @param {string} str |
|||
* @returns {Boolean} |
|||
*/ |
|||
export function isString(str) { |
|||
if (typeof str === 'string' || str instanceof String) { |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
/** |
|||
* @param {Array} arg |
|||
* @returns {Boolean} |
|||
*/ |
|||
export function isArray(arg) { |
|||
if (typeof Array.isArray === 'undefined') { |
|||
return Object.prototype.toString.call(arg) === '[object Array]'; |
|||
} |
|||
return Array.isArray(arg); |
|||
} |
|||
|
|||
/** |
|||
* 是否合法IP地址 |
|||
* @param rule |
|||
* @param value |
|||
* @param callback |
|||
*/ |
|||
export function validateIP(rule, value, callback) { |
|||
if (value === '' || value === undefined || value == null) { |
|||
callback(); |
|||
} else { |
|||
const reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/; |
|||
if ((!reg.test(value)) && value !== '') { |
|||
callback(new Error('请输入正确的IP地址')); |
|||
} else { |
|||
callback(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/* 是否手机号码或者固话*/ |
|||
export function validatePhoneTwo(rule, value, callback) { |
|||
const reg = /^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/; |
|||
if (value === '' || value === undefined || value == null) { |
|||
callback(); |
|||
} else { |
|||
if ((!reg.test(value)) && value !== '') { |
|||
callback(new Error('请输入正确的电话号码或者固话号码')); |
|||
} else { |
|||
callback(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/* 是否固话*/ |
|||
export function validateTelephone(rule, value, callback) { |
|||
const reg = /0\d{2}-\d{7,8}/; |
|||
if (value === '' || value === undefined || value == null) { |
|||
callback(); |
|||
} else { |
|||
if ((!reg.test(value)) && value !== '') { |
|||
callback(new Error('请输入正确的固话(格式:区号+号码,如010-1234567)')); |
|||
} else { |
|||
callback(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/* 是否手机号码*/ |
|||
export function validatePhone(rule, value, callback) { |
|||
const reg = /^[1][3,4,5,7,8][0-9]{9}$/; |
|||
if (value === '' || value === undefined || value == null) { |
|||
callback(); |
|||
} else { |
|||
if ((!reg.test(value)) && value !== '') { |
|||
callback(new Error('请输入正确的电话号码')); |
|||
} else { |
|||
callback(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/* 是否身份证号码*/ |
|||
export function validateIdNo(rule, value, callback) { |
|||
const reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; |
|||
if (value === '' || value === undefined || value == null) { |
|||
callback(); |
|||
} else { |
|||
if ((!reg.test(value)) && value !== '') { |
|||
callback(new Error('请输入正确的身份证号码')); |
|||
} else { |
|||
callback(); |
|||
} |
|||
} |
|||
} |
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue