1 Commits

Author SHA1 Message Date
徐哼唧L
97ff3915c0 游客模式 2023-12-06 16:26:45 +08:00
10 changed files with 603 additions and 405 deletions

View File

@@ -2,7 +2,7 @@
<view> <view>
<view class="footer_box" :class="{ footer_bg: bg }"> <view class="footer_box" :class="{ footer_bg: bg }">
<view v-for="(item, index) of navigationList" :key="index" class="footer_item"> <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" <image v-if="item.pagePath == path" class="footer_nav_item_image footer_nav_item_image_scale"
:src="'/' + item.selectedIconPath" mode="aspectFit"></image> :src="'/' + item.selectedIconPath" mode="aspectFit"></image>
<image v-else class="footer_nav_item_image" :src="'/' + item.iconPath" 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', iconPath: 'static/tab/icon2_n.png',
selectedIconPath: 'static/tab/icon2_y.png', selectedIconPath: 'static/tab/icon2_y.png',
text: '我的订单' text: '我的订单'
}, },
{ {
pagePath: 'pages/peanut/mine', pagePath: 'pages/peanut/mine',
@@ -69,11 +69,23 @@
}, },
//方法 //方法
methods: { methods: {
onPageJump(url) { onPageJump(url,num) {
if (this.path !== url) { if (uni.getStorageSync("anonymous") == '0000000000' && (num == 2 || num == 3)) {
uni.switchTab({ uni.showToast({
url: '/' + url 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 { .footer_item_text_active {
color: #079307; color: #079307;
font-weight: bold; font-weight: bold;
} }
</style> </style>

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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