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