Commit 8b02e0d7 by chenzhenan

增加生活事件量表

parent f4cf084b
{
"pages": [
"pages/index/index",
"pages/screenshots/screenshots",
"pages/fenxiang/fenxiang",
"pages/disable/disable",
"pages/user/user",
"pages/webinfo/webinfo",
"pages/setperm/setperm",
"pages/personinfo/personinfo",
"pages/swiper/swiper",
"pages/dati/dati",
"pages/dati03/dati03",
"pages/dati02/dati02",
"pages/dati05/dati05",
"pages/qrlist/qrlist",
"pages/shouquan/shouquan",
"pages/showqdetail/showqdetail",
"pages/record/record",
"pages/QRcode/QRcode",
"pages/agreement/agreement",
"pages/liangbiao/liangbiao",
"pages/lbgouwuche/lbgouwuche",
"pages/zaixian/zaixian",
"pages/cashRecord/cashRecord",
"pages/cashregister/cashregister",
"pages/scaleset/scaleset",
"pages/prepaidlist/prepaidlist",
"pages/cashDisbursement/cashDisbursement",
"pages/zhichuRecord/zhichuRecord",
"pages/end/end",
"pages/info/info",
"pages/info1/info1",
"pages/pay/pay",
"pages/invoice/invoice",
"pages/sqtg/sqtg",
"pages/chongzhi/chongzhi",
"pages/fpkj/fpkj",
"pages/fpdetail/fpdetail",
"pages/fapiao/fapiao",
"pages/fenxiangperson/fenxiangperson",
"pages/bslbrecord/bslbrecord",
"pages/webview/webview",
"pages/dati04/dati04",
"pages/addAdm/addAdm",
"pages/shenhe/shenhe",
"pages/setAddm/setAddm",
"pages/banner/banner",
"pages/prepaidcard/prepaidcard",
"pages/canvas/canvas",
"pages/dati06/dati06"
],
"window": {
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "",
"navigationBarTextStyle": "black",
"backgroundColor": "#f2f2f2",
"enablePullDownRefresh": true,
"backgroundTextStyle": "dark"
},
"tabBar": {
"color": "#999",
"selectedColor": "#37c0b8",
"backgroundColor": "#fff",
"borderStyle": "black",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "images/sw@2x.png",
"selectedIconPath": "images/sx@2x.png"
},
{
"pagePath": "pages/record/record",
"text": "报告",
"iconPath": "images/bw@2x.png",
"selectedIconPath": "images/bx@2x.png"
}
]
},
"sitemapLocation": "sitemap.json"
"pages": [
"pages/index/index",
"pages/screenshots/screenshots",
"pages/fenxiang/fenxiang",
"pages/disable/disable",
"pages/user/user",
"pages/webinfo/webinfo",
"pages/setperm/setperm",
"pages/personinfo/personinfo",
"pages/swiper/swiper",
"pages/dati/dati",
"pages/dati03/dati03",
"pages/dati02/dati02",
"pages/dati05/dati05",
"pages/qrlist/qrlist",
"pages/shouquan/shouquan",
"pages/showqdetail/showqdetail",
"pages/record/record",
"pages/QRcode/QRcode",
"pages/agreement/agreement",
"pages/liangbiao/liangbiao",
"pages/lbgouwuche/lbgouwuche",
"pages/zaixian/zaixian",
"pages/cashRecord/cashRecord",
"pages/cashregister/cashregister",
"pages/scaleset/scaleset",
"pages/prepaidlist/prepaidlist",
"pages/cashDisbursement/cashDisbursement",
"pages/zhichuRecord/zhichuRecord",
"pages/end/end",
"pages/info/info",
"pages/info1/info1",
"pages/pay/pay",
"pages/invoice/invoice",
"pages/sqtg/sqtg",
"pages/chongzhi/chongzhi",
"pages/fpkj/fpkj",
"pages/fpdetail/fpdetail",
"pages/fapiao/fapiao",
"pages/fenxiangperson/fenxiangperson",
"pages/bslbrecord/bslbrecord",
"pages/webview/webview",
"pages/dati04/dati04",
"pages/addAdm/addAdm",
"pages/shenhe/shenhe",
"pages/setAddm/setAddm",
"pages/banner/banner",
"pages/prepaidcard/prepaidcard",
"pages/canvas/canvas",
"pages/dati06/dati06",
"pages/dati08/dati08"
],
"window": {
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "",
"navigationBarTextStyle": "black",
"backgroundColor": "#f2f2f2",
"enablePullDownRefresh": true,
"backgroundTextStyle": "dark"
},
"tabBar": {
"color": "#999",
"selectedColor": "#37c0b8",
"backgroundColor": "#fff",
"borderStyle": "black",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "images/sw@2x.png",
"selectedIconPath": "images/sx@2x.png"
},
{
"pagePath": "pages/record/record",
"text": "报告",
"iconPath": "images/bw@2x.png",
"selectedIconPath": "images/bx@2x.png"
}
]
},
"sitemapLocation": "sitemap.json"
}
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<view class="dati05">
<view class="warp">
<block wx:for="{{scaleTitleData}}" wx:for-item="scaleTitle" wx:for-index="scaleTitleIndex" wx:key="scaleTitleIndex">
<block wx:if="{{currentIndex === scaleTitleIndex}}">
<block wx:for="{{questionData}}" wx:for-index="answerIndex" wx:for-item="answerItem" wx:key="answerIndex">
<block wx:if="{{answerItem.isShow}}">
<view class="con">
<text style="margin-top: 10rpx;">{{scaleTitle}}--{{answerItem.subtitle}}</text>
</view>
<view wx:for="{{answerItem.content}}" wx:for-index="contentIndex" wx:for-item="contentItem"
wx:key="contentIndex">
<view bindtap="selectOption" data-content-item="{{contentItem}}" data-answer-index="{{answerIndex}}"
data-content-index="{{contentIndex}}"
class="answer + {{answerRecord[currentIndex][answerIndex].index === contentIndex?'s-active':''}}">
<text>{{contentItem.title}}</text>
</view>
</view>
</block>
</block>
</block>
</block>
</view>
<block>
<view class="btn">
<view wx:if="{{currentIndex > 0}}" class="menuebtn menuebtn-active" bindtap="prev">上一题</view>
<view
wx:if="{{(currentIndex > 0 && scaleTitleData.length != (currentIndex+1)) || (currentIndex > 0 && !isCanSubmit)}}"
class="menuebtn" style="margin-left:40rpx;">提交</view>
<button wx:if="{{scaleTitleData.length === (currentIndex+1) && isCanSubmit}}"
class="menuebtn menuebtn-active menuebtn1" style="margin-left:40rpx;" :disabled="disab" bindtap="submit">提交
</button>
</view>
</block>
<view class="all-item">
<text>{{currentIndex+1}}/{{scaleTitleData.length}}</text>
</view>
</view>
\ No newline at end of file
.dati05{
background-image: url("https://static.xiaodongai.com/xiaodong_yiyuan/kongtian/Uploads/Picture/uid2/member/20180129/5a6ee68692cd8.png");
background-size: 36rpx 36rpx;
padding-top: 29rpx;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
.line_top {
background: #cecece;
}
.warp {
width: 690rpx;
margin: 0 auto;
border: 0.5px solid #e3e3e3;
background: #fff;
overflow: hidden;
}
.con {
padding: 40rpx 30rpx;
border-bottom: 0.5px solid #e3e3e3;
}
.con text {
color: #179259;
display: block;
font-family: "PingFang-SC-Bold";
font-size: 36rpx;
letter-spacing: 5rpx;
font-weight: bold;
}
.answer {
min-height: 30rpx;
width: 630rpx;
border-bottom: 0.5px solid #e3e3e3;
padding: 30rpx 30rpx;
font-family: "PingFang-SC-Bold";
font-size: 32rpx;
color: #666;
font-weight: bold;
display: table;
}
.shehui {
width: 345rpx;
float: left;
}
.answer1 {
min-height: 30rpx;
width: 285rpx;
border-bottom: 0.5px solid #e3e3e3;
padding: 30rpx 30rpx;
font-family: "PingFang-SC-Bold";
font-size: 32rpx;
color: #666;
font-weight: bold;
display: table;
text-align: center;
float: left;
}
.answer text {
vertical-align: middle;
display: table-cell;
}
.answer1 text {
vertical-align: middle;
display: table-cell;
}
.s-active {
background: #179259;
color: #fff;
}
.btn {
display: flex;
justify-content: center;
height: 88rpx;
width: 690rpx;
position: fixed;
left: 30rpx;
bottom: 80rpx;
padding-bottom: constant(safe-area-inset-bottom);
/* 兼容 iOS < 11.2 */
padding-bottom: env(safe-area-inset-bottom);
/* 兼容 iOS >= 11.2 */
}
.menuebtn {
width: 325rpx;
height: 88rpx;
line-height: 88rpx;
text-align: center;
background: #eaeaea;
border: 1px solid #e3e3e3;
box-sizing: border-box;
font-family: "PingFang-SC-Medium";
font-size: 34rpx;
color: #999;
}
.menuebtn1{
border-radius: 0;
}
.menuebtn-active {
background: #2684ff;
color: #fff;
border: none;
opacity: 1;
}
.all-item {
position: fixed;
bottom: 20rpx;
width: 100%;
text-align: center;
font-size: 30rpx;
color: #333;
padding-bottom: constant(safe-area-inset-bottom);
/* 兼容 iOS < 11.2 */
padding-bottom: env(safe-area-inset-bottom);
/* 兼容 iOS >= 11.2 */
}
.pizibao {
width: 582rpx;
height: 90rpx;
margin: 300rpx auto;
}
.p_time {
width: 220rpx;
height: 88rpx;
float: left;
}
.p_time input {
display: block;
width: 150rpx;
height: 88rpx;
text-align: center;
font-size: 34rpx;
float: left;
border: 0.5px solid #cecece;
border-radius: 8rpx;
outline: none;
}
.p_time text {
display: block;
font-size: 30rpx;
height: 88rpx;
width: 30rpx;
margin-left: 20rpx;
float: left;
line-height: 88rpx;
color: #666;
}
.p_btn {
height: 88rpx;
width: 120rpx;
text-align: center;
line-height: 88rpx;
float: left;
margin-left: 20rpx;
background: #2684ff;
color: #fff;
border-radius: 8rpx;
font-size: 30rpx;
}
.con .con-first {
font-size: 28rpx;
color: #666;
}
.con-title {
text-align: right;
}
......@@ -517,6 +517,18 @@ Page({
}, 500)
}
})
}else if(Number(that.data.lb_id) == '145'){
wx.navigateTo({
url: '/pages/dati08/dati08?id=' + that.data.bid,
success: function () {
wx.hideLoading()
setTimeout(function () {
that.setData({
payInfo: true
})
}, 500)
}
})
} else {
wx.navigateTo({
url: '/pages/dati04/dati04?id=' + that.data.bid,
......
//验证数据的完整性
export function checkAnswerRecord(data){
for(let i = 0;i < data.length;i++){
let keys = Object.keys(data[i])
if(keys.length != 1 && keys.length != 4 && keys.length != 5){
return false
break
}
}
return true
}
//将数据转为后端需要的格式,将数组对象中的score取出来
export function sendAnswerScore(data){
let arr = []
data.forEach((value,index)=>{
let arr1 = []
for (let key in value) {
arr1.push(value[key].score)
}
arr[index] = arr1.join(',')
})
return arr.join('|')
}
export function sendAnswerOption(data){
let arr = []
data.forEach((value,index)=>{
let arr1 = []
for (let key in value) {
arr1.push(value[key].index)
}
arr[index] = arr1.join(',')
})
return arr.join('|')
}
//答题记录的保存格式
// [
// {0:{index:0,score:0}}, //选择未发生或一年前,key为选项数组的索引,index为选项数组中content的索引,score为分数
// {0:{index:1,score:0},1:{index:4,score:4},2:{index:1,score:0},3:{index:1,score:0},4:{index:4,score:3}}, //一年内
// ]
\ No newline at end of file
/*
数据说明:数据为dati05.vue使用
数据逻辑:数据已在下方注释,详细逻辑如下
判断
回答 1=>'一年内' 让被试选择 该事件发生次数为 1=>"1次",2=>"2次",3=>"3次",4=>"4次以上"
回答 2=>'长期性' 让被试选择 该事件持续时间为 1=>"半年之内",2=>"半年以上"
随后
选择性质 1=>'好事 ',2=>'坏事'
然后判断
精神影响程度 0=>'无影响',1=>'轻度',2=>"中度",3=>"重度",4=>"极重"
如果选择 无影响,则直接跳下一题。
否则
选择 影响持续时间 1=>"三月内",2=>"半年内",3=>"一年内",4=>"一年以上"
数据层级不易再深,所以默认导出的数据(exports default)用数据的下标index来区分与编程
index值代表如下:
0 0=>'未发生 ',0=>'一年前',1=>'一年内',2=>'长期性'
1 1=>"1次",2=>"2次",3=>"3次",4=>"4次以上"
2 1=>"半年之内",2=>"半年以上"
3 1=>'好事 ',2=>'坏事'
4 0=>'无影响',1=>'轻度',2=>"中度",3=>"重度",4=>"极重"
5 1=>"三月内",2=>"半年内",3=>"一年内",4=>"一年以上"
*/
export default [
{
isShow:true, //默认显示第一项
subtitle:'事件发生时间',//副标题
content:[{
toIndex: 0 ,//跳转目标,跳转到该数组的某个下标(0 为直接跳转下一个题目)
score: 0,
title: '未发生'
},
{
toIndex: 0 ,//跳转目标,nextQuestion为跳转下一组大题
score: 0,
title: '一年前'
},
{
toIndex: 1 ,//跳转到发生次数
score: 1,
title: '一年内'
},
{
toIndex: 2 ,//跳转到1=>"半年之内",2=>"半年以上"
score: 2,
title: '长期性'
}],
},
{
isShow:false,
subtitle:'该事件发生次数为', //副标题
content:[{
toIndex: 3,
score: 1,
title: '1次'
},
{
toIndex: 3,
score: 2,
title: '2次'
},
{
toIndex: 3,
score: 3,
title: '3次'
},
{
toIndex: 3,
score: 4,
title: '4次以上'
}],
},
{
isShow:false,
subtitle:'该事件持续时间为',
content:[{
toIndex: 3,
score: 1,
title: '半年之内'
},
{
toIndex: 3,
score: 2,
title: '半年以上'
}],
},
{
isShow:false,
subtitle:'性质',
content:[{
toIndex: 4,
score: 1,
title: '好事'
},
{
toIndex: 4,
score: 2,
title: '坏事'
}],
},
{
isShow:false,
subtitle:'精神影响程度',
content:[{
toIndex: 0,
score: 0,
title: '无影响'
},
{
toIndex: 5,
score: 1,
title: '轻度'
},
{
toIndex: 5,
score: 2,
title: '中度'
},
{
toIndex: 5,
score: 3,
title: '重度'
},{
toIndex: 5,
score: 4,
title: '极重'
}],
},
{
isShow:false,
subtitle:'影响持续时间',
content:[{
toIndex: 0,
score: 1,
title: '三月内'
},
{
toIndex: 0,
score: 2,
title: '半年内'
},
{
toIndex: 0,
score: 3,
title: '一年内'
},
{
toIndex: 0,
score: 4,
title: '一年以上'
}]
}
]
//答题记录的保存格式
// [
// {0:{index:0,score:0}}, //选择未发生或一年前,key为选项数组的索引,index为选项数组中content的索引,score为分数
// {0:{index:1,score:0},1:{index:4,score:4},2:{index:1,score:0},3:{index:1,score:0},4:{index:4,score:3}}, //一年内
// ]
\ No newline at end of file
export default [{
"measure_id": "145",
"measure_name": "生活事件量表(LES)",
"price": "50",
"measure_desc": "下面是每个人都有可能遇到的一些日常生活事件,究竟是好事还是坏事,可根据个人情况自行判断。这些事件可能对个人有精神上的影响(体验为紧张、压力、兴奋或苦恼等),影响的轻重程度是各不相同的。影响持续的时间也不一样。请你根据自己的情况,实事求是地回答下列问题,请选择最适合自己的答案。\n",
"type": "0"
},
[{
"quesion_title": "1、恋爱或订婚",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "2、恋爱失败、破裂",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "3、结婚",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "4、自己(爱人)怀孕",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "5、自己(爱人)流产",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "6、家庭增添新成员",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "7、与爱人父母不和",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "8、夫妻感情不好",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "9、夫妻分居(因不和)",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "10、夫妻两地分居(工作需要)",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "11、性生活不满意或独身",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "12、配偶一方有外遇",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "13、夫妻重归于好",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "14、超指标生育",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "15、本人(爱人)作绝育手术",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "16、配偶死亡",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "17、离婚",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "18、子女升学(就业)失败",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "19、子女管教困难",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "20、子女长期离家",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "21、父母不和",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "22、家庭经济困难",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "23、欠债",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "24、经济情况显著改善",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "25、家庭成员重病、重伤",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "26、家庭成员死亡",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "27、本人重病或重伤",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "28、住房紧张",
"type": "1",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "29、待业、无业",
"type": "2",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "30、开始就业",
"type": "2",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "31、高考失败",
"type": "2",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "32、扣发奖金或罚款",
"type": "2",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "33、突出的个人成就",
"type": "2",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "34、晋升、提级",
"type": "2",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "35、对现职工作不满意",
"type": "2",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "36、工作学习中压力大(如成绩不好)",
"type": "2",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "37、与上级关系紧张",
"type": "2",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "38、与同事邻居不和",
"type": "2",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "39、第一次远走他乡异国",
"type": "2",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "40、生活规律重大变动(饮食睡眠规律改变)",
"type": "2",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "41、本人退休离休或未安排具体工作",
"type": "2",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "42、好友重病或重伤",
"type": "3",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "43、好友死亡",
"type": "3",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "44、被人误会、错怪、诬告、议论",
"type": "3",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "45、介入民事法律纠纷",
"type": "3",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "46、被拘留、受审",
"type": "3",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "47、失窃、财产损失",
"type": "3",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}, {
"quesion_title": "48、意外惊吓、发生事故、自然灾害",
"type": "3",
"quesion_answer": "未发生,一年前,一年内,长期性",
"quesion_score": "0,0,0,0"
}]
]
\ No newline at end of file
var Api = require('../utils/api.js');
function stripTags(str, r_str = "") {
//去掉所有的html标记
return str.replace(/<[^>]+>/g, r_str);
}
// function stripTags(str, r_str = "") {
// //去掉所有的html标记
// return str.replace(/<[^>]+>/g, r_str);
// }
//photo
function imageUtil(e) {
var imageSize = {};
......@@ -203,9 +203,73 @@ function timestampToTime(timestamp) {
m = m < 10 ? '0' + m : m;
return Y + M + D;
}
//非空判断
function isEmpty(obj) {
if (!obj || obj == "undefined" || obj == "null" || obj == "NaN") return true;
else return false;
}
/**
* 防抖动函数
* @param {function} func 实际要执行的函数
* @param {interval} delay 延迟时间,也就是阈值,单位是毫秒(ms)
* @param {boolean} immediate 是否立即执行
* @return {function} 返回一个“去弹跳”了的函数
*/
function debouce(func, delay, immediate) {
let timer;
return function() {
var context = this; //闭包取当前函数this
if (timer) clearTimeout(timer);
if (immediate) {
console.log()
var doNow = !timer;
//每一次都重新设置timer,就是要保证每一次执行的至少delay秒后才可以执行
timer = setTimeout(function() {
timer = null;
}, delay);
//根据距离上次触发操作的时间是否到达delay来决定是否要现在执行函数
//立即执行
if (doNow) {
//封装实参的对象arguments
func.apply(context, arguments);
}
} else {
timer = setTimeout(function() {
func.apply(context, arguments);
}, delay);
}
}
}
/**
* 秒数转换时间
* @param {Int} value
*/
function formatSeconds(value) {
var theTime = parseInt(value); // 秒
var middle = 0; // 分
var hour = 0; // 小时
if (theTime > 60) {
middle = parseInt(theTime / 60);
theTime = parseInt(theTime % 60);
if (middle > 60) {
hour = parseInt(middle / 60);
middle = parseInt(middle % 60);
}
}
if (theTime < 10) {
theTime = '0' + theTime;
}
if (middle < 10) {
middle = '0' + middle;
}
if (hour < 10) {
hour = '0' + hour;
}
var result = hour + ":" + middle + ":" + theTime;
return result;
}
function base64src(base64data) {
return new Promise((resolve, reject) => {
const fsm = wx.getFileSystemManager();
......@@ -242,4 +306,7 @@ module.exports = {
Base64: Base64,
formatLocation: formatLocation,
timestampToTime: timestampToTime,
debouce:debouce,
isEmpty:isEmpty,
formatSeconds:formatSeconds
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment