| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- /**
- * Created by PanJiaChen on 16/11/18.
- */
- /**
- * @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
- }
- // 手机号验证
- export function isvalidPhone(str) {
- const reg = /^1[3|4|5|7|8|9][0-9]\d{8}$/
- return reg.test(str)
- }
- // 学生地址
- export function vaildStudentUrl() {
- let url = window.location.href
- let returnUrl = ''
- if(/test/.test(url)) { // test环境
- returnUrl = 'http://mstutest.dayaedu.com'
- } else if(/dev/.test(url)) { // dev 环境
- returnUrl = 'http://mstudev.dayaedu.com'
- } else if(/online/.test(url)) { //线上
- returnUrl = 'https://mstuonline.dayaedu.com'
- } else { // 默认dev环境
- returnUrl = 'http://mstudev.dayaedu.com'
- }
- return returnUrl
- }
- // 老师地址
- export function vaildTeacherUrl() {
- let url = window.location.href
- let returnUrl = ''
- if(/test/.test(url)) { // test环境
- returnUrl = 'http://mteatest.dayaedu.com'
- } else if(/dev/.test(url)) {// dev 环境
- returnUrl = 'http://mteadev.dayaedu.com'
- } else if(/online/.test(url)) {//线上
- returnUrl = 'https://mteaonline.dayaedu.com'
- } else { // 默认dev环境
- returnUrl = 'http://mteadev.dayaedu.com'
- }
- return returnUrl
- }
|