var vue =new vue({
el: '#vue',
data: {
role: @html.raw(json.encode(viewbag.role)),
talent: @html.raw(json.encode(viewbag.talent)),
levels: [
{
id:1,
name:'普通',
color:'black',
cost: 50,
add:5,
},
{
id:2,
name: '优良',
color:'green',
cost: 200,
add: 25,
},
{
id:3,
name: '精良',
color:'blue',
cost: 500,
add: 85,
},
{
id:4,
name: '史诗',
color:'purple',
cost: 1000,
add: 200,
},
{
id:5,
name: '传说',
color:'orange',
cost: 10000,
add: 2500,
},
],
booknums: [
{
num1: 1,
num2: 1,
num3: 1,
num4: 1,
num5: 1,
},
{
num1: 1,
num2: 1,
num3: 1,
num4: 1,
num5: 1,
}, {
num1: 1,
num2: 1,
num3: 1,
num4: 1,
num5: 1,
}, {
num1: 1,
num2: 1,
num3: 1,
num4: 1,
num5: 1,
}, {
num1: 1,
num2: 1,
num3: 1,
num4: 1,
num5: 1,
},
],
tiptext: '提示',
tipbtn: '关闭',
tip: false,
},
methods: {
buy: function () {
let _self = this;
$.ajax({
url: "/ltgdgame.web/talent/buytalent",
type: "post",
datatype: 'json',
data: $("#vue").serialize() ,//这里直接把表单序列化模拟submit提交
success: function (data) {
if (data.result == "true")
{
_self.tip = true;
_self.tiptext = '购买成功';
_self.role.goldcoin = data.goldcoin;
if (typeof (data.vit) != "undefined")
_self.talent.vit = data.vit;
if (typeof (data.str) != "undefined")
_self.talent.str = data.str;
if (typeof (data.wis) != "undefined")
_self.talent.wis = data.wis;
if (typeof (data.dex) != "undefined")
_self.talent.dex = data.dex;
if (typeof (data.luk) != "undefined")
_self.talent.luk = data.luk;
resetchart();
}
else if(data.result=="false")
{
_self.tip = true;
_self.tiptext = '金币不足';
}
else
{
_self.tip = true;
_self.tiptext = '请选择购买';
}
}
})
},
cancel: function () {
this.tip = false;
},
}
})
mychart = echarts.init(document.getelementbyid('imgatr'));
var option = {
title: {
},
tooltip: {},
radar: {
// shape: 'circle',
name: {
textstyle: {
color: '#fff',
backgroundcolor: '#999',
borderradius: 5,
padding: [3, 5],
fontsize:20
}
},
splitarea: {
areastyle: {
color:['white'],
}
},
indicator: [
{ name: '体力vit', max: 1000 },
{ name: '力量str', max: 1000 },
{ name: '魔力wis', max: 1000 },
{ name: '敏捷dex', max: 1000 },
{ name: '幸运luk', max: 1000 },
]
},
series: [{
name: '属性',
type: 'radar',
// areastyle: {normal: {}},
data: [
{
value: [vue.talent.vit, vue.talent.str, vue.talent.wis, vue.talent.dex, vue.talent.luk],
name: '属性值'
},
]
}]
}
mychart.setoption(option);
function resetchart() {
mychart.setoption({
series: [{
data: [{
value: [vue.talent.vit, vue.talent.str, vue.talent.wis, vue.talent.dex, vue.talent.luk],
name: '属性值'
},]
}]
})
}