tanyanfei vor 3 Monaten
Ursprung
Commit
f38cd2b3b1

BIN
images/cuo.png


+ 23 - 0
pages/message/message.js

@@ -22,6 +22,29 @@ Page({
     })
     this.getData()
   },  
+  getDetail(e){
+    console.log(e.target)
+    var id=e.target.dataset.id
+    wx.request({
+      url: host+'/api/wx/notice?id='+id,
+      header: {
+        openid: this.data.openid
+      },
+      success:res=>{
+        var msg=this.data.list.filter(item=>item.id==id)
+        msg=msg[0]
+        console.log(msg)
+        wx.showModal({
+          title: msg.title,
+          content: msg.content,
+          showCancel:false,
+          success (res) {
+            this.getData()
+          }
+        })
+      }
+    })
+  },
   getData:function(){
     wx.request({
       url: host+'/api/wx/notice',

+ 6 - 6
pages/message/message.wxml

@@ -1,10 +1,10 @@
 <view class="content">
-    <navigator wx:for="{{list}}" class="list">
-        <view>
+    <view wx:for="{{list}}" class="list" catchtap="getDetail" data-id='{{item.id}}'>
+        <view data-id='{{item.id}}'>
             {{item.title}}
-            <view class="newflag"></view>
+            <view wx:if='{{!viewer}}' class="newflag"></view>
         </view>
-        <text style="display:block;">{{item.content}}</text>
-        <text>{{item.ctime}}</text>
-    </navigator>
+        <text style="display:block;" data-id='{{item.id}}'>{{item.content}}</text>
+        <text data-id='{{item.id}}'>{{item.ctime}}</text>
+    </view>
 </view>

+ 1 - 1
pages/online/online.js

@@ -73,7 +73,7 @@ Page({
               wx.chooseMedia({
                 count: 1,
                 mediaType: ['image'],
-                sourceType: ['album', 'camera'],
+                sourceType: ['camera'],
                 camera: 'back',
                 success(res) {
                   wx.showLoading({

+ 1 - 0
pages/subject/subject.js

@@ -108,6 +108,7 @@ Page({
     data.questions.forEach(item=>{
       if(id == item.id){
         item.post_answer=value
+        item.post_answer_str=''
       }
     })
     this.setData({

+ 14 - 10
pages/subject/subject.wxml

@@ -61,20 +61,13 @@
     </view>
 
     <view class="ans" wx:if="{{!status}}">
-    
+  
       <radio-group class="option"  wx:if="{{item.qtype == 3}}" bindchange='answer' data-id='{{item.id}}'>
-              <view><radio color="#358BFF" checked="{{item.post_answer=='对'}}"   value="对">正确</radio></view>
+              <view ><radio color="#358BFF" checked="{{item.post_answer=='对'}}"   value="对">正确</radio></view>
               <view><radio color="#358BFF" checked="{{item.post_answer=='错'}}"  value="错">错误</radio></view>
         </radio-group>
         <checkbox-group  class="option" wx:elif="{{item.qtype == 2}}" bindchange='answer' data-id='{{item.id}}'>
             <view wx:for="{{item.options}}" wx:for-item="opt" wx:key="*this" wx:for-index="i">
-                <!-- <view wx:for="{{item.post_answer}}" wx:for-item="ans" wx:key="*this">
-                  {{ans==opt[0]}}
-                  <checkbox checked="{{ans==opt[0]}}" color="#358BFF" value="{{opt[0]}}">{{opt}}</checkbox>
-                </view> -->
-                <!-- <view wx:if="{{item.post_answer.indexOf(opt[0])!=-1}}" wx:key="*this">
-                  <checkbox checked="true" color="#358BFF" value="{{opt[0]}}">{{opt}}</checkbox>
-                </view> -->
                 <checkbox color="#358BFF" value="{{opt[0]}}">{{opt}}</checkbox>
             </view>
         </checkbox-group>
@@ -83,6 +76,13 @@
               <radio color="#358BFF" checked="{{item.post_answer==opt[0]}}"  value="{{opt[0]}}">{{opt}}</radio>
             </view>
         </radio-group> 
+        <view wx:if='{{item.post_answer_str}}' style="position: relative;">
+          <image wx:if='{{item.correct}}' mode="widthFix" class="flag" src="../../images/gou.png"></image>
+           <image wx:else class="flag" style="width: 20px;" mode="widthFix" src="../../images/cuo.png"></image>
+            <view style="color: green;">正确答案:{{item.answer}}</view>
+            <view style="color:#666">答案解析:</view>
+            <view class="analysis">{{item.analysis}}</view>
+        </view>
     </view>
 </view> 
 
@@ -102,7 +102,11 @@
       </block>
     </block>
     <block wx:else>
-      <text  wx:for="{{data.questions}}" class="{{item.post_answer ? 'act':''}}" bindtap="skip" data-id='{{index}}'>{{index+1}}</text>
+      <block wx:for="{{data.questions}}">
+        <text wx:if='{{item.post_answer_str}}'  class="{{item.correct ? 'right':'error'}}" bindtap="skip" data-id='{{index}}'>{{index+1}}</text>
+        <text wx:else  class="{{item.post_answer ? 'act':''}}" bindtap="skip" data-id='{{index}}'>{{index+1}}</text>
+      </block>
+      
     </block>
   </view>
 </view>

+ 6 - 0
pages/subject/subject.wxss

@@ -186,4 +186,10 @@
   background-color: #FF6868;
   border-color: #FF6868;
   color: #fff;
+}
+
+.flag{
+  position: absolute;
+  width: 30px;
+  right: 30rpx;
 }

+ 50 - 50
project.config.json

@@ -1,52 +1,52 @@
 {
-	"description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
-	"packOptions": {
-		"ignore": [],
-		"include": []
-	},
-	"setting": {
-		"urlCheck": true,
-		"es6": true,
-		"postcss": true,
-		"preloadBackgroundData": false,
-		"minified": true,
-		"newFeature": true,
-		"coverView": true,
-		"autoAudits": false,
-		"showShadowRootInWxmlPanel": true,
-		"scopeDataCheck": false,
-		"checkInvalidKey": true,
-		"checkSiteMap": true,
-		"uploadWithSourceMap": true,
-		"babelSetting": {
-			"ignore": [],
-			"disablePlugins": [],
-			"outputPath": ""
-		},
-		"useCompilerModule": false,
-		"userConfirmedUseCompilerModuleSwitch": false,
-		"lazyloadPlaceholderEnable": false,
-		"uglifyFileName": false,
-		"enhance": true,
-		"useMultiFrameRuntime": true,
-		"packNpmManually": false,
-		"packNpmRelationList": [],
-		"minifyWXSS": true,
-		"useStaticServer": true,
-		"showES6CompileOption": false,
-		"disableUseStrict": false,
-		"useCompilerPlugins": false,
-		"minifyWXML": true
-	},
-	"compileType": "miniprogram",
-	"libVersion": "2.11.0",
-	"appid": "wxd417822087cf4573",
-	"projectname": "yifeng",
-	"simulatorType": "wechat",
-	"simulatorPluginLibVersion": {},
-	"editorSetting": {
-		"tabIndent": "insertSpaces",
-		"tabSize": 2
-	},
-	"condition": {}
+  "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+  "packOptions": {
+    "ignore": [],
+    "include": []
+  },
+  "setting": {
+    "urlCheck": true,
+    "es6": true,
+    "postcss": true,
+    "preloadBackgroundData": false,
+    "minified": true,
+    "newFeature": true,
+    "coverView": true,
+    "autoAudits": false,
+    "showShadowRootInWxmlPanel": true,
+    "scopeDataCheck": false,
+    "checkInvalidKey": true,
+    "checkSiteMap": true,
+    "uploadWithSourceMap": true,
+    "babelSetting": {
+      "ignore": [],
+      "disablePlugins": [],
+      "outputPath": ""
+    },
+    "useCompilerModule": false,
+    "userConfirmedUseCompilerModuleSwitch": false,
+    "lazyloadPlaceholderEnable": false,
+    "uglifyFileName": false,
+    "enhance": true,
+    "useMultiFrameRuntime": true,
+    "packNpmManually": false,
+    "packNpmRelationList": [],
+    "minifyWXSS": true,
+    "useStaticServer": true,
+    "showES6CompileOption": false,
+    "disableUseStrict": false,
+    "useCompilerPlugins": false,
+    "minifyWXML": true
+  },
+  "compileType": "miniprogram",
+  "libVersion": "2.11.0",
+  "appid": "wxd417822087cf4573",
+  "projectname": "yifeng",
+  "simulatorType": "wechat",
+  "simulatorPluginLibVersion": {},
+  "editorSetting": {
+    "tabIndent": "insertSpaces",
+    "tabSize": 2
+  },
+  "condition": {}
 }