| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <template>
- <view class="popupBox ">
- <view class="es-bc-white popupBox-content" v-if="userList.length>0">
- <view class="u-f es-mt-20 popupBox-content-list" v-for="(item,index) in userList" :key="index"
- @tap="loginByUserIdFun(item)">
- <view class="es-mr-20">
- <image class="es-icon-90 es-br-ban" :src="item.avatar" mode=""></image>
- </view>
- <view class="es-fs-40 es-fw x-c">
- {{item.nickName}}
- </view>
- </view>
- </view>
- <view v-else>
- <u-empty></u-empty>
- </view>
- </view>
- </template>
- <script>
- import {
- loginByUserId
- } from '@/api/user'
- export default {
- data() {
- return {
- userList: []
- }
- },
- mounted() {
- this.getRegistrationID()
- const wechatList = uni.getStorageSync('wechatList')
- if (wechatList) {
- this.userList = wechatList
- uni.removeStorageSync('wechatList')
- }
- },
- methods: {
- getRegistrationID() {
- let registrationID = uni.getStorageSync("registrationID");
- if (!registrationID) {
- uni.getPushClientId({
- success: res => {
- uni.setStorageSync("registrationID", res.cid);
- }
- });
- }
- },
- async loginByUserIdFun(e) {
- const requestParam = uni.getStorageSync('requestParam')
- uni.removeStorageSync('requestParam')
- let params = {
- ...requestParam,
- userId: e.userId,
- jpushId: uni.getStorageSync("registrationID")
- }
- const res = await loginByUserId(params)
- if (res.code == 200) {
- uni.setStorageSync('AppToken', res.token);
- uni.setStorageSync('userInfo', JSON.stringify(res.user));
- uni.$emit('refreshIM');
- uni.$emit('showHealthButler');
- this.goPage();
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- });
- }
- },
- goPage() {
- let pages = getCurrentPages();
- let url = pages[pages.length - 1];
- let openUrl = uni.getStorageSync("openUrl");
- if (openUrl) {
- uni.navigateTo({
- url: openUrl,
- success: function(res) {
- uni.removeStorageSync("openUrl")
- }
- })
- } else {
- this.$updateMsgDot();
- this.$setSource();
- uni.reLaunch({
- // url: '../course/index',
- url: '/pages_im/pages/conversation/conversationList/index',
- animationType: 'none',
- animationDuration: 2000
- });
- return;
- if (pages.length == 1) {
- uni.reLaunch({
- // url: '../course/index',
- url: '/pages_im/pages/conversation/conversationList/index',
- //url: '../course/video/living-app',
- animationType: 'none',
- animationDuration: 2000
- });
- } else {
- //this.$navBack();
- }
- }
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- .popupBox {
- padding: 48rpx 24rpx;
- padding-top: 0rpx;
- margin-top: 24rpx;
- width: 100vw;
- box-sizing: border-box;
- flex-direction: column;
- .popupBox-content {
- padding: 24rpx;
- padding-bottom: 0;
- border-radius: 16rpx;
- .popupBox-content-list {
- padding-bottom: 24rpx;
- border-bottom: 1rpx solid #F7F8FA;
- &:last-child {
- border-bottom: none;
- }
- }
- }
- }
- </style>
|