宝塔服务器面板,一键全能部署及管理,送你10850元礼包,点我领取

[HTML] 纯文本查看 复制代码

修改rpgsave存档

class=”upload-demo”

drag

:auto-upload=”1==2″

:on-change=”upload”

:on-preview=”clickFile”

action=”#”

>

将文件拖到此处,或 点击上传

原文:

解码:

金钱

姓名

等级

生命

魔力

攻击

魔攻

敏捷

占位

var app = new Vue{

el: ‘#app’,

data: {

文件路径: null,

加密内容: null,

解密内容: null,

json内容: null,

json对象: {},

角色列表: []

},

computed: {

金钱: {

get: function ) {

try {

var _ = this.json对象[“party”][“_gold”]

} catch error) {

console.logerror)

_ = “未取到值”

}

return _

},

set: function value){

try {

this.json对象[“party”][“_gold”] = value

} catch error) {

console.logerror)

}

}

}

},

watch: {

加密内容新值, 旧值) {

this.解密内容 = this.读取解密内容新值)

},

解密内容新值, 旧值) {

this.json内容 = this.读取json内容新值)

},

json内容新值, 旧值) {

this.json对象 = this.to_json_obj新值)

try {

this.角色列表 = this.json对象[“actors”][“_data”][“@a”]

} catch error) {

console.logerror)

this.角色列表 = []

}

}

},

methods: {

// 1)

upload: function file, fileList) {

this.文件路径 = file.name

file.文件路径 = this.文件路径

this.读取加密内容file.raw)

},

clickFile: function file) {

this.读取加密内容file.raw)

this.文件路径 = file.文件路径

},

// 2)

读取加密内容: function file) {

var _this = this

var reader = new FileReader)

reader.readAsTextfile)

reader.onload = function){

_this.加密内容 = this.result

}

},

// 3)

decodeText_to_encodeText: function ) {

this.加密内容 = this.encodethis.解密内容)

this.ctrl_cthis.加密内容)

},

// 4)

读取解密内容: function 加密内容) {

return this.decode加密内容)

},

// 5)

读取json内容: function 解密内容) {

return JSON.stringifyJSON.parse解密内容),null,2)

},

// 6)

change_and_encode_and_save: function obj) {

this.change_and_encodeobj)

this.savethis.加密内容, this.文件路径)

},

change_and_encode_and_ctrlC: function obj) {

this.change_and_encodeobj)

this.ctrl_cthis.加密内容)

},

// ———— 辅助方法 ————

change_and_encode: function obj) {

let _ = this.to_json_strobj)

this.加密内容 = this.encode_)

},

ctrl_c: function text) {

this.copyTexttext)

this.$message’已复制’);

},

// ———— 工具方法 ————

to_json_obj: function obj) {

return JSON.parseobj)

},

to_json_str: function obj) {

iftypeofobj) == “string”){

return JSON.stringifyJSON.parseobj))

}

return JSON.stringifyobj)

},

encode: function text) {

return LZString.compressToBase64text)let _ = this.to_json_strobj)

this.加密内容 = this.encode_)

},

ctrl_c: function text) {

this.copyTexttext)

this.$message’已复制’);

},

// ———— 工具方法 ————

to_json_obj: function obj) {

return JSON.parseobj)

},

to_json_str: function obj) {

iftypeofobj) == “string”){

return JSON.stringifyJSON.parseobj))

}

return JSON.stringifyobj)

},

encode: function text) {

return LZString.compressToBase64text)

},

decode: function text) {

return LZString.decompressFromBase64text)

},

save: function text, 文件名 = “a1.txt”) {

let pos = 文件名.lastIndexOf”/”)

文件名 = 文件名.substringpos+1)

var file = new File[text], 文件名, { type: “text/plain;charset=utf-8” })

saveAsfile)

},

// 复制的方法

copyText: functiontext, callback){ // text: 要复制的内容, callback: 回调

var tag = document.createElement’input’);

tag.setAttribute’id’, ‘cp_hgz_input’);

tag.value = text;

document.getElementsByTagName’body’)[0].appendChildtag);

document.getElementById’cp_hgz_input’).select);

document.execCommand’copy’);

document.getElementById’cp_hgz_input’).remove);

ifcallback) {callbacktext)}

}

}

})