feat: 登录页面记录列表支持滚动条

This commit is contained in:
2026-06-26 13:38:34 +08:00
parent 655eceafbc
commit a2f39099d6
+34 -7
View File
@@ -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,8 +431,9 @@
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 (res?.code === 0) {
if (type.value == 3) { if (type.value == 3) {
typeChange(2); typeChange(2);
return; return;
@@ -437,7 +446,22 @@
uni.reLaunch({ url: '/pages/index/index' }); uni.reLaunch({ url: '/pages/index/index' });
}, 1000); }, 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;