feat: 登录页面记录列表支持滚动条
This commit is contained in:
+45
-18
@@ -43,10 +43,14 @@
|
|||||||
<uni-icons type="bottom" size="18" color="#C6C6C6" />
|
<uni-icons type="bottom" size="18" color="#C6C6C6" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<scroll-view
|
||||||
v-if="shouldShowSuggestionList(dataObj.formArr[v].value)"
|
v-if="shouldShowSuggestionList(dataObj.formArr[v].value)"
|
||||||
class="login-suggest"
|
class="login-suggest"
|
||||||
|
scroll-y="true"
|
||||||
|
:show-scrollbar="false"
|
||||||
|
enhanced
|
||||||
@tap.stop
|
@tap.stop
|
||||||
|
@touchmove.stop
|
||||||
>
|
>
|
||||||
<view
|
<view
|
||||||
v-for="item in suggestionListFor(dataObj.formArr[v].value)"
|
v-for="item in suggestionListFor(dataObj.formArr[v].value)"
|
||||||
@@ -63,7 +67,7 @@
|
|||||||
<view class="login-suggest-sub">{{ item.hasPassword ? '已保存密码' : '仅保存账号' }}</view>
|
<view class="login-suggest-sub">{{ item.hasPassword ? '已保存密码' : '仅保存账号' }}</view>
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</scroll-view>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
</view>
|
</view>
|
||||||
</uni-forms>
|
</uni-forms>
|
||||||
@@ -84,7 +88,7 @@
|
|||||||
>{{ dataObj.btns[dataObj.con[type].btn2]?.text }}</view
|
>{{ dataObj.btns[dataObj.con[type].btn2]?.text }}</view
|
||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
<view class="submit-btn" @click="$debounce(sub, 1000)">
|
<view class="submit-btn" :class="{ 'submit-btn--disabled': submitLoading }" @tap="handleSubmit">
|
||||||
{{ dataObj.con[type].sub }}
|
{{ dataObj.con[type].sub }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -109,7 +113,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, computed } from 'vue';
|
import { ref, reactive, computed, nextTick } from 'vue';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import AuthUtil from '@/sheep/api/member/auth';
|
import AuthUtil from '@/sheep/api/member/auth';
|
||||||
@@ -264,6 +268,7 @@
|
|||||||
const HISTORY_LIMIT = 20;
|
const HISTORY_LIMIT = 20;
|
||||||
const loginHistory = ref([]);
|
const loginHistory = ref([]);
|
||||||
const dropdownVisibleFor = ref('');
|
const dropdownVisibleFor = ref('');
|
||||||
|
const submitLoading = ref(false);
|
||||||
const hasAnyHistory = computed(() => {
|
const hasAnyHistory = computed(() => {
|
||||||
const list = Array.isArray(loginHistory.value) ? loginHistory.value : [];
|
const list = Array.isArray(loginHistory.value) ? loginHistory.value : [];
|
||||||
return list.length > 0;
|
return list.length > 0;
|
||||||
@@ -372,6 +377,9 @@
|
|||||||
formData.mobile = item.mobile;
|
formData.mobile = item.mobile;
|
||||||
if (item.hasPassword) formData.password = item.password;
|
if (item.hasPassword) formData.password = item.password;
|
||||||
dropdownVisibleFor.value = '';
|
dropdownVisibleFor.value = '';
|
||||||
|
nextTick(() => {
|
||||||
|
uni.hideKeyboard();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatPasswordPreview(value) {
|
function formatPasswordPreview(value) {
|
||||||
@@ -423,21 +431,37 @@
|
|||||||
case 4: //忘记密码
|
case 4: //忘记密码
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
url(obj).then((res) => {
|
if (!url) return;
|
||||||
if (res.code === 0) {
|
const res = await url(obj).catch(() => null);
|
||||||
if (type.value == 3) {
|
if (res?.code === 0) {
|
||||||
typeChange(2);
|
if (type.value == 3) {
|
||||||
return;
|
typeChange(2);
|
||||||
}
|
return;
|
||||||
if (type.value === 2) {
|
|
||||||
upsertLoginHistory({ mobile: formData.mobile, password: formData.password });
|
|
||||||
}
|
|
||||||
sheep.$store('user').getInfo();
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.reLaunch({ url: '/pages/index/index' });
|
|
||||||
}, 1000);
|
|
||||||
}
|
}
|
||||||
});
|
if (type.value === 2) {
|
||||||
|
upsertLoginHistory({ mobile: formData.mobile, password: formData.password });
|
||||||
|
}
|
||||||
|
sheep.$store('user').getInfo();
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.reLaunch({ url: '/pages/index/index' });
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSubmit = async () => {
|
||||||
|
if (submitLoading.value) return;
|
||||||
|
submitLoading.value = true;
|
||||||
|
dropdownVisibleFor.value = '';
|
||||||
|
uni.hideKeyboard();
|
||||||
|
await nextTick();
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 80));
|
||||||
|
try {
|
||||||
|
await sub();
|
||||||
|
} finally {
|
||||||
|
setTimeout(() => {
|
||||||
|
submitLoading.value = false;
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
let timer = ref();
|
let timer = ref();
|
||||||
const getCode = () => {
|
const getCode = () => {
|
||||||
@@ -567,6 +591,9 @@
|
|||||||
);
|
);
|
||||||
box-shadow: 0 18rpx 44rpx var(--primary-shadow, rgba(47, 124, 246, 0.35));
|
box-shadow: 0 18rpx 44rpx var(--primary-shadow, rgba(47, 124, 246, 0.35));
|
||||||
}
|
}
|
||||||
|
.submit-btn--disabled {
|
||||||
|
opacity: 0.72;
|
||||||
|
}
|
||||||
.input-icon {
|
.input-icon {
|
||||||
width: 40rpx;
|
width: 40rpx;
|
||||||
height: 40rpx;
|
height: 40rpx;
|
||||||
|
|||||||
Reference in New Issue
Block a user