Files
m2pool_web_frontend/mining-pool/src/views/documentManagement/addDocument/index.js

68 lines
2.4 KiB
JavaScript
Raw Normal View History

2025-07-18 16:22:28 +08:00
import { findDataInfo } from "../../../api/documentManagement"
export default{
data(){
return{
2025-08-01 16:33:33 +08:00
typeArray:[],
2025-07-18 16:22:28 +08:00
}
},
mounted(){
// this.fetchDataInfo()
2025-08-01 16:33:33 +08:00
2025-07-18 16:22:28 +08:00
2025-08-01 16:33:33 +08:00
// if (this.$route.query.id) {
// this.fetchDataInfo({id:this.$route.query.id})
// }
2025-07-18 16:22:28 +08:00
},
methods:{
async fetchDataInfo(params){
const res = await findDataInfo(params)
if (res && res.code === 200) {
this.modifyData = res.data
2025-08-01 16:33:33 +08:00
this.addParams = this.modifyData
// 确保type字段为字符串类型以便与TypeList中的value匹配
this.addParams.type = String(this.addParams.type)
2025-08-01 16:33:33 +08:00
this.addParams.childType = String(this.addParams.childType)
this.typeArray = [this.addParams.type]
// 标记已从后台获取数据,避免被本地存储覆盖
this.hasBackendData = true
// 强制用接口数据刷新编辑器内容
if (this.editor && this.addParams.content) {
this.editor.txt.html(this.addParams.content)
this.html = this.addParams.content
}
2025-07-18 16:22:28 +08:00
}
2025-08-01 16:33:33 +08:00
},
/**
* 币种选择变更处理
* @param {string} scope - 选择的币种
*/
changeScreen(scope) {
let brand = scope
for (let index in this.currencyList) {
let aa = this.currencyList[index];
let value = aa.value;
if (brand === value) {
this.$refs.screen.$el.children[0].children[0].setAttribute('style', "background:url(" + aa.imgUrl + ") no-repeat 10PX;background-size: 20PX 20PX;color:#333;padding-left: 33PX;");
}
}
// 保存用户选择的币种到localStorage
localStorage.setItem('userManagement_selectedCurrency', scope);
2025-07-18 16:22:28 +08:00
2025-08-01 16:33:33 +08:00
},
handleClearScreen(){
// 清除币种图片样式
if (this.$refs.screen && this.$refs.screen.$el) {
this.$refs.screen.$el.children[0].children[0].style.background = '';
this.$refs.screen.$el.children[0].children[0].style.paddingLeft = '';
}
// 也可以清除 localStorage 里的币种选择
localStorage.removeItem('userManagement_selectedCurrency');
2025-07-18 16:22:28 +08:00
}
}
}