Browse Source

feat: 更新登录验证和UI改进

- 在多个组件中添加登录状态检查,未登录时跳转至登录页
- 修改环境配置从prod到local
- 优化wxLogin页面UI和交互,包括复选框样式和点击区域
- 移除部分注释代码和未使用的组件
- 更新首页头部显示逻辑和样式,添加用户数展示
- 调整景点详情页布局,直接显示内容并移除冗余代码
master
前端-胡立永 2 days ago
parent
commit
16ab0a0e41
11 changed files with 113 additions and 30 deletions
  1. +1
    -1
      api/api.js
  2. +0
    -2
      api/model/browseRecord.js
  3. +8
    -0
      mixins/rewardedVideoAd.js
  4. +25
    -3
      pages/index/index.vue
  5. +48
    -13
      pages_order/auth/wxLogin.vue
  6. +14
    -0
      pages_order/components/list/comment/commentItem.vue
  7. +7
    -0
      pages_order/components/list/comment/commentList.vue
  8. +1
    -0
      pages_order/components/list/comment/commentPublish.vue
  9. +1
    -1
      pages_order/mine/promotion.vue
  10. +1
    -1
      pages_order/post/postDetail.vue
  11. +7
    -9
      pages_order/scenicSpot/scenicSpotDetail.vue

+ 1
- 1
api/api.js View File

@ -472,7 +472,7 @@ export function api(key, data, callback, loadingTitle) {
if (req.auth) { if (req.auth) {
if (!uni.getStorageSync('token')) { if (!uni.getStorageSync('token')) {
utils.toLogin() utils.toLogin()
console.error('需要登录')
console.error('需要登录', req)
return return
} }
} }


+ 0
- 2
api/model/browseRecord.js View File

@ -5,8 +5,6 @@ const api = {
addBrowseRecord: { addBrowseRecord: {
url: '/city/browseRecord/addBrowseRecord', url: '/city/browseRecord/addBrowseRecord',
method: 'POST', method: 'POST',
auth : true,
showLoading : true,
}, },
//获取记录列表type-0帖子-1租房-2工作-3景点-4美食-5活动-6人找车-7车找人-8文章 //获取记录列表type-0帖子-1租房-2工作-3景点-4美食-5活动-6人找车-7车找人-8文章
getBrowseRecordPage: { getBrowseRecordPage: {


+ 8
- 0
mixins/rewardedVideoAd.js View File

@ -112,6 +112,14 @@ export default {
* @param {String} options.fallbackContent 广告加载失败时的弹窗内容 * @param {String} options.fallbackContent 广告加载失败时的弹窗内容
*/ */
showRewardedVideoAd(options = {}) { showRewardedVideoAd(options = {}) {
// 检查用户是否已登录
if (!this.userInfo || !this.userInfo.id) {
console.log('用户未登录,跳转到登录页面')
// 使用utils中的toLogin方法跳转到登录页面
this.$utils.toLogin()
return
}
// 如果正在观看广告,直接返回 // 如果正在观看广告,直接返回
if (this.isWatchingAd) { if (this.isWatchingAd) {
return return


+ 25
- 3
pages/index/index.vue View File

@ -13,10 +13,13 @@
<!-- 瑶都万能墙 --> <!-- 瑶都万能墙 -->
<view class="Headbackground"> <view class="Headbackground">
<view class="Toggle">
<view class="Toggle" v-if="userInfo.id">
<uv-icon size="30rpx" color="#fff" name="map"></uv-icon> <uv-icon size="30rpx" color="#fff" name="map"></uv-icon>
江华瑶族自治县 江华瑶族自治县
</view> </view>
<view class="Toggle"
v-else>
</view>
<view class="top"> <view class="top">
<view class="profilePicture"> <view class="profilePicture">
<image :src="headInfo.headImage" mode=""></image> <image :src="headInfo.headImage" mode=""></image>
@ -26,6 +29,7 @@
{{ headInfo.name }} {{ headInfo.name }}
</view> </view>
<!-- 原有的动态信息 - 已注释
<view class="dynamics"> <view class="dynamics">
{{headInfo.num}}动态 {{headInfo.num}}动态
@ -42,18 +46,31 @@
<text>|</text> <text>|</text>
{{headInfo.jobNum}}工作 {{headInfo.jobNum}}工作
<!-- <text>|</text>
<text>|</text>
{{headInfo.jdNum}}景点 {{headInfo.jdNum}}景点
<text>|</text> <text>|</text>
{{headInfo.shopNum}}美食 {{headInfo.shopNum}}美食
<text>|</text> <text>|</text>
{{headInfo.activityNum}}活动 -->
{{headInfo.activityNum}}活动
</view> </view>
<view class="dynamics"> <view class="dynamics">
江华便民生活好帮手 江华便民生活好帮手
</view> </view>
-->
<!-- 新的入驻人数显示 -->
<view class="dynamics">
<view
@click="$utils.navigateTo('/pages_order/mine/allUser')"
>
当前已有{{headInfo.userNum}}位江华人入驻
</view>
</view>
<view class="dynamics intro-text">
江华便民生活好帮手
</view>
</view> </view>
<view class="join" @click="join"> <view class="join" @click="join">
@ -404,6 +421,7 @@
top: 0; top: 0;
left: 0; left: 0;
padding-top: 80rpx; padding-top: 80rpx;
background-color: #00000052;
// background: linear-gradient(to bottom, rgb(85, 94, 123), rgb(45, 51, 73)); // background: linear-gradient(to bottom, rgb(85, 94, 123), rgb(45, 51, 73));
.Toggle { .Toggle {
@ -451,6 +469,10 @@
text { text {
margin: 0 10rpx; margin: 0 10rpx;
} }
&.intro-text {
font-weight: bold;
}
} }
} }


+ 48
- 13
pages_order/auth/wxLogin.vue View File

@ -18,7 +18,7 @@
</view> </view>
<view class="btn b2" <view class="btn b2"
@click="qux"> @click="qux">
取消登录
匿名体验
</view> </view>
@ -27,20 +27,20 @@
<uv-checkbox-group <uv-checkbox-group
v-model="checkboxValue" v-model="checkboxValue"
shape="circle"> shape="circle">
<view class="content">
<view
style="display: flex;">
<view class="content" @click="toggleCheckbox">
<view class="checkbox-row">
<uv-checkbox <uv-checkbox
size="40rpx"
icon-size="30rpx"
size="50rpx"
icon-size="40rpx"
activeColor="#5baaff" activeColor="#5baaff"
:name="1" :name="1"
></uv-checkbox> ></uv-checkbox>
阅读并同意我们的<text @click="openConfigDetail('getPrivacyPolicy')">服务协议与隐私条款</text>
<view class="text-content">
阅读并同意我们的<text @click.stop="openConfigDetail('getPrivacyPolicy')">"服务协议与隐私条款"</text>
</view>
</view> </view>
<view class="">
以及<text @click="openConfigDetail('getUserAgreement')">个人信息保护指引</text>
<view class="text-line">
以及<text @click.stop="openConfigDetail('getUserAgreement')">个人信息保护指引</text>
</view> </view>
</view> </view>
</uv-checkbox-group> </uv-checkbox-group>
@ -70,6 +70,14 @@
} }
this.$store.commit('login') this.$store.commit('login')
}, },
//
toggleCheckbox(){
if(this.checkboxValue.includes(1)){
this.checkboxValue = []
} else {
this.checkboxValue = [1]
}
},
// //
openConfigDetail(key){ openConfigDetail(key){
this.$refs.popup.open(key) this.$refs.popup.open(key)
@ -126,8 +134,8 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
margin: 20rpx 0;
border-radius: 20rpx; border-radius: 20rpx;
margin: 20rpx 0;
.icon{ .icon{
margin-right: 10rpx; margin-right: 10rpx;
image{ image{
@ -147,11 +155,38 @@
.config{ .config{
position: absolute; position: absolute;
bottom: 0; bottom: 0;
font-size: 22rpx;
font-size: 28rpx;
text-align: center; text-align: center;
line-height: 40rpx;
line-height: 50rpx;
padding: 20rpx;
.content {
cursor: pointer;
padding: 15rpx;
border-radius: 10rpx;
transition: background-color 0.2s;
}
.checkbox-row {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 10rpx;
}
.text-content {
margin-left: 15rpx;
flex: 1;
}
.text-line {
text-align: center;
margin-top: 5rpx;
}
text{ text{
color: $uni-color; color: $uni-color;
font-weight: 500;
} }
} }
} }


+ 14
- 0
pages_order/components/list/comment/commentItem.vue View File

@ -112,6 +112,13 @@
// //
handleReply() { handleReply() {
//
if (!this.userInfo || !this.userInfo.id) {
console.log('用户未登录,跳转到登录页面')
// 使utilstoLogin
this.$utils.toLogin()
return
}
this.$emit('reply', { this.$emit('reply', {
item : this.item, item : this.item,
level : 0, level : 0,
@ -120,6 +127,13 @@
// //
handleSubReply(subComment) { handleSubReply(subComment) {
//
if (!this.userInfo || !this.userInfo.id) {
console.log('用户未登录,跳转到登录页面')
// 使utilstoLogin
this.$utils.toLogin()
return
}
this.$emit('reply', { this.$emit('reply', {
item : subComment, item : subComment,
level : 1, level : 1,


+ 7
- 0
pages_order/components/list/comment/commentList.vue View File

@ -46,6 +46,13 @@ export default {
// //
openCommentPublish() { openCommentPublish() {
//
if (!this.userInfo || !this.userInfo.id) {
console.log('用户未登录,跳转到登录页面')
// 使utilstoLogin
this.$utils.toLogin()
return
}
this.currentReplyComment = null this.currentReplyComment = null
this.$refs.commentPublish.open() this.$refs.commentPublish.open()
}, },


+ 1
- 0
pages_order/components/list/comment/commentPublish.vue View File

@ -81,6 +81,7 @@ export default {
// //
async submit() { async submit() {
// //
if (!this.userInfo.mail) { if (!this.userInfo.mail) {
this.$refs.emailPopup.show() this.$refs.emailPopup.show()


+ 1
- 1
pages_order/mine/promotion.vue View File

@ -43,7 +43,7 @@
return { return {
url: '', url: '',
title: '123123', title: '123123',
baseUrl: 'https://dianpin-img.xzaiyp.top/',
baseUrl: '',
canvas: {}, canvas: {},
imagePath: '', imagePath: '',
} }


+ 1
- 1
pages_order/post/postDetail.vue View File

@ -28,7 +28,7 @@
</view> </view>
<view class="avatarStack" v-if="tagIndex != 0"> <view class="avatarStack" v-if="tagIndex != 0">
<FansList :list="list" />
<!-- <FansList :list="list" /> -->
</view> </view>
<commentList v-if="tagIndex == 0" @getData="getData" :list="list" :params="params" /> <commentList v-if="tagIndex == 0" @getData="getData" :list="list" :params="params" />


+ 7
- 9
pages_order/scenicSpot/scenicSpotDetail.vue View File

@ -8,7 +8,7 @@
<view class="box"> <view class="box">
<view class="title">
<!-- <view class="title">
{{ detail.name }} {{ detail.name }}
<view class="spot"> <view class="spot">
3A景区 3A景区
@ -18,7 +18,6 @@
<view class="pig"> <view class="pig">
江华同志故居位于永州市江华瑶族自治县大石桥... 江华同志故居位于永州市江华瑶族自治县大石桥...
</view> </view>
<hr />
<view class="mie"> <view class="mie">
<view class="dog"> <view class="dog">
开园时间 830-17.30 开园时间 830-17.30
@ -29,9 +28,8 @@
<uv-icon name="arrow-right"></uv-icon> <uv-icon name="arrow-right"></uv-icon>
</view>
</view> -->
<hr />
<!-- <view class="createBy"> <!-- <view class="createBy">
<view class=""> <view class="">
// {{ $dayjs(detail.createTime).format('YYYY-MM-DD') }} // {{ $dayjs(detail.createTime).format('YYYY-MM-DD') }}
@ -45,11 +43,10 @@
</view> --> </view> -->
<addressSpot :address="detail.address" :latitude="detail.latitude" :longitude="detail.longitude" /> <addressSpot :address="detail.address" :latitude="detail.latitude" :longitude="detail.longitude" />
<uv-parse :content="detail.details"></uv-parse>
</view> </view>
<view style="background-color: #fff;margin-top: 20rpx;">
<!-- <view style="background-color: #fff;margin-top: 20rpx;">
<uv-tabs :list="tags" <uv-tabs :list="tags"
:activeStyle="{color : '#000', fontWeight : 900}" :activeStyle="{color : '#000', fontWeight : 900}"
lineColor="#5baaff" lineColor="#5baaff"
@ -61,9 +58,10 @@
<view class="content" v-if="tagIndex == 1"> <view class="content" v-if="tagIndex == 1">
<uv-parse :content="detail.details"></uv-parse> <uv-parse :content="detail.details"></uv-parse>
</view>
</view> -->
<commentList v-if="tagIndex == 0" @getData="getData" :list="list" :params="params" />
<commentList @getData="getData" :list="list" :params="params" />
<!-- <commentList v-if="tagIndex == 0" @getData="getData" :list="list" :params="params" /> -->
</view> </view>
</template> </template>


Loading…
Cancel
Save