<template>
    <view>
        <navigator class="site" v-for="(item, i) in account_list" :key="item.userid" url="#" @click="selectSite(i)">
            {{ item.sitename }}-{{ item.name }}
        </navigator>
    </view>
</template>

<script>
import { loginMsg } from "./modules/dispose";
export default {
    name: "SelectSite",
    data() {
        return {
            account_list: uni.getStorageSync('account_list')
        }
    },
    methods: {
        selectSite(index) {
            let that = this,
                site = this.account_list[index];
            uni.showModal({
                title: '提示',
                content: `是否确定登录“${site.sitename}”站点的“${site.name}”账号`,
                success: ({ confirm }) => {
                    if (confirm) loginMsg([site], that, false);
                }
            })
        },
    },
}
</script>

<style lang="scss" scoped>
.site {
    width: 345px;
    border-radius: 4px;
    background: #fff;
    padding: 10px 15px;
    box-sizing: border-box;
    margin: 10px auto;
    font-size: 14px;
    color: #333333;
}
</style>