登录相关

master
yujialong 12 months ago
parent 724c037db5
commit b7eb30ac13
  1. 5
      apis/modules/parner.js
  2. 3
      apis/modules/user.js
  3. 88
      pages/login/login.vue
  4. 283
      pages/person/person.vue
  5. 2
      team/personAuth/personAuth.vue
  6. 28
      team/setting/setting.vue

@ -39,4 +39,9 @@ export const editProvinceCity = data => {
export const getPartnerTeamRates = data => {
return post(`nakadai/nakadai/partner-team/getPartnerTeamRates`, data)
}
// new
export const getTeamsByPlatformId = data => {
return get(`nakadai/kindergarten/platformTeamAccount/getTeamsByPlatformId`, data)
}

@ -10,9 +10,6 @@ export const kindergartenWeChatApplication = (data) => {
export const realNameAuthentication = (data) => {
return post(`users/users/autonym/realNameAuthentication`, data)
}
export const faceAuthenticationByObject = (data) => {
return post(`users/users/autonym/faceAuthenticationByObject`, data)
}
export const faceAuthentication = (data) => {
return post(`users/users/autonym/faceAuthentication?imgFile=${data.imgFile}&side=${data.side}`)
}

@ -31,19 +31,19 @@
</view>
<view class="types">
<view class="item">
<view class="item" @click="toReg(5)">
<view class="icon">
<image class="img" src="https://occupationlab.com/images/preschoolEdu/role-icon1.png" mode="widthFix" />
</view>
<view class="text">我是幼儿园</view>
</view>
<view class="item item2">
<view class="item item2" @click="toReg(6)">
<view class="icon">
<image class="img" src="https://occupationlab.com/images/preschoolEdu/role-icon2.png" mode="widthFix" />
</view>
<view class="text">我是供应商</view>
</view>
<view class="item item3" @click="toReg">
<view class="item item3" @click="toReg(7)">
<view class="icon">
<image class="img" src="https://occupationlab.com/images/preschoolEdu/role-icon3.png" mode="widthFix" />
</view>
@ -72,6 +72,7 @@
openid: '',
unionid: '',
code: '',
phone: '',
submiting: false
}
},
@ -112,38 +113,18 @@
}).then(({ data }) => {
const { sessionKey, state } = data
this.submiting = false
//
//
if (state === 'bind') {
this.code = code
this.openid = sessionKey.openid
this.sessionKey = sessionKey.session_key
this.isLogin = true
this.isReg = true
// unilogincode
// uni.login({
// success: ({ code }) => {
// getSessionKey({
// code,
// }).then(({ sessionKey }) => {
// this.sessionKey = sessionKey.session_key
// this.openid = sessionKey.openid
// }).catch(e => {})
// this.isReg = true
// }
// })
} else {
const e = data.sessionKey
this.sessionKey = e.session_key
this.openid = e.openid
this.unionid = e.unionid
uni.setStorageSync('sessionKey', e.session_key)
uni.setStorageSync('openid', e.openid)
//
if (data.state === 'login') {
this.toIndex()
uni.setStorageSync('token', data.token)
} else {
this.isLogin = true
}
uni.setStorageSync('token', data.token)
uni.setStorageSync('platformId', data.platformId)
this.toIndex()
}
}).catch(e => {
this.submiting = false
@ -174,6 +155,7 @@
const data = pc.decryptData(encryptedData , iv)
this.submiting = true
const phone = data.phoneNumber
this.phone = phone
if (this.isReg) { //
this.$refs.popup.open('bottom')
} else { //
@ -213,52 +195,16 @@
}
},
//
async toReg() {
const res = await kindergartenWeChatApplication({
async toReg(platformId) {
const { data } = await kindergartenWeChatApplication({
code: this.code,
openId: this.openid,
platformId: 7
platformId,
phone: this.phone
})
// this.isReg = true
// if (this.agree.length) {
// const that = this
// uni.getUserProfile({
// lang: 'zh_CN',
// desc: '',
// success: ({ userInfo }) => {
// console.log(22, userInfo)
// uni.setStorageSync('userName', userInfo.nickName)
// uni.setStorageSync('avatar', userInfo.avatarUrl)
// uni.login({
// success: ({ code }) => {
// if (code) {
// this.submiting = true
// getSessionKey({
// code,
// }).then(({ sessionKey }) => {
// console.log(11, sessionKey)
// this.sessionKey = sessionKey.session_key
// this.openid = sessionKey.openid
// this.submiting = false
// this.isLogin = true
// }).catch(e => {
// this.submiting = false
// })
// } else {
// this.submiting = false
// that.$util.errMsg('')
// }
// }
// })
// },
// fail(res) {
// that.$util.errMsg('')
// }
// })
// } else {
// this.$util.errMsg('')
// }
uni.setStorageSync('token', data.token)
uni.setStorageSync('platformId', platformId)
this.toIndex()
},
toAgreement(id) {
this.$util.openFile(id)

@ -2,13 +2,20 @@
<view class="page">
<view class="status-bar"></view>
<image class="bg" src="https://occupationlab.com/images/preschoolEdu/person-bg.png" />
<view v-if="platformId !== 7" class="team-wrap" :style="{paddingTop: headerTop}">
<view class="team">
<uni-data-picker class="picker-input" placeholder="切换团队" popup-title="切换团队" preload :clear-icon="false" :localdata="teams" :map="{text: 'classificationName', value: 'teamId'}" v-model="teamId" @change="teamChange"></uni-data-picker>
</view>
</view>
<view class="wrap">
<view class="info">
<button class="avatar-btn" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<image class="avatar" :src="avatar" mode=""></image>
</button>
<view class="text">
<view class="name">{{ info.realName }}</view>
<view class="name">{{ info.realName || userName }}</view>
<view class="phone">1369641301</view>
</view>
<view class="auth" @click="toAuth">
@ -49,14 +56,40 @@
</ul>
</view>
<view v-if="role" class="block" style="padding-bottom: 0;">
<template v-if="platformId === 7">
<view class="types">
<view class="item">
<view class="left">
<view class="icon">
<image class="img" src="https://occupationlab.com/images/preschoolEdu/role-icon1.png" mode="widthFix" />
</view>
<view class="text">我是供应商</view>
</view>
<view class="btn" @click="tips">供应商认证</view>
</view>
</view>
<view class="types">
<view class="item item2">
<view class="left">
<view class="icon">
<image class="img" src="https://occupationlab.com/images/preschoolEdu/role-icon2.png" mode="widthFix" />
</view>
<view class="text">我是幼儿园</view>
</view>
<view class="btn" @click="tips">幼儿园认证</view>
</view>
</view>
</template>
<view v-else class="block" style="padding-bottom: 0;">
<view class="identity">
<view class="title">我是供应商</view>
<view class="badge">供应商负责人</view>
<view class="title">我是{{ platformName }}</view>
<view class="badge">{{ platformName }}负责人</view>
<view class="auth" @click="toPage('/team/certified/certified')">未认证</view>
</view>
<view class="identity-bg">
<image class="pic" src="https://occupationlab.com/images/preschoolEdu/vip.png" mode="widthFix" />
<image v-if="isPreschool" class="pic" src="https://occupationlab.com/images/preschoolEdu/preschool1.png" mode="widthFix" />
<image v-else class="pic" src="https://occupationlab.com/images/preschoolEdu/supplier1.png" mode="widthFix" />
<view class="open">
立即开通
<uni-icons class="icon" type="right" size="12" color="#c5530d"></uni-icons>
@ -68,9 +101,9 @@
<ul class="func">
<li @click="toPage('/team/auth/auth')">
<image src="https://occupationlab.com/images/preschoolEdu/icon7.png" />
<view class="text ell">供应商认证</view>
<view class="text ell">{{ platformName }}认证</view>
</li>
<li @click="tips">
<li v-if="isSupplier" @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon8.png" />
<view class="text ell">商品管理</view>
</li>
@ -80,9 +113,9 @@
</li>
<li @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon10.png" />
<view class="text ell">订单管理</view>
<view class="text ell">{{ isSupplier ? '订单管理' : '我的订单' }}</view>
</li>
<li @click="tips">
<li v-if="isSupplier" @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon11.png" />
<view class="text ell">活动管理</view>
</li>
@ -90,40 +123,27 @@
<image src="https://occupationlab.com/images/preschoolEdu/icon12.png" />
<view class="text ell">信息维护</view>
</li>
<li v-if="isPreschool" @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon15.png" />
<view class="text ell">我要采购</view>
</li>
<li @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon13.png" />
<view class="text ell">对账管理</view>
</li>
<li @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon14.png" />
<view class="text ell">商机线索</view>
</li>
<li @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon15.png" />
<view class="text ell">发票管理</view>
</li>
<template v-if="isSupplier">
<li @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon14.png" />
<view class="text ell">商机线索</view>
</li>
<li @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon15.png" />
<view class="text ell">发票管理</view>
</li>
</template>
</ul>
</view>
<template v-else>
<view class="types">
<view class="item">
<view class="icon">
<image class="img" src="https://occupationlab.com/images/preschoolEdu/role-icon1.png" mode="widthFix" />
</view>
<view class="text">我是幼儿园</view>
</view>
</view>
<view class="types">
<view class="item item2">
<view class="icon">
<image class="img" src="https://occupationlab.com/images/preschoolEdu/role-icon2.png" mode="widthFix" />
</view>
<view class="text">我是供应商</view>
</view>
</view>
</template>
<view class="list">
<view class="item" @click="toPage(`/team/setting/setting`)">
<view class="left">
@ -138,14 +158,15 @@
</template>
<script>
import { my, editProvinceCity } from '@/apis/modules/parner.js'
import { authenticationOrNot, queryProvince, queryCity, updateAvatars, getUserRolesPermissionMenu } from '@/apis/modules/user.js'
import { getTeamsByAccountId } from '@/apis/modules/client.js'
import { getTeamsByPlatformId } from '@/apis/modules/parner.js'
import { authenticationOrNot, updateAvatars } from '@/apis/modules/user.js'
import OSS from '@/libs/Oss/upload'
export default {
data() {
return {
per: true, //
teamId: uni.getStorageSync('teamId') || '',
platformId: uni.getStorageSync('platformId'),
teams: [],
info: {},
// avatar: uni.getStorageSync('avatar') || '@/static/image/avatar.png',
@ -154,12 +175,28 @@
hasOwnTeam: 0, //
disabled: true,
isAuth: false,
role: 0
headerTop: 0
}
},
computed: {
//
isPreschool() {
return this.platformId === 5
},
//
isSupplier() {
return this.platformId === 6
},
//
platformName() {
return this.platformId === 6 ? '供应商' : this.platformId === 5 ? '幼儿园' : ''
},
},
onShow() {
this.headerTop = uni.getMenuButtonBoundingClientRect().top + 8 + 'px'
this.per = true
this.getAuthOrNot()
this.platformId === 7 || this.getTeams()
},
methods: {
//
@ -178,79 +215,36 @@
this.info = res.authenticationInformation
}
},
//
getAuth() {
uni.showLoading({
title: '加载中'
//
async getTeams() {
const { data } = await getTeamsByPlatformId({platformId: this.platformId})
data.map(e => {
const n = e.platformTeamClassificationList
e.id = n.id
// parnerIdidteamIduni.getStorageSync('team').partnerId使
e.teamId = e.isTeam === '1' ? +e.classificationId : n.id
e.classificationName = n.classificationName
delete e.platformTeamClassificationList
})
getUserRolesPermissionMenu({
teamId: this.teams.find(e => e.teamId == this.teamId).partnerClassificationId,
platformId: 4
}).then(({ permissionMenu }) => {
uni.hideLoading()
const auth = []
//
const generateAuth = (list, parent) => {
list.map(e => {
const name = `${parent ? parent + ':' : ''}${e.name}`
auth.push(name)
generateAuth(e.children, name)
})
if (data.length) {
/**
* @description 如果是第一次进则默认选中第一个团队并把该团队的信息存入缓存
* 或者团队列表里没有该id则说明超管已经被转让也需要重新选中团队
*/
if (!uni.getStorageSync('team') || !data.find(e => e.teamId == this.teamId)) {
this.teamId = data[0].teamId
uni.setStorageSync('teamId', data[0].teamId)
uni.setStorageSync('team', data[0])
}
generateAuth(permissionMenu[0].children, '')
uni.setStorageSync('auth', auth)
this.initRole()
}).catch(e => {
uni.hideLoading()
uni.setStorageSync('auth', [])
this.initRole()
})
}
this.teams = data
},
//
getTeam() {
uni.showLoading({
title: '加载中'
})
getTeamsByAccountId().then(({ data }) => {
let hasOwnTeam = 0 //
data.map(e => {
const n = e.partnerClassificationList
e.id = n.id
// parnerIdidteamIduni.getStorageSync('team').partnerId使
e.teamId = e.isTeam == 1 ? +e.partnerClassificationId : n.id
e.partnerClassificationName = n.partnerClassificationName
delete e.partnerClassificationList
if (e.isTeam == 1) hasOwnTeam = 1
})
this.hasOwnTeam = hasOwnTeam
const teamId = uni.getStorageSync('teamId')
if (data.length) {
/**
* @description 如果是第一次进则默认选中第一个团队并把该团队的信息存入缓存
* 或者团队列表里没有该id则说明超管已经被转让也需要重新选中团队
*/
const curTeam = data.find(e => e.teamId == teamId)
if (teamId && curTeam) {
uni.setStorageSync('team', curTeam)
} else if (!uni.getStorageSync('team') || !curTeam) {
this.teamId = data[0].teamId
uni.setStorageSync('teamId', data[0].teamId)
uni.setStorageSync('team', data[0])
}
} else {
// 退
uni.hideLoading()
uni.clearStorageSync()
uni.navigateTo({
url: '../login/login'
})
}
this.disabled = uni.getStorageSync('team').isTeam == 0 //
this.teams = data
this.getAuth()
}).catch(e => {
uni.hideLoading()
})
//
teamChange() {
const { teamId } = this
const e = this.teams.find(e => e.teamId == teamId)
uni.setStorageSync('team', e)
uni.setStorageSync('teamId', teamId)
},
//
getInfo() {
@ -263,34 +257,30 @@
const avatar = my.info.userAvatars || 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png'
this.avatar = avatar
uni.setStorageSync('avatar', avatar)
this.provinceId = my.teamInfo.provinceId
this.cityId = my.teamInfo.cityId
uni.setStorageSync('provinceId', this.provinceId)
uni.setStorageSync('cityId', this.cityId)
this.getProvince()
this.provinceId && this.getCity()
}).catch(e => {})
},
//
onChooseAvatar(e) {
uni.uploadFile({
url: 'https://huorantech.cn/nakadai/nakadai/oss/fileUpload',
filePath: e.detail.avatarUrl,
name: 'file',
header: {
token: uni.getStorageSync('token'),
},
formData: {},
success: ({ data }) => {
updateAvatars(JSON.parse(data).filesResult.fileUrl).then(res => {
this.getInfo()
}).catch(e => {})
}
OSS(e.detail.avatarUrl, (name) => {
updateAvatars(name).then(res => {
// this.getInfo()
}).catch(e => {})
})
},
//
createTeam() {
this.$util.to(`../reg/reg?openid=${uni.getStorageSync('openid')}&phone=${this.my.info.phone}&my=1`)
// uni.uploadFile({
// url: 'https://huorantech.cn/nakadai/nakadai/oss/fileUpload',
// filePath: e.detail.avatarUrl,
// name: 'file',
// header: {
// token: uni.getStorageSync('token'),
// },
// formData: {},
// success: ({ data }) => {
// updateAvatars(JSON.parse(data).filesResult.fileUrl).then(res => {
// this.getInfo()
// }).catch(e => {})
// }
// })
},
toPage(href) {
this.$util.to(href)
@ -312,10 +302,21 @@
width: 100%;
height: calc(var(--status-bar-height) + 500rpx);
}
.team-wrap {
margin: -560rpx 30rpx 30rpx;
}
.team {
position: relative;
width: 300rpx;
/deep/.selected-item text {
font-size: 30rpx;
font-weight: 600;
color: #5f5f5f;
}
}
.wrap {
position: relative;
padding: 0 24rpx 24rpx;
margin-top: -400rpx;
}
.block {
padding: 24rpx;
@ -433,7 +434,7 @@
}
.open {
position: absolute;
top: 46rpx;
top: 50rpx;
right: 20rpx;
display: flex;
align-items: center;
@ -476,6 +477,7 @@
text-align: center;
.item {
display: flex;
justify-content: space-between;
align-items: center;
height: 150rpx;
padding: 0 50rpx;
@ -483,6 +485,10 @@
background: url('https://occupationlab.com/images/preschoolEdu/role-bg1.png') 0 0/100% 100% no-repeat;
box-sizing: border-box;
}
.left {
display: inline-flex;
align-items: center;
}
.icon {
display: inline-flex;
justify-content: center;
@ -508,5 +514,12 @@
width: 70rpx;
}
}
.btn {
padding: 8rpx 16rpx;
font-size: 24rpx;
color: #c5530d;
background-color: #f9cf9d;
border-radius: 8px;
}
}
</style>

@ -41,7 +41,7 @@
</template>
<script>
import { realNameAuthentication, faceAuthenticationByObject, faceAuthentication } from '@/apis/modules/user.js'
import { realNameAuthentication, faceAuthentication } from '@/apis/modules/user.js'
import OSS from '@/libs/Oss/upload'
export default {
data() {

@ -1,7 +1,7 @@
<template>
<view>
<uni-list>
<uni-list-item :show-extra-icon="true" showArrow :extra-icon="accountIcon" title="姓名" :rightText="info.account" clickable @click="toPage('../userName/userName')" />
<uni-list-item :show-extra-icon="true" showArrow :extra-icon="accountIcon" title="姓名" :rightText="realName" clickable @click="toPage('../userName/userName')" />
<uni-list-item :show-extra-icon="true" showArrow :extra-icon="phoneIcon" title="手机号" :rightText="info.phone" clickable @click="toPage('../phone/phone')" />
</uni-list>
@ -10,7 +10,7 @@
</template>
<script>
import { my } from '@/apis/modules/parner.js'
import { authenticationOrNot } from '@/apis/modules/user.js'
export default {
data() {
return {
@ -19,21 +19,12 @@
size: '22',
type: 'phone'
},
mailIcon: {
color: '#007eff',
size: '22',
type: 'email'
},
accountIcon: {
color: '#007eff',
size: '22',
type: 'person'
},
pwdIcon: {
color: '#007eff',
size: '22',
type: 'locked'
},
realName: '',
info: {
account: '',
phone: '',
@ -46,14 +37,11 @@
},
methods: {
//
getInfo() {
const { partnerId, teamId } = uni.getStorageSync('team')
my({
partnerId,
teamId
}).then(({ my }) => {
this.info = my.info
}).catch(e => {})
async getInfo() {
const res = await authenticationOrNot()
if (res.authenticationInformation) {
this.realName = res.authenticationInformation.realName
}
},
toPage(path) {
this.$util.to(path)

Loading…
Cancel
Save