106 lines
2.3 KiB
JavaScript
106 lines
2.3 KiB
JavaScript
// packageG/mycomponent/ys_member/ys_member.js
|
|
var app = getApp();
|
|
Component({
|
|
/**
|
|
* 组件的属性列表
|
|
*/
|
|
properties: {
|
|
datas: {
|
|
value:{
|
|
preview_color: {
|
|
color: 'transparent',
|
|
isColor: 1
|
|
}
|
|
},
|
|
type: null,
|
|
},
|
|
component_id: {
|
|
type: null,
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 组件的初始数据
|
|
*/
|
|
data: {
|
|
level_list: [],
|
|
info: {},
|
|
optionName: {}
|
|
},
|
|
lifetimes: {
|
|
attached: function () {
|
|
// 在组件实例进入页面节点树时执行
|
|
this.getData();
|
|
try {
|
|
let basic_info = wx.getStorageSync("yz_basic_info");
|
|
let { point, balance, love, integral } = basic_info;
|
|
this.data.optionName.point = point;
|
|
this.data.optionName.balance = balance;
|
|
this.data.optionName.love = love;
|
|
this.data.optionName.integral = integral;
|
|
this.setData({
|
|
optionName: this.data.optionName
|
|
})
|
|
} catch (error) {
|
|
|
|
}
|
|
},
|
|
detached: function () {
|
|
// 在组件实例被从页面节点树移除时执行
|
|
},
|
|
},
|
|
/**
|
|
* 组件的方法列表
|
|
*/
|
|
methods: {
|
|
getData() {
|
|
let urlStr = app.getNetAddresss("plugin.ys-system.frontend.member-info.index");
|
|
app._postNetWork({
|
|
url: urlStr,
|
|
data: {},
|
|
success: (resdata) => {
|
|
let res = resdata.data;
|
|
if (res.result == 1) {
|
|
this.setData({
|
|
level_list: res.data.level_list,
|
|
info: res.data
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
icon: "none",
|
|
title: res.msg,
|
|
duration: 1000,
|
|
});
|
|
}
|
|
},
|
|
fail: (res) => {
|
|
console.log(res);
|
|
},
|
|
});
|
|
},
|
|
toUrl(e) {
|
|
let _data = e.currentTarget.dataset || {};
|
|
this.wxRouterLink(_data);
|
|
},
|
|
wxRouterLink(_data) {
|
|
let _Param = '';
|
|
const {
|
|
url,
|
|
...otherParam
|
|
} = _data;
|
|
if(Object.keys(otherParam).length == 0){
|
|
wx.navigateTo({
|
|
url: url
|
|
});
|
|
return;
|
|
}
|
|
Object.keys(otherParam).forEach(function (key) {
|
|
if (otherParam[key] !== '') _Param += key + '=' + otherParam[key] + '&';
|
|
});
|
|
if (url === '') return;
|
|
wx.navigateTo({
|
|
url: url + '?' + _Param.slice(0, -1)
|
|
});
|
|
},
|
|
}
|
|
}); |