Commit b5a2c407 by wenyang

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

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