You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
2.3 KiB
113 lines
2.3 KiB
2 years ago
|
// pages/constitutionGrade/constitutionGrade.js
|
||
|
const app = getApp()
|
||
|
Page({
|
||
|
|
||
|
/**
|
||
|
* 页面的初始数据
|
||
|
*/
|
||
|
data: {
|
||
|
res_test_id:0,//测试id
|
||
|
child:[],//排名
|
||
|
user_id:0,
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面加载
|
||
|
*/
|
||
|
onLoad: function (options) {
|
||
|
this.getUserId();
|
||
|
this.setData({
|
||
|
res_test_id:options.res_test_id,
|
||
|
})
|
||
|
},
|
||
|
onShow:function(){
|
||
|
this.getinfo();
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面隐藏
|
||
|
*/
|
||
|
onHide: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面卸载
|
||
|
*/
|
||
|
onUnload: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||
|
*/
|
||
|
onPullDownRefresh: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面上拉触底事件的处理函数
|
||
|
*/
|
||
|
onReachBottom: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
//详情
|
||
|
getinfo:function(){
|
||
|
console.log(this.data.user_id)
|
||
|
var that=this;
|
||
|
this.setData({ loading: true });
|
||
|
app.request('/api/mini/getTestById', {
|
||
|
test_id:this.data.res_test_id,
|
||
|
user_id:this.data.user_id,
|
||
|
}, function (data, ret) {
|
||
|
if(ret.code == 1){
|
||
|
var detail = ret.data.detail;
|
||
|
that.setData({
|
||
|
loading: false,
|
||
|
child:detail.orichild,
|
||
|
});
|
||
|
}
|
||
|
typeof cb == 'function' && cb(data);
|
||
|
}, function (data, ret) {
|
||
|
|
||
|
that.setData({
|
||
|
loading: false
|
||
|
});
|
||
|
app.error(ret.msg);
|
||
|
},2);
|
||
|
},
|
||
|
|
||
|
getUserId(){
|
||
|
var getuser = wx.getStorageSync("userInfo");
|
||
|
if(getuser){
|
||
|
this.data.user_id = getuser.id;
|
||
|
}else if(app.globalData.userInfo){
|
||
|
this.data.user_id = app.globalData.userInfo.id;
|
||
|
}else{
|
||
|
wx.navigateTo({
|
||
|
url: '/page/login/login',
|
||
|
});
|
||
|
}
|
||
|
},
|
||
|
//查看
|
||
|
seeResult:function(){
|
||
|
wx.navigateTo({
|
||
|
url: '/page/identificationTwo/identificationTwo?res_test_id='+this.data.res_test_id,
|
||
|
});
|
||
|
},
|
||
|
//转发
|
||
|
onShareAppMessage: function() {
|
||
|
return {
|
||
|
title: '转发',
|
||
|
path: '/pages/result/result',
|
||
|
success: function(res) {
|
||
|
wx.showToast({
|
||
|
title: '分享成功',
|
||
|
icon: 'none',
|
||
|
duration: 1500//持续的时间
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
})
|