123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- <template>
- <view class="container bg-main pos-r">
- <view class="padding-xl dflex-c dflex-flow-c">
- <!-- Logo -->
- <view class="headimg-box margin-top margin-bottom-xl" style="width: 120px; height: 120px;">
- <image class="headimg border-radius-c" :src="logo"
- style="width: 100%; height: 100%; object-fit: cover;" />
- </view>
- <!-- 标题 -->
- <view class="fs-xl fw-bold margin-bottom-sm">{{name}}</view>
- <!-- 简介 -->
- <view class="ft-dark margin-bottom-xxl tac">
- {{info}}
- </view>
- <!-- 加载中 -->
- <view v-if="loading" class="dflex-c dflex-flow-c margin-top-xl">
- <text class="fs ft-dark margin-bottom-sm">亲爱的~欢迎您回来...</text>
- <view class="loading-spinner"></view>
- </view>
- <view v-else class="w-full" style="margin-top:40rpx;">
- <view class="dflex margin-bottom">
- <view class="iconfont iconmima margin-right"></view>
- <view class="dflex flex1 border-line">
- <input class="padding-sm flex1" type="text" v-model="code" :focus="true"
- placeholder="请输入访问码进入系统" @focus="inputType = 'password'" autocomplete="new-password"
- autocorrect="off" spellcheck="false" />
- <view class="pos-r" @click="show">
- <view class="vertical-line" style="right: calc(100% + 9px);"></view>
- <view class="padding-tb-sm ft-dark">不知道?</view>
- </view>
- </view>
- </view>
- <!-- 登录按钮 -->
- <view class="w-full margin-top-xxl">
- <view class="dflex-b border-radius-lg">
- <u-button text="进入" type="error" :disabled="loading" :loading="loading" @tap="entry"></u-button>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import config from '@/lib/dever/config.js'
- export default {
- data() {
- return {
- name: '',
- place: '',
- info: '',
- logo: '',
- code: '',
- jump: '',
- loading: false
- }
- },
- onLoad(query) {
- if (query.scene) {
- let scene = decodeURIComponent(query.scene)
- query.code = scene
- }
- if (query.jump) {
- this.jump = query.jump;
- }
- if (query.code) {
- this.code = query.code;
- }
- this.place = query.p;
- },
- onShow() {
- if (this.code) {
- return this.entry()
- }
- this.init(this.place)
- },
- methods: {
- init(place) {
- if (place) {
- this.DeverApi.setCode(place);
- }
- place = this.DeverApi.getCode();
- if (place) {
- this.loading = true;
- this.loadData()
- } else {
- this.loading = false;
- this.DeverApi.get(this, 'version', {}, res => {
- this.logo = res.logo
- this.name = res.name
- this.info = res.info
- if (res.code) {
- this.code = res.code;
- this.entry()
- } else if(!this.place && !this.code && config.base.code) {
- this.code = config.base.code
- this.entry()
- }
- });
- }
- },
- async loadData() {
- this.$config = this.Dever.upConfig(true);
- this.$config.then(config => {
- this.logo = config.l
- this.name = config.n
- this.info = config.i
- uni.setNavigationBarTitle({
- title: this.name
- });
- if (this.jump) {
- this.Dever.data('jump', this.jump);
- }
- this.Dever.goTabbar(config.m, 0)
- });
- },
- show() {
- this.Dever.alert('这个访问码是私密的哦,请先联系您的主理人吧');
- },
- entry() {
- if (!this.code) {
- return this.Dever.alert('请输入正确访问码');
- }
- this.DeverApi.post('code', {
- code: this.code
- }, res => {
- if (res.jump) {
- this.jump = res.jump;
- }
- this.init(res.code)
- });
- }
- }
- }
- </script>
- <style lang="scss">
- page {
- background: #f4f4f4;
- }
- .container {
- padding-top: 15vh;
- width: 100vw;
- min-height: 100vh;
- overflow: hidden;
- }
- .headimg-box {
- image {
- width: 130rpx;
- height: 130rpx;
- border: 5rpx solid #fff;
- }
- }
- /* 简单 Loading 动画 */
- .loading-spinner {
- width: 40rpx;
- height: 40rpx;
- border: 4rpx solid #ccc;
- border-top-color: #409eff;
- border-radius: 50%;
- animation: spin 1s linear infinite;
- }
- @keyframes spin {
- 0% {
- transform: rotate(0deg);
- }
- 100% {
- transform: rotate(360deg);
- }
- }
- </style>
|