feat: 添加隐私协议链接和用户协议勾选验证
fix: 修复文章详情页路由错误问题 refactor: 优化手机号显示逻辑和存储方式 style: 调整页面布局样式和导航栏固定定位 perf: 优化排行榜数据显示和格式化逻辑
This commit is contained in:
parent
a70819522e
commit
f0da0b3760
|
|
@ -11,11 +11,13 @@ onLaunch(() => {
|
|||
onShow(() => { });
|
||||
onHide(() => {
|
||||
console.log("App Hide");
|
||||
uni.setStorageSync('homeTabIndex', null)
|
||||
});
|
||||
</script>
|
||||
<style lang="scss">
|
||||
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
|
||||
@import "@/uni_modules/uview-plus/index.scss";
|
||||
|
||||
#app,
|
||||
uni-app,
|
||||
uni-page,
|
||||
|
|
|
|||
|
|
@ -28,13 +28,30 @@
|
|||
|
||||
<view :class="['news-meta', isLogin ? '' : 'mohu']">
|
||||
|
||||
<view>
|
||||
<view style="display: flex;justify-content: space-between;width: 100%;">
|
||||
<view style="display: flex;">
|
||||
<text class="source">{{ item.source }}</text>
|
||||
<text class="time">{{
|
||||
dayjs(item.publish_time).format("YYYY-MM-DD HH:MM:ss")
|
||||
}}</text>
|
||||
</view>
|
||||
|
||||
<view class="r_option">
|
||||
<image class="option_icon"
|
||||
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/eye_icon%402x.png"></image>
|
||||
<text class="option_text">{{ item.viewCount }}</text>
|
||||
|
||||
<image class="option_icon"
|
||||
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/like_icon%402x.png"></image>
|
||||
<text class="option_text">{{ item.likeCount }}</text>
|
||||
|
||||
<image class="option_icon"
|
||||
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/share_icon%402x.png"></image>
|
||||
<text class="option_text">{{ item.shareCount }}</text>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="lock_view" v-if="!isLogin">
|
||||
<image class="lock_icon"
|
||||
|
|
@ -84,7 +101,34 @@ watch(
|
|||
return;
|
||||
}
|
||||
|
||||
rankListLocal.value.push(item);
|
||||
// item.likeCount = item.likeCount || 3840;
|
||||
// item.shareCount = item.shareCount || 20;
|
||||
// item.viewCount = item.viewCount || 290000;
|
||||
|
||||
let likeCount = 0;
|
||||
let shareCount = 0;
|
||||
let viewCount = 0;
|
||||
let favCount = 0;
|
||||
if (item.likeCount) {
|
||||
likeCount = item.likeCount > 10000 ? Number(item.likeCount / 10000).toFixed(1) + '万' : item.likeCount;
|
||||
}
|
||||
if (item.shareCount) {
|
||||
shareCount = item.shareCount > 10000 ? Number(item.shareCount / 10000).toFixed(1) + '万' : item.shareCount;
|
||||
}
|
||||
if (item.viewCount) {
|
||||
viewCount = item.viewCount > 10000 ? Number(item.viewCount / 10000).toFixed(1) + '万' : item.viewCount;
|
||||
}
|
||||
if (item.favCount) {
|
||||
favCount = item.favCount > 10000 ? Number(item.favCount / 10000).toFixed(1) + '万' : item.viewCount;
|
||||
}
|
||||
|
||||
rankListLocal.value.push({
|
||||
...item,
|
||||
favCount: favCount,
|
||||
likeCount: likeCount,
|
||||
shareCount: shareCount,
|
||||
viewCount: viewCount,
|
||||
});
|
||||
});
|
||||
loading.value = false;
|
||||
}
|
||||
|
|
@ -322,4 +366,26 @@ const handlePopupErrorCallback = () => {
|
|||
font-style: normal;
|
||||
}
|
||||
}
|
||||
|
||||
.r_option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10rpx;
|
||||
|
||||
.option_icon {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
}
|
||||
|
||||
.option_text {
|
||||
font-family: PingFangSC, PingFang SC;
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #192236;
|
||||
line-height: 33rpx;
|
||||
text-align: justify;
|
||||
font-style: normal;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@
|
|||
</view>
|
||||
</template>
|
||||
</u-cell>
|
||||
|
||||
|
||||
</u-cell-group>
|
||||
</view>
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,14 @@
|
|||
</view>
|
||||
</template>
|
||||
</u-cell>
|
||||
<u-cell title="隐私协议"
|
||||
icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/%E9%9A%90%E7%A7%81%E5%8D%8F%E8%AE%AE%E5%92%8C%E7%94%A8%E6%88%B7%E5%8D%8F%E8%AE%AEicon.png"
|
||||
isLink :iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }" :titleStyle="{
|
||||
fontSize: '32rpx',
|
||||
color: '#333333',
|
||||
}" @click="handleClick(3)">
|
||||
|
||||
</u-cell>
|
||||
</u-cell-group>
|
||||
</view>
|
||||
|
||||
|
|
@ -111,10 +119,11 @@ onMounted(() => {
|
|||
});
|
||||
|
||||
// 将手机号的中间四位用 * 代替
|
||||
const maskPhoneNumber = (phoneNumber: string) => {
|
||||
if (!phoneNumber && uni.getStorageSync("userPhone")) {
|
||||
phoneNumber = uni.getStorageSync("userPhone");
|
||||
}
|
||||
const maskPhoneNumber = () => {
|
||||
// if (!phoneNumber && uni.getStorageSync("userPhone")) {
|
||||
// phoneNumber = uni.getStorageSync("userPhone");
|
||||
// }
|
||||
let phoneNumber = uni.getStorageSync("userPhone");
|
||||
if (phoneNumber) {
|
||||
return phoneNumber.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
|
||||
} else {
|
||||
|
|
@ -161,7 +170,14 @@ const handleClick = (val: number) => {
|
|||
uni.navigateTo({
|
||||
url: "/pages/subscribed/index",
|
||||
});
|
||||
} else {
|
||||
} else if (val === 3) {
|
||||
wx.openPrivacyContract({
|
||||
success: () => { }, // 打开成功
|
||||
fail: () => { }, // 打开失败
|
||||
complete: () => { },
|
||||
});
|
||||
}
|
||||
else {
|
||||
uni.navigateTo({
|
||||
url: `/pages/bookmark/index?tabs=${val}`,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// const baseURL = "http://192.168.31.25:8060/api";
|
||||
// export const baseUrl = "http://192.168.3.38:8040/apih5";
|
||||
export const baseUrl = "https://cankao.cs.com.cn/apih5";
|
||||
export const baseUrl = "http://192.168.3.38:8040/apih5";
|
||||
// export const baseUrl = "https://cankao.cs.com.cn/apih5";
|
||||
export const baseUrlDataV = "https://cankao.cs.com.cn/zzck_datav";
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ const props = defineProps({
|
|||
const doDetail = (item: any) => {
|
||||
console.log("🚀 ~ doDetail ~ item:", item)
|
||||
uni.navigateTo({
|
||||
url: `/pages/detail/index?id=${item.id}`,
|
||||
url: `/pages/detail/indexNewsInfo?id=${item.id}`,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@
|
|||
}"></view>
|
||||
<!-- <Navbar title="中证参考"></Navbar> -->
|
||||
<!-- 头部 -->
|
||||
<view class="subHeader">
|
||||
<view class="subHeader"
|
||||
:style="{ position: 'sticky', top: getNavHeight() + 'px', background: '#fff', zIndex: '9999' }">
|
||||
<view class="flashBack" @click="doBack">
|
||||
<u-icon size="20" name="arrow-left" color="#333333"></u-icon>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
<template>
|
||||
<view class="container">
|
||||
<view :style="{ height: getNavHeight() + 'px' }"></view>
|
||||
<view :style="{ height: getNavHeight() + 'px', position: 'sticky', top: 0, background: '#fff', zIndex: '9999' }">
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 导航栏 start -->
|
||||
<view class="custom-bav-bar">
|
||||
<view class="custom-bav-bar"
|
||||
:style="{ position: 'sticky', top: getNavHeight() + 'px', background: '#fff', zIndex: '9999' }">
|
||||
|
||||
<view class="left">
|
||||
<image src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/static/icon_left.png" class="back_icon"
|
||||
@click="handleBack" />
|
||||
|
|
|
|||
|
|
@ -7,18 +7,30 @@
|
|||
|
||||
<!-- <view class="bottom_btn" @click="goIndex"> 立即进入 </view> -->
|
||||
|
||||
<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" class="bottom_btn">
|
||||
<!-- 用户协议 -->
|
||||
<view class="tips">
|
||||
|
||||
<u-checkbox-group v-model="checked" placement="column" @change="checkboxChange">
|
||||
<u-checkbox class="checkbox" shape="circle"></u-checkbox>
|
||||
</u-checkbox-group>
|
||||
|
||||
<text class="r_userAgreement">已阅读并同意<text class="userAgreement"
|
||||
@click="goUserAgreement">《江南农商银行隐私政策》《中证参考智能资讯小程序服务使用许可及服务协议》</text>,首次登录的手机号将自动注册。</text>
|
||||
</view>
|
||||
|
||||
|
||||
<button v-if="checked && checked?.length > 0" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"
|
||||
class="bottom_btn">
|
||||
<view>
|
||||
<text>立即进入</text>
|
||||
</view>
|
||||
</button>
|
||||
|
||||
<!-- 用户协议 -->
|
||||
<view class="tips">
|
||||
<u-checkbox class="checkbox" shape="circle"></u-checkbox>
|
||||
<text class="r_userAgreement">已阅读并同意<text class="userAgreement"
|
||||
@click="goUserAgreement">《江南农商银行隐私政策》《中证参考智能资讯小程序服务使用许可及服务协议》</text>,首次登录的手机号将自动注册。</text>
|
||||
<button v-else class="bottom_btn" @click="needCheck">
|
||||
<view>
|
||||
<text>立即进入</text>
|
||||
</view>
|
||||
</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -37,6 +49,14 @@ import { doWxAuth } from "@/api/index";
|
|||
import { onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app";
|
||||
import { useShareStore } from "@/stores/shareStore";
|
||||
const stores = useShareStore();
|
||||
const checked = ref([])
|
||||
|
||||
watch(checked, (newVal) => {
|
||||
console.log("🚀 ~ newVal:", newVal)
|
||||
if (newVal) {
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
let timer = ref();
|
||||
|
||||
|
|
@ -62,6 +82,7 @@ function getPhoneNumber(phoneObj) {
|
|||
uni.showLoading();
|
||||
getWxCode(phoneObj.detail);
|
||||
}
|
||||
|
||||
const codeWx = ref();
|
||||
function getWxCode(phoneObj) {
|
||||
console.log("🚀 ~ getWxCode ~ phoneObj:", phoneObj);
|
||||
|
|
@ -96,7 +117,7 @@ async function doWxAuthFn(phoneObj, jsCode) {
|
|||
// uni.setStorageSync("userId", data.userId);
|
||||
uni.setStorageSync("unionId", data.unionId);
|
||||
uni.setStorageSync("openId", data.openId);
|
||||
uni.setStorageSync("phone", data.phone);
|
||||
uni.setStorageSync("userPhone", data.phone);
|
||||
uni.redirectTo({
|
||||
url: "/pages/minihome/index",
|
||||
});
|
||||
|
|
@ -120,6 +141,15 @@ onLoad((option) => {
|
|||
// }, 2000)
|
||||
});
|
||||
|
||||
// 点击用户协议
|
||||
function needCheck() {
|
||||
uni.showToast({
|
||||
title: "请先同意用户协议",
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function goUserAgreement() {
|
||||
wx.openPrivacyContract({
|
||||
success: () => { }, // 打开成功
|
||||
|
|
@ -135,6 +165,7 @@ onUnload(() => {
|
|||
|
||||
onShow(() => {
|
||||
stores.initWxConfig();
|
||||
uni.setStorageSync('homeTabIndex', null)
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -6,13 +6,9 @@
|
|||
<u-icon size="20" name="arrow-left" color="#333333"></u-icon>
|
||||
</view>
|
||||
<view class="title">
|
||||
<u-tabs
|
||||
:list="list"
|
||||
:activeStyle="{
|
||||
<u-tabs :list="list" :activeStyle="{
|
||||
color: '#E7303F',
|
||||
}"
|
||||
lineColor="#E7303F"
|
||||
></u-tabs>
|
||||
}" lineColor="#E7303F"></u-tabs>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -48,6 +44,7 @@ const list = ref([
|
|||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
|
||||
.title {
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
|
|
|
|||
|
|
@ -118,11 +118,16 @@ onShow(() => {
|
|||
} else {
|
||||
tabChange(0)
|
||||
}
|
||||
|
||||
uni.setStorageSync('homeTabIndex', null)
|
||||
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
getNewsList()
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
|
|
|||
Loading…
Reference in New Issue