2.4 组件结构调整,调整会员权限判断
This commit is contained in:
101
unpackage/dist/dev/mp-weixin/pages/ztfx/ztfx.js
vendored
101
unpackage/dist/dev/mp-weixin/pages/ztfx/ztfx.js
vendored
@@ -1,7 +1,6 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const request_http = require("../../request/http.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 WordCloud = () => "../../components/WordCloud/WordCloud2.js";
|
||||
@@ -162,8 +161,12 @@ const _sfc_main = {
|
||||
}
|
||||
// ≤20%
|
||||
],
|
||||
// bkTypes: [
|
||||
// '板块关联图',
|
||||
// '板块分布',
|
||||
// '热门概念词云'
|
||||
// ],
|
||||
bkTypes: [
|
||||
"板块关联图",
|
||||
"板块分布",
|
||||
"热门概念词云"
|
||||
],
|
||||
@@ -240,8 +243,6 @@ const _sfc_main = {
|
||||
this.contentTop = this.navH + 20 / 750 * common_vendor.inject("windowWidth");
|
||||
},
|
||||
onReady() {
|
||||
this.fetchData();
|
||||
this.initGraphChart();
|
||||
},
|
||||
methods: {
|
||||
getHeatColor(value, max) {
|
||||
@@ -256,24 +257,29 @@ const _sfc_main = {
|
||||
this.activeType = index;
|
||||
switch (index) {
|
||||
case 0:
|
||||
this.$refs.graphChartRef && this.initGraphChart();
|
||||
this.$refs.chartRef && this.initPieChart();
|
||||
break;
|
||||
case 1:
|
||||
this.$refs.chartRef && this.initPieChart();
|
||||
this.initWordCloud();
|
||||
break;
|
||||
case 2:
|
||||
this.initWordCloud();
|
||||
break;
|
||||
}
|
||||
},
|
||||
getPreviousDayDate(dateStr) {
|
||||
getPreviousDayDate() {
|
||||
const now = /* @__PURE__ */ new Date();
|
||||
const currentYear = now.getFullYear();
|
||||
const currentMonth = String(now.getMonth() + 1).padStart(2, "0");
|
||||
const currentDay = String(now.getDate()).padStart(2, "0");
|
||||
const dateStr = `${currentYear}-${currentMonth}-${currentDay}`;
|
||||
if (!/^\d{4}-\d{2}-\d{2}$/.test(dateStr)) {
|
||||
common_vendor.index.__f__("error", "at pages/ztfx/ztfx.vue:483", "日期格式错误,请传入 YYYY-MM-DD 格式的日期");
|
||||
common_vendor.index.__f__("error", "at pages/ztfx/ztfx.vue:505", "日期格式错误,请传入 YYYY-MM-DD 格式的日期");
|
||||
return "";
|
||||
}
|
||||
const [year, month, day] = dateStr.split("-").map(Number);
|
||||
const date = new Date(year, month - 1, day);
|
||||
date.setDate(date.getDate() - 2);
|
||||
date.setDate(date.getDate() - 1);
|
||||
const prevYear = date.getFullYear();
|
||||
const prevMonth = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const prevDay = String(date.getDate()).padStart(2, "0");
|
||||
@@ -285,10 +291,10 @@ const _sfc_main = {
|
||||
async fetchData() {
|
||||
try {
|
||||
const timestamp = (/* @__PURE__ */ new Date()).getTime();
|
||||
const formattedDate = this.getPreviousDayDate(this.selectedFullDate);
|
||||
const formattedDate = this.selectedFullDate;
|
||||
const baseURL = request_http.getBaseURL1();
|
||||
const requestUrl = `${baseURL}/data/zt/daily/${formattedDate}.json?t=${timestamp}`;
|
||||
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:515", "请求URL:", requestUrl);
|
||||
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:538", "请求URL:", requestUrl);
|
||||
const res = await common_vendor.index.request({
|
||||
url: requestUrl,
|
||||
method: "GET"
|
||||
@@ -326,7 +332,7 @@ const _sfc_main = {
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/ztfx/ztfx.vue:562", "请求异常:", error);
|
||||
common_vendor.index.__f__("error", "at pages/ztfx/ztfx.vue:585", "请求异常:", error);
|
||||
common_vendor.index.showToast({
|
||||
title: "网络异常",
|
||||
icon: "none"
|
||||
@@ -376,18 +382,18 @@ const _sfc_main = {
|
||||
];
|
||||
if (this.$refs.chartRef) {
|
||||
const Piechart = await this.$refs.chartRef.init(echarts);
|
||||
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:623", "Piechart实例创建成功", Piechart);
|
||||
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:646", "Piechart实例创建成功", Piechart);
|
||||
Piechart.setOption(this.pieOption);
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/ztfx/ztfx.vue:627", "饼图初始化失败:", error);
|
||||
common_vendor.index.__f__("error", "at pages/ztfx/ztfx.vue:650", "饼图初始化失败:", error);
|
||||
}
|
||||
},
|
||||
// 初始化词云
|
||||
initWordCloud() {
|
||||
if (this.originData.word_freq_data && Array.isArray(this.originData.word_freq_data)) {
|
||||
this.wordData = this.originData.word_freq_data;
|
||||
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:636", "词云数据赋值完成", this.wordData);
|
||||
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:659", "词云数据赋值完成", this.wordData);
|
||||
} else {
|
||||
this.wordData = [{
|
||||
name: "脑机",
|
||||
@@ -400,12 +406,12 @@ const _sfc_main = {
|
||||
},
|
||||
handleDateChange(data) {
|
||||
var _a, _b, _c, _d;
|
||||
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:654", "从日历组件接收的参数:", {
|
||||
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:677", "从日历组件接收的参数:", {
|
||||
currentZtCount: (_a = data.item) == null ? void 0 : _a.zt_count,
|
||||
prevZtCount: (_b = data.prevItem) == null ? void 0 : _b.zt_count
|
||||
});
|
||||
this.selectedYearMonth = data.yearMonth;
|
||||
this.selectedFullDate = data.fullDate;
|
||||
this.selectedFullDate = data.fullDate ? data.fullDate.replace(/-/g, "") : "";
|
||||
this.selectedItem = data.item;
|
||||
if (data.fullDate) {
|
||||
const [year, month, day] = data.fullDate.split("-").map(Number);
|
||||
@@ -417,20 +423,35 @@ const _sfc_main = {
|
||||
const prevZtCount = ((_d = data.prevItem) == null ? void 0 : _d.zt_count) ?? 0;
|
||||
const changeValue = ztCount === 0 || prevZtCount === 0 ? 0 : ztCount - prevZtCount;
|
||||
this.tabTypes[1].change = changeValue;
|
||||
if (this.selectedFullDate) {
|
||||
const today = /* @__PURE__ */ new Date();
|
||||
const todayYear = today.getFullYear();
|
||||
const todayMonth = String(today.getMonth() + 1).padStart(2, "0");
|
||||
const todayDay = String(today.getDate()).padStart(2, "0");
|
||||
const todayFormatted = `${todayYear}${todayMonth}${todayDay}`;
|
||||
if (this.selectedFullDate === todayFormatted) {
|
||||
const selectedDate = new Date(
|
||||
parseInt(this.selectedFullDate.substring(0, 4)),
|
||||
// 年
|
||||
parseInt(this.selectedFullDate.substring(4, 6)) - 1,
|
||||
// 月(月份从0开始)
|
||||
parseInt(this.selectedFullDate.substring(6, 8))
|
||||
// 日
|
||||
);
|
||||
selectedDate.setDate(selectedDate.getDate() - 1);
|
||||
const prevYear = selectedDate.getFullYear();
|
||||
const prevMonth = String(selectedDate.getMonth() + 1).padStart(2, "0");
|
||||
const prevDay = String(selectedDate.getDate()).padStart(2, "0");
|
||||
const prevDateFormatted = `${prevYear}${prevMonth}${prevDay}`;
|
||||
this.selectedFullDate = prevDateFormatted;
|
||||
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:735", `选中日期为当天(${todayFormatted}),已自动调整为前一天:`, prevDateFormatted);
|
||||
}
|
||||
}
|
||||
this.fetchData();
|
||||
},
|
||||
analyseHighStocks() {
|
||||
const formatDate = this.getPreviousDayDate(this.selectedFullDate);
|
||||
let param = {
|
||||
date: formatDate
|
||||
};
|
||||
request_api.analyseHighStocks(param).then((res) => {
|
||||
}).catch((error) => {
|
||||
});
|
||||
},
|
||||
bkydAction(index) {
|
||||
common_vendor.index.navigateTo({
|
||||
url: `/pagesStock/stockCenterDetails/bkydmx?index=${index}`
|
||||
url: `/pagesStock/stockCenterDetails/bkydmx?index=${index}&data=${this.selectedFullDate}`
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -457,8 +478,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
hideBack: true
|
||||
}),
|
||||
b: common_assets._imports_0,
|
||||
c: common_assets._imports_1$10,
|
||||
d: common_assets._imports_2$8,
|
||||
c: common_assets._imports_1$9,
|
||||
d: common_assets._imports_2$9,
|
||||
e: common_vendor.f($data.tabTypes, (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(item.data),
|
||||
@@ -492,8 +513,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
a: common_vendor.t(item.title),
|
||||
b: common_vendor.t(item.count),
|
||||
c: index,
|
||||
d: common_vendor.o(($event) => $options.bkydAction(index), index),
|
||||
e: item.bgColor
|
||||
d: item.bgColor
|
||||
};
|
||||
}),
|
||||
k: common_vendor.f($data.bkTypes, (item, index, i0) => {
|
||||
@@ -505,26 +525,15 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
e: $data.activeType == index ? "#FFFAF1" : "#FFF"
|
||||
};
|
||||
}),
|
||||
l: common_vendor.sr("graphChartRef", "06b829a4-2"),
|
||||
l: common_vendor.sr("chartRef", "06b829a4-2"),
|
||||
m: $data.activeType === 0,
|
||||
n: common_vendor.sr("chartRef", "06b829a4-3"),
|
||||
o: $data.activeType === 1,
|
||||
p: $data.activeType === 2,
|
||||
q: common_vendor.p({
|
||||
n: $data.activeType === 1,
|
||||
o: common_vendor.p({
|
||||
wordData: $data.wordData,
|
||||
width: 330,
|
||||
height: 330
|
||||
}),
|
||||
r: common_assets._imports_3$8,
|
||||
s: common_vendor.f(10, (item, index, i0) => {
|
||||
return {
|
||||
a: index
|
||||
};
|
||||
}),
|
||||
t: common_assets._imports_1$11,
|
||||
v: common_assets._imports_5$4,
|
||||
w: common_assets._imports_5$4,
|
||||
x: common_vendor.s("top:" + $data.contentTop + "px;")
|
||||
p: common_vendor.s("top:" + $data.contentTop + "px;")
|
||||
};
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
|
||||
Reference in New Issue
Block a user