Commit 3b08473e by sunchao

relaunch改成redirectTo

parent 1b76257f
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<input class="uni-input" name="invitationCode" placeholder="输入邀请码(非必填)" v-model="invitation_code"/> <input class="uni-input" name="invitationCode" placeholder="输入邀请码(非必填)" v-model="invitation_code"/>
</view> --> </view> -->
<view class="inputItem" v-if="loginType!=='agentlogin'"> <view class="inputItem" v-if="loginType!=='agentlogin'">
<input class="uni-input" name="mobileNo" placeholder="输入手机号" v-model="form.mobile" maxlength="11"/> <input type="number" class="uni-input" name="mobileNo" placeholder="输入手机号" v-model="form.mobile" maxlength="11"/>
</view> </view>
<view class="inputItem" v-if="loginType==='agentlogin'"> <view class="inputItem" v-if="loginType==='agentlogin'">
<input class="uni-input" name="mobileNo" placeholder="输入账号" v-model="form.account" maxlength="11"/> <input class="uni-input" name="mobileNo" placeholder="输入账号" v-model="form.account" maxlength="11"/>
...@@ -155,16 +155,22 @@ ...@@ -155,16 +155,22 @@
} }
api.loginVerification(params).then((res)=>{ api.loginVerification(params).then((res)=>{
if(res['success']){ if(res['success']){
console.log(1)
this.userId = String(res['data']['userId']); this.userId = String(res['data']['userId']);
uni.setStorageSync('isLogin','1') uni.setStorageSync('isLogin','1');
uni.setStorageSync('cffp_userId',this.userId); uni.setStorageSync('cffp_userId',this.userId);
uni.setStorageSync('loginType',this.loginType) uni.setStorageSync('loginType',this.loginType)
// uni.navigateTo({ // uni.navigateTo({
// url:'/pages/index/index' // url:'/pages/index/index'
// }) // })
console.log(2)
// uni.switchTab({
// url: '/pages/courselist/courselist'
// })
uni.switchTab({ uni.switchTab({
url: '/pages/index/index' url:'/pages/index/index'
}) })
console.log(3)
}else{ }else{
uni.showToast({ uni.showToast({
title: res['message'], title: res['message'],
......
...@@ -48,15 +48,11 @@ ...@@ -48,15 +48,11 @@
}else{ }else{
//有参数就掉查询否则直接跳转到课程列表页 //有参数就掉查询否则直接跳转到课程列表页
if(this.queryName){ if(this.queryName){
// this.$emit("send",this.queryName) uni.setStorageSync('queryName',this.queryName)
uni.navigateTo({
url:`/pages/courselist/courselist?queryName=${this.queryName}`
})
}else{
uni.switchTab({
url:'/pages/courselist/courselist'
})
} }
uni.switchTab({
url:'/pages/courselist/courselist'
})
} }
} }
......
...@@ -270,14 +270,9 @@ ...@@ -270,14 +270,9 @@
} }
}, },
goBack() { goBack() {
let back = getCurrentPages(); uni.navigateBack({
if (back && back.length > 1) { delta: 1
uni.navigateBack({ });
delta: 1
});
} else {
history.back();
}
}, },
// 监听空白关闭 // 监听空白关闭
maskClick(val) { maskClick(val) {
......
<template> <template>
<view :class="{pad:onlyShowList!=0}"> <view class="pad">
<!--搜索组件--> <!--搜索组件-->
<search :isSearch="1" v-if="onlyShowList!=0" @send="getCourseList"></search> <search :isSearch="1" @send="getCourseList"></search>
<!--轮播组件--> <!--轮播组件-->
<carousel :carouselList="fileUploadItemCFFPList" v-if="onlyShowList!=0"></carousel> <carousel :carouselList="fileUploadItemCFFPList"></carousel>
<h4 v-if="cffpCourseInfos.length<=0" class="noListTip">暂无课程列表</h4> <h4 v-if="cffpCourseInfos.length<=0" class="noListTip">暂无课程列表</h4>
<view class="ulBox" v-if="cffpCourseInfos.length>0"> <view class="ulBox" v-if="cffpCourseInfos.length>0">
<view class="liBox" v-for="item in cffpCourseInfos" :key="item.fileId" @click="goDetail(item)"> <view class="liBox" v-for="item in cffpCourseInfos" :key="item.fileId" @click="goDetail(item)">
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
import carousel from '@/components/carousel/carousel.vue'; import carousel from '@/components/carousel/carousel.vue';
import search from '@/components/search/search.vue'; import search from '@/components/search/search.vue';
export default{ export default{
props:['tagIds','onlyShowList'], props:['tagIds'],
data(){ data(){
return{ return{
cffpCourseInfos:[], cffpCourseInfos:[],
...@@ -37,9 +37,9 @@ ...@@ -37,9 +37,9 @@
carousel, carousel,
search search
}, },
onLoad(options){ onLoad(){
this.fileUploadItemCFFPList = uni.getStorageSync('fileUploadItemCFFPList'); this.fileUploadItemCFFPList = uni.getStorageSync('fileUploadItemCFFPList');
this.queryName = options.queryName; this.queryName = uni.getStorageSync('queryName');
}, },
methods:{ methods:{
goDetail(item){ goDetail(item){
...@@ -78,6 +78,9 @@ ...@@ -78,6 +78,9 @@
}, },
mounted() { mounted() {
this.courseList(); this.courseList();
},
onHide() {
uni.removeStorageSync('queryName')
} }
} }
</script> </script>
......
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
search, search,
courseItem courseItem
}, },
onLoad(options) { onLoad() {
if (uni.getStorageSync('isLogin')) { if (uni.getStorageSync('isLogin')) {
this.queryAreaCenterInfo(); this.queryAreaCenterInfo();
this.announcementQuery(); this.announcementQuery();
...@@ -173,6 +173,7 @@ ...@@ -173,6 +173,7 @@
}) })
} }
this.courseList() this.courseList()
}, },
onShow() { onShow() {
let loginType = uni.getStorageSync('loginType') let loginType = uni.getStorageSync('loginType')
...@@ -217,7 +218,7 @@ ...@@ -217,7 +218,7 @@
duration: 2000, duration: 2000,
icon: 'none' icon: 'none'
}); });
uni.reLaunch({ uni.redirectTo({
url:'/components/login/login' url:'/components/login/login'
}) })
return false return false
...@@ -304,14 +305,11 @@ ...@@ -304,14 +305,11 @@
}) })
}, },
onChange: function(e) { onChange: function(e) {
console.log(e)
this.old.x = e.detail.x this.old.x = e.detail.x
this.old.y = e.detail.y this.old.y = e.detail.y
} }
}, },
mounted() { mounted() {
} }
} }
</script> </script>
......
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
created() { created() {
}, },
destroyed() {
uni.hideToast();
},
methods:{ methods:{
getFile(type){ getFile(type){
uni.navigateTo({ uni.navigateTo({
......
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
codetimecode: false codetimecode: false
} }
}, },
destroyed() {
uni.hideToast();
},
methods: { methods: {
sendMessage() { sendMessage() {
const params = { const params = {
...@@ -76,7 +79,7 @@ ...@@ -76,7 +79,7 @@
icon: 'none' icon: 'none'
}) })
uni.removeStorageSync('isLogin') uni.removeStorageSync('isLogin')
uni.reLaunch({ uni.redirectTo({
url:'/components/login/login' url:'/components/login/login'
}) })
//重置密码后需要密码登录 //重置密码后需要密码登录
......
...@@ -170,10 +170,15 @@ ...@@ -170,10 +170,15 @@
duration: 2000, duration: 2000,
icon: 'none' icon: 'none'
}); });
uni.reLaunch({ uni.redirectTo({
url:'/components/login/login' url:'/components/login/login'
}) })
uni.clearStorageSync(); try {
uni.clearStorageSync();
} catch (e) {
// console.log(e)
// error
}
return false return false
}, },
// 菜单跳转页面 // 菜单跳转页面
......
...@@ -38,9 +38,12 @@ ...@@ -38,9 +38,12 @@
let dataForm = uni.getStorageSync('userinfodataForm') let dataForm = uni.getStorageSync('userinfodataForm')
this.mobile = dataForm.mobile this.mobile = dataForm.mobile
}, },
destroyed() {
uni.hideToast();
},
methods: { methods: {
cancel(){ cancel(){
uni.navigateBack(1) uni.navigateBack({delta:1})
}, },
sunmit(){ sunmit(){
api.cancellation({userId: this.userId}).then(res =>{ api.cancellation({userId: this.userId}).then(res =>{
...@@ -49,7 +52,7 @@ ...@@ -49,7 +52,7 @@
title: '操作成功', title: '操作成功',
icon: 'none' icon: 'none'
}); });
uni.reLaunch({ uni.redirectTo({
url:'/components/login/login' url:'/components/login/login'
}) })
} }
......
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
mounted() { mounted() {
console.log(this.minorMenuLists, 7412) console.log(this.minorMenuLists, 7412)
}, },
destroyed() {
uni.hideToast();
},
methods: { methods: {
goDetail(item) { goDetail(item) {
console.log(item, 844) console.log(item, 844)
......
...@@ -48,6 +48,9 @@ import MenuList from "@/components/menuList/menuList.vue" ...@@ -48,6 +48,9 @@ import MenuList from "@/components/menuList/menuList.vue"
] ]
} }
}, },
destroyed() {
uni.hideToast();
},
methods:{ methods:{
outLing(){ outLing(){
uni.showModal({ uni.showModal({
...@@ -56,10 +59,16 @@ import MenuList from "@/components/menuList/menuList.vue" ...@@ -56,10 +59,16 @@ import MenuList from "@/components/menuList/menuList.vue"
showCancel: true, showCancel: true,
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
uni.reLaunch({ console.log(getCurrentPages().length)
uni.redirectTo({
url:'/components/login/login' url:'/components/login/login'
}) })
uni.clearStorageSync(); try {
uni.clearStorageSync();
} catch (e) {
console.log(e)
// error
}
uni.showToast({ uni.showToast({
title: '操作成功', title: '操作成功',
icon: 'none' icon: 'none'
......
...@@ -12,7 +12,7 @@ export default function initApp(){ ...@@ -12,7 +12,7 @@ export default function initApp(){
// 页面跳转前进行拦截, invoke根据返回值进行判断是否继续执行跳转 // 页面跳转前进行拦截, invoke根据返回值进行判断是否继续执行跳转
invoke (e) { invoke (e) {
if(!hasPermission(e.url)){ if(!hasPermission(e.url)){
uni.reLaunch({ uni.redirectTo({
url: '/components/login/login' url: '/components/login/login'
}) })
return false return false
...@@ -27,7 +27,7 @@ export default function initApp(){ ...@@ -27,7 +27,7 @@ export default function initApp(){
// tabbar页面跳转前进行拦截 // tabbar页面跳转前进行拦截
invoke (e) { invoke (e) {
if(!hasPermission(e.url)){ if(!hasPermission(e.url)){
uni.reLaunch({ uni.redirectTo({
url: '/components/login/login' url: '/components/login/login'
}) })
return false return false
......
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