Commit b9c7b42a authored by xinzhedeai's avatar xinzhedeai

加载中进度条取消 列表页跳转返回位置定位处理

parent 096faad1
...@@ -36,10 +36,10 @@ ...@@ -36,10 +36,10 @@
<div class="bgImg" @click="nav('dw-list')"> <div class="bgImg" @click="nav('dw-list')">
<img src="image/dw-list.png" alt="" srcset="" /> <img src="image/dw-list.png" alt="" srcset="" />
</div> </div>
<div class="bgImg" @click="nav('notice-list')"> <div class="bgImg" @click="nav('law-lv1')">
<img src="image/law-list.png" alt="" srcset="" /> <img src="image/law-list.png" alt="" srcset="" />
</div> </div>
<div class="bgImg" @click="nav('law-lv1')"> <div class="bgImg" @click="nav('notice-list')">
<img src="image/notice-list.png" alt="" srcset="" /> <img src="image/notice-list.png" alt="" srcset="" />
</div> </div>
<div class="bgImg" @click="nav('emergency')"> <div class="bgImg" @click="nav('emergency')">
......
...@@ -38,7 +38,7 @@ var http2 = { ...@@ -38,7 +38,7 @@ var http2 = {
// vaildInterfacefn("gqyjglptxiefn", params.serviceId, data, "1", "https://" + urldomaincreatesign, "https://" + urldomaingateway).then((value) => { // vaildInterfacefn("gqyjglptxiefn", params.serviceId, data, "1", "https://" + urldomaincreatesign, "https://" + urldomaingateway).then((value) => {
vaildInterfacefn("gqyjglptxiefn", params.serviceId, data, "1", extraData).then((value) => { vaildInterfacefn("gqyjglptxiefn", params.serviceId, data, "1", extraData).then((value) => {
console.log('vaildInterfacefn响应', value) // console.log('vaildInterfacefn响应', value)
/** /**
* code: 200 * code: 200
data: "048b04671ad85e52e" // value 值就是接口返回的data值 data: "048b04671ad85e52e" // value 值就是接口返回的data值
...@@ -59,7 +59,7 @@ var http2 = { ...@@ -59,7 +59,7 @@ var http2 = {
let sm2_encrypt_result = value // 后台返回待解密内容 let sm2_encrypt_result = value // 后台返回待解密内容
let sm2_decrypt_result = sm2_Decrypt(sm2_encrypt_result, params.interfacePrivateKey) let sm2_decrypt_result = sm2_Decrypt(sm2_encrypt_result, params.interfacePrivateKey)
// console.log('vaildInterfacefn响应解密', sm2_decrypt_result) console.log('vaildInterfacefn响应解密', sm2_decrypt_result)
const decryptRes = JSON.parse(sm2_decrypt_result) const decryptRes = JSON.parse(sm2_decrypt_result)
if(decryptRes.code === 400 || decryptRes.code === 401 || decryptRes.status === 401){ if(decryptRes.code === 400 || decryptRes.code === 401 || decryptRes.status === 401){
vant.Dialog.alert({ vant.Dialog.alert({
......
const appword = "aKd20dbGdFvmuwrt" // 固定值 const appword = "aKd20dbGdFvmuwrt" // 固定值
window.onload = function() { window.onload = function() {
vant.Toast.loading({ // vant.Toast.loading({
message: '加载中...', // message: '加载中...',
forbidClick: true, // forbidClick: true,
loadingType: 'spinner', // loadingType: 'spinner',
}); // });
// if(!localStorage.getItem('token')){ // if(!localStorage.getItem('token')){
if(!gemhoUtil.getCookie('token')){ if(!gemhoUtil.getCookie('token')){
getUserInfo() getUserInfo()
......
...@@ -203,6 +203,15 @@ gemhoUtil.navigatePage = function(path, title) { ...@@ -203,6 +203,15 @@ gemhoUtil.navigatePage = function(path, title) {
} else { } else {
url += path + '?rev=' + (+new Date()) url += path + '?rev=' + (+new Date())
} }
// 保存当前的滚动位置
var scrollPosition = window.scrollY;
// 利用 pushState 在浏览器历史记录中添加新状态
// history.pushState({ scrollPosition: scrollPosition }, '');
console.log('跳转页面', scrollPosition)
gemhoUtil.setCookie('scrollPosition', scrollPosition)
location.href = url; location.href = url;
} }
......
...@@ -13,7 +13,7 @@ window.addEventListener("load", function() { ...@@ -13,7 +13,7 @@ window.addEventListener("load", function() {
loading: false, loading: false,
finished: false, finished: false,
page: 0, page: 0,
size: 10, size: 9999,
total: 0 total: 0
} }
}, },
...@@ -34,10 +34,6 @@ window.addEventListener("load", function() { ...@@ -34,10 +34,6 @@ window.addEventListener("load", function() {
gemhoUtil.navigatePage('./dw-list-detail.html?dwId='+item.id+'&type=edit') gemhoUtil.navigatePage('./dw-list-detail.html?dwId='+item.id+'&type=edit')
}, },
getList(){ getList(){
// if(this.loading){
// return
// }
// this.loading = true
setTimeout(() => { setTimeout(() => {
http2.post({ http2.post({
serviceId: API_KEY_MAP["dw-list"]['id'], serviceId: API_KEY_MAP["dw-list"]['id'],
...@@ -51,7 +47,7 @@ window.addEventListener("load", function() { ...@@ -51,7 +47,7 @@ window.addEventListener("load", function() {
}, (res) => { }, (res) => {
if(res){ if(res){
console.log('接口回调数据', JSON.parse(res)) // console.log('接口回调数据', JSON.parse(res))
var result = JSON.parse(res) var result = JSON.parse(res)
this.loading = false; // 加载状态结束 this.loading = false; // 加载状态结束
...@@ -63,6 +59,10 @@ window.addEventListener("load", function() { ...@@ -63,6 +59,10 @@ window.addEventListener("load", function() {
} }
} }
this.loading = false this.loading = false
this.$nextTick(()=>{
// 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
})
}) })
}, 0) }, 0)
} }
......
...@@ -12,7 +12,7 @@ window.addEventListener("load", function() { ...@@ -12,7 +12,7 @@ window.addEventListener("load", function() {
loading: false, loading: false,
finished: false, finished: false,
page: 0, page: 0,
size: 10, size: 9999,
total: 0 total: 0
} }
}, },
...@@ -25,7 +25,7 @@ window.addEventListener("load", function() { ...@@ -25,7 +25,7 @@ window.addEventListener("load", function() {
}, },
resetSearchForm() { resetSearchForm() {
this.page = 0 this.page = 0
this.size = 20 this.size = 9999
this.total = 0 this.total = 0
this.list = [] this.list = []
this.finished = false; this.finished = false;
...@@ -40,10 +40,6 @@ window.addEventListener("load", function() { ...@@ -40,10 +40,6 @@ window.addEventListener("load", function() {
this.getList() this.getList()
}, },
getList() { getList() {
// if(this.loading){
// return
// }
// this.loading = true
setTimeout(() => { setTimeout(() => {
http2.post({ http2.post({
serviceId: API_KEY_MAP["emergency"]['id'], serviceId: API_KEY_MAP["emergency"]['id'],
...@@ -61,7 +57,7 @@ window.addEventListener("load", function() { ...@@ -61,7 +57,7 @@ window.addEventListener("load", function() {
}, (res) => { }, (res) => {
if (res) { if (res) {
console.log('接口回调数据', JSON.parse(res)) // console.log('接口回调数据', JSON.parse(res))
var result = JSON.parse(res).body var result = JSON.parse(res).body
this.loading = false; // 加载状态结束 this.loading = false; // 加载状态结束
...@@ -73,6 +69,10 @@ window.addEventListener("load", function() { ...@@ -73,6 +69,10 @@ window.addEventListener("load", function() {
} }
} }
this.loading = false this.loading = false
this.$nextTick(()=>{
// 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
})
}) })
}, 0) }, 0)
} }
......
...@@ -13,7 +13,7 @@ window.addEventListener("load", function() { ...@@ -13,7 +13,7 @@ window.addEventListener("load", function() {
loading: false, loading: false,
finished: false, finished: false,
page: 0, page: 0,
size: 10, size: 9999,
total: 0 total: 0
} }
}, },
...@@ -22,18 +22,10 @@ window.addEventListener("load", function() { ...@@ -22,18 +22,10 @@ window.addEventListener("load", function() {
}, },
methods: { methods: {
detail(index) { detail(index) {
// this.list[index].currentUserRead = true
// location.href = './law-list-detail.html?law_id='+this.list[index].lawId
gemhoUtil.navigatePage('./law-list-detail.html?law_id=' + this.list[index].lawId) gemhoUtil.navigatePage('./law-list-detail.html?law_id=' + this.list[index].lawId)
}, },
getList() { getList() {
// if(this.loading){
// return
// }
// this.loading = true
setTimeout(() => { setTimeout(() => {
http2.post({ http2.post({
serviceId: API_KEY_MAP["law-list"]['id'], serviceId: API_KEY_MAP["law-list"]['id'],
interfacePublicKey: API_KEY_MAP["law-list"]["publicKey"], interfacePublicKey: API_KEY_MAP["law-list"]["publicKey"],
...@@ -47,7 +39,7 @@ window.addEventListener("load", function() { ...@@ -47,7 +39,7 @@ window.addEventListener("load", function() {
}, (res) => { }, (res) => {
if (res) { if (res) {
console.log('接口回调数据', JSON.parse(res)) // console.log('接口回调数据', JSON.parse(res))
var result = JSON.parse(res) var result = JSON.parse(res)
this.list.push(...result.content); this.list.push(...result.content);
...@@ -58,6 +50,10 @@ window.addEventListener("load", function() { ...@@ -58,6 +50,10 @@ window.addEventListener("load", function() {
} }
} }
this.loading = false this.loading = false
this.$nextTick(()=>{
// 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
})
}) })
}, 0) }, 0)
} }
......
...@@ -13,7 +13,7 @@ window.addEventListener("load", function() { ...@@ -13,7 +13,7 @@ window.addEventListener("load", function() {
loading: false, loading: false,
finished: false, finished: false,
page: 0, page: 0,
size: 20, size: 9999,
total: 0 total: 0
} }
}, },
...@@ -26,13 +26,7 @@ window.addEventListener("load", function() { ...@@ -26,13 +26,7 @@ window.addEventListener("load", function() {
gemhoUtil.navigatePage('./law-lv2.html?pid=' + item.id) gemhoUtil.navigatePage('./law-lv2.html?pid=' + item.id)
}, },
getList() { getList() {
// if(this.loading){
// return
// }
// this.loading = true
setTimeout(() => { setTimeout(() => {
http2.post({ http2.post({
serviceId: API_KEY_MAP["law-lv"]['id'], serviceId: API_KEY_MAP["law-lv"]['id'],
interfacePublicKey: API_KEY_MAP["law-lv"]["publicKey"], interfacePublicKey: API_KEY_MAP["law-lv"]["publicKey"],
...@@ -45,7 +39,7 @@ window.addEventListener("load", function() { ...@@ -45,7 +39,7 @@ window.addEventListener("load", function() {
}, (res) => { }, (res) => {
if (res) { if (res) {
console.log('接口回调数据', JSON.parse(res)) // console.log('接口回调数据', JSON.parse(res))
var result = JSON.parse(res) var result = JSON.parse(res)
this.loading = false; // 加载状态结束 this.loading = false; // 加载状态结束
...@@ -57,6 +51,10 @@ window.addEventListener("load", function() { ...@@ -57,6 +51,10 @@ window.addEventListener("load", function() {
} }
} }
this.loading = false this.loading = false
this.$nextTick(()=>{
// 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
})
}) })
}, 0) }, 0)
} }
......
...@@ -11,7 +11,7 @@ window.addEventListener("load", function() { ...@@ -11,7 +11,7 @@ window.addEventListener("load", function() {
loading: false, loading: false,
finished: false, finished: false,
page: 0, page: 0,
size: 20, size: 9999,
total: 0 total: 0
} }
}, },
...@@ -25,13 +25,7 @@ window.addEventListener("load", function() { ...@@ -25,13 +25,7 @@ window.addEventListener("load", function() {
gemhoUtil.navigatePage('./law-list.html?category_id=' + category_id) gemhoUtil.navigatePage('./law-list.html?category_id=' + category_id)
}, },
getList() { getList() {
// if(this.loading){
// return
// }
// this.loading = true
setTimeout(() => { setTimeout(() => {
http2.post({ http2.post({
serviceId: API_KEY_MAP["law-lv"]['id'], serviceId: API_KEY_MAP["law-lv"]['id'],
interfacePublicKey: API_KEY_MAP["law-lv"]["publicKey"], interfacePublicKey: API_KEY_MAP["law-lv"]["publicKey"],
...@@ -45,7 +39,7 @@ window.addEventListener("load", function() { ...@@ -45,7 +39,7 @@ window.addEventListener("load", function() {
}, (res) => { }, (res) => {
if (res) { if (res) {
console.log('接口回调数据', JSON.parse(res)) // console.log('接口回调数据', JSON.parse(res))
var result = JSON.parse(res) var result = JSON.parse(res)
this.loading = false; // 加载状态结束 this.loading = false; // 加载状态结束
...@@ -60,6 +54,10 @@ window.addEventListener("load", function() { ...@@ -60,6 +54,10 @@ window.addEventListener("load", function() {
} }
} }
this.loading = false this.loading = false
this.$nextTick(()=>{
// 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
})
}) })
}, 0) }, 0)
} }
......
...@@ -11,12 +11,14 @@ window.addEventListener("load", function() { ...@@ -11,12 +11,14 @@ window.addEventListener("load", function() {
loading: false, loading: false,
finished: false, finished: false,
page: 0, page: 0,
size: 10, size: 9999,
total: 0 total: 0
} }
}, },
mounted() { mounted() {
this.getList() this.getList()
}, },
methods: { methods: {
detail(index) { detail(index) {
...@@ -25,13 +27,7 @@ window.addEventListener("load", function() { ...@@ -25,13 +27,7 @@ window.addEventListener("load", function() {
.noticeId) .noticeId)
}, },
getList() { getList() {
// if(this.loading){
// return
// }
// this.loading = true
setTimeout(() => { setTimeout(() => {
http2.post({ http2.post({
serviceId: API_KEY_MAP["notice-list"]['id'], serviceId: API_KEY_MAP["notice-list"]['id'],
interfacePublicKey: API_KEY_MAP["notice-list"]["publicKey"], interfacePublicKey: API_KEY_MAP["notice-list"]["publicKey"],
...@@ -44,7 +40,7 @@ window.addEventListener("load", function() { ...@@ -44,7 +40,7 @@ window.addEventListener("load", function() {
}, (res) => { }, (res) => {
if (res) { if (res) {
console.log('接口回调数据', JSON.parse(res)) // console.log('接口回调数据', JSON.parse(res))
var result = JSON.parse(res) var result = JSON.parse(res)
this.loading = false; // 加载状态结束 this.loading = false; // 加载状态结束
...@@ -56,6 +52,10 @@ window.addEventListener("load", function() { ...@@ -56,6 +52,10 @@ window.addEventListener("load", function() {
} }
} }
this.loading = false this.loading = false
this.$nextTick(()=>{
// 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
})
}) })
}, 0) }, 0)
} }
......
...@@ -13,21 +13,13 @@ window.addEventListener("load", function() { ...@@ -13,21 +13,13 @@ window.addEventListener("load", function() {
// loadFlag: false, // loadFlag: false,
finished: false, finished: false,
page: 0, page: 0,
size: 10, size: 9999,
total: 0 total: 0
} }
}, },
mounted() { mounted() {
this.getList() this.getList()
}, },
watch: {
loadFlag: {
handler(newValue, oldValue) {
console.log('loadFlag111变化了', oldValue, newValue);
},
immediate: true // 立即执行监听器
}
},
methods: { methods: {
detail(item) { detail(item) {
gemhoUtil.navigatePage('./yh-list-detail.html?hdId=' + item.hdId + '&type=detail') gemhoUtil.navigatePage('./yh-list-detail.html?hdId=' + item.hdId + '&type=detail')
...@@ -36,12 +28,6 @@ window.addEventListener("load", function() { ...@@ -36,12 +28,6 @@ window.addEventListener("load", function() {
gemhoUtil.navigatePage('./yh-list-detail.html?hdId=' + item.hdId + '&type=edit') gemhoUtil.navigatePage('./yh-list-detail.html?hdId=' + item.hdId + '&type=edit')
}, },
getList() { getList() {
console.log('this.loadFlag', this.loadFlag)
// if (this.loadFlag) {
// return
// }
// this.loadFlag = true
setTimeout(() => { setTimeout(() => {
http2.post({ http2.post({
serviceId: API_KEY_MAP["yh-list"]['id'], serviceId: API_KEY_MAP["yh-list"]['id'],
...@@ -63,7 +49,11 @@ window.addEventListener("load", function() { ...@@ -63,7 +49,11 @@ window.addEventListener("load", function() {
} }
} }
this.loadFlag = false this.loadFlag = false
console.log('响应结束',this.total, this.list.length) // console.log('响应结束',this.total, this.list.length)
this.$nextTick(()=>{
// 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
})
}) })
}, 0) }, 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment