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.
172 lines
3.8 KiB
172 lines
3.8 KiB
// pages/identificationTwo/identificationTwo.js
|
|
const app = getApp()
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
res_test_id:0,//测试id
|
|
child:[],//
|
|
user_id:0,
|
|
health:0,//是否是平和质,0不是,1是
|
|
detail:[],
|
|
ids:[],
|
|
pianpo_Title:"",
|
|
pianpo_text:"",
|
|
qinxiang_title:"",
|
|
qinxiang_text:""
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.getUserId();
|
|
this.setData({
|
|
res_test_id:options.res_test_id,
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
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;
|
|
let pianpo_Title = detail.pianpo_text.split(':')[0]
|
|
let pianpo_text = detail.pianpo_text.split(':')[1]
|
|
let qinxiang_title = detail.qinxiang_text.split(':')[0]
|
|
let qinxiang_text = detail.qinxiang_text.split(':')[1]
|
|
let ids = detail.child.map(item=>{
|
|
return item.testcate_id
|
|
})
|
|
that.setData({
|
|
loading: false,
|
|
child:detail.child,
|
|
detail:detail,
|
|
ids:ids,
|
|
pianpo_Title:pianpo_Title,
|
|
pianpo_text:pianpo_text,
|
|
qinxiang_title:qinxiang_title,
|
|
qinxiang_text:qinxiang_text
|
|
|
|
});
|
|
|
|
|
|
that.canvasRing = that.selectComponent("#canvasRing");
|
|
that.canvasRing.showCanvasRing();
|
|
}
|
|
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',
|
|
});
|
|
}
|
|
},
|
|
//转发
|
|
onShareAppMessage: function() {
|
|
return {
|
|
// title: '转发',
|
|
// path: '/pages/getscore/getscore',
|
|
success: function(res) {
|
|
wx.showToast({
|
|
title: '分享成功',
|
|
icon: 'none',
|
|
duration: 1500//持续的时间
|
|
})
|
|
}
|
|
}
|
|
},
|
|
//再测一遍
|
|
testAgin:function(){
|
|
wx.switchTab({
|
|
url: '/page/begin/begin',
|
|
})
|
|
},
|
|
goAnalyseDetail:function(e){
|
|
var testcate_id = e.currentTarget.dataset.testcate_id;
|
|
let ids = JSON.stringify(this.data.ids)
|
|
wx.navigateTo({
|
|
url: '/page/constitutionAnalyse/constitutionAnalyse?testcate_id='+ids,
|
|
});
|
|
},
|
|
|
|
//打开另外的小程序
|
|
goOther(){
|
|
wx.navigateToMiniProgram({
|
|
appId: 'wxb1640083b8804601',
|
|
path: '/pages/shop/index?storeId=2259009053',
|
|
extraData: {
|
|
foo: 'bar'
|
|
},
|
|
envVersion: 'release',
|
|
success(res) {
|
|
// 打开成功
|
|
}
|
|
})
|
|
}
|
|
}) |