登录相关

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 => { export const getPartnerTeamRates = data => {
return post(`nakadai/nakadai/partner-team/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) => { export const realNameAuthentication = (data) => {
return post(`users/users/autonym/realNameAuthentication`, data) return post(`users/users/autonym/realNameAuthentication`, data)
} }
export const faceAuthenticationByObject = (data) => {
return post(`users/users/autonym/faceAuthenticationByObject`, data)
}
export const faceAuthentication = (data) => { export const faceAuthentication = (data) => {
return post(`users/users/autonym/faceAuthentication?imgFile=${data.imgFile}&side=${data.side}`) return post(`users/users/autonym/faceAuthentication?imgFile=${data.imgFile}&side=${data.side}`)
} }

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

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

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

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

Loading…
Cancel
Save