游客模式

This commit is contained in:
徐哼唧L
2023-12-06 16:26:45 +08:00
parent 52b8c4503b
commit 97ff3915c0
10 changed files with 603 additions and 405 deletions

View File

@@ -2,7 +2,7 @@
<view>
<view class="footer_box" :class="{ footer_bg: bg }">
<view v-for="(item, index) of navigationList" :key="index" class="footer_item">
<view class="footer_nav_item" @click="onPageJump(item.pagePath)">
<view class="footer_nav_item" @click="onPageJump(item.pagePath,index+1)">
<image v-if="item.pagePath == path" class="footer_nav_item_image footer_nav_item_image_scale"
:src="'/' + item.selectedIconPath" mode="aspectFit"></image>
<image v-else class="footer_nav_item_image" :src="'/' + item.iconPath" mode="aspectFit"></image>
@@ -49,7 +49,7 @@
iconPath: 'static/tab/icon2_n.png',
selectedIconPath: 'static/tab/icon2_y.png',
text: '我的订单'
},
{
pagePath: 'pages/peanut/mine',
@@ -69,11 +69,23 @@
},
//方法
methods: {
onPageJump(url) {
if (this.path !== url) {
uni.switchTab({
url: '/' + url
});
onPageJump(url,num) {
if (uni.getStorageSync("anonymous") == '0000000000' && (num == 2 || num == 3)) {
uni.showToast({
icon: 'none',
title: '请先登录'
})
// setTimeout(() => {
// uni.navigateTo({
// url: "/pages/user/login"
// });
// }, 1000)
} else {
if (this.path !== url) {
uni.switchTab({
url: '/' + url
});
}
}
},
}
@@ -159,10 +171,10 @@
}
}
.footer_item_text_active {
color: #079307;
font-weight: bold;
}
</style>
</style>

View File

@@ -6,10 +6,10 @@ if (process.env.NODE_ENV === 'development') {
// socketUrl = "ws://localhost:6001/";
// baseUrl = "https://twin-ui.com/demo/";
// baseUrl = "http://59.110.212.44:9200/pb/";
// baseUrl = "https://testapi.nuttyreading.com/"; // 线上测试环境
baseUrl = "https://testapi.nuttyreading.com/"; // 线上测试环境
// baseUrl = "https://api.nuttyreading.com/"; // 线上正式
// baseUrl = "http://192.168.110.100:9100/pb/"; // 开发用电脑
baseUrl = "http://192.168.110.110:9200/pb/";
// baseUrl = "http://192.168.110.110:9200/pb/";
// baseUrl = "http://192.168.110.38:9200/pb/"; // 吴春磊笔记本1
// socketUrl = "ws://8.129.186.35:6001/";
} else if (process.env.NODE_ENV === 'production') {

View File

@@ -240,13 +240,13 @@ export const h5Login = function(type = "judge", callback) {
appMutual("jumpLogin", null, function() {
if (type == "force") {
// 没登录跳转回登录页
uni.showToast({
icon: 'none',
title: '用户信息失效,请重新登陆。'
})
uni.navigateTo({
url: "/pages/user/login"
});
// uni.showToast({
// icon: 'none',
// title: '用户信息失效,请重新登陆。'
// })
// uni.navigateTo({
// url: "/pages/user/login"
// });
}else{
uni.showModal({
title:"提示",

View File

@@ -125,9 +125,11 @@ $http.requestStart = function(options) {
let storeUserInfo = store.state.userInfo;
if (!storeUserInfo.token) { // nvue页面读取不到vuex里面数据将取缓存
storeUserInfo = uni.getStorageSync("userInfo");
uni.setStorageSync('anonymous', '0000000000');
}
if (storeUserInfo.token) {
options.header['token'] = storeUserInfo.token;
uni.setStorageSync('anonymous', storeUserInfo.token);
};
return options;
}
@@ -161,8 +163,9 @@ $http.dataFactory = async function(res) {
// 返回正确的结果(then接受数据)
return Promise.resolve(httpData);
} else if (httpData.code == "401") {
console.log(uni.getStorageSync("anonymous"))
// token失效
if (uni.getStorageSync('guidePages') == 2) {
if (uni.getStorageSync('guidePages') == 2 && uni.getStorageSync("anonymous") != '0000000000') {
uni.showToast({
title: '登录失效,请重新登录',
icon: 'none'
@@ -295,7 +298,7 @@ $http.dataFactory = async function(res) {
});
} else { //其他错误提示
console.log(httpData.info || httpData.msg)
if (res.isPrompt && res.data.loadAnimate != 'none') {
if (res.isPrompt && res.data.loadAnimate != 'none') {
uni.showToast({
title: httpData.info || httpData.msg,
icon: "none",
@@ -334,4 +337,4 @@ $http.requestError = function(e) {
// });
}
}
export default $http;
export default $http;

View File

@@ -110,7 +110,7 @@
</u-row>
</view>
<!-- <view class="commodityIntroduce" v-html="productInfo.productDetails"> -->
<view class="commodityIntroduce">
<view class="commodityIntroduce">
<view v-if="productInfo.productDetails">
<rich-text v-if="productInfo.productDetails" class="xiangqing" @itemclick="showImg"
:nodes="productInfo.productDetails|formatRichText"></rich-text>
@@ -225,7 +225,7 @@
options: [{
icon: 'cart',
text: '购物车'
}],
}],
buttonGroup: [{
text: '加入购物车',
backgroundColor: 'linear-gradient(90deg, #FFCD1E, #FF8A18)',
@@ -448,8 +448,18 @@
url: '../peanut/shopping'
});
},
// 关联商品点击按钮组件
buttonClickLink(e) {
// 游客跳转
if (uni.getStorageSync("anonymous") == '0000000000') {
uni.showToast({
icon: 'none',
title: '请先登录'
})
return
}
console.log('点击的是关联商品的组件')
if (e.index == 0) {
// 点击的是加入购物车
@@ -484,6 +494,14 @@
},
// 点击按钮组间
buttonClick(e) {
// 游客跳转
if (uni.getStorageSync("anonymous") == '0000000000') {
uni.showToast({
icon: 'none',
title: '请先登录'
})
return
}
// console.log(e)
if (e.index == 0) {
// 点击的是加入购物车

View File

@@ -67,6 +67,7 @@
<view v-if="item.clockIn != null && item.clockIn != 2" @click="goDaKa(item)">
<image src="../../static/icon/home1.png" mode="aspectFit"></image>
</view>
<view v-else @click="noOp()">
<image class="gray" src="../../static/icon/home1.png" mode="aspectFit"></image>
</view>

File diff suppressed because it is too large Load Diff

View File

@@ -5,12 +5,12 @@
<view style="height: 50rpx;"></view>
<view class="per_mes">
<image :src="userMes.avatar" v-if="userMes.avatar!=null" class="per_mes_img"></image>
<image src="../../static/icon/home_icon_1.png" v-if="userMes.avatar==null" class="per_mes_img"></image>
<image src="../../static/icon/home_icon_1.png" v-if="userMes.avatar==null" class="per_mes_img" @click="signOut()"></image>
<view>
<text class="name" v-if="userMes.nickname!=null">{{userMes.nickname}}</text>
<text class="name" v-if="userMes.nickname==null">设置</text>
<text class="name" v-if="userMes.nickname==null" @click="signOut()">登录</text>
<!-- <image v-if="userMes.vip==1" src="../../static/icon/mine_v.png" alt="" class="per_user_img"></image> -->
<text style="margin-left: 20rpx;font-size: 22rpx;color: #888;">({{userMes.tel}})</text>
<text style="margin-left: 20rpx;font-size: 22rpx;color: #888;" v-if="userMes.tel">({{userMes.tel}})</text>
<!-- <text class="tong">累计读书5本
<span style="margin: 0 20upx;">|</span> 今日读50分钟
@@ -35,7 +35,7 @@
<b class="kt_btn" @click="onPageJump('./opeVip')">立即续费</b>
</view> -->
<view class="chong_zhi">
<view class="chong_zhi" v-if="!anonymous">
<view class="zhanghu" @click="onPageJump('../user/persCount')">
我的账户
<text style="float: right;line-height: 85rpx;"> > </text>
@@ -55,54 +55,64 @@
</view>
<view class="xiugai">
<view class="nav_list" @click="switchTab('../bookShop/orderList')">
<text>我的订单</text>
</view>
<!-- <view class="nav_list" @click="onPageJump('../clock/clockList')">
<view v-if="!anonymous">
<view class="nav_list" @click="switchTab('../bookShop/orderList')">
<text>我的订单</text>
</view>
<!-- <view class="nav_list" @click="onPageJump('../clock/clockList')">
<text>我的打卡</text>
</view> -->
<view class="nav_list" @click="onPageJump('../listen/home')">
<text>我的听书</text>
</view>
<view class="nav_list" @click="onPageJump('../listen/setListen')">
<text>听书设置</text>
</view>
<view class="nav_list" @click="onPageJump('../peanut/myComments')">
<text>我的评价</text>
</view>
<view class="nav_list" @click="onPageJump('../peanut/shopping')">
<text>购物车</text>
</view>
<!-- <view v-if="showEbook" class="nav_list" @click="onPageJump('../eBook/bookBuy')">
<view class="nav_list" @click="onPageJump('../listen/home')">
<text>我的听书</text>
</view>
<view class="nav_list" @click="onPageJump('../listen/setListen')">
<text>听书设置</text>
</view>
<view class="nav_list" @click="onPageJump('../peanut/myComments')">
<text>我的评价</text>
</view>
<view class="nav_list" @click="onPageJump('../peanut/shopping')">
<text>购物车</text>
</view>
<!-- <view v-if="showEbook" class="nav_list" @click="onPageJump('../eBook/bookBuy')">
<text>电子书购买记录</text>
</view> -->
<!-- <view v-if="showEbook" class="nav_list" @click="onPageJump('../eBook/bookRecord')">
<!-- <view v-if="showEbook" class="nav_list" @click="onPageJump('../eBook/bookRecord')">
<text>阅读记录</text>
</view> -->
<view class="nav_list" @click="onPageJump('../user/persData')">
<text>修改个人资料</text>
</view>
<view class="nav_list" @click="onPageJump('../user/address')">
<text>地址管理</text>
</view>
<!-- <view class="nav_list" @click="onGoing()">
<view class="nav_list" @click="onPageJump('../user/persData')">
<text>修改个人资料</text>
</view>
<view class="nav_list" @click="onPageJump('../user/address')">
<text>地址管理</text>
</view>
<!-- <view class="nav_list" @click="onGoing()">
<text>帮助与反馈11111</text>
</view> -->
<!-- <view class="nav_list" @click="newOnShare" v-if="isAndorid"> -->
<view class="nav_list" @click="newOnShare">
<text>分享App</text>
</view> -->
<!-- <view class="nav_list" @click="newOnShare" v-if="isAndorid"> -->
<view class="nav_list" @click="newOnShare">
<text>分享App</text>
</view>
<view class="nav_list" @click="onPageJump('../peanut/aboutUs')">
<text>关于我们</text>
</view>
<view class="nav_list" @click="signShow=true">
<text>退出登录</text>
</view>
<view class="nav_list" @click="logout">
<text>注销帐号</text>
</view>
</view>
<view class="nav_list" @click="onPageJump('../peanut/aboutUs')">
<text>关于我们</text>
<view v-if="anonymous">
<view class="nav_list" @click="newOnShare">
<text>分享App</text>
</view>
<view class="nav_list" @click="onPageJump('../peanut/aboutUs')">
<text>关于我们</text>
</view>
</view>
<view class="nav_list" @click="signShow=true">
<text>退出登录</text>
</view>
<view class="nav_list" @click="logout">
<text>注销帐号</text>
</view>
</view>
<u-modal :show="signShow" :content="signContent" :showCancelButton="true" @cancel="signShow=false"
@@ -112,9 +122,10 @@
<uni-popup ref="share" type="share" safeArea backgroundColor="#fff">
<uni-popup-share @select="haveSelected"></uni-popup-share>
</uni-popup>
<music-play :playData="playData"></music-play>
<z-navigation></z-navigation>
</view>
</template>
@@ -123,26 +134,28 @@
import $http from '@/config/requestConfig.js';
// import appShare, { closeShare } from '@/uni_modules/zhouWei-APPshare/js_sdk/appShare';
import {
mapState,mapMutations
mapState,
mapMutations
} from 'vuex';
export default {
data() {
return {
showEbook:false, // 显示电子书相关
showEbook: false, // 显示电子书相关
userMes: {},
signShow: false,
signContent: '是否要退出登录?',
playData:{},
isAndorid:true,
platform : null, // 设备系统
playData: {},
isAndorid: true,
platform: null, // 设备系统
anonymous: false, //游客
};
},
//第一次加载
onLoad(e) {
// 隐藏原生的tabbar
uni.hideTabBar();
uni.hideTabBar();
// #ifdef APP-PLUS
this.getOS()
this.getOS()
this.platform = uni.getSystemInfoSync().platform
// console.log('操纵系统',this.platform)
// #endif
@@ -155,27 +168,28 @@
// 隐藏原生的tabbar
uni.hideTabBar();
this.getData();
this.anonyMo();
},
components: {
components: {
musicPlay
},
//方法
methods: {
...mapMutations(['setUserInfo']),
// 获得操作系统
getOS(){
let oprateOs = ''
getOS() {
let oprateOs = ''
oprateOs = uni.getSystemInfoSync().platform
// console.log(oprateOs)
if(oprateOs == 'android'){
if (oprateOs == 'android') {
this.isAndorid = true
}else{
} else {
this.isAndorid = false
}
},
haveSelected(data){
console.log(data,' 选择的是')
if(data.index == 0){
haveSelected(data) {
console.log(data, ' 选择的是')
if (data.index == 0) {
// 分享到好友
uni.share({
provider: "weixin",
@@ -185,14 +199,14 @@
title: "疯子读书",
summary: "我正在使用疯子读书提升自己,赶紧跟我一起来体验吧!",
imageUrl: "static/fengziIcon.jpg",
success: function (res) {
success: function(res) {
console.log("success:" + JSON.stringify(res));
},
fail: function (err) {
fail: function(err) {
console.log("fail:" + JSON.stringify(err));
}
});
}else if(data.index == 1){
} else if (data.index == 1) {
// 分享到朋友圈
uni.share({
provider: "weixin",
@@ -202,20 +216,32 @@
title: "疯子读书",
summary: "我正在使用疯子读书提升自己,赶紧跟我一起来体验吧!",
imageUrl: "static/fengziIcon.jpg",
success: function (res) {
success: function(res) {
console.log("success:" + JSON.stringify(res));
},
fail: function (err) {
fail: function(err) {
console.log("fail:" + JSON.stringify(err));
}
});
}
},
switchTab(url){
switchTab(url) {
uni.switchTab({
url: url
});
},
// 游客模式
anonyMo() {
if (uni.getStorageSync("anonymous") == '0000000000') {
this.anonymous = true
} else {
this.anonymous = false
}
},
getData() {
// 获取个人信息
if (this.userInfo.id != undefined) {
@@ -232,25 +258,25 @@
}
},
// 新写分享
newOnShare(){
newOnShare() {
this.$refs.share.open()
},
},
// 注销账户
logout(){
logout() {
let that = this
uni.showModal({
title: '提示',
content: '确定要注销当前账户吗?',
success: function (res) {
success: function(res) {
if (res.confirm) {
uni.showModal({
title: '提示',
showCancel:false,
showCancel: false,
content: `注销申请已提交成功,请联系客服进行后续操作022-24142321`,
success: function (res1) {
success: function(res1) {
if (res1.confirm) {
that.signOut()
}
@@ -270,7 +296,7 @@
})
},
onPageJump(url) {
console.log(url,'url')
console.log(url, 'url')
uni.navigateTo({
url: url
});
@@ -280,7 +306,9 @@
// 退出登录
signOut() {
this.signShow = false
this.setUserInfo({'token': null})
this.setUserInfo({
'token': null
})
uni.reLaunch({
url: '../user/login'
});
@@ -447,4 +475,4 @@
border-bottom: 0;
}
}
</style>
</style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB