| | |
| | | globalData: { |
| | | userInfo: null, |
| | | pageData: {}, |
| | | // url: 'https://nsjcy.hugeinfo.com.cn/nsjc-charge', |
| | | url: 'https://nsjcy.hugeinfo.com.cn/nsjc-charge', |
| | | // url: 'http://1p885086k1.iok.la/nsjc-charge', |
| | | // url: 'http://192.168.0.31:8085/nsjc-charge', |
| | | imgUrl: 'https://nsjcy.hugeinfo.com.cn/nsjc-charge', |
| | | url: 'http://nsjc.vaiwan.com/nsjc-charge', |
| | | // url: 'http://nsjc.vaiwan.com/nsjc-charge', |
| | | // imgUrl: 'http://nsjc.vaiwan.com/nsjc-charge' |
| | | }, |
| | | // 过滤数组 |
| | |
| | | */ |
| | | data: { |
| | | question: {}, |
| | | confirm: true |
| | | confirm: true, |
| | | value1:'' |
| | | }, |
| | | // 去单选页面 |
| | | toRadio(e) { |
| | |
| | | }, |
| | | // 提交信息 |
| | | submit() { |
| | | if ($v.psqList.length == 0) { |
| | | // if ($v.psqList.length == 0) { |
| | | // wx.showToast({ |
| | | // title: '你还没有创建题目', |
| | | // icon: "none", |
| | | // duration: 800 |
| | | // }); |
| | | // return; |
| | | // } |
| | | wx.showToast({ |
| | | title: '你还没有创建题目', |
| | | icon: "none", |
| | | duration: 800 |
| | | }); |
| | | return; |
| | | } |
| | | this.setData({ |
| | | confirm: false |
| | | }) |
| | | title: '提交成功!', |
| | | icon: 'success', |
| | | duration: 2000 |
| | | }, wx.reLaunch({ |
| | | url: '../yshjqyfw/yshjqyfw', |
| | | })) |
| | | |
| | | }, |
| | | // 发布信息 |
| | | publish() { |
| | |
| | | */ |
| | | onLoad: function (options) { |
| | | var _m = "question"; |
| | | |
| | | var id = options.id |
| | | console.log(options) |
| | | var that = this; |
| | | wx.request({ |
| | | url: app.globalData.url + '/api/activity/finds', |
| | | url: app.globalData.url + '/api/question/find/' + id, |
| | | success: function (res) { |
| | | console.log(res) |
| | | if (res.data.code == 0) { |
| | | console.log(res) |
| | | that.setData({ |
| | | [_m]: { |
| | | "paper": { |
| | | "title": res.data.data.title, |
| | | "des": res.data.data.content |
| | | }, |
| | | "psqList": res.data.data.questionDtos |
| | | // "psqList": [{ |
| | | // "isMust": 1, |
| | | // "type": 1, |
| | | // "question": "111", |
| | | // "answerslist": [{ |
| | | // "answer": "11" |
| | | // }, { |
| | | // "answer": "111" |
| | | // }, { |
| | | // "answer": "11" |
| | | // }, { |
| | | // "answer": "111" |
| | | // }], |
| | | // 'value': [] |
| | | // }, { |
| | | // "isMust": 1, |
| | | // "type": 1, |
| | | // "question": "11111", |
| | | // "answerslist": [{ |
| | | // "answer": "111" |
| | | // }, { |
| | | // "answer": "111" |
| | | // }], |
| | | // value: [] |
| | | // }, { |
| | | // "isMust": 1, |
| | | // "type": 0, |
| | | // "question": "11111" |
| | | // }, { |
| | | // "isMust": 0, |
| | | // "type": 1, |
| | | // "question": "wqwqw", |
| | | // "answerslist": [{ |
| | | // "answer": "qw" |
| | | // }, { |
| | | // "answer": "wqw" |
| | | // }, { |
| | | // "answer": "wqw" |
| | | // }] |
| | | // }] |
| | | } |
| | | |
| | | }); |
| | | } else { |
| | | wx.showModal({ |
| | | title: '提示', |
| | |
| | | } |
| | | } |
| | | }) |
| | | this.setData({ |
| | | [_m]: { |
| | | "paper": { |
| | | "title": "11", |
| | | "des": "111" |
| | | |
| | | }, |
| | | "psqList": [{ |
| | | "isMust": 1, |
| | | "type": 1, |
| | | "question": "111", |
| | | "answerslist": [{ |
| | | "answer": "11" |
| | | }, { |
| | | "answer": "111" |
| | | }, { |
| | | "answer": "11" |
| | | }, { |
| | | "answer": "111" |
| | | }], |
| | | 'value': [] |
| | | }, { |
| | | "isMust": 1, |
| | | "type": 1, |
| | | "question": "11111", |
| | | "answerslist": [{ |
| | | "answer": "111" |
| | | }, { |
| | | "answer": "111" |
| | | }], |
| | | value: [] |
| | | }, { |
| | | "isMust": 1, |
| | | "type": 0, |
| | | "question": "11111" |
| | | }, { |
| | | "isMust": 0, |
| | | "type": 1, |
| | | "question": "wqwqw", |
| | | "answerslist": [{ |
| | | "answer": "qw" |
| | | }, { |
| | | "answer": "wqw" |
| | | }, { |
| | | "answer": "wqw" |
| | | }] |
| | | }] |
| | | } |
| | | }); |
| | | |
| | | onChange1(e) { |
| | | var index = e.currentTarget.dataset['index']; |
| | | const { |
| | | value |
| | | } = e.detail; |
| | | console.log('checkbox', e, '索引', index); |
| | | console.log('value', value); |
| | | console.log('this.data.question', this.data.question); |
| | | |
| | | const data = this.data.question.psqList[index].value || []; |
| | | console.log(data) |
| | | this.data.question.psqList[index].value = value |
| | | console.log('this.data.question', this.data.question) |
| | | this.setData({ |
| | | question: this.data.question |
| | | }) |
| | | }, |
| | | |
| | | onChange: function (e) { |
| | |
| | | "navigationBarTitleText": "问卷", |
| | | "usingComponents": { |
| | | "wux-checkbox-group": "../../templeteDist/wuxDist/checkbox-group/index", |
| | | "wux-checkbox": "../../templeteDist/wuxDist/checkbox/index" |
| | | "wux-checkbox": "../../templeteDist/wuxDist/checkbox/index", |
| | | "wux-radio": "../../templeteDist/wuxDist/radio/index", |
| | | "wux-radio-group": "../../templeteDist/wuxDist/radio-group/index" |
| | | } |
| | | } |
| | |
| | | <view class="question" wx:for="{{question.psqList}}" wx:key="{{index}}"> |
| | | <view class="questionB"> |
| | | <view class="questionT"> |
| | | <text wx:if="{{item.isMust == 1}}">*</text> {{index+1}}、{{item.question}} |
| | | <text wx:if="{{item.required == 'true'}}">*</text> {{index+1}}、{{item.title}} |
| | | <view wx:if="{{confirm}}" catchtap="edit" data-index="{{index}}"> |
| | | <!-- <icon class="iconfont icon-icon_edit"></icon> |
| | | 修改 --> |
| | | </view> |
| | | </view> |
| | | <view class="questionA"> |
| | | <!-- <radio-group class="radio-group" |
| | | wx:if="{{item.type == 1}}"> |
| | | <label class="radio" wx:for="{{item.answerslist}}" wx:key="{{index}}"> |
| | | <radio value="{{item.id}}"/>{{item.answer}} |
| | | </label> |
| | | </radio-group> --> |
| | | <wux-checkbox-group name="a" data-index="{{index}}" value="{{ item.value || [] }}" bind:change="onChange" wx:if="{{item.type == 1}}"> |
| | | <wux-checkbox color="positive" title="{{item.answer}}" value="{{item.answer}}" wx:for="{{item.answerslist}}" wx:key="{{index}}"> |
| | | {{item.answer}} |
| | | <wux-radio-group name="a" data-index="{{index}}" value="{{ item.value || [] }}" bind:change="onChange1" wx:if="{{item.type == 'radio'}}"> |
| | | <wux-radio color="positive" title="{{item}}" value="{{item}}" wx:for="{{item.options}}" wx:key="{{index}}"> |
| | | {{item}} |
| | | </wux-radio> |
| | | </wux-radio-group> |
| | | |
| | | <wux-checkbox-group name="a" data-index="{{index}}" value="{{ item.value || [] }}" bind:change="onChange" wx:if="{{item.type == 'checkbox'}}"> |
| | | <wux-checkbox color="positive" title="{{item}}" value="{{item}}" wx:for="{{item.options}}" wx:key="{{index}}"> |
| | | {{item}} |
| | | </wux-checkbox> |
| | | </wux-checkbox-group> |
| | | |
| | | <view class="textarea" wx:if="{{item.type == 0}}"> |
| | | <view class="textarea" wx:if="{{item.type == 'text'}}"> |
| | | <textarea placeholder="请输入回答" /> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="question" wx:if="{{confirm}}"> |
| | | <!-- <view class="question" wx:if="{{confirm}}"> |
| | | <view class="selectType"> |
| | | <view class="toRadio" data-type="1" catchtap="toRadio"> |
| | | <icon class="iconfont icon-guanbi"></icon> |
| | |
| | | 填空题 |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> --> |
| | | <button class="btn" catchtap='submit' wx:if="{{confirm}}">提交</button> |
| | | <button class="btn" catchtap='publish' wx:if="{{!confirm}}">确认发布</button> |
| | | <button class="btn" catchtap='returnEdit' wx:if="{{!confirm}}">返回修改</button> |
| | |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | user: app.globalData.imgUrl + '/image/user.svg', |
| | | question: {}, |
| | | confirm: true |
| | | confirm: true, |
| | | data: {} |
| | | }, |
| | | // 去单选页面 |
| | | toRadio(e) { |
| | |
| | | url: '/pages/radio/radio?type=' + types, |
| | | }) |
| | | }, |
| | | //去编辑页面 |
| | | edit(e) { |
| | | var index = e.currentTarget.dataset.index; |
| | | wx.navigateTo({ |
| | | url: '/pages/radio/radio?index=' + index, |
| | | }) |
| | | }, |
| | | // 提交信息 |
| | | submit() { |
| | | if ($v.psqList.length == 0) { |
| | | wx.showToast({ |
| | | title: '你还没有创建题目', |
| | | icon: "none", |
| | | duration: 800 |
| | | }); |
| | | return; |
| | | } |
| | | this.setData({ |
| | | confirm: false |
| | | }) |
| | | }, |
| | | // 发布信息 |
| | | publish() { |
| | | app.res({ |
| | | url: "psq/save", |
| | | method: "POST", |
| | | data: $v, |
| | | callback: res => { |
| | | $v.paper = {}; |
| | | $v.psqList = []; |
| | | wx.showModal({ |
| | | title: '提示', |
| | | content: '发布成功,跳转新建问卷', |
| | | showCancel: false, |
| | | success: res => { |
| | | if (res.confirm) { |
| | | wx.switchTab({ |
| | | url: '/pages/creat/creat', |
| | | success: function (e) { |
| | | var page = getCurrentPages().pop(); |
| | | if (page == undefined || page == null) return; |
| | | page.onLoad(); |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | returnEdit() { |
| | | this.setData({ |
| | | confirm: true |
| | | }) |
| | | }, |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad: function (options) { |
| | | var _m = "question"; |
| | | |
| | | var that = this; |
| | | wx.request({ |
| | | url: app.globalData.url + '/api/question/examination', |
| | | success: function (res) { |
| | | console.log(res.data.data) |
| | | if (res.data.code == 0) { |
| | | console.log(res) |
| | | that.setData({ |
| | | data: res.data.data |
| | | }) |
| | | } else { |
| | | wx.showModal({ |
| | | title: '提示', |
| | |
| | | } |
| | | } |
| | | }) |
| | | this.setData({ |
| | | [_m]: { |
| | | "paper": { |
| | | "title": "11", |
| | | "des": "111" |
| | | }, |
| | | "psqList": [{ |
| | | "isMust": 1, |
| | | "type": 1, |
| | | "question": "111", |
| | | "answerslist": [{ |
| | | "answer": "11" |
| | | }, { |
| | | "answer": "111" |
| | | }, { |
| | | "answer": "11" |
| | | }, { |
| | | "answer": "111" |
| | | }], |
| | | 'value': [] |
| | | }, { |
| | | "isMust": 1, |
| | | "type": 1, |
| | | "question": "11111", |
| | | "answerslist": [{ |
| | | "answer": "111" |
| | | }, { |
| | | "answer": "111" |
| | | }], |
| | | value: [] |
| | | }, { |
| | | "isMust": 1, |
| | | "type": 0, |
| | | "question": "11111" |
| | | }, { |
| | | "isMust": 0, |
| | | "type": 1, |
| | | "question": "wqwqw", |
| | | "answerslist": [{ |
| | | "answer": "qw" |
| | | }, { |
| | | "answer": "wqw" |
| | | }, { |
| | | "answer": "wqw" |
| | | }] |
| | | }] |
| | | } |
| | | }); |
| | | |
| | | }, |
| | | |
| | | onChange: function (e) { |
| | | var index = e.currentTarget.dataset['index']; |
| | | const { |
| | | value |
| | | } = e.detail; |
| | | console.log('checkbox', e, '索引', index); |
| | | const data = this.data.question.psqList[index].value || []; |
| | | const idx = data.indexOf(value) |
| | | const current = idx === -1 ? [...data, value] : data.filter((n) => n !== value) |
| | | console.log('current', current); |
| | | this.data.question.psqList[index].value = current |
| | | this.setData({ |
| | | question: this.data.question |
| | | businessSchedule: function(event) { |
| | | wx.navigateTo({ |
| | | url: '../createSub/createSub?id=' + this.data.data.id, |
| | | }) |
| | | |
| | | } |
| | | |
| | | }) |
| | |
| | | { |
| | | "navigationBarTitleText": "问卷", |
| | | "navigationBarTitleText": "问卷列表", |
| | | "backgroundTextStyle": "light", |
| | | "navigationBarBackgroundColor": "#fff", |
| | | "navigationBarTextStyle": "black", |
| | | "usingComponents": { |
| | | "wux-checkbox-group": "../../templeteDist/wuxDist/checkbox-group/index", |
| | | "wux-checkbox": "../../templeteDist/wuxDist/checkbox/index" |
| | | "wux-refresher": "../../templeteDist/wuxDist/refresher/index", |
| | | "wux-cell": "../../templeteDist/wuxDist/cell/index" |
| | | } |
| | | } |
| | |
| | | <!--pages/createSub/createSub.wxml--> |
| | | <!--pages/detail/detail.wxml--> |
| | | <view class="container"> |
| | | <view class="title">{{question.paper.title}}</view> |
| | | <view class="des">{{question.paper.des}}</view> |
| | | <view class="question" wx:for="{{question.psqList}}" wx:key="{{index}}"> |
| | | <view class="questionB"> |
| | | <view class="questionT"> |
| | | <text wx:if="{{item.isMust == 1}}">*</text> {{index+1}}、{{item.question}} |
| | | <view wx:if="{{confirm}}" catchtap="edit" data-index="{{index}}"> |
| | | <!-- <icon class="iconfont icon-icon_edit"></icon> |
| | | 修改 --> |
| | | </view> |
| | | </view> |
| | | <view class="questionA"> |
| | | <!-- <radio-group class="radio-group" |
| | | wx:if="{{item.type == 1}}"> |
| | | <label class="radio" wx:for="{{item.answerslist}}" wx:key="{{index}}"> |
| | | <radio value="{{item.id}}"/>{{item.answer}} |
| | | </label> |
| | | </radio-group> --> |
| | | <wux-checkbox-group name="a" data-index="{{index}}" value="{{ item.value || [] }}" bind:change="onChange" wx:if="{{item.type == 1}}"> |
| | | <wux-checkbox color="positive" title="{{item.answer}}" value="{{item.answer}}" wx:for="{{item.answerslist}}" wx:key="{{index}}"> |
| | | {{item.answer}} |
| | | </wux-checkbox> |
| | | </wux-checkbox-group> |
| | | <div class="guide-all-list" data-id="{{data.id}}" bindtap='businessSchedule'> |
| | | <div class="guide-all-list-top">{{data.title}} |
| | | <span> |
| | | <image class="index-pane-icon " src="{{user}} " /> |
| | | </span> |
| | | </div> |
| | | |
| | | <view class="textarea" wx:if="{{item.type == 0}}"> |
| | | <textarea placeholder="请输入回答" /> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="question" wx:if="{{confirm}}"> |
| | | <view class="selectType"> |
| | | <view class="toRadio" data-type="1" catchtap="toRadio"> |
| | | <icon class="iconfont icon-guanbi"></icon> |
| | | 单选题 |
| | | </view> |
| | | <view class="toFillBlack" data-type="0" catchtap="toRadio"> |
| | | <icon class="iconfont icon-combinedshapecopy2"></icon> |
| | | 填空题 |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <button class="btn" catchtap='submit' wx:if="{{confirm}}">提交</button> |
| | | <button class="btn" catchtap='publish' wx:if="{{!confirm}}">确认发布</button> |
| | | <button class="btn" catchtap='returnEdit' wx:if="{{!confirm}}">返回修改</button> |
| | | </view> |
| | | </div> |
| | |
| | | /* pages/createSub/createSub.wxss */ |
| | | |
| | | page { |
| | | background-color: #eaf3fb; |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | |
| | | .container { |
| | | padding: 0 20rpx; |
| | | background-color: #eaf3fb; |
| | | color: #343434; |
| | | overflow: auto; |
| | | } |
| | | |
| | | .title { |
| | | text-align: center; |
| | | font-size: 32rpx; |
| | | padding: 30rpx 0 20rpx; |
| | | } |
| | | |
| | | .des { |
| | | padding: 0 30rpx; |
| | | line-height: 50rpx; |
| | | font-size: 28rpx; |
| | | margin-bottom: 24rpx; |
| | | } |
| | | |
| | | .question { |
| | | width: 100%; |
| | | padding: 0 20rpx; |
| | | } |
| | | |
| | | .questionB { |
| | | padding: 0 20rpx; |
| | | border-radius: 5px; |
| | | background-color: white; |
| | | margin-top: 24rpx; |
| | | } |
| | | |
| | | .questionB .questionT { |
| | | padding: 20rpx 0; |
| | | border-bottom: 1px solid #58a6f6; |
| | | font-size: 32rpx; |
| | | color: #58a6f6; |
| | | } |
| | | |
| | | .questionA radio-group { |
| | | display: block; |
| | | } |
| | | |
| | | .questionT text { |
| | | color: red; |
| | | } |
| | | |
| | | .questionT view { |
| | | float: right; |
| | | font-size: 28rpx; |
| | | margin-top: -5px; |
| | | } |
| | | |
| | | .radio { |
| | | display: block; |
| | | font-size: 30rpx; |
| | | padding: 20rpx; |
| | | border-bottom: 1rpx dashed #dadada; |
| | | } |
| | | |
| | | .radio:last-child { |
| | | border-bottom: none; |
| | | } |
| | | |
| | | .radio radio { |
| | | margin-right: 20rpx; |
| | | } |
| | | |
| | | .textarea { |
| | | padding: 24rpx; |
| | | } |
| | | |
| | | .questionA textarea { |
| | | width: 100%; |
| | | height: 160rpx; |
| | | padding: 20rpx; |
| | | box-sizing: border-box; |
| | | font-size: 30rpx; |
| | | border: 1rpx solid #dadada; |
| | | border-radius: 5px; |
| | | } |
| | | |
| | | .selectType { |
| | | padding: 20rpx 100rpx; |
| | | border-radius: 5px; |
| | | background-color: white; |
| | | margin-top: 24rpx; |
| | | .guide-all-list { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | font-size: 32rpx; |
| | | flex-direction: column; |
| | | padding: 2vh; |
| | | border-bottom: 1px solid #f2f2f2; |
| | | } |
| | | |
| | | .selectType icon { |
| | | font-size: 40rpx; |
| | | color: #58a6f6; |
| | | .guide-all-list-top { |
| | | font-size: 16px; |
| | | color: #333; |
| | | } |
| | | |
| | | .toRadio icon { |
| | | position: relative; |
| | | font-size: 45rpx; |
| | | top: 5rpx; |
| | | .guide-all-list-bottom { |
| | | font-size: 14px; |
| | | color: #999; |
| | | display: flex; |
| | | margin-top: 1vh; |
| | | } |
| | | |
| | | .btn { |
| | | width: 80%; |
| | | height: 40px; |
| | | background-color: #58a6f6; |
| | | border-radius: 40px; |
| | | line-height: 40px; |
| | | color: white; |
| | | margin: 24rpx auto; |
| | | font-size: 32rpx; |
| | | .guide-all-list-left { |
| | | margin-right: auto; |
| | | } |
| | | |
| | | .guide-all-list-right { |
| | | width: 3vh; |
| | | height: 3vh; |
| | | } |
| | | .index-pane-icon { |
| | | width: 16px; |
| | | height: 16px; |
| | | float:right; |
| | | } |
| | |
| | | <view class="text-black text-bold text-lg">法律查询</view> |
| | | </view> |
| | | </view> |
| | | <view class="zhwj-list-flex-r" data-str="createSub" bindtap='linkFunction'> |
| | | <view class="zhwj-list-flex-r" data-str="createSubList" bindtap='linkFunction'> |
| | | <view class="cu-avatar round margin-left zhwj-list-flex-l-img" style="background-image: url('https://xnwj.gznsjc.gov.cn/nsjc-charge/image/zuj4.png');"></view> |
| | | <view class="zhwj-list-flex-l-text"> |
| | | <view class="text-black text-bold text-lg">企业体检</view> |