Commit b5a2c407 by wenyang

IOS上架,按要求调整(1.用户不登录可以访问非基于帐户的功能,默认以游客身份登录)

parent 63dcef6d
......@@ -11,7 +11,7 @@
import api from "../../api/api";
import common from '../../common/common';
export default{
props:['isSearch'],
props:['isSearch','userId'],
data(){
return {
messageUnreadCount:null,
......@@ -25,12 +25,15 @@
},
methods:{
jumpToSystemMsg(){
if(this.userId){
uni.navigateTo({
url:'../systemMsg/system_msg'
})
}
},
querySystemMessage(){
api.querySystemMessage({systemType:1,userId:uni.getStorageSync('cffp_userId')}).then((res)=>{
if(this.userId){
api.querySystemMessage({systemType:1,userId:this.userId}).then((res)=>{
if(res['success']){
this.messageUnreadCount = res['data']['unReadcount'];
if(Number(this.messageUnreadCount) > 99){
......@@ -40,6 +43,9 @@
this.messageUnreadCount = null;
}
})
}else{
this.messageUnreadCount = 0;
}
},
searchBtn(){
if(this.isSearch == 1){
......@@ -54,7 +60,6 @@
url:'/pages/courselist/courselist'
})
}
}
},
mounted() {
......
......@@ -2,7 +2,7 @@
"name" : "CFFP财富中心",
"appid" : "__UNI__ED34740",
"description" : "",
"versionCode" : 101,
"versionCode" : 102,
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
......
......@@ -15,7 +15,7 @@
<text class="iconfont icon-31tishi" @click="getIntroduce('center')"></text>
</view>
<!--搜索组件-->
<search :isSearch="0"></search>
<search :isSearch="0" :userId = "userId"></search>
<!--轮播组件-->
<view class="banner">
<view class="uni-margin-wrap">
......@@ -170,23 +170,43 @@
search,
courseItem
},
onLoad() {
onShow() {
},
onShow() {
onLoad() {
if (uni.getStorageSync('isLogin')) {
this.queryAreaCenterInfo();
this.announcementQuery();
this.courseList()
} else {
uni.navigateTo({
url: '/components/login/login'
})
}
let loginType = uni.getStorageSync('loginType')
if(loginType == "visitor" ){
this.loginornot = false
};
} else {
/* uni.navigateTo({
url: '/components/login/login'
}) */
api.loginVerification({"loginType":1}).then((res)=>{
if(res['success']){
this.userId = String(res['data']['userId']);
uni.setStorageSync('isLogin','1');
uni.setStorageSync('cffp_userId',this.userId);
uni.setStorageSync('loginType', 'visitor');
uni.setStorageSync('uni-token', res.data['token']);
this.loginornot = false;
this.queryAreaCenterInfo();
this.announcementQuery();
this.courseList()
}else{
uni.showToast({
title: res['message'],
duration: 2000,
icon: 'none'
})
}
})
}
},
methods: {
goDetail(item){
......
// import {baseURL,apiURL,cffpURL} from "../environments/environment";
import {baseURL,apiURL,cffpURL} from "../environments/environment";
// 白名单,不需要携带token就允许被访问的接口
const whiteApiList = [`/api/authorize/obtainToken`, `/api/authorize/checkToken`];
const whiteApiList = [`${apiURL}/authorize/obtainToken`, `${apiURL}/authorize/checkToken`];
export const interceptor = () => {
uni.addInterceptor('request', {
// 请求拦截器
invoke(args) {
// console.log('请求拦截器',args);
//console.log('请求拦截器',args.url);
// 加载loading
// uni.showLoading({
// title: '加载中...'
......@@ -24,7 +24,7 @@ export const interceptor = () => {
params.loginId = h5userId;
}
uni.request({
url: '/api/authorize/obtainToken',
url: `${apiURL}/authorize/obtainToken`,
method: 'POST',
data: params,
success: (res) => {
......
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