xtz 4 anni fa
parent
commit
dd9d49ac54

+ 3 - 0
api/api.js

@@ -148,6 +148,9 @@ module.exports = {
     },
     submitUserAnswer(d, cb) {
       post('/mCompetition/submitUserAnswer', d).then(resolver(cb).done).catch(resolver(cb).fail)
+    },
+    submitReviews(d, cb) {
+      post('/mCompetition/submitReviews', d).then(resolver(cb).done).catch(resolver(cb).fail)
     }
   }
 

+ 2 - 0
app.js

@@ -56,5 +56,7 @@ App({
     appid: 'wx4398d60942bc7710',
     imgUrl: 'https://zmbx.oss-cn-shanghai.aliyuncs.com/'
     // imgUrl: 'http://cdn.info666.com/'
+    // wx289928fedd0242a5 测试
+    // wx0883711d2af54d70 正式
   }
 })

+ 1 - 0
app.json

@@ -15,6 +15,7 @@
     "pages/contest/answer/answer",
     "pages/contest/info/info",
     "pages/contest/score/score",
+    "pages/contest/stars/stars",
     "pages/contest/ranking/ranking"
   ],
   "window": {

BIN
imgs/contest/ranking/bg.png


BIN
imgs/contest/ranking/help-icon.png


BIN
imgs/contest/ranking/page-2.png


BIN
imgs/contest/ranking/page-3.png


BIN
imgs/contest/ranking/test-area.png


BIN
imgs/contest/ranking/top-1.png


BIN
imgs/contest/ranking/top-2.png


BIN
imgs/contest/ranking/top-3.png


BIN
imgs/contest/score/icon-rank.png


BIN
imgs/contest/score/icon-start.png


BIN
imgs/contest/score/iocn-share.png


BIN
imgs/contest/score/kuang.png


BIN
imgs/contest/stars/kuang.png


BIN
imgs/contest/stars/stars-active.png


BIN
imgs/contest/stars/stars.png


+ 33 - 7
pages/contest/answer/answer.js

@@ -23,7 +23,8 @@ Page({
     questionTotal: [],
     chooseList: [],
     time: 0,
-    allAnswer: false
+    allAnswer: false,
+    statusBar: 0
   },
 
   attendContest () {
@@ -36,6 +37,11 @@ Page({
           return item
         })
       }, () => {
+        timer = setInterval(() => {
+          this.setData({
+            time: ++this.data.time
+          })
+        }, 1000)
         this.setData({
           questionList: this.data.questionTotal.filter((item,index)=>index<10)
         })
@@ -43,6 +49,23 @@ Page({
     })
   },
 
+  goHome (e) {
+    wx.showModal({
+      title: '确定要离开吗?',
+      content: '一旦离开,本次答题成绩不予记录!',
+      confirmColor: '#ff0000',
+      success (res) {
+        if (res.confirm) {
+          wx.reLaunch({
+            url: '/pages/home/home',
+          })
+        } else if (res.cancel) {
+          console.log('用户点击取消')
+        }
+      }
+    })
+  },
+
   showToggle(e) {
     this.setData({
       show: !this.data.show,
@@ -112,8 +135,9 @@ Page({
       paperScore,
       paperDuration:time
     }},r => {
+      let {rank,id} = r.object
       wx.navigateTo({
-        url: `/pages/contest/score/score?rank=${r.object}&score=${paperScore}`,
+        url: `/pages/contest/score/score?rank=${rank}&id=${id}&score=${paperScore}`,
       })
     })
   },
@@ -135,11 +159,6 @@ Page({
    */
   onLoad: function (options) {
     this.attendContest()
-    timer = setInterval(() => {
-      this.setData({
-        time: ++this.data.time
-      })
-    }, 1000)
     let {chooseList} = this.data
     for (let index = 0; index < 50; index++) {
       chooseList[index] = null
@@ -147,6 +166,13 @@ Page({
     this.setData({
       chooseList
     })
+    wx.getSystemInfo({
+      success: e => {
+        this.setData({
+          statusBar: e.statusBarHeight + 13
+        })
+      }
+    })
   },
 
   /**

+ 2 - 1
pages/contest/answer/answer.wxml

@@ -2,7 +2,8 @@
 <wxs src="../../../utils/util.wxs" module="format" />
 <view>
   <image mode="widthFix" src="../../../imgs/contest/answer/bg.png" class="bg"></image>
-  <view class="page-title">参加竞赛</view>
+  <image src="../../../imgs/contest/ranking/home.png" class="home" style="top:{{statusBar}}px" bindtap="goHome"></image>
+  <view class="page-title" style="padding-top:{{statusBar}}px">参加竞赛</view>
   <view class="top">
     <view class="top-title">您已回答
       <view class="time">

+ 9 - 1
pages/contest/answer/answer.wxss

@@ -2,6 +2,14 @@
 page {
   background: #fff;
 }
+.home {
+  width: 40rpx;
+  height: 40rpx;
+  position: absolute;
+  top: 70rpx;
+  left: 50rpx;
+  z-index: 99;
+}
 .page-title {
   position: relative;
   z-index: 1;
@@ -21,7 +29,7 @@ page {
 .top{
   position: relative;
   z-index: 9;
-  padding-top: 60rpx;
+  padding-top: 44rpx;
   width: 100%;
 }
 .top-title {

+ 91 - 13
pages/contest/info/info.js

@@ -9,22 +9,45 @@ Page({
    */
   data: {
     sexList: [{label:'男',value:1},{label:'女',value:2}],
-    form: {},
+    form: {schoolName:''},
     areaList: [],
     sortList: [
       {name:'actualName',title:'姓名'},
       {name:'sex',title:'性别'},
-      {name:'age',title:'年龄'},
+      {name:'birthday',title:'生日'},
       {name:'area',title:'区域'},
       {name:'school',title:'学校'},
       {name:'grade',title:'年级'}
     ],
-    jgList: [true,true,true,true,true,true]
+    ageList: [],
+    gradeList: [
+      {label:'一年级',value:'一年级'},
+      {label:'二年级',value:'二年级'},
+      {label:'三年级',value:'三年级'},
+      {label:'四年级',value:'四年级'},
+      {label:'五年级',value:'五年级'},
+      {label:'六年级',value:'六年级'},
+      {label:'七年级',value:'七年级'},
+      {label:'八年级',value:'八年级'},
+      {label:'九年级',value:'九年级'},
+      {label:'高一',value:'高一'},
+      {label:'高二',value:'高二'},
+      {label:'高三',value:'高三'}
+    ],
+    schoolList: [],
+    jgList: [true,true,true,true,true,true],
+    statusBar: 0
+  },
+
+  goHome (e) {
+    wx.reLaunch({
+      url: '/pages/home/home',
+    })
   },
 
   changeInput (e) {
     const id = e.currentTarget.id;
-    let value = (id === 'age' ? e.detail.value.replace(/\D/g, '')-0 : e.detail.value)
+    let value = (id === 'actualName' ? e.detail.value.replace(/[^\u4E00-\u9FA5]/g, '') : e.detail.value)
     this.setData({
       ['form.'+id]: value
     })
@@ -38,11 +61,30 @@ Page({
     })
   },
 
-  bindPickerSex (e) {
+  bindPickerData (e) {
+    const id = e.currentTarget.id;
+    const value = this.formatYMD(e.detail.value)
+    this.setData({
+      ['form.'+id]: value
+    })
+  },
+
+  formatYMD (time) {
+    let date = new Date(time)
+    let y = date.getFullYear()
+    let m = date.getMonth() + 1
+    m = m < 10 ? '0' + m : m
+    let d = date.getDate()
+    d = d < 10 ? '0' + d : d
+    return y + '-' + m + '-' + d
+  },
+
+  bindPicker (e) {
     const id = e.currentTarget.id;
+    const list = e.currentTarget.dataset.list
     const value = e.detail.value
     this.setData({
-      ['form.'+id]: this.data.sexList[value].value
+      ['form.'+id]: this.data[list][value].value
     })
   },
 
@@ -50,7 +92,7 @@ Page({
     const id = e.currentTarget.id;
     const value = e.detail.value
     this.setData({
-      ['form.'+id]: this.data.areaList[value].id,
+      ['form.'+id]: this.data.schoolList[value].id,
       ['form.schoolName']: this.data.schoolList[value].schoolName
     })
   },
@@ -65,16 +107,21 @@ Page({
       imine.querySchoolByAreaId({reqdata:{
         id: this.data.form[id]
       }},r => {
+        let list = r.list
+        let index = list.findIndex(item=>item.schoolName.includes('其他'))
+        let obj = list.splice(index,1)
+        list.push(obj[0])
         this.setData({
-          schoolList: r.list,
-          ['form.school']: null
+          schoolList: list,
+          ['form.school']: null,
+          ['form.schoolName']: ''
         })
       })
     })
   },
 
   submit (e) {
-    let {actualName,sex,age,area,grade,other,school} = this.data.form
+    let {actualName,sex,birthday,area,grade,other,school} = this.data.form
     let {sortList} = this.data
     this.setData({
       jgList: sortList.map(item => !!this.data.form[item.name])
@@ -84,10 +131,24 @@ Page({
         return
       }
       let id = wx.getStorageSync('id')
-      imine.updateUser({reqdata:{actualName,sex,age,area,grade,other,school,id}},r => {
+      imine.updateUser({reqdata:{actualName,sex,birthday,area,grade,other,school,id}},r => {
         this.loadMyinformation()
-        wx.navigateTo({
-          url: '/pages/contest/answer/answer'
+        wx.showModal({
+          title: '答题须知:',
+          content: '1.每人每天最多答题三次\n\n 2.排行榜以得分情况计算',
+          confirmColor: '#ff0000',
+          cancelText: '返回',
+          success (res) {
+            if (res.confirm) {
+              wx.navigateTo({
+                url: '/pages/contest/answer/answer'
+              })
+            } else if (res.cancel) {
+              wx.reLaunch({
+                url: '/pages/home/home',
+              })
+            }
+          }
         })
       })
     })
@@ -113,6 +174,23 @@ Page({
    */
   onLoad: function (options) {
     this.queryAllArea()
+    wx.getSystemInfo({
+      success: e => {
+        this.setData({
+          statusBar: e.statusBarHeight + 13
+        })
+      }
+    })
+    let {ageList} = this.data
+
+    for (let index = 0; index < 100; index++) {
+      // const element = array[index];
+      ageList[index] = { label: index+1+'岁',value: index+1}
+    }
+    this.setData({
+      ageList,
+      endDate: new Date().format('yyyy-MM-dd')
+    })
   },
 
   /**

+ 43 - 19
pages/contest/info/info.wxml

@@ -1,19 +1,21 @@
 <!--pages/contest/contest.wxml-->
+<wxs src="../../../utils/util.wxs" module="format" />
 <view>
   <image mode="widthFix" src="../../../imgs/contest/bg.png" class="bg"></image>
-  <view class="page-title">个人信息</view>
+  <image src="../../../imgs/contest/ranking/home.png" class="home" style="top:{{statusBar}}px" bindtap="goHome"></image>
+  <view class="page-title" style="padding-top:{{statusBar}}px">个人信息</view>
   <view class="form">
     <view class="form-item">
       <image class="form-item-bg" mode="widthFix" src="../../../imgs/contest/list-bg.png"></image>
       <view class="content">
         <view class="form-item-label" style="border-right: 4rpx solid #D8D8D8">姓名</view>
-        <input bindinput="changeInput" id="actualName" placeholder="请输入" placeholder-class="phcolor"></input>
+        <input bindinput="changeInput" id="actualName" value="{{form.actualName}}" placeholder="请输入中文" placeholder-class="phcolor"></input>
       </view>
     </view>
     
     <view class="{{jgList[0]?'hidden':'warning'}}" wx:if="{{!jgList[0]}}">
       <image mode="widthFix" src="../../../imgs/contest/warning.png" class="warning-icon"></image>
-      <view class="warning-text">请填写学校完整名称</view>
+      <view class="warning-text">请填写姓名</view>
     </view>
 
     <view class="form-item">
@@ -21,7 +23,7 @@
       <view class="content">
         <view class="form-item-label" style="border-right: 4rpx solid #D8D8D8">性别</view>
         <view class="select">
-          <picker bindchange="bindPickerSex" value="{{value}}" range="{{sexList}}" range-key="label" id="sex">
+          <picker bindchange="bindPicker" value="{{value}}" data-list="sexList" range="{{sexList}}" range-key="label" id="sex">
             <view class="picker {{form.sex?'':'phcolor'}}">
               {{form.sex?sexList[form.sex-1].label:'请选择'}}
             </view>
@@ -33,20 +35,33 @@
 
     <view class="{{jgList[1]?'hidden':'warning'}}" wx:if="{{!jgList[1]}}">
       <image mode="widthFix" src="../../../imgs/contest/warning.png" class="warning-icon"></image>
-      <view class="warning-text">请填写学校完整名称</view>
+      <view class="warning-text">请选择性别</view>
     </view>
 
     <view class="form-item">
       <image class="form-item-bg" mode="widthFix" src="../../../imgs/contest/list-bg.png"></image>
       <view class="content">
-        <view class="form-item-label" style="border-right: 4rpx solid #D8D8D8">年龄</view>
-        <input bindinput="changeInput" id="age" value="{{form.age}}" maxlength="{{2}}" placeholder="请输入" placeholder-class="phcolor"></input>
+        <view class="form-item-label" style="border-right: 4rpx solid #D8D8D8">生日</view>
+        <!-- <input bindinput="changeInput" id="age" value="{{form.age}}" maxlength="{{2}}" placeholder="请输入" placeholder-class="phcolor"></input> -->
+        <view class="select">
+          <!-- <picker bindchange="bindPicker" value="{{value}}" data-list="ageList" range="{{ageList}}" range-key="label" id="age">
+            <view class="picker {{form.age?'':'phcolor'}}">
+              {{form.age?ageList[form.age-1].label:'请选择'}}
+            </view>
+          </picker> -->
+          <picker mode="date" start='1940-01-01' end='{{endDate}}' value="{{form.birthday}}" id="birthday" bindchange="bindPickerData">
+            <view class="picker {{form.birthday||'phcolor'}}">
+              {{form.birthday||'请选择'}}
+            </view>
+          </picker>
+          <image class="arrow" src="../../../imgs/contest/arrow.png" mode="widthFix"></image>
+        </view>
       </view>
     </view>
 
     <view class="{{jgList[2]?'hidden':'warning'}}" wx:if="{{!jgList[2]}}">
       <image mode="widthFix" src="../../../imgs/contest/warning.png" class="warning-icon"></image>
-      <view class="warning-text">请填写学校完整名称</view>
+      <view class="warning-text">请选择生日</view>
     </view>
 
     <view class="form-item">
@@ -66,7 +81,7 @@
 
     <view class="{{jgList[3]?'hidden':'warning'}}" wx:if="{{!jgList[3]}}">
       <image mode="widthFix" src="../../../imgs/contest/warning.png" class="warning-icon"></image>
-      <view class="warning-text">请填写学校完整名称</view>
+      <view class="warning-text">请选择区域</view>
     </view>
 
     <view class="form-item">
@@ -85,31 +100,40 @@
       </view>
     </view>
 
+    <view class="form-item" wx:if="{{format.isIncludes(form.schoolName,'其他')}}">
+      <image class="form-item-bg" mode="widthFix" src="../../../imgs/contest/list-bg.png"></image>
+      <view class="content">
+        <view class="form-item-label" style="border-right: 4rpx solid #D8D8D8">其他</view>
+        <input bindinput="changeInput" id="other" placeholder="请输入学校名称" placeholder-class="phcolor"></input>
+      </view>
+    </view>
+
     <view class="{{jgList[4]?'hidden':'warning'}}" wx:if="{{!jgList[4]}}">
       <image mode="widthFix" src="../../../imgs/contest/warning.png" class="warning-icon"></image>
-      <view class="warning-text">请填写学校完整名称</view>
+      <view class="warning-text">请选择学校</view>
     </view>
 
     <view class="form-item">
       <image class="form-item-bg" mode="widthFix" src="../../../imgs/contest/list-bg.png"></image>
       <view class="content">
         <view class="form-item-label" style="border-right: 4rpx solid #D8D8D8">年级</view>
-        <input bindinput="changeInput" id="grade" placeholder="请输入" placeholder-class="phcolor"></input>
+        <!-- <input bindinput="changeInput" id="grade" placeholder="请输入" placeholder-class="phcolor"></input> -->
+        <view class="select">
+          <picker bindchange="bindPicker" value="{{value}}" data-list="gradeList" range="{{gradeList}}" range-key="label" id="grade">
+            <view class="picker {{form.grade||'phcolor'}}">
+              {{form.grade||'请选择'}}
+            </view>
+          </picker>
+          <image class="arrow" src="../../../imgs/contest/arrow.png" mode="widthFix"></image>
+        </view>
       </view>
     </view>
 
     <view class="{{jgList[5]?'hidden':'warning'}}" wx:if="{{!jgList[5]}}">
       <image mode="widthFix" src="../../../imgs/contest/warning.png" class="warning-icon"></image>
-      <view class="warning-text">请填写学校完整名称</view>
+      <view class="warning-text">请选择年级</view>
     </view>
 
-    <view class="form-item">
-      <image class="form-item-bg" mode="widthFix" src="../../../imgs/contest/list-bg.png"></image>
-      <view class="content">
-        <view class="form-item-label" style="border-right: 4rpx solid #D8D8D8">其他</view>
-        <input bindinput="changeInput" id="other" placeholder="请输入" placeholder-class="phcolor"></input>
-      </view>
-    </view>
   </view>
   <view class="button" bindtap="submit">
     <!-- <image class="button-bg" mode="widthFix" src="../../../imgs/contest/button-bg.png"></image> -->

+ 8 - 0
pages/contest/info/info.wxss

@@ -2,6 +2,14 @@
 page {
   background: #fff;
 }
+.home {
+  width: 40rpx;
+  height: 40rpx;
+  position: absolute;
+  top: 70rpx;
+  left: 50rpx;
+  z-index: 99;
+}
 .page-title {
   position: relative;
   z-index: 1;

+ 30 - 5
pages/contest/ranking/ranking.js

@@ -12,7 +12,22 @@ Page({
     first: {},
     second: {},
     third: {},
-    dataList: []
+    dataList: [],
+    statusBar: 0,
+    user: wx.getStorageSync('user') || {},
+    helpState: false
+  },
+
+  clickHelp () {
+    this.setData({
+      helpState: true
+    })
+  },
+
+  closeShow () {
+    this.setData({
+      helpState: false
+    })
   },
 
   getRankingList (type) {
@@ -20,10 +35,7 @@ Page({
       type
     }},r => {
       this.setData({
-        first: r.list[0]||{},
-        second: r.list[1]||{},
-        third: r.list[2]||{},
-        dataList: r.list.filter((item,index) => index>2),
+        dataList: r.list,
         page: type
       })
     })
@@ -44,6 +56,19 @@ Page({
    */
   onLoad: function (options) {
     this.getRankingList(this.data.page)
+
+    wx.getSystemInfo({
+      success: e => {
+        // this.globalData.statusBar = e.statusBarHeight; //状态栏高度
+        this.setData({
+          statusBar: e.statusBarHeight + 13
+        })
+        // let custom = wx.getMenuButtonBoundingClientRect();//菜单按钮
+        // this.globalData.custom = custom;
+        // this.globalData.customBar = custom.bottom + custom.top - e.statusBarHeight;
+        // //计算得到定义的状态栏高度
+      }
+    })
   },
 
   /**

+ 26 - 48
pages/contest/ranking/ranking.wxml

@@ -1,62 +1,40 @@
 <!--pages/contest/ranking/ranking.wxml-->
-<view>
-  <image src="../../../imgs/contest/ranking/bg.png" class="bg"></image>
-  <image src="../../../imgs/contest/ranking/home.png" class="home" bindtap="goHome"></image>
-  <view class="page-title">排行榜</view>
+<wxs src="../../../utils/util.wxs" module="format" />
+<view bindtap="closeShow" style="min-height:100vh">
+  <image src="../../../imgs/contest/ranking/bg.png" class="bg" mode="widthFix"></image>
+  <image src="../../../imgs/contest/ranking/home.png" class="home" style="top:{{statusBar}}px" bindtap="goHome"></image>
+  <view class="page-title" style="padding-top:{{statusBar}}px">排行榜</view>
   <view class="content">
     <view class="navList">
       <view class="{{page==1&&'active'}}" bindtap="togglePage" data-index="1">个人排名</view>
       <view class="{{page==2&&'active'}}" bindtap="togglePage" data-index="2">区排名</view>
       <view class="{{page==3&&'active'}}" bindtap="togglePage" data-index="3">学校排名</view>
     </view>
-    <view class="ranking-top">
-      <view class="second" wx:if="{{second.userId}}">
-        <image src="{{second.avatar}}"></image>
-        <view class="num">2</view>
-        <view class="nickname">{{second.nickname}}</view>
-        <view class="fraction">{{second.score}}分</view>
-      </view>
-      <view class="second" wx:else></view><!-- 占位 -->
-      <view class="first" wx:if="{{first.userId}}">
-        <image src="{{first.avatar}}"></image>
-        <view class="num">1</view>
-        <view class="nickname">{{first.nickname}}</view>
-        <view class="fraction">{{first.score}}分</view>
-      </view>
-      <view class="first" wx:else></view><!-- 占位 -->
-      <view class="third" wx:if="{{third.userId}}">
-        <image src="{{third.avatar}}"></image>
-        <view class="num">3</view>
-        <view class="nickname">{{third.nickname}}</view>
-        <view class="fraction">{{third.score}}分</view>
-      </view>
-      <view class="third" wx:else></view><!-- 占位 -->
-    </view>
+    <view style="height:430rpx"></view>
     <view class="ranking-list">
       <view class="ranking-item" wx:for="{{dataList}}" wx:key="index">
-        <view class="order-num">{{index+4}}</view>
-        <image src="{{item.avatar}}"></image>
-        <view class="nickname">{{item.nickname}}</view>
-        <view class="fraction">{{item.score}}分</view>
+        <view class="order-num" wx:if="{{index>2}}">{{index+1}}</view>
+        <image class="top-three" wx:else src="../../../imgs/contest/ranking/top-{{index+1}}.png"></image>
+        <image class="avatar" src="{{item.avatar}}" wx:if="{{page===1}}"></image>
+        <image class="page-icon-2" src="../../../imgs/contest/ranking/page-2.png" wx:elif="{{page===2}}"></image>
+        <image class="page-icon-3" src="../../../imgs/contest/ranking/page-3.png" wx:else></image>
+        <view class="nickname">{{item.nickname||item.areaName||item.schoolName||''}}
+          <view wx:if="{{page===1}}">
+            <text class="school-tag">{{item.schoolName||''}}</text>
+          </view>  
+        </view>
+        <view class="fraction">{{format.toFixed(item.score||item.avgScore||0,1)}}分</view>
       </view>
-      <!-- <view class="ranking-item">
-        <view class="order-num">4</view>
-        <image mode="widthFix" src="../../../imgs/contest/ranking/avatr.png"></image>
-        <view class="nickname">乔巴</view>
-        <view class="fraction">99分</view>
-      </view>
-      <view class="ranking-item">
-        <view class="order-num">4</view>
-        <image mode="widthFix" src="../../../imgs/contest/ranking/avatr.png"></image>
-        <view class="nickname">乔巴</view>
-        <view class="fraction">99分</view>
+    </view>
+  </view>
+  <view class="help">
+    <image class="help-icon" src="../../../imgs/contest/ranking/help-icon.png" catchtap="clickHelp"></image>
+    <view class="help-message" wx:if="{{helpState}}">
+      <image src="../../../imgs/contest/ranking/test-area.png"></image>
+      <view class="message">
+        <view class="message-title">{{['','个人','区','学校'][page]}}排名说明</view> 
+        <view class="message-test">以竞赛时间范围内个人最好成绩排序高低,如分数并列,则按照答题时间的快慢平均值排序;</view>
       </view>
-      <view class="ranking-item">
-        <view class="order-num">4</view>
-        <image mode="widthFix" src="../../../imgs/contest/ranking/avatr.png"></image>
-        <view class="nickname">乔巴</view>
-        <view class="fraction">99分</view>
-      </view> -->
     </view>
   </view>
 </view>

+ 81 - 6
pages/contest/ranking/ranking.wxss

@@ -1,14 +1,17 @@
 /* pages/contest/ranking/ranking.wxss */
+Page {
+  background-color: #4EB3F9;
+}
 .bg {
   width: 100%;
   height: 100vh;
-  position: fixed;
+  position: absolute;
   z-index: 0;
 }
 .home {
   width: 40rpx;
   height: 40rpx;
-  position: fixed;
+  position: absolute;
   top: 70rpx;
   left: 50rpx;
   z-index: 99;
@@ -127,20 +130,92 @@
   text-align: center;
   margin: 0 38rpx 0 34rpx;
 }
-.ranking-item > image {
+.top-three {
+  width: 80rpx;
+  height: 100rpx;
+  padding: 0 14rpx 0 16rpx;
+}
+.ranking-item .avatar {
   width: 88rpx;
   height: 88rpx;
   border-radius: 44rpx;
   background: rgb(187, 181, 181);
+  margin-right: 36rpx;
+}
+.page-icon-2 {
+  width: 26rpx;
+  height: 54rpx;
+  margin: 0 54rpx 0 44rpx;
+}
+.page-icon-3 {
+  width: 56rpx;
+  height: 56rpx;
+  margin: 0 32rpx 0 36rpx;
 }
 .ranking-item .nickname {
-  margin-left: 36rpx;
-  width: 300rpx;
-  margin-right: 100rpx;
+  width: 400rpx;
+  /* margin-right: 100rpx; */
+}
+.school-tag {
+  padding: 7rpx 16rpx;
+  height: 38rpx;
+  background: #4283F3;
+  border-radius: 24rpx;
+  font-size: 24rpx;
+  font-weight: 400;
+  color: #EAF1FD;
+  margin-top: 6rpx;
 }
 .ranking-item .fraction {
   font-size: 24rpx;
   font-weight: 800;
   line-height: 40rpx;
   color: #FFF431;
+}
+.help {
+  position: absolute; 
+  top: 482rpx;
+  right: 43rpx;
+  display: flex;
+  flex-direction: column;
+  align-items: flex-end;
+}
+.help-icon {
+  width: 42rpx;
+  height: 42rpx;
+  position: relative;
+  right: 22rpx;
+  z-index: 99;
+}
+.help-message {
+  margin-top: 6rpx;
+  position: relative;
+}
+.help-message > image {
+  width: 396rpx;
+  height: 196rpx;
+  position: absolute;
+  z-index: 99;
+}
+.message {
+  width: 396rpx;
+  padding: 22rpx 14rpx 18rpx 18rpx;
+  box-sizing: border-box;
+  position: relative;
+  z-index: 999;
+}
+.message-title {
+  font-weight: 500;
+  color: #FFFFFF;
+  font-size: 28rpx;
+  text-align: end;
+  padding-right: 12rpx;
+  margin-bottom: 10rpx;
+}
+.message-test {
+  font-weight: 400;
+  color: #D1D8EB;
+  font-size: 24rpx;
+  line-height: 34rpx;
+  text-align: end;
 }

+ 11 - 2
pages/contest/score/score.js

@@ -7,7 +7,8 @@ Page({
    */
   data: {
     score: 0,
-    rank: 0
+    rank: 0,
+    statusBar: 0
   },
 
   toLink (e) {
@@ -20,11 +21,19 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    let {rank,score} = options
+    let {rank,id,score} = options
     this.setData({
+      id,
       rank,
       score
     })
+    wx.getSystemInfo({
+      success: e => {
+        this.setData({
+          statusBar: e.statusBarHeight + 13
+        })
+      }
+    })
   },
 
   /**

+ 18 - 2
pages/contest/score/score.wxml

@@ -1,6 +1,7 @@
 <!--pages/contest/score/score.wxml-->
 <view>
   <image class="bg" src="../../../imgs/contest/score/bg.png"></image>
+  <view class="page-title" style="top:{{statusBar}}px">排行榜</view>
   <view class="content">
     <image mode="widthFix" class="kuang" src="../../../imgs/contest/score/kuang.png"></image>
     <view class="detail">
@@ -19,8 +20,23 @@
         <view>{{rank}}</view>
       </view>
       <view class="button-group">
-        <button class="" bindtap="toLink" data-url="/pages/contest/ranking/ranking">查看排行榜</button>
-        <button open-type="share">分享</button>
+        <!-- <button class="" bindtap="toLink" data-url="/pages/contest/ranking/ranking">查看排行榜</button>
+        <button open-type="share">分享</button> -->
+        <button class="rank" bindtap="toLink" data-url="/pages/contest/ranking/ranking">
+          <image class="button-icon" src="../../../imgs/contest/score/icon-rank.png"></image>
+          排行榜
+          <view class="arrow-icon"></view>
+        </button>
+        <button class="go-score" bindtap="toLink" data-url="/pages/contest/stars/stars?id={{id}}">
+          <image class="button-icon" src="../../../imgs/contest/score/icon-start.png"></image>
+          去评分
+          <view class="arrow-icon"></view>
+        </button>
+        <button class="go-share" open-type="share">
+          <image class="share-icon" src="../../../imgs/contest/score/iocn-share.png"></image>
+          分享
+          <view class="arrow-icon"></view>
+        </button>
       </view>
     </view>
   </view>

+ 49 - 7
pages/contest/score/score.wxss

@@ -2,6 +2,16 @@
 page {
   background: #fff;
 }
+.page-title {
+  position: absolute;
+  z-index: 1;
+  width: 100%;
+  font-size: 32rpx;
+  font-weight: 400;
+  color: #FFFFFF;
+  top: 68rpx;
+  text-align: center;
+}
 .bg {
   position: fixed;
   background: transparent;
@@ -37,7 +47,7 @@ page {
   font-weight: bold;
   font-size: 36rpx;
   color: #161616;
-  margin-top: 124rpx;
+  margin-top: 54rpx;
 }
 .score {
   margin-top: 52rpx;
@@ -97,19 +107,51 @@ page {
 }
 .button-group {
   margin-top: 36rpx;
+  /* display: flex; */
+  /* justify-content: center; */
+}
+.button-group .button-icon {
+  width: 44rpx;
+  height: 44rpx;
+  margin: 0 28rpx 0 40rpx;
+}
+.share-icon {
+  width: 34rpx;
+  height: 34rpx;
+  margin: 0 32rpx 0 45rpx;
+}
+.arrow-icon {
+  width: 20rpx;
+  height: 20rpx;
+  border-bottom: 4rpx solid #9BA4A6;
+  border-right: 4rpx solid #9BA4A6;
+  transform: rotate(-45deg);
+  position: absolute;
+  right: 40rpx;
+}
+.button-group button {
+  width: 650rpx;
+  height: 120rpx;
   display: flex;
-  justify-content: center;
+  align-items: center;
+  font-weight: 400;
+  color: #000000;
+  font-size: 32rpx;
+  position: relative;
 }
 button {
   background-color: transparent;
-  
   padding-left: 0;
-  
   padding-right: 0;
+  border-radius: 0;
   line-height:inherit;
+}
   
-  }
-.button-group > button {
+button::after {
+  border: 0;
+  border-bottom: 2rpx solid #EAEFF2;
+} 
+/* .button-group > button {
   width: 284rpx;
   height: 96rpx;
   border-radius: 50rpx;
@@ -122,4 +164,4 @@ button {
   align-items: center;
   justify-content: center;
   margin: 0 5rpx;
-}
+} */

+ 113 - 0
pages/contest/stars/stars.js

@@ -0,0 +1,113 @@
+// pages/contest/stars/stars.js
+import {
+  answer
+} from '../../../api/api.js'
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    statusBar: 0,
+    starsNum: 5
+  },
+
+  clickStars(e) {
+    // console.log(e)
+    this.setData({
+      starsNum: e.currentTarget.dataset.index+1
+    })
+  },
+
+  submit () {
+    let {starsNum,id} = this.data
+    answer.submitReviews({reqdata:{
+      assessScore: starsNum*2,
+      userAnswerId: id
+    }},r => {
+      wx.reLaunch({
+        url: '/pages/home/home',
+        success: () => {
+          setTimeout(()=>{
+            wx.showToast({
+              title: '评分成功!',
+              icon: 'none'
+            })
+          },300)
+        }
+      })
+    })
+  },
+
+  goHome (e) {
+    wx.reLaunch({
+      url: '/pages/home/home',
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    let {id} = options
+    this.setData({
+      id
+    })
+    wx.getSystemInfo({
+      success: e => {
+        this.setData({
+          statusBar: e.statusBarHeight + 13
+        })
+      }
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 4 - 0
pages/contest/stars/stars.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationStyle": "custom"
+}

+ 16 - 0
pages/contest/stars/stars.wxml

@@ -0,0 +1,16 @@
+<!--pages/contest/stars/stars.wxml-->
+<view>
+  <image class="bg" src="../../../imgs/contest/score/bg.png"></image>
+  <image src="../../../imgs/contest/ranking/home.png" class="home" style="top:{{statusBar}}px" bindtap="goHome"></image>
+  <view class="page-title" style="top:{{statusBar}}px">评分</view>
+  <view class="content">
+    <image mode="widthFix" class="kuang" src="../../../imgs/contest/stars/kuang.png"></image>
+    <view class="detail">
+      <view class="stars-group">
+        <image class="stars-icon" bindtap="clickStars" data-index="{{item}}" src="../../../imgs/contest/stars/stars{{starsNum>item?'-active':''}}.png" wx:for="{{5}}" wx:key="index"></image>
+      </view>
+      <view class="detail-text">您对此次竞赛答题还满意吗?</view>
+      <view class="confim-button" bindtap="submit">提交</view>
+    </view>
+  </view>
+</view>

+ 105 - 0
pages/contest/stars/stars.wxss

@@ -0,0 +1,105 @@
+/* pages/contest/stars/stars.wxss */
+page {
+  background: #fff;
+}
+.home {
+  width: 40rpx;
+  height: 40rpx;
+  position: absolute;
+  top: 70rpx;
+  left: 50rpx;
+  z-index: 99;
+}
+.page-title {
+  position: absolute;
+  z-index: 1;
+  width: 100%;
+  font-size: 32rpx;
+  font-weight: 400;
+  color: #FFFFFF;
+  top: 68rpx;
+  text-align: center;
+}
+.bg {
+  position: fixed;
+  background: transparent;
+  width: 100%;
+  height: 100vh;
+  top: 0;
+  z-index: 0;
+}
+/* pages/contest/score/score.wxss */
+page {
+  background: #fff;
+}
+.page-title {
+  position: absolute;
+  z-index: 1;
+  width: 100%;
+  font-size: 32rpx;
+  font-weight: 400;
+  color: #FFFFFF;
+  top: 68rpx;
+  text-align: center;
+}
+.bg {
+  position: fixed;
+  background: transparent;
+  width: 100%;
+  height: 100vh;
+  top: 0;
+  z-index: 0;
+}
+.content {
+  width: 100%;
+  height: 100vh;
+  position: relative;
+  z-index: 9;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+.kuang {
+  width: 730rpx;
+  position: absolute;
+  background: transparent;
+  z-index: 9;
+}
+.detail {
+  position: relative;
+  z-index: 9;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  height: 970rpx;
+}
+.stars-group {
+  display: flex;
+  padding-top: 280rpx;
+}
+.stars-group > image {
+  width: 54rpx;
+  height: 54rpx;
+  position: relative;
+  z-index: 10;
+  margin: 0 15rpx;
+}
+
+.detail-text {
+  font-size: 26rpx;
+  font-weight: 400;
+  color: #333333;
+  margin-top: 40rpx;
+}
+.confim-button{
+  width: 450rpx;
+  height: 100rpx;
+  border-radius: 110rpx;
+  background-image: linear-gradient(to right, #57A8EF, #6247FF);
+  text-align: center;
+  line-height: 100rpx;
+  font-size: 28rpx;
+  font-weight: 600;
+  color: #FFFFFF;
+  margin-top: 56rpx;
+}

+ 33 - 1
pages/home/home.js

@@ -16,6 +16,7 @@ Page({
         user: Object.assign(this.data.user, r.object)
       })
       wx.setStorageSync('user', this.data.user)
+      this.data.linkState && this.toLinkR()
     })
   },
   loadMyActivities() {
@@ -112,6 +113,7 @@ Page({
         rows: 10
       }
     },
+    linkState: false //判断执行 toLinkR 的条件
     // isRegister: wx.getStorageSync('user')?wx.getStorageSync('user').isRegister:null
   },
   loadArticles() {
@@ -386,9 +388,39 @@ Page({
       url: e.currentTarget.dataset.url,
     })
   },
+  toLinkR() {
+    if (!this.data.user || !this.data.user.id) {
+      return this.setData({
+        showAuthPanel: true,
+        linkState: true
+      })
+    }
+    console.log(111)
+    this.setData({
+      linkState: false
+    })
+    // user.isRegister?'/pages/contest/answer/answer':'/pages/contest/info/info'
+    this.data.user.isRegister
+    ? wx.showModal({
+        title: '答题须知:',
+        content: '1.每人每天最多答题三次\n\n 2.排行榜以得分情况计算',
+        confirmColor: '#ff0000',
+        cancelText: '返回',
+        success (res) {
+          if (res.confirm) {
+            wx.navigateTo({
+              url: '/pages/contest/answer/answer'
+            })
+          }
+       }
+      })
+    : wx.navigateTo({
+        url: '/pages/contest/info/info'
+      })
+  },
   clickStudy () {
     wx.showToast({
-      title: '该功能尚未开放,敬请期待!',
+      title: '精彩视频,即将呈现~',
       icon: 'none'
     })
   },

+ 11 - 3
pages/home/home.wxml

@@ -14,7 +14,7 @@
   <view class="home-nav-list">
     <image src="../../imgs/home/nav-bg.png"></image>
     <view class="home-nav-select">
-      <view class="contest" bindtap="toLink" data-url="{{user.isRegister?'/pages/contest/answer/answer':'/pages/contest/info/info'}}">
+      <view class="contest" bindtap="toLinkR">
         <image mode="widthFix" src="../../imgs/home/contest.png"></image>
         <view>参加竞赛</view>
       </view>
@@ -104,6 +104,14 @@
 
     </view>
   </view> -->
+  <view class="sponsor">
+    <view class="sponsor-title">合作伙伴</view>
+    <view class="sponsor-list">
+      <view class="sponsor-item" wx:for="{{home.partners}}" wx:key="index">
+        <image mode="widthFix" src="{{imgUrl + item.brandImage}}"></image>
+      </view>
+    </view>
+  </view>
   <!-- <view class="authorization">
     <button open-type="getUserInfo" bindgetuserinfo="getUserinfo">点击授权</button>
   </view> -->
@@ -140,7 +148,7 @@
       <input focus wx:if="{{searchOn}}" bindblur="blurSearch" bindinput="inputSearch"></input>
       <text class="cuIcon-search" wx:if="{{!searchOn}}"> 请输入活动关键字查询</text>
     </view>
-    <button bindtap="clickAddtidings">发布</button>
+    <view class="release-button" bindtap="clickAddtidings">发布</view>
   </view>
   <view class="bfc">
     <!-- item -->
@@ -318,7 +326,7 @@
     <!-- <view class="release" bindtap="clickAddtidings" >
       <image mode="widthFix" src="../../imgs/nav/release.png"></image>
     </view> -->
-    <view class="release" bindtap="toLink" data-url="{{user.isRegister?'/pages/contest/answer/answer':'/pages/contest/info/info'}}">
+    <view class="release" bindtap="toLinkR">
       <image mode="widthFix" src="../../imgs/nav/release.png"></image>
     </view>
     <view class="community" bindtap="clickNav" data-cur="2">

+ 38 - 6
pages/home/home.wxss

@@ -156,8 +156,10 @@ page {
   display: flex;
   justify-content: space-between;
 }
-.searchContainer > button {
+.searchContainer > .release-button {
    flex: 1;
+   text-align: center;
+   line-height: 68rpx;
    margin-left: 20rpx;
    border-radius: 100rpx;
    background-image: linear-gradient(to right, #57A8EF, #6247FF);
@@ -166,7 +168,7 @@ page {
 }
 .search {
   padding: 0.5em 1em;
-  flex: 4;
+  flex: 3;
   border-radius: 40rpx;
   background-color: #efefef;
   height: 45rpx;
@@ -471,7 +473,7 @@ page {
 .news-list .hot-title {
   display: flex;
   justify-content: space-between;
-  margin-bottom: 30rpx;
+  margin-bottom: 15rpx;
 }
 .news-list .hot-title .title{
   width: 128rpx;
@@ -496,7 +498,7 @@ page {
 }
 .news-list .news-list-content .news-list-item{
   position: relative;
-  margin-top: -30rpx;
+  margin-top: -20rpx;
 }
 .news-list .news-list-content .news-list-item >image{
   width: 100%;
@@ -521,11 +523,12 @@ page {
 .news-list .news-list-content .news-list-item .content .right {
   display: flex;
   justify-content: center;
+  /* align-items: center; */
   flex-direction: column;
 }
 .news-list .news-list-content .news-list-item .content .right .title {
   width: 372rpx;
-  min-height: 44rpx;
+  min-height: 80rpx;
   font-size: 26rpx;
   font-weight: bold;
   color: #262626;
@@ -541,7 +544,7 @@ page {
 }
 .news-list .news-list-content .news-list-item .content .right .introduce {
   width: 372rpx;
-  height: 68rpx;
+  height: 62rpx;
   font-size: 24rpx;
   font-weight: bold;
   color: #868AA8;
@@ -578,4 +581,33 @@ page {
   position: relative;
   display: block;
   z-index: 99999;
+}
+
+.sponsor .sponsor-title {
+  margin: 20rpx 0 0 48rpx;
+  font-size: 32rpx;
+  font-weight: bold;
+  color: #000000;
+  line-height: 44rpx;
+}
+.sponsor-list {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+
+.sponsor-item {
+  width: 690rpx;
+  height: 184rpx;
+  background: #FFFFFF;
+  box-shadow: 0px 4px 30px 0px rgba(228, 231, 246, 0.5);
+  border-radius: 12px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  margin-top: 14rpx;
+}
+.sponsor-item > image{
+  width: 300rpx;
+  height: 110rpx;
 }

+ 87 - 81
project.config.json

@@ -1,83 +1,89 @@
 {
-	"description": "项目配置文件",
-	"packOptions": {
-		"ignore": []
-	},
-	"setting": {
-		"urlCheck": false,
-		"es6": true,
-		"enhance": false,
-		"postcss": true,
-		"preloadBackgroundData": false,
-		"minified": true,
-		"newFeature": true,
-		"coverView": true,
-		"nodeModules": false,
-		"autoAudits": false,
-		"showShadowRootInWxmlPanel": true,
-		"scopeDataCheck": false,
-		"uglifyFileName": false,
-		"checkInvalidKey": true,
-		"checkSiteMap": true,
-		"uploadWithSourceMap": true,
-		"compileHotReLoad": false,
-		"babelSetting": {
-			"ignore": [],
-			"disablePlugins": [],
-			"outputPath": ""
-		},
-		"useIsolateContext": true,
-		"useCompilerModule": true,
-		"userConfirmedUseCompilerModuleSwitch": false
-	},
-	"compileType": "miniprogram",
-	"libVersion": "2.4.4",
-	"appid": "wx0883711d2af54d70",
-	"projectname": "iSnow2",
-	"debugOptions": {
-		"hidedInDevtools": []
-	},
-	"isGameTourist": false,
-	"simulatorType": "wechat",
-	"simulatorPluginLibVersion": {},
-	"condition": {
-		"search": {
-			"current": -1,
-			"list": []
-		},
-		"conversation": {
-			"current": -1,
-			"list": []
-		},
-		"plugin": {
-			"current": -1,
-			"list": []
-		},
-		"game": {
-			"currentL": -1,
-			"list": []
-		},
-		"gamePlugin": {
-			"current": -1,
-			"list": []
-		},
-		"miniprogram": {
-			"current": -1,
-			"list": [
-				{
-					"id": -1,
-					"name": "pages/contest/answer/answer",
-					"pathName": "pages/contest/answer/answer",
-					"query": "",
-					"scene": null
-				},
-				{
-					"id": -1,
-					"name": "pages/contest/info/info",
-					"pathName": "pages/contest/info/info",
-					"scene": null
-				}
-			]
-		}
-	}
+  "description": "项目配置文件",
+  "packOptions": {
+    "ignore": []
+  },
+  "setting": {
+    "urlCheck": false,
+    "es6": true,
+    "enhance": false,
+    "postcss": true,
+    "preloadBackgroundData": false,
+    "minified": true,
+    "newFeature": true,
+    "coverView": true,
+    "nodeModules": false,
+    "autoAudits": false,
+    "showShadowRootInWxmlPanel": true,
+    "scopeDataCheck": false,
+    "uglifyFileName": false,
+    "checkInvalidKey": true,
+    "checkSiteMap": true,
+    "uploadWithSourceMap": true,
+    "compileHotReLoad": false,
+    "useMultiFrameRuntime": false,
+    "useApiHook": true,
+    "babelSetting": {
+      "ignore": [],
+      "disablePlugins": [],
+      "outputPath": ""
+    },
+    "enableEngineNative": false,
+    "useIsolateContext": true,
+    "useCompilerModule": false,
+    "userConfirmedUseCompilerModuleSwitch": false,
+    "packNpmManually": false,
+    "packNpmRelationList": [],
+    "minifyWXSS": true
+  },
+  "compileType": "miniprogram",
+  "libVersion": "2.4.4",
+  "appid": "wx0883711d2af54d70",
+  "projectname": "iSnow2",
+  "debugOptions": {
+    "hidedInDevtools": []
+  },
+  "isGameTourist": false,
+  "simulatorType": "wechat",
+  "simulatorPluginLibVersion": {},
+  "condition": {
+    "plugin": {
+      "list": []
+    },
+    "game": {
+      "list": []
+    },
+    "gamePlugin": {
+      "list": []
+    },
+    "miniprogram": {
+      "list": [
+        {
+          "id": -1,
+          "name": "pages/contest/answer/answer",
+          "pathName": "pages/contest/answer/answer",
+          "query": "",
+          "scene": null
+        },
+        {
+          "id": -1,
+          "name": "pages/contest/info/info",
+          "pathName": "pages/contest/info/info",
+          "query": "",
+          "scene": null
+        },
+        {
+          "name": "pages/contest/score/score",
+          "pathName": "pages/contest/score/score",
+          "query": "",
+          "scene": null
+        },
+        {
+          "name": "pages/contest/stars/stars",
+          "pathName": "pages/contest/stars/stars",
+          "scene": null
+        }
+      ]
+    }
+  }
 }

+ 11 - 1
utils/util.wxs

@@ -12,6 +12,14 @@ function valueOf (time=null) {
   return t 
 }
 
+function isIncludes (val,str) {
+  return val && val.indexOf(str)!==-1
+}
+
+function toFixed (val,num) {
+  return val.toFixed(num)
+}
+
 function shuffle(arr) {
   for (var i=arr.length-1; i>=0; i--) {
     var rIndex = Math.floor(Math.random()*(i+1));
@@ -27,5 +35,7 @@ function shuffle(arr) {
 module.exports = {
   formatTime: formatTime,
   valueOf: valueOf,
-  shuffle: shuffle
+  shuffle: shuffle,
+  toFixed: toFixed,
+  isIncludes: isIncludes
 }