unknown
3 weeks ago
25 changed files with 735 additions and 109 deletions
-
3App.vue
-
7common/css/app.scss
-
2components/searchRow/searchRow.vue
-
58config/api.js
-
4config/request.js
-
4config/site.config.js
-
7config/utils.js
-
4manifest.json
-
23pages.json
-
2pages/indexEntry/enroll/registInfo/registInfo.vue
-
2pages/indexEntry/findCoach/comp/coachItem.vue
-
24pages/indexEntry/findShcool/findShcool.vue
-
2pages/indexEntry/findShcool/searchShcool/searchShcool.vue
-
2pages/indexEntry/findShcool/shcoolDetail/shcoolDetail.vue
-
373pages/indexEntry/signIn/signAndOut/signAndOutSubjiect1.vue
-
14pages/indexEntry/signIn/signIn.vue
-
2pages/indexEntry/webView/webView.vue
-
6pages/mineEntry/personaInfo/personaInfo.vue
-
4pages/tabbar/index/comp/coachItem.vue
-
18pages/tabbar/index/comp/schoolItem.vue
-
52pages/tabbar/index/index.vue
-
8pages/tabbar/mine/index.vue
-
10pages/userCenter/login/login.vue
-
204pages/userCenter/login/new_file.html
-
7store/modules/user.js
@ -0,0 +1,373 @@ |
|||||
|
<template> |
||||
|
<view class="main"> |
||||
|
<view class="signAndOut"> |
||||
|
<view class="top_row"> |
||||
|
<view class="flex-box"> |
||||
|
<view class="icon"> |
||||
|
<image src="@/static/images/carIcon/home_icon_buzhou@2x.png" mode=""></image> |
||||
|
</view> |
||||
|
<view class="txt">步骤</view> |
||||
|
</view> |
||||
|
<view class="flex-box"> |
||||
|
<view class="icon"> |
||||
|
<image src="@/static/images/carIcon/home_icon_zhuangtai@2x.png" mode=""></image> |
||||
|
</view> |
||||
|
<view class="txt">状态</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="step"> |
||||
|
<view class="li" :class="{active: step1}"> |
||||
|
<view class="leftIcon" > |
||||
|
<view class="icon">1</view> |
||||
|
<view class="line" ></view> |
||||
|
</view> |
||||
|
<view class="textCon"> |
||||
|
<view class="text">信息认证</view> |
||||
|
<view class="redTps" v-if="!step1">失败原因:{{stepFailureReason}}</view> |
||||
|
</view> |
||||
|
<view class="btn" :class="{red: !step1}">{{step1?'通过': '不通过'}}</view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="li" :class="{active: step2}"> |
||||
|
<view class="leftIcon"> |
||||
|
<view class="icon">2</view> |
||||
|
<view class="line" ></view> |
||||
|
</view> |
||||
|
<view class="textCon"> |
||||
|
<view class="text">人脸识别</view> |
||||
|
<view class="redTps"></view> |
||||
|
</view> |
||||
|
<view class="btn" v-if="step2">通过</view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="li" :class="{active: step3}"> |
||||
|
<view class="leftIcon"> |
||||
|
<view class="icon">3</view> |
||||
|
</view> |
||||
|
<view class="textCon"> |
||||
|
<view class="text">信息同步</view> |
||||
|
<view class="redTps"></view> |
||||
|
</view> |
||||
|
<view class="btn" v-if="step3">通过</view> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
|
||||
|
<view class="footBtn"> |
||||
|
<view class="oneBtn" :class="{active: btnActive}" v-if="!step3" @click="Recertification">重新认证</view> |
||||
|
<view class="oneBtn" :class="{active: step3}" v-else @click="goBack">我知道了</view> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { getInitBodyFaceVerify, getDescribeBodyFaceVerify, theorySignSubject1, vailStudentSignSubject1, vailStudentSignOutSubject1, theorySignOutSubject1, } from '@/config/api.js' |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
deviceCode: 0, |
||||
|
stepFailureReason: '未通过', |
||||
|
step1: false, |
||||
|
step2: false, |
||||
|
step3: false, |
||||
|
params: {}, |
||||
|
count: 0 |
||||
|
} |
||||
|
}, |
||||
|
onLoad(options) { |
||||
|
this.vailStudentInfoFn() |
||||
|
}, |
||||
|
computed: { |
||||
|
btnActive() { |
||||
|
if(this.step1&&(!this.step2||!this.step3)) { |
||||
|
return true |
||||
|
}else { |
||||
|
return false |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
// 信息校验 |
||||
|
async vailStudentInfoFn() { |
||||
|
await this.$store.dispatch('getCity') |
||||
|
if(!this.vuex_cityInfo.lat) return |
||||
|
let schoolCoach = this.$store.state.school.schoolCoach |
||||
|
this.params = { |
||||
|
coachId: schoolCoach.id , |
||||
|
stduentId: this.studentId, |
||||
|
lng: this.vuex_cityInfo.lng, |
||||
|
lat: this.vuex_cityInfo.lat, |
||||
|
key: schoolCoach.key, |
||||
|
type: schoolCoach.QrType, |
||||
|
} |
||||
|
let fn = vailStudentSignSubject1 |
||||
|
if(this.params.type==5) { |
||||
|
fn = vailStudentSignOutSubject1 |
||||
|
} |
||||
|
console.log('扫码传的参数') |
||||
|
console.log(this.params) |
||||
|
const res = await fn(this.params) |
||||
|
console.log('第一步校验信息') |
||||
|
console.log(res) |
||||
|
console.log(res.msg) |
||||
|
if(res.code=='200240213') { |
||||
|
this.stepFailureReason = res.msg |
||||
|
// if(res.msg=='学员未签退,请先签退') { |
||||
|
// if(!this.count) { |
||||
|
// this.count ++ |
||||
|
// console.log('来这了?') |
||||
|
// const res2 = await reSignOut({coachId: this.params.coachId}) |
||||
|
// console.log('来这没有?') |
||||
|
// this.vailStudentInfoFn() |
||||
|
// console.log('补签结果') |
||||
|
// console.log(res2) |
||||
|
|
||||
|
// this.getInitFaceVerifyFn('补签退') |
||||
|
// } |
||||
|
|
||||
|
// } |
||||
|
} |
||||
|
|
||||
|
if(res.code==0) { |
||||
|
this.step1 = true |
||||
|
this.params.key = res.data |
||||
|
// this.siginFn() |
||||
|
this.getInitFaceVerifyFn() |
||||
|
} |
||||
|
console.log(res) |
||||
|
}, |
||||
|
// 人脸对比 |
||||
|
async getInitFaceVerifyFn() { |
||||
|
const verifyPlugin = uni.requireNativePlugin('Ocr-FaceDetectModule'); |
||||
|
var metaInfo = verifyPlugin.getMetaInfo() |
||||
|
if(typeof metaInfo =='object' ) { |
||||
|
metaInfo = JSON.stringify(metaInfo) |
||||
|
} |
||||
|
console.log(metaInfo) |
||||
|
const res = await getInitBodyFaceVerify({metaInfo, userId : this.userId}) |
||||
|
console.log(res) |
||||
|
let certifyId = res.data.body.resultObject.certifyId |
||||
|
let _this = this |
||||
|
verifyPlugin.verify({ |
||||
|
certifyId, |
||||
|
// extParams: { |
||||
|
// kIdentityParamKeyIdCardFaceOnly: 'YES' |
||||
|
// } |
||||
|
}, function(response){ |
||||
|
console.log(response) |
||||
|
if(response.code==1000) { |
||||
|
getDescribeBodyFaceVerify({certifyId,}).then((useRes)=>{ |
||||
|
_this.step2 = true |
||||
|
_this.params.certifyId = certifyId |
||||
|
_this.siginFn() |
||||
|
}) |
||||
|
}else if(response.code==2006) { |
||||
|
_this.$u.toast('认证失败!请确定是本人后再重试') |
||||
|
}else { |
||||
|
_this.$u.toast(response.msg) |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
// 签到签退 |
||||
|
async siginFn() { |
||||
|
let fn = theorySignSubject1 |
||||
|
let obj = this.params |
||||
|
if(this.params.type==5) { |
||||
|
fn = theorySignOutSubject1 |
||||
|
obj = { |
||||
|
"certifyId": this.params.certifyId, |
||||
|
"signKey": this.params.key, |
||||
|
"coachId": this.params.coachId, |
||||
|
"type": 5, |
||||
|
"key": this.$store.state.school.schoolCoach.key, |
||||
|
"lat": this.vuex_cityInfo.lat, |
||||
|
"lng": this.vuex_cityInfo.lng |
||||
|
} |
||||
|
} |
||||
|
console.log('来到这里没?11') |
||||
|
console.log(obj) |
||||
|
const res = await fn(obj) |
||||
|
if(res.code=='200240213') { |
||||
|
this.$u.toast(res.msg) |
||||
|
} |
||||
|
console.log('签到结果') |
||||
|
console.log(res) |
||||
|
if(res.code==0) { |
||||
|
this.step3 = true |
||||
|
let msg = '签到成功' |
||||
|
if(this.params.type==5) { |
||||
|
msg = '签退成功' |
||||
|
} |
||||
|
this.$u.toast(msg) |
||||
|
setTimeout(()=>{ |
||||
|
uni.navigateBack() |
||||
|
},1000) |
||||
|
} |
||||
|
}, |
||||
|
// 重新认证 |
||||
|
Recertification() { |
||||
|
if(!this.step1) return |
||||
|
if(!this.step2) { |
||||
|
// this.siginFn() |
||||
|
this.getInitFaceVerifyFn() |
||||
|
} |
||||
|
if(!this.step3) { |
||||
|
this.siginFn() |
||||
|
} |
||||
|
}, |
||||
|
goBack() { |
||||
|
uni.navigateBack() |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
.main { |
||||
|
padding: 10rpx 32rpx; |
||||
|
} |
||||
|
|
||||
|
.signAndOut { |
||||
|
width: 100%; |
||||
|
height: calc(100vh - 150rpx); |
||||
|
background-color: #fff; |
||||
|
padding: 48rpx; |
||||
|
border-radius: 16rpx; |
||||
|
position: relative; |
||||
|
|
||||
|
.footBtn { |
||||
|
padding: 48rpx 100rpx; |
||||
|
position: absolute; |
||||
|
left: 0; |
||||
|
width: 100%; |
||||
|
bottom: 60rpx; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.top_row { |
||||
|
display: flex; |
||||
|
justify-content: space-between; |
||||
|
padding: 0 0 0 52rpx; |
||||
|
|
||||
|
.flex-box { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
|
||||
|
.icon { |
||||
|
width: 28rpx; |
||||
|
height: 28rpx; |
||||
|
|
||||
|
image { |
||||
|
display: block; |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.txt { |
||||
|
font-size: 28rpx; |
||||
|
color: #FD6401; |
||||
|
margin-left: 14rpx; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.step { |
||||
|
padding: 50rpx 0 0 0; |
||||
|
|
||||
|
.li { |
||||
|
width: 100%; |
||||
|
display: flex; |
||||
|
height: 256rpx; |
||||
|
|
||||
|
// padding: 0 0 8rpx 0; |
||||
|
.leftIcon { |
||||
|
width: 56rpx; |
||||
|
height: 100%; |
||||
|
position: relative; |
||||
|
|
||||
|
.icon { |
||||
|
width: 56rpx; |
||||
|
height: 56rpx; |
||||
|
border-radius: 50%; |
||||
|
font-size: 24rpx; |
||||
|
color: #333; |
||||
|
text-align: center; |
||||
|
line-height: 56rpx; |
||||
|
background: url('../../../../static/images/carIcon/home_icon_weidao@2x.png'); |
||||
|
background-size: 100% 100%; |
||||
|
} |
||||
|
|
||||
|
.line { |
||||
|
position: absolute; |
||||
|
left: 26rpx; |
||||
|
top: 50rpx; |
||||
|
width: 5rpx; |
||||
|
height: 200rpx; |
||||
|
border: 2rpx solid; |
||||
|
border-image: linear-gradient(180deg, rgba(238, 238, 238, 1), rgba(216, 216, 216, 1)) 2 2; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.textCon { |
||||
|
flex: 1; |
||||
|
padding: 0 0 0 8rpx; |
||||
|
font-weight: 550; |
||||
|
|
||||
|
.text { |
||||
|
font-size: 36rpx; |
||||
|
color: #363A44; |
||||
|
} |
||||
|
|
||||
|
.redTps { |
||||
|
font-size: 28rpx; |
||||
|
color: #E63633; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.btn { |
||||
|
width: 108rpx; |
||||
|
height: 52rpx; |
||||
|
text-align: center; |
||||
|
line-height: 52rpx; |
||||
|
color: #ffffff; |
||||
|
background: linear-gradient(180deg, #53D3E5 0%, #3593FB 100%); |
||||
|
border-radius: 8rpx; |
||||
|
|
||||
|
&.red { |
||||
|
background: linear-gradient(180deg, #ea7c48 0%, #f54e40 100%); |
||||
|
} |
||||
|
} |
||||
|
&.active { |
||||
|
.leftIcon { |
||||
|
.icon { |
||||
|
// background: url('../../../static/images/icon/home_icon_yiguo@2x.png'); |
||||
|
background-size: 100% 100%; |
||||
|
} |
||||
|
.line { |
||||
|
border-image: linear-gradient(180deg, rgba(83, 211, 229, 1), rgba(53, 147, 251, 1)) 2 2; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.oneBtn { |
||||
|
width: 100%; |
||||
|
height: 96rpx; |
||||
|
border-radius: 48rpx; |
||||
|
font-size: 36rpx; |
||||
|
color: #fff; |
||||
|
background: linear-gradient(180deg, #EEEEEE 0%, #D8D8D8 100%); |
||||
|
text-align: center; |
||||
|
line-height: 96rpx; |
||||
|
|
||||
|
&.active { |
||||
|
background: linear-gradient(180deg, #3593FB 0%, #53D3E5 100%); |
||||
|
} |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,204 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="zh"> |
||||
|
<head> |
||||
|
<meta charset="UTF-8"> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
<title>Document</title> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div id="root"></div> |
||||
|
</body> |
||||
|
</html> |
||||
|
|
||||
|
<script> |
||||
|
// 1,dom转json |
||||
|
const dom = document.getElementById('s-news-rank-content'); |
||||
|
|
||||
|
function dom2json(dom) { |
||||
|
let obj = {}; |
||||
|
obj.name = dom.tagName; |
||||
|
obj.children = []; |
||||
|
dom.childNodes.forEach(child => obj.children.push(dom2json(child))) |
||||
|
return obj; |
||||
|
} |
||||
|
console.log(dom2json(dom)) |
||||
|
|
||||
|
|
||||
|
// 2,json转dom |
||||
|
const json = { |
||||
|
tag: 'div', |
||||
|
attrs: { |
||||
|
id: 'app', class: 'app', |
||||
|
}, |
||||
|
children: [{ |
||||
|
tag: 'ul', |
||||
|
children: [ |
||||
|
{tag: 'li', children: ['list1']}, |
||||
|
{tag: 'li', children: ['list2']}, |
||||
|
{tag: 'li', children: ['list3']}, |
||||
|
{tag: 'li', children: ['list4']}, |
||||
|
{tag: 'li', children: ['list5']}, |
||||
|
] |
||||
|
}, |
||||
|
{tag: 'div', |
||||
|
children: ['我是个球']} |
||||
|
] |
||||
|
} |
||||
|
|
||||
|
function json2dom(vnode) { |
||||
|
if(typeof vnode=='string'||typeof vnode=='number') { |
||||
|
return document.createTextNode(String(vnode)) |
||||
|
}else { |
||||
|
const _dom = document.createElement(vnode.tag) |
||||
|
if(vnode.attrs) { |
||||
|
Object.entries(vnode.attrs).forEach(([key, value])=>{ |
||||
|
console.log(key, value) |
||||
|
_dom.setAttribute(key, value) |
||||
|
}) |
||||
|
} |
||||
|
vnode.children.forEach((item)=>_dom.appendChild(json2dom(item))) |
||||
|
return _dom |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
let dom2 = json2dom(json) |
||||
|
|
||||
|
let root = document.getElementById('root') |
||||
|
|
||||
|
root.appendChild(dom2) |
||||
|
|
||||
|
// 3,树转list |
||||
|
let tree = [{ |
||||
|
id: 1, |
||||
|
text: '根节点', |
||||
|
children: [ |
||||
|
{ |
||||
|
id: 2, |
||||
|
text: '一级节点1' |
||||
|
}, |
||||
|
{ |
||||
|
id: 3, |
||||
|
text: '一级节点2', |
||||
|
children: [ |
||||
|
{ |
||||
|
id: 4, |
||||
|
text: '二级节点2-1' |
||||
|
}, |
||||
|
{ |
||||
|
id: 5, |
||||
|
text: '二级节点2-2' |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
] |
||||
|
}] |
||||
|
|
||||
|
function treeToList(root) { |
||||
|
let res = [] |
||||
|
const dfs = function (data, parentId) { |
||||
|
data.forEach((item)=>{ |
||||
|
if(item.children) { |
||||
|
dfs(item.children, item.id) |
||||
|
delete (item.children) |
||||
|
} |
||||
|
item.parentId = parentId |
||||
|
res.push(item) |
||||
|
}) |
||||
|
} |
||||
|
dfs(root, 0) |
||||
|
return res |
||||
|
} |
||||
|
|
||||
|
// 4,list转树 |
||||
|
const list = [ |
||||
|
{ |
||||
|
"id": 2, |
||||
|
"text": "一级节点1", |
||||
|
"parentId": 1 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 4, |
||||
|
"text": "二级节点2-1", |
||||
|
"parentId": 3 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 6, |
||||
|
"text": "二级节点2-2", |
||||
|
"parentId": 3 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 3, |
||||
|
"text": "一级节点2", |
||||
|
"parentId": 1 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 1, |
||||
|
"text": "根节点", |
||||
|
"parentId": 0 |
||||
|
} |
||||
|
] |
||||
|
|
||||
|
function listToTree(data) { |
||||
|
let deps = {} |
||||
|
let result = [] |
||||
|
data.forEach(item=>{deps[item.id] = item}) |
||||
|
for(let i in deps) { |
||||
|
if(deps[i].parentId!=0) { |
||||
|
console.log(deps[deps[i].parentId], '不会了') |
||||
|
if(!deps[deps[i].parentId].children) { |
||||
|
deps[deps[i].parentId].children = [] |
||||
|
} |
||||
|
deps[deps[i].parentId].children.push(deps[i]) |
||||
|
}else { |
||||
|
result.push(deps[i]) |
||||
|
} |
||||
|
} |
||||
|
return result |
||||
|
} |
||||
|
console.log(listToTree(list)) |
||||
|
|
||||
|
// 5,数组打平 |
||||
|
let arr = [1,2,[3,4,[5,6]]] |
||||
|
|
||||
|
function flatten(arr) { |
||||
|
if(!arr.length) return |
||||
|
return arr.reduce((pre,cur)=> Array.isArray(cur)?[...pre, ...flatten(cur)]:[...pre,cur], []) |
||||
|
} |
||||
|
console.log(flatten(arr)) |
||||
|
|
||||
|
//6, 对象打平 |
||||
|
let obj = { |
||||
|
a: { |
||||
|
b: { |
||||
|
e: 2, |
||||
|
c: { |
||||
|
d: 1 |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
function flatten(obj) { |
||||
|
if(typeof obj !== 'object' || obj===null) return |
||||
|
let res = {} |
||||
|
const dfs = function(cur, prefix) { |
||||
|
if(typeof cur == 'object' && cur!==null) { |
||||
|
for(let k in cur) { |
||||
|
dfs(cur[k], `${prefix}${prefix?'.':''}${k}`) |
||||
|
} |
||||
|
}else { |
||||
|
res[prefix] = cur |
||||
|
} |
||||
|
} |
||||
|
dfs(obj, '') |
||||
|
console.log(res) |
||||
|
// return res |
||||
|
} |
||||
|
flatten(obj) |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
.app { |
||||
|
background-color: aquamarine; |
||||
|
} |
||||
|
</style> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue