AssetManager.UniApp/unpackage/dist/dev/mp-weixin/pages/strategies/edit/edit.js
fanfpy bc48e8f7a3 feat: 初始化项目并添加基础功能
- 添加uni-ui组件库依赖
- 实现微信静默登录功能
- 创建资产、策略、我的等核心页面
- 添加策略组合配置功能
- 实现持仓详情展示
- 完善用户信息展示
- 添加全局样式和工具类
- 配置小程序项目设置
2026-02-18 20:51:42 +08:00

166 lines
6.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";
const common_vendor = require("../../../common/vendor.js");
if (!Array) {
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
_easycom_uni_icons2();
}
const _easycom_uni_icons = () => "../../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
if (!Math) {
_easycom_uni_icons();
}
const _sfc_main = {
__name: "edit",
setup(__props) {
const currentType = common_vendor.ref("weight");
const strategyTypes = [
{
key: "weight",
name: "目标权重策略",
tag: "资产配置",
icon: "pie-chart-filled",
bgClass: "bg-green-100",
iconColor: "#059669",
description: "为投资组合中的每个资产设定固定的目标权重比例通过定期再平衡将资产配置恢复到目标权重。适合长期投资和多元化资产配置如60/40组合。"
},
{
key: "ma",
name: "双均线策略",
tag: "趋势跟踪",
icon: "navigate-filled",
bgClass: "bg-blue-100",
iconColor: "#2563EB",
description: "经典技术分析策略,通过短期和长期移动平均线的金叉死叉信号捕捉价格趋势。金叉买入,死叉卖出,过滤短期噪音。"
},
{
key: "chandelier",
name: "吊灯止损策略",
tag: "风险控制",
icon: "fire-filled",
bgClass: "bg-orange-100",
iconColor: "#EA580C",
description: "结合移动平均线和ATR平均真实波幅生成的动态止损点。随着价格上涨止损点上移价格回撤触及止损点时离场有效锁住利润。"
}
];
const formData = common_vendor.ref({
alias: "",
period: "每季度",
threshold: "",
fastPeriod: "",
slowPeriod: "",
maType: "SMA",
atrPeriod: "",
atrMultiplier: "",
trendMa: ""
});
const currentStrategyInfo = common_vendor.computed(() => {
return strategyTypes.find((item) => item.key === currentType.value);
});
const selectType = (key) => {
currentType.value = key;
};
const onPeriodChange = (e) => {
const periods = ["每日", "每周", "每月", "每季度", "每年"];
formData.value.period = periods[e.detail.value];
};
const onMaTypeChange = (e) => {
const types = ["SMA", "EMA"];
formData.value.maType = types[e.detail.value];
};
const submit = () => {
common_vendor.index.__f__("log", "at pages/strategies/edit/edit.vue:185", "保存策略:", {
type: currentType.value,
config: formData.value
});
common_vendor.index.showLoading({ title: "保存中" });
setTimeout(() => {
common_vendor.index.hideLoading();
common_vendor.index.showToast({ title: "策略已保存", icon: "success" });
setTimeout(() => common_vendor.index.navigateBack(), 1500);
}, 800);
};
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.f(strategyTypes, (item, index, i0) => {
return common_vendor.e({
a: "ddbff522-0-" + i0,
b: common_vendor.p({
type: item.icon,
size: "24",
color: currentType.value === item.key ? "#064E3B" : item.iconColor
}),
c: common_vendor.n(currentType.value === item.key ? "bg-white text-green" : item.bgClass),
d: common_vendor.t(item.name),
e: currentType.value === item.key ? 1 : "",
f: common_vendor.t(item.tag),
g: currentType.value === item.key ? 1 : "",
h: currentType.value === item.key
}, currentType.value === item.key ? {
i: "ddbff522-1-" + i0,
j: common_vendor.p({
type: "checkmarkempty",
size: "16",
color: "#064E3B"
})
} : {}, {
k: index,
l: currentType.value === item.key ? 1 : "",
m: common_vendor.o(($event) => selectType(item.key), index)
});
}),
b: currentStrategyInfo.value
}, currentStrategyInfo.value ? {
c: common_vendor.p({
type: "info-filled",
size: "18",
color: "#064E3B"
}),
d: common_vendor.t(currentStrategyInfo.value.description)
} : {}, {
e: formData.value.alias,
f: common_vendor.o(($event) => formData.value.alias = $event.detail.value),
g: currentType.value === "weight"
}, currentType.value === "weight" ? {
h: common_vendor.t(formData.value.period || "请选择"),
i: common_vendor.p({
type: "bottom",
size: "14",
color: "#9CA3AF"
}),
j: ["每日", "每周", "每月", "每季度", "每年"],
k: common_vendor.o(onPeriodChange),
l: formData.value.threshold,
m: common_vendor.o(($event) => formData.value.threshold = $event.detail.value)
} : {}, {
n: currentType.value === "ma"
}, currentType.value === "ma" ? {
o: formData.value.fastPeriod,
p: common_vendor.o(($event) => formData.value.fastPeriod = $event.detail.value),
q: formData.value.slowPeriod,
r: common_vendor.o(($event) => formData.value.slowPeriod = $event.detail.value),
s: common_vendor.t(formData.value.maType || "SMA"),
t: common_vendor.p({
type: "bottom",
size: "14",
color: "#9CA3AF"
}),
v: ["SMA (简单移动平均)", "EMA (指数移动平均)"],
w: common_vendor.o(onMaTypeChange)
} : {}, {
x: currentType.value === "chandelier"
}, currentType.value === "chandelier" ? {
y: formData.value.atrPeriod,
z: common_vendor.o(($event) => formData.value.atrPeriod = $event.detail.value),
A: formData.value.atrMultiplier,
B: common_vendor.o(($event) => formData.value.atrMultiplier = $event.detail.value),
C: formData.value.trendMa,
D: common_vendor.o(($event) => formData.value.trendMa = $event.detail.value)
} : {}, {
E: common_vendor.o(submit)
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-ddbff522"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/strategies/edit/edit.js.map