This commit is contained in:
34701892@qq.com 2025-08-17 17:59:21 +08:00
commit 70aa8e6f58
8 changed files with 406 additions and 101 deletions

View File

@ -62,3 +62,8 @@ export const searchNews = (data: any) => {
return Request.post("/news/search", data);
};
// 微信授权
export const doWxAuth = (data: any) => {
return Request.post("/common/auth", data);
};

View File

@ -24,7 +24,11 @@
<image :src="props.data.picture" mode="widthFix" />
</view>
<view class="articleDes" :class="props?.data?.needpay && 'needpay'" v-html="props.data.content">
<view
class="articleDes"
:class="props?.data?.needpay && 'needpay'"
v-html="props.data.content"
>
</view>
</view>
</template>
@ -43,7 +47,7 @@ import {
const props = defineProps({
data: {
type: Object,
default: () => { },
default: () => {},
},
});

View File

@ -16,17 +16,31 @@
<!-- 两个标签 start -->
<view class="r_r_tags">
<view style="display: flex; margin-top: 20rpx; overflow-x: auto; width: 95vw">
<view
style="display: flex; margin-top: 20rpx; overflow-x: auto; width: 95vw"
>
<view class="r_tags">
<view class="tag" style="background-color: #fff9ec; color: #ffb100"
v-for="(item, index) in props.data.conceptLabels" :key="index">{{ item }}</view>
<view
class="tag"
style="background-color: #fff9ec; color: #ffb100"
v-for="(item, index) in props.data.conceptLabels"
:key="index"
>{{ item }}</view
>
</view>
</view>
<view style="display: flex; margin-top: 20rpx; overflow-x: auto; width: 100vw">
<view
style="display: flex; margin-top: 20rpx; overflow-x: auto; width: 100vw"
>
<view class="r_tags">
<view class="tag" style="background-color: #f5f8fe; color: #007aff"
v-for="(item, index) in props.data.industryLabels" :key="index">{{ item }}</view>
<view
class="tag"
style="background-color: #f5f8fe; color: #007aff"
v-for="(item, index) in props.data.industryLabels"
:key="index"
>{{ item }}</view
>
</view>
</view>
</view>
@ -42,15 +56,17 @@
<image :src="props.data.picture" mode="widthFix" />
</view>
<view style="padding: 35rpx;">
<view style="padding: 35rpx">
<!-- <text class="articleDes" :class="props?.data?.needpay && 'needpay'" style="white-space: pre-wrap;"
v-html="props.data.content">
</text> -->
<rich-text class="articleDes" :class="props?.data?.needpay && 'needpay'" style="white-space: pre-wrap;"
v-html="props.data.content"></rich-text>
<rich-text
class="articleDes"
:class="props?.data?.needpay && 'needpay'"
style="white-space: pre-wrap"
v-html="props.data.content"
></rich-text>
</view>
<!-- <view
@ -76,7 +92,7 @@ import {
const props = defineProps({
data: {
type: Object,
default: () => { },
default: () => {},
},
});
const tagList1 = ref([

View File

@ -3,12 +3,13 @@
<Navbar title="中证参考" :hasBack="false"></Navbar>
<!-- 用户信息 -->
<view class="userContainer">
<u-avatar src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/avatar.png" size="60"></u-avatar>
<u-avatar
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/avatar.png"
size="60"
></u-avatar>
<view class="userData">
<text class="phone">{{
!isLoginStatus
? "未登录用户"
: maskPhoneNumber()
!isLoginStatus ? "未登录用户" : maskPhoneNumber()
}}</text>
<!-- <view class="setUserData">
编辑我的个人资料
@ -34,30 +35,53 @@
<!-- 其他功能区 -->
<view class="otherContainer" v-if="isLoginStatus">
<u-cell-group :border="false">
<u-cell title="已订阅栏目" icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/vip.png" isLink
:iconStyle="{ width: '46rpx', height: '32rpx', marginRight: '14rpx' }" :titleStyle="{
<u-cell
title="已订阅栏目"
icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/vip.png"
isLink
:iconStyle="{ width: '46rpx', height: '32rpx', marginRight: '14rpx' }"
:titleStyle="{
fontSize: '32rpx',
color: '#333333',
}" @click="handleClick(-1)">
}"
@click="handleClick(-1)"
>
</u-cell>
<u-cell title="我的收藏" icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/star.png" isLink
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }" :titleStyle="{
<u-cell
title="我的收藏"
icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/star.png"
isLink
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }"
:titleStyle="{
fontSize: '32rpx',
color: '#333333',
}" @click="handleClick(0)">
}"
@click="handleClick(0)"
>
</u-cell>
<u-cell title="我喜欢的" icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/like.png" isLink
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }" :titleStyle="{
<u-cell
title="我喜欢的"
icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/like.png"
isLink
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }"
:titleStyle="{
fontSize: '32rpx',
color: '#333333',
}" @click="handleClick(1)">
}"
@click="handleClick(1)"
>
</u-cell>
<!-- title="浏览记录" :icon="time" :border="false" -->
<u-cell icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/time.png" isLink
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }" :titleStyle="{
<u-cell
icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/time.png"
isLink
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }"
:titleStyle="{
fontSize: '32rpx',
color: '#333333',
}" @click="handleClick(2)">
}"
@click="handleClick(2)"
>
<template #title>
<view class="recordText">
<text style="font-size: 32rpx">浏览记录</text>
@ -82,8 +106,12 @@
</view>
<!-- 登录弹框 -->
<LoginPopup :show="LoginShow" @handlePopupClose="handlePopupClose"
@handlePopupSuccessCallback="handlePopupSuccessCallback" @handlePopupErrorCallback="handlePopupErrorCallback" />
<LoginPopup
:show="LoginShow"
@handlePopupClose="handlePopupClose"
@handlePopupSuccessCallback="handlePopupSuccessCallback"
@handlePopupErrorCallback="handlePopupErrorCallback"
/>
</view>
</template>
@ -103,26 +131,23 @@ const isLoginStatus = ref(false);
const LoginShow = ref(false);
onMounted(() => {
console.log("🚀 ~ uni.getStorageSync('token'):", uni.getStorageSync('token'))
console.log("🚀 ~ uni.getStorageSync('token'):", uni.getStorageSync("token"));
if (uni.getStorageSync('token')) {
if (uni.getStorageSync("token")) {
isLoginStatus.value = true;
}
});
// *
const maskPhoneNumber = (phoneNumber: string) => {
if (!phoneNumber && uni.getStorageSync('userPhone')) {
phoneNumber = uni.getStorageSync('userPhone')
if (!phoneNumber && uni.getStorageSync("userPhone")) {
phoneNumber = uni.getStorageSync("userPhone");
}
if (phoneNumber) {
return phoneNumber.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
} else {
return "未登录用户";
}
};
//
@ -146,7 +171,10 @@ const loginBtnStatus = () => {
// 退
loginOut();
} else {
LoginShow.value = true;
// LoginShow.value = true;
uni.navigateTo({
url: "/pages/login/indexMini",
});
}
};

View File

@ -1,25 +1,30 @@
<template>
<view class="tabbar">
<view class="tabbar_item" @click="tabChange(0)">
<image v-if="tabIndex == 1"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/home_icon_normal.png"
class="tabbar_img" />
<image v-if="tabIndex == 0"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/home_icon_pre.png"
class="tabbar_img" />
<text class="tabbar_title" :style="{ color: tabIndex == 0 ? '#D13E3C' : '#757A80' }">海外资讯</text>
</view>
<view class="tabbar_item" @click="tabChange(1)">
<image v-if="tabIndex == 0"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_normal.png"
class="tabbar_img" />
<image v-if="tabIndex == 1"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_pre.png"
class="tabbar_img" />
<text class="tabbar_title" :style="{ color: tabIndex == 1 ? '#D13E3C' : '#757A80' }">全部</text>
</view>
<view class="tabbar">
<view class="tabbar_item" @click="tabChange(0)">
<image v-if="tabIndex == 1" src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/home_icon_normal.png"
class="tabbar_img" />
<image v-if="tabIndex == 0" src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/home_icon_pre.png"
class="tabbar_img" />
<text class="tabbar_title" :style="{ color: tabIndex == 0 ? '#D13E3C' : '#757A80' }">海外资讯</text>
</view>
<view class="tabbar_item" @click="tabChange(1)">
<image v-if="tabIndex == 0" src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_normal.png"
class="tabbar_img" />
<image v-if="tabIndex == 1" src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_pre.png"
class="tabbar_img" />
<text class="tabbar_title" :style="{ color: tabIndex == 1 ? '#D13E3C' : '#757A80' }">全部</text>
</view>
</view>
<view class="tabbar_item" @click="tabChange(1)">
<image v-if="tabIndex == 0" src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_normal.png"
class="tabbar_img" />
<image v-if="tabIndex == 1" src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_pre.png"
class="tabbar_img" />
<text class="tabbar_title" :style="{ color: tabIndex == 1 ? '#D13E3C' : '#757A80' }">全部</text>
</view>
</view>
</template>
<script setup>
@ -28,9 +33,8 @@ const emit = defineEmits(["tabChange"]);
const tabIndex = ref(0);
function tabChange(index) {
tabIndex.value = index;
emit("tabChange", index);
tabIndex.value = index;
emit("tabChange", index);
}
onMounted(async () => { });
@ -38,40 +42,40 @@ onMounted(async () => { });
<style scoped lang="scss">
.tabbar {
display: flex;
width: 100vw;
height: 150rpx;
position: fixed;
bottom: 0;
left: 0;
box-shadow: 0 -2rpx 10rpx rgba(128, 128, 128, 0.2);
width: 100vw;
background-color: white;
z-index: 9999999;
.tabbar_item {
width: 50%;
display: flex;
width: 100vw;
height: 150rpx;
position: fixed;
bottom: 0;
left: 0;
box-shadow: 0 -2rpx 10rpx rgba(128, 128, 128, 0.2);
width: 100vw;
background-color: white;
z-index: 9999999;
flex-direction: column;
align-items: center;
margin-top: 30rpx;
}
.tabbar_item {
width: 50%;
display: flex;
flex-direction: column;
align-items: center;
margin-top: 30rpx;
}
.tabbar_img {
width: 44rpx;
height: 44rpx;
}
.tabbar_img {
width: 44rpx;
height: 44rpx;
}
.tabbar_title {
display: flex;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 20rpx;
color: #666666;
line-height: 28rpx;
text-align: left;
font-style: normal;
margin-top: 5rpx;
}
.tabbar_title {
display: flex;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 20rpx;
color: #666666;
line-height: 28rpx;
text-align: left;
font-style: normal;
margin-top: 5rpx;
}
}
</style>

View File

@ -22,6 +22,9 @@
{
"path": "pages/login/index"
},
{
"path": "pages/login/indexMini"
},
{
"path": "pages/realtimeInfo/rankDetail"
},

View File

@ -0,0 +1,232 @@
<template>
<view class="loginContainer">
<!-- prompt -->
<!-- <view class="prompt"></view> -->
<!-- logo -->
<view class="logo"></view>
<!-- <view class="bottom_btn" @click="goIndex"> 立即进入 </view> -->
<button
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
>
</view>
</view>
</template>
<script setup lang="ts">
import { onMounted, ref, reactive, watch, nextTick, onActivated } from "vue";
import {
onLaunch,
onShow,
onLoad,
onShareAppMessage,
onShareTimeline,
onUnload,
} from "@dcloudio/uni-app";
import { doWxAuth } from "@/api/index";
import { onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app";
import { useShareStore } from "@/stores/shareStore";
const stores = useShareStore();
let timer = ref();
function goIndex() {
const subStatus = {
overseas: false, //
domestic: false, //
chinaSecurities: false, //
};
uni.setStorageSync("subStatus", subStatus);
//
uni.removeStorageSync("tabValue");
uni.removeStorageSync("colTypeValue");
uni.navigateTo({
url: "/pages/home/index",
});
}
//
function getPhoneNumber(phoneObj) {
uni.showLoading();
getWxCode(phoneObj.detail);
}
const codeWx = ref();
function getWxCode(phoneObj) {
console.log("🚀 ~ getWxCode ~ phoneObj:", phoneObj);
uni.login({
success: (res) => {
console.log("🚀 ~ getWxCode ~ res:", res);
if (res.code) {
// code
codeWx.value = res.code;
doWxAuthFn(phoneObj, res.code);
} else {
console.log("登录失败!" + res.errMsg);
}
},
});
}
/**
* 微信授权
* @param userInfo
*/
async function doWxAuthFn(phoneObj, jsCode) {
let { code, data } = await doWxAuth({
jsCode: jsCode,
encryptedData: phoneObj.encryptedData,
siv: phoneObj.iv,
});
uni.hideLoading();
if (code == 200) {
uni.setStorageSync("token", data.token);
uni.setStorageSync("userId", data.userId);
// #ifdef MP-WEIXIN
uni.setStorageSync("unionId", data.unionId);
// #endif
// #ifdef MP-ALIPAY
uni.setStorageSync("openId", data.openId);
// #endif
emit("authFinish", true);
} else {
emit("authFinish", false);
}
}
onShareAppMessage((res) => {
return {};
});
// onReachBottom(() => {
// console.log("🚀 ~ onReachBottom ~ onReachBottom:");
// });
//
onLoad((option) => {
// timer.value = setTimeout(() => {
// uni.navigateTo({
// url: "/pages/home/index",
// });
// }, 2000)
});
function goUserAgreement() {
wx.openPrivacyContract({
success: () => {}, //
fail: () => {}, //
complete: () => {},
});
}
//
onUnload(() => {
clearTimeout(timer.value);
});
onShow(() => {
stores.initWxConfig();
});
</script>
<style lang="scss" scoped>
.loginContainer {
height: 100vh;
overflow-y: auto;
background-image: url(https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/log_bg.png);
background-size: cover;
position: relative;
box-sizing: border-box;
padding: 176rpx 0;
.prompt {
width: 80rpx;
height: 596rpx;
position: absolute;
left: 50%;
top: 0;
margin-top: 176rpx;
transform: translateX(-50%);
background-image: url(https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/new_logo.png);
background-size: contain;
}
.logo {
width: 292rpx;
height: 68rpx;
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
margin-bottom: 176rpx;
background-image: url(https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/logo.png);
background-size: cover;
}
}
.bottom_btn {
width: 360rpx;
height: 80rpx;
background: linear-gradient(to right, #fc5c69, #e7303f);
border-radius: 100rpx;
position: fixed;
bottom: 270rpx;
left: 50%;
transform: translate(-50%, 0);
box-shadow: 0 0 10rpx rgba($color: #000000, $alpha: 0.1);
display: flex;
color: white;
font-size: 32rpx;
text-align: center;
justify-content: center;
align-items: center;
}
.tips {
width: 87vw;
position: fixed;
bottom: 370rpx;
left: 50%;
transform: translate(-50%, 0);
display: flex;
align-items: start;
.checkbox {
}
:deep(.u-checkbox) {
margin-top: 5rpx;
}
.r_userAgreement {
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 28rpx;
color: #192236;
line-height: 40rpx;
text-align: left;
font-style: normal;
}
.userAgreement {
color: #5978b2;
}
}
</style>

View File

@ -9,13 +9,22 @@
</view>
<view class="bannerContainer">
<u-swiper :list="bannerList" keyName="image" class="banner" radius="10" autoPlay interval="5000"
img-mode="heightFix"></u-swiper>
<u-swiper
:list="bannerList"
keyName="image"
class="banner"
radius="10"
autoPlay
interval="5000"
img-mode="heightFix"
></u-swiper>
</view>
<view class="subscribe" v-show="subShow">
<view class="subTitle">订阅要闻解锁全部资讯</view>
<view class="subBtn" @click="show = true">立即解锁 <text class="price">25</text>/</view>
<view class="subBtn" @click="show = true"
>立即解锁 <text class="price">25</text>/</view
>
</view>
<!-- 文章列表 -->
@ -32,7 +41,12 @@
</view>
<!-- 全部解锁 -->
<Pay :isShow="false" :show="show" @onClick="handleClick" @handleSub="handleSub" />
<Pay
:isShow="false"
:show="show"
@onClick="handleClick"
@handleSub="handleSub"
/>
<!-- 单篇解锁 -->
<Pay :show="Newsshow" @onClick="handleClose" @handleSub="handleNewsSub" />
</view>
@ -88,8 +102,7 @@ function back() {
});
}
onShow(() => {
});
onShow(() => {});
function handleSubListItem(id: any) {
uni.setStorageSync("newsItem", id);