From 1629cb4a35884cdbd52088377fffd37fca2c225e Mon Sep 17 00:00:00 2001
From: liuwh <hugeinfo123>
Date: Mon, 23 Mar 2020 16:47:09 +0800
Subject: [PATCH] 123

---
 SunshineLnsMinApp/pages/createSubList/createSubList.json |    9 
 SunshineLnsMinApp/pages/createSub/createSub.json         |    4 
 SunshineLnsMinApp/pages/createSubList/createSubList.wxml |   54 -----
 SunshineLnsMinApp/pages/createSub/createSub.wxml         |   26 +-
 SunshineLnsMinApp/pages/createSubList/createSubList.wxss |  135 ++------------
 SunshineLnsMinApp/pages/createSub/createSub.js           |  161 ++++++++++-------
 SunshineLnsMinApp/app.js                                 |    4 
 SunshineLnsMinApp/pages/createSubList/createSubList.js   |  136 +-------------
 SunshineLnsMinApp/pages/yshjqyfw/yshjqyfw.wxml           |    2 
 9 files changed, 164 insertions(+), 367 deletions(-)

diff --git a/SunshineLnsMinApp/app.js b/SunshineLnsMinApp/app.js
index 9653496..5ba6922 100644
--- a/SunshineLnsMinApp/app.js
+++ b/SunshineLnsMinApp/app.js
@@ -10,11 +10,11 @@
   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'
   },
   // 过滤数组
diff --git a/SunshineLnsMinApp/pages/createSub/createSub.js b/SunshineLnsMinApp/pages/createSub/createSub.js
index 0323bca..9f59096 100644
--- a/SunshineLnsMinApp/pages/createSub/createSub.js
+++ b/SunshineLnsMinApp/pages/createSub/createSub.js
@@ -8,7 +8,8 @@
    */
   data: {
     question: {},
-    confirm: true
+    confirm: true,
+    value1:''
   },
   // 去单选页面
   toRadio(e) {
@@ -26,17 +27,22 @@
   },
   // 提交信息
   submit() {
-    if ($v.psqList.length == 0) {
-      wx.showToast({
-        title: '你还没有创建题目',
-        icon: "none",
-        duration: 800
-      });
-      return;
-    }
-    this.setData({
-      confirm: false
-    })
+    // if ($v.psqList.length == 0) {
+    //   wx.showToast({
+    //     title: '你还没有创建题目',
+    //     icon: "none",
+    //     duration: 800
+    //   });
+    //   return;
+    // }
+    wx.showToast({
+      title: '提交成功!',
+      icon: 'success',
+      duration: 2000
+    }, wx.reLaunch({
+      url: '../yshjqyfw/yshjqyfw',
+    }))
+    
   },
   // 发布信息
   publish() {
@@ -55,7 +61,7 @@
             if (res.confirm) {
               wx.switchTab({
                 url: '/pages/creat/creat',
-                success: function (e) {
+                success: function(e) {
                   var page = getCurrentPages().pop();
                   if (page == undefined || page == null) return;
                   page.onLoad();
@@ -75,15 +81,67 @@
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function (options) {
+  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',
-      success: function (res) {
+      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: '提示',
@@ -92,57 +150,28 @@
         }
       }
     })
-    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) {
+  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) {
     var index = e.currentTarget.dataset['index'];
     const {
       value
diff --git a/SunshineLnsMinApp/pages/createSub/createSub.json b/SunshineLnsMinApp/pages/createSub/createSub.json
index d7e2107..f109a7e 100644
--- a/SunshineLnsMinApp/pages/createSub/createSub.json
+++ b/SunshineLnsMinApp/pages/createSub/createSub.json
@@ -2,6 +2,8 @@
   "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"
   }
 }
\ No newline at end of file
diff --git a/SunshineLnsMinApp/pages/createSub/createSub.wxml b/SunshineLnsMinApp/pages/createSub/createSub.wxml
index 60fb792..8732d9b 100644
--- a/SunshineLnsMinApp/pages/createSub/createSub.wxml
+++ b/SunshineLnsMinApp/pages/createSub/createSub.wxml
@@ -6,32 +6,32 @@
   <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>
@@ -42,7 +42,7 @@
         填空题
       </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>
diff --git a/SunshineLnsMinApp/pages/createSubList/createSubList.js b/SunshineLnsMinApp/pages/createSubList/createSubList.js
index ebb07f0..06c0369 100644
--- a/SunshineLnsMinApp/pages/createSubList/createSubList.js
+++ b/SunshineLnsMinApp/pages/createSubList/createSubList.js
@@ -7,8 +7,10 @@
    * 页面的初始数据
    */
   data: {
+    user: app.globalData.imgUrl + '/image/user.svg',
     question: {},
-    confirm: true
+    confirm: true,
+    data: {}
   },
   // 去单选页面
   toRadio(e) {
@@ -17,73 +19,19 @@
       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";
-
+  onLoad: function(options) {
     var that = this;
     wx.request({
       url: app.globalData.url + '/api/question/examination',
-      success: function (res) {
+      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: '提示',
@@ -92,71 +40,13 @@
         }
       }
     })
-    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,
     })
-
   }
 
 })
\ No newline at end of file
diff --git a/SunshineLnsMinApp/pages/createSubList/createSubList.json b/SunshineLnsMinApp/pages/createSubList/createSubList.json
index d7e2107..a48f018 100644
--- a/SunshineLnsMinApp/pages/createSubList/createSubList.json
+++ b/SunshineLnsMinApp/pages/createSubList/createSubList.json
@@ -1,7 +1,10 @@
 {
-  "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"
   }
 }
\ No newline at end of file
diff --git a/SunshineLnsMinApp/pages/createSubList/createSubList.wxml b/SunshineLnsMinApp/pages/createSubList/createSubList.wxml
index 60fb792..b837ef7 100644
--- a/SunshineLnsMinApp/pages/createSubList/createSubList.wxml
+++ b/SunshineLnsMinApp/pages/createSubList/createSubList.wxml
@@ -1,49 +1,9 @@
 <!--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>
\ No newline at end of file
+</div>
\ No newline at end of file
diff --git a/SunshineLnsMinApp/pages/createSubList/createSubList.wxss b/SunshineLnsMinApp/pages/createSubList/createSubList.wxss
index 1830c58..8a511af 100644
--- a/SunshineLnsMinApp/pages/createSubList/createSubList.wxss
+++ b/SunshineLnsMinApp/pages/createSubList/createSubList.wxss
@@ -1,121 +1,34 @@
 /* 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;
 }
diff --git a/SunshineLnsMinApp/pages/yshjqyfw/yshjqyfw.wxml b/SunshineLnsMinApp/pages/yshjqyfw/yshjqyfw.wxml
index 4c60026..a51b31c 100644
--- a/SunshineLnsMinApp/pages/yshjqyfw/yshjqyfw.wxml
+++ b/SunshineLnsMinApp/pages/yshjqyfw/yshjqyfw.wxml
@@ -25,7 +25,7 @@
 				<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>

--
Gitblit v1.8.0