职站学生端小程序版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
2.0 KiB

4 days ago
<template>
<view class="page">
4 days ago
<view class="tips">已为你展示{{ phone }}手机号关联的账号登录后可在切换账号列表快捷切换至其他账号</view>
<template v-if="accounts.length">
<ul class="list">
<li v-for="item in accounts">
<view class="left">
<image class="avatar" :src="item.userAvatars || require('@/static/image/avatar.png')" mode=""></image>
<view class="info">
<view class="name">{{ item.userName }}</view>
<view class="org">{{ item.schoolName }}</view>
4 days ago
</view>
</view>
<view class="btn" @click="login(item)">登录</view>
4 days ago
</li>
</ul>
</template>
</view>
</template>
<script>
import { weChatToken } from '@/apis/modules/user.js'
4 days ago
export default {
data() {
return {
openid: '',
phone: '',
accounts: JSON.parse(uni.getStorageSync('accounts')),
4 days ago
}
},
onShow() {
const pages = getCurrentPages()
const { options } = pages[pages.length - 1]
this.openid = options.openid
this.phone = options.phone
4 days ago
},
methods: {
// 登录
async login(item) {
const { data } = await weChatToken({
id: item.id,
openid: this.openid,
phone: this.phone,
platformId: 1,
})
uni.setStorageSync('token', data.token)
uni.switchTab({
url: '/pages/index/index'
})
4 days ago
}
}
}
</script>
<style scoped lang="scss">
.page {
padding: 30rpx;
}
4 days ago
.tips {
margin-bottom: 20rpx;
font-size: 24rpx;
color: #616161;
4 days ago
}
.list {
li {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
margin-bottom: 30rpx;
background-color: #fff;
border-radius: 8rpx;
}
.left {
display: inline-flex;
align-items: center;
4 days ago
}
.avatar {
width: 100rpx;
height: 100rpx;
margin-right: 30rpx;
border-radius: 50%;
}
.name {
margin-bottom: 6rpx;
font-size: 32rpx;
4 days ago
color: #333;
}
.org {
4 days ago
font-size: 28rpx;
color: #333;
}
.btn {
padding: 10rpx 36rpx;
4 days ago
font-size: 24rpx;
color: #fff;
background-color: #2979ff;
border-radius: 20px;
}
}
</style>