Files
m2pool_web_frontend/mining-pool/src/views/documentManagement/addDocument/index.js
2025-08-01 16:33:33 +08:00

68 lines
2.4 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.

import { findDataInfo } from "../../../api/documentManagement"
export default{
data(){
return{
typeArray:[],
}
},
mounted(){
// this.fetchDataInfo()
// if (this.$route.query.id) {
// this.fetchDataInfo({id:this.$route.query.id})
// }
},
methods:{
async fetchDataInfo(params){
const res = await findDataInfo(params)
if (res && res.code === 200) {
this.modifyData = res.data
this.addParams = this.modifyData
// 确保type字段为字符串类型以便与TypeList中的value匹配
this.addParams.type = String(this.addParams.type)
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
}
}
},
/**
* 币种选择变更处理
* @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);
},
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');
}
}
}