7.10 增加登录页面,事件详情接口对接,我的点赞,关注收藏页面搭建,接口对接

This commit is contained in:
尚政杰
2025-07-10 18:08:16 +08:00
parent c4267a0e27
commit 58b3414bdd
356 changed files with 7710 additions and 978 deletions

View File

@@ -1,26 +1,256 @@
"use strict";
const common_vendor = require("../../../common/vendor.js");
const request_api = require("../../../request/api.js");
const common_assets = require("../../../common/assets.js");
const echarts = require("../../../uni_modules/lime-echart/static/echarts.min.js");
const _sfc_main = {
data() {
return {};
return {
navH: common_vendor.inject("navHeight"),
contentTop: "",
navTitle: "",
stockCode: "",
//股票code
categoryList: ["分钟线", "分时图", "日K线"],
selectCategory: 0,
option: {
title: {
show: false
},
tooltip: {
trigger: "axis",
axisPointer: {
type: "cross"
}
},
legend: {
show: false
},
grid: {
left: "10%",
right: "10%",
bottom: "15%"
},
xAxis: {
type: "category",
data: [],
boundaryGap: false,
axisLine: { onZero: false },
splitLine: { show: false },
min: "dataMin",
max: "dataMax"
},
yAxis: {
scale: true,
splitArea: {
show: true
}
},
dataZoom: [
{
type: "inside",
start: 50,
end: 100
},
{
show: true,
type: "slider",
top: "90%",
start: 50,
end: 100
}
],
series: [
{
name: "日K",
type: "candlestick",
data: [],
itemStyle: {
color: "#ec0000",
color0: "#8A0000",
borderColor: "#00da3c",
borderColor0: "#008F28"
},
markPoint: {
label: {
formatter: function(param) {
return param != null ? Math.round(param.value) + "" : "";
}
},
data: [
{
name: "Mark",
coord: ["2013/5/31", 2300],
value: 2300,
itemStyle: {
color: "rgb(41,60,85)"
}
},
{
name: "highest value",
type: "max",
valueDim: "highest"
},
{
name: "lowest value",
type: "min",
valueDim: "lowest"
},
{
name: "average value on close",
type: "average",
valueDim: "close"
}
],
tooltip: {
formatter: function(param) {
return param.name + "<br>" + (param.data.coord || "");
}
}
},
markLine: {
symbol: ["none", "none"],
data: [
[
{
name: "from lowest to highest",
type: "min",
valueDim: "lowest",
symbol: "circle",
symbolSize: 10,
label: {
show: false
},
emphasis: {
label: {
show: false
}
}
},
{
type: "max",
valueDim: "highest",
symbol: "circle",
symbolSize: 10,
label: {
show: false
},
emphasis: {
label: {
show: false
}
}
}
],
{
name: "min line on close",
type: "min",
valueDim: "close"
},
{
name: "max line on close",
type: "max",
valueDim: "close"
}
]
}
}
]
}
};
},
methods: {}
onLoad(e) {
this.contentTop = this.navH + (60 + 10) / 750 * common_vendor.inject("windowWidth");
if (e.code) {
this.stockCode = e.code;
this.getStockDetailsData();
this.getStockCandlestickChartData();
}
},
methods: {
async init() {
const chart = await this.$refs.chartRef.init(echarts);
chart.setOption(this.option);
},
/**
* 点击切换分类
* @param {Object} index
*/
clickCategoryItem(index) {
if (this.selectCategory != index) {
this.selectCategory = index;
if (index == 0 || index == 2) {
this.getStockCandlestickChartData();
}
}
},
/**
* 获取股票详情数据
*/
getStockDetailsData() {
let stockCode = this.stockCode;
request_api.stockDetails(stockCode).then((res) => {
if (res.code == 200) {
this.navTitle = res.data.basic_info.stock_name + "(" + res.data.basic_info.stock_code + ")";
} else
common_vendor.index.showToast({
title: res.message,
icon: "none"
});
}).catch((error) => {
});
},
/**
* 获取股票K线数据
*/
getStockCandlestickChartData() {
let stockCode = this.stockCode;
let param = { chart_type: "minute" };
if (this.selectCategory == 2) {
param.chart_type = "daily";
}
request_api.stockCandlestickChartData(stockCode, param).then((res) => {
let data = res.data;
let categoryData = [];
for (let item of data) {
categoryData.push(item.time);
}
this.option.xAxis.data = categoryData;
this.init();
}).catch((error) => {
});
}
}
};
if (!Array) {
const _easycom_navBar2 = common_vendor.resolveComponent("navBar");
_easycom_navBar2();
const _easycom_l_echart2 = common_vendor.resolveComponent("l-echart");
(_easycom_navBar2 + _easycom_l_echart2)();
}
const _easycom_navBar = () => "../../../components/navBar/navBar.js";
const _easycom_l_echart = () => "../../../uni_modules/lime-echart/components/l-echart/l-echart.js";
if (!Math) {
_easycom_navBar();
(_easycom_navBar + _easycom_l_echart)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.p({
leftText: "科锐国际(300662.SZ)"
leftText: $data.navTitle
}),
b: common_assets._imports_0
b: common_assets._imports_0,
c: common_vendor.f($data.categoryList, (item, index, i0) => {
return common_vendor.e({
a: common_vendor.t(item),
b: $data.selectCategory == index
}, $data.selectCategory == index ? {} : {}, {
c: common_vendor.n("item relative " + ($data.selectCategory == index ? "select" : "")),
d: index,
e: common_vendor.o(($event) => $options.clickCategoryItem(index), index)
});
}),
d: common_vendor.s("top:" + $data.navH + "px;"),
e: common_vendor.sr("chartRef", "42054871-1"),
f: common_vendor.s("top:" + $data.contentTop + "px;")
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);

View File

@@ -1,6 +1,7 @@
{
"navigationBarTitleText": "",
"usingComponents": {
"nav-bar": "../../../components/navBar/navBar"
"nav-bar": "../../../components/navBar/navBar",
"l-echart": "../../../uni_modules/lime-echart/components/l-echart/l-echart"
}
}

View File

@@ -1 +1 @@
<view><nav-bar wx:if="{{a}}" u-i="42054871-0" bind:__l="__l" u-p="{{a}}"></nav-bar><image class="topBg absolute" src="{{b}}" mode="widthFix"></image></view>
<view><nav-bar wx:if="{{a}}" u-i="42054871-0" bind:__l="__l" u-p="{{a}}"></nav-bar><image class="topBg absolute" src="{{b}}" mode="widthFix"></image><view class="tabC fixed" style="{{d}}"><view wx:for="{{c}}" wx:for-item="item" wx:key="d" class="{{item.c}}" bindtap="{{item.e}}">{{item.a}} <view wx:if="{{item.b}}" class="line absolute"></view></view></view><view class="contentC fixed" style="{{f}}"><view style="width:750rpx;height:400rpx"><l-echart class="r" u-r="chartRef" u-i="42054871-1" bind:__l="__l"></l-echart></view><view class="section">关联描述</view><view class="des">全球原油运输巨头VLCC运力规模全球第一直接受益于霍尔木兹海峡地缘风险带来的运价上涨及风险溢价。</view></view></view>

View File

@@ -4,3 +4,48 @@
width: 100%;
height: auto;
}
.tabC {
background-color: white;
margin-top: 10rpx;
left: 0;
right: 0;
border-radius: 20rpx 20rpx 0 0;
}
.tabC .item {
display: inline-block;
padding: 0 30rpx;
line-height: 60rpx;
font-size: 28rpx;
font-weight: 500;
color: #42485B;
}
.tabC .item.select {
font-weight: bold;
color: #F97316;
}
.tabC .item.select .line {
background-color: #F97316;
left: calc((100% - 50rpx)/2);
bottom: 0;
width: 50rpx;
height: 2rpx;
}
.contentC {
background-color: white;
left: 0;
right: 0;
bottom: 0;
}
.contentC .section {
padding: 0 28rpx;
line-height: 80rpx;
font-size: 32rpx;
font-weight: bold;
color: #222;
}
.contentC .des {
padding: 0 30rpx;
font-size: 24rpx;
font-weight: 500;
color: #666;
}