浏览代码

10/18 新赛季 & 按钮单次点击 V2.2.2

Foystor 3 年之前
父节点
当前提交
659fd70032

+ 2 - 2
config/dev.env.js

@@ -3,6 +3,6 @@ var prodEnv = require('./prod.env')
 
 module.exports = merge(prodEnv, {
   NODE_ENV: '"development"',
-  // REQUEST_URI: "'https://api.shuimuai.com/'"
-  REQUEST_URI: "'https://testapi.shuimuai.com/'"
+  REQUEST_URI: "'https://api.shuimuai.com/'"
+  // REQUEST_URI: "'https://testapi.shuimuai.com/'"
 })

+ 2 - 2
config/prod.env.js

@@ -1,5 +1,5 @@
 module.exports = {
   NODE_ENV: '"production"',
-  // REQUEST_URI: "'https://api.shuimuai.com/'"
-  REQUEST_URI:"'https://testapi.shuimuai.com/'"
+  REQUEST_URI: "'https://api.shuimuai.com/'"
+  // REQUEST_URI:"'https://testapi.shuimuai.com/'"
 }

+ 2 - 4
project.config.json

@@ -26,14 +26,12 @@
       "disablePlugins": [],
       "outputPath": ""
     },
-    "bundle": false,
     "useIsolateContext": true,
-    "useCompilerModule": true,
-    "userConfirmedUseCompilerModuleSwitch": false,
     "userConfirmedBundleSwitch": false,
     "packNpmManually": false,
     "packNpmRelationList": [],
-    "minifyWXSS": true
+    "minifyWXSS": true,
+    "showES6CompileOption": false
   },
   "miniprogramRoot": "dist/wx/",
   "compileType": "miniprogram",

+ 15 - 2
src/components/banner.vue

@@ -32,7 +32,7 @@
 </template>
 
 <script>
-import { getBannerList } from "../requests/user";
+import { getBannerList, getJointBanner } from "../requests/user";
 
 var $this;
 export default {
@@ -43,6 +43,7 @@ export default {
         {
           id: 1,
           src: "https://img.shuimuai.com/mp/banner1_new.png",
+          // src: "",
           url: "/pages/none/main",
           button_text: "关于水母星球",
         },
@@ -54,7 +55,8 @@ export default {
         },
         {
           id: 3,
-          src: "https://img.shuimuai.com/banner_joint.png",
+          src: "https://img.shuimuai.com/banner_blue.png",
+          // src: "",
           url: "/pages/joint/main",
           button_text: "我要联名",
         },
@@ -83,9 +85,20 @@ export default {
           "/pages/competition/main?activity_id=" + $new_act["activity_id"];
       });
     },
+
+    // jointBanner(){
+    //   getJointBanner().then((res) => {
+    //     console.log("banner活动", res.data.data)
+    //     let $banner_img = res.data.data
+        
+    //     $this.banners[0].src = $banner_img[0].img
+    //     $this.banners[2].src = $banner_img[1].img
+    //   });
+    // }
   },
   mounted() {
     $this.getBanners();
+    // $this.jointBanner()
   },
   created() {
     $this = this;

+ 1 - 0
src/components/device/unconnect.vue

@@ -33,6 +33,7 @@
 
 <script>
 var $this;
+
 export default {
   name: "unconnect",
   data() {

+ 6 - 4
src/pages/competition/index.vue

@@ -152,7 +152,7 @@
             <van-row>
               <van-col span="8">
                 <img
-                  src="https://img.shuimuai.com/yu_sai_rank_june_23_1.png"
+                  src="https://img.shuimuai.com/rank_ready.png"
                   alt=""
                   class="rank_card"
                   @click="changeRankAction(1)"
@@ -166,7 +166,7 @@
               </van-col>
               <van-col span="8">
                 <img
-                  src="https://img.shuimuai.com/raise_rank_june_23.png"
+                  src="https://img.shuimuai.com/rank_levelup.png"
                   alt=""
                   class="rank_card"
                   @click="changeRankAction(2)"
@@ -180,7 +180,7 @@
               </van-col>
               <van-col span="8">
                 <img
-                  src="https://img.shuimuai.com/final_rank_june_23.png"
+                  src="https://img.shuimuai.com/rank_champion.png"
                   alt=""
                   class="rank_card"
                   @click="changeRankAction(3)"
@@ -1009,7 +1009,9 @@ page {
 
 .index_container {
   /* background: url("https://img.shuimuai.com//mp/pk/background_3%402x.png");  小乌龟 */
-  background: url("https://img.shuimuai.com/mppkbackground_june_23_2.png");
+  /* background: url("https://img.shuimuai.com/mppkbackground_june_23_2.png"); */
+  /* background: url("https://img.shuimuai.com/bg_game.png"); */
+  background: url("https://img.shuimuai.com/bg_game_2.png");
 
   background-size: 100% 100%;
   background-position: center;

+ 111 - 74
src/pages/joint/index.vue

@@ -9,11 +9,13 @@
           <input 
           placeholder='请输入学校名称'
           v-model="school" 
+          @input="textControl($event,'sch')"
           placeholder-style="font-size: 28rpx;color: #B0784F;"/>
 
           <input 
           placeholder='请输入学生'
           v-model="student" 
+          @input="textControl($event,'stu')"
           placeholder-style="font-size: 28rpx;color: #B0784F;"/>
 
           <button class="cu-btn btn" @click="joint_test">免费测评</button>
@@ -52,7 +54,7 @@
   </div>
 </template>
 <script>
-import { addJoint, getJoint } from "../../requests/competition"
+import { addJoint, getJoint } from "../../requests/competition";
 import Toast from "../../../static/vant/toast/toast";
 
 var $this;
@@ -60,74 +62,111 @@ export default {
   name: "scan_container",
   data() {
     return {
-       show: false,
-       school:'',
-       student: '',
-       scroll_list:[],
-       // 轮播配置
-       indicatorDots: false,
-       autoplay: true,
-       interval: 1800,
-       duration: 1800,
-       vertical: true,
-       circular: true,
+      show: false,
+      school: "",
+      student: "",
+      scroll_list: [],
+      // 轮播配置
+      indicatorDots: false,
+      autoplay: true,
+      interval: 1800,
+      duration: 1800,
+      vertical: true,
+      circular: true,
     };
   },
   methods: {
-   joint_test(){
-       let $joint = {
-         phone: wx.getStorageSync("phone"),
-         school: $this.school,
-         name: $this.student
-       }
-       addJoint($joint).then((res) => {
-         console.log("联名",res)
-         let $res = res.data;
-         if ($res.code == 0) {
-           $this.show = true
-           $this.school = ''
-           $this.student = ''
-         }else if($res.code == 1012){
+    joint_test() {
+      // 限制输入(学校:中英文   学生:中文
+      var reg_sch = /^[a-zA-Z\u4e00-\u9fa5]+$/
+      var reg_stu = /^[\u4e00-\u9fa5]+$/
+      if ( $this.school && $this.student && (!reg_sch.test($this.school) || !reg_stu.test($this.student))) {
+        if(!reg_sch.test($this.school)){
            wx.showToast({
-             title:'请先登录',
-             icon: "error"
+             title: "请输中英文校名",
+             icon: "error",
            })
-         }else{
-           wx.showToast({
-             title: $res.errmsg,
-             icon: "error"
+        } else if(!reg_stu.test($this.student) && reg_sch.test($this.school)){
+          wx.showToast({
+             title: "请输入中文名",
+             icon: "error",
            })
-         }
-      }).catch((err)=>{
-        console.log("错误",err)
-      })
-   },
+        } 
+        
+      } else{
+        let $joint = {
+          phone: wx.getStorageSync("phone"),
+          school: $this.school,
+          name: $this.student,
+        };
+        addJoint($joint)
+        .then((res) => {
+          console.log("联名", res);
+          let $res = res.data;
+          if ($res.code == 0) {
+            $this.show = true;
+            $this.school = "";
+            $this.student = "";
+          } else if ($res.code == 1012) {
+            wx.showToast({
+              title: "请先登录",
+              icon: "error",
+            });
+          } else {
+            wx.showToast({
+              title: $res.errmsg,
+              icon: "error",
+            });
+          }
+        })
+        .catch((err) => {
+          console.log("错误", err);
+        });
+      }
+
+    },
 
     close_pop() {
       $this.show = false;
     },
+    
+    // textControl($e,watch) {
+    //   console.log($e)
+    //   const value = $e.mp.detail.value
+
+    //   var reg = /^[a-zA-Z\u4e00-\u9fa5]+$/;
+    //   if (value && !reg.test(value)) {
+    //     wx.showToast({
+    //       title: "请输入中英文",
+    //       icon: "error",
+    //     })
+    //     watch == "sch" ? $this.school = "" : $this.student = ""
+    //   } 
+    // },
   },
   mounted() {
-    getJoint().then((res) => {
-         console.log("已联名",res)
-         let $res = res.data;
-         if ($res.code == 0) {
-           $this.scroll_list = $res.data
-         }else{
-           console.log("获取不到已联名",err)
-         }
-      }).catch((err)=>{
-        console.log("错误",err)
+    getJoint()
+      .then((res) => {
+        console.log("已联名", res);
+        let $res = res.data;
+        if ($res.code == 0) {
+          $this.scroll_list = $res.data;
+        } else {
+          console.log("获取不到已联名", err);
+        }
       })
+      .catch((err) => {
+        console.log("错误", err);
+      });
   },
   created() {
     $this = this;
   },
-  onUnload(){
+  onUnload() {
     $this.show = false;
-    $this.school = ''
-    $this.student = ''
-  }
+    $this.school = "";
+    $this.student = "";
+  },
 };
 </script>
 <style scoped>
@@ -136,7 +175,7 @@ export default {
 }
 
 .cover_whole {
-  background: url("https://img.shuimuai.com/bg_joint_2.png");
+  background: url("https://img.shuimuai.com/bg_new.png");
   width: 100%;
   height: 4586px;
   background-size: 100% 100%;
@@ -150,7 +189,7 @@ export default {
   font-weight: 400;
 }
 
-.cover_input{
+.cover_input {
   background: url("https://img.shuimuai.com/bg_input.png");
   background-size: 100% 100%;
   background-position: center;
@@ -161,11 +200,11 @@ export default {
   align-items: center;
   box-sizing: border-box;
   flex-direction: column;
-  justify-content:space-around;
-  padding: 20px 0 28px
+  justify-content: space-around;
+  padding: 20px 0 28px;
 }
 
-.cover_scroll{
+.cover_scroll {
   background: url("https://img.shuimuai.com/bg_scroll.png");
   background-size: 100% 100%;
   background-position: center;
@@ -175,56 +214,54 @@ export default {
   padding: 14rpx;
 }
 
-
-.item{
+.item {
   font-size: 24rpx;
-  color: #FFF1D7;
+  color: #fff1d7;
   display: flex;
   align-items: center;
   box-sizing: border-box;
   flex-direction: column;
 }
 
-.title{
+.title {
   font-size: 32rpx;
-  color: #FFAF74;
-  letter-spacing:5px
+  color: #ffaf74;
+  letter-spacing: 5px;
 }
 
-.btn{
+.btn {
   width: 502rpx;
   height: 80rpx;
-  background: linear-gradient(180deg, #FFE8C0 0%, #E19C6A 100%);
+  background: linear-gradient(180deg, #ffe8c0 0%, #e19c6a 100%);
   border-radius: 40rpx;
   font-size: 30rpx;
   font-weight: 500;
-  color: #9A4720;
-  letter-spacing:5px
+  color: #9a4720;
+  letter-spacing: 5px;
 }
 
-input{
+input {
   width: 502rpx;
   height: 80rpx;
-  background: #4A3843;
-  border: 2px solid #FFAF74;
+  background: #4a3843;
+  border: 2px solid #ffaf74;
   border-radius: 40rpx;
   padding-left: 41rpx;
-  color: white
+  color: white;
 }
 
-.cover_pop{
+.cover_pop {
   width: 493rpx;
   height: 662rpx;
 }
-
 </style>
 
 <style>
 .pop {
   background-color: rgba(255, 255, 255, 0) !important;
 }
- .swiper{
-  height:87rpx !important;
+.swiper {
+  height: 87rpx !important;
 }
 /* .swiper-item{
   height:90rpx !important;

+ 5 - 5
src/pages/report/index.vue

@@ -207,7 +207,7 @@
               id="changeFirst"
             >81-100
             </view>
-            <view class="colorChangeTime">{{ record.level_time0 }}({{ record.level_ratio0 }}%)</view>
+            <view class="colorChangeTime">{{ record.level_time4 }}({{ record.level_ratio4 }}%)</view>
           </view>
 
           <view class="flexBoxLand colorChangeWrap">
@@ -216,7 +216,7 @@
               id="changeSecond"
             >61-80
             </view>
-            <view class="colorChangeTime">{{ record.level_time1 }}({{ record.level_ratio1 }}%)</view>
+            <view class="colorChangeTime">{{ record.level_time3 }}({{ record.level_ratio3 }}%)</view>
           </view>
 
           <view class="flexBoxLand colorChangeWrap">
@@ -234,7 +234,7 @@
               id="changeFourth"
             >21-40
             </view>
-            <dview class="colorChangeTime">{{ record.level_time3 }}({{ record.level_ratio3 }}%)</dview>
+            <dview class="colorChangeTime">{{ record.level_time1 }}({{ record.level_ratio1 }}%)</dview>
           </view>
 
           <view class="flexBoxLand">
@@ -243,7 +243,7 @@
               id="changeFifth"
             >00-20
             </view>
-            <view class="colorChangeTime">{{ record.level_time4 }}({{ record.level_ratio4 }}%)</view>
+            <view class="colorChangeTime">{{ record.level_time0 }}({{ record.level_ratio0 }}%)</view>
           </view>
         </view>
       </view>
@@ -608,7 +608,7 @@ export default {
             $this.record.level_ratio4 =
               Math.round($this.record.level[4] / all_time * 100 * 100) / 100;
 
-            let $pie_option = getPieChartsOption($pie_data);
+            let $pie_option = getPieChartsOption($pie_data.reverse());
             $pie_charts.setOption($pie_option);
 
             //5分钟阶段

+ 44 - 35
src/pages/start/index.vue

@@ -25,6 +25,7 @@
           <button
             class="cu-btn bg-red text-white margin-top-sm"
             @click="game_finished"
+            :disabled="executed"
           >
             <img
               src="https://img.shuimuai.com/m_duankainaohuan.png"
@@ -330,6 +331,7 @@ export default {
       highbetas: [],
       //判断是否结束游戏
       is_end: false,
+      executed: false,
       //  消耗的时间
       played_time: null,
       played_time_text: "--:--",
@@ -346,42 +348,45 @@ export default {
   },
   methods: {
     //游戏结束方法
-    game_finished() {
-      bluetooth.sendEnd();
-
-      $this.$emit("closePop", true);
-      //取消监听低功耗蓝牙设备
-      wx.offBLECharacteristicValueChange();
-      //设置游戏状态为 停止游戏
-      game_store.getters.getGameStatus() == 0
-        ? game_store.setters.setGameStatus(0)
-        : game_store.setters.setGameStatus(3);
-      //游戏结束重置游戏时间
-      wx.removeStorageSync("play_time");
-      //删除游戏专注数据
-      game_store.remover.rmGameAttMedDatas();
-      //删除隐藏时间
-      game_store.remover.rmHideTime();
-      //游戏结束重置游戏模式
-      // game_store.setters.setMode(0);
-      //删除游戏得id
-      game_store.setters.removeToyHex();
-
-      // 结束游戏在提交报告函数里
-      $this.post_data();
-
-      $this.game_over();
-
-
-      Toast.loading({
-        forbidClick: true,
-        mask: true,
-        message: "正在生成报告...",
-        duration: 2000,
-        onClose() {
-          $this.to_report();
+    game_finished() {  
+        if (!$this.executed){
+          bluetooth.sendEnd();
+
+          $this.$emit("closePop", true);
+          //取消监听低功耗蓝牙设备
+          wx.offBLECharacteristicValueChange();
+          //设置游戏状态为 停止游戏
+          game_store.getters.getGameStatus() == 0
+            ? game_store.setters.setGameStatus(0)
+            : game_store.setters.setGameStatus(3);
+          //游戏结束重置游戏时间
+          wx.removeStorageSync("play_time");
+          //删除游戏专注数据
+          game_store.remover.rmGameAttMedDatas();
+          //删除隐藏时间
+          game_store.remover.rmHideTime();
+          //游戏结束重置游戏模式
+          // game_store.setters.setMode(0);
+          //删除游戏得id
+          game_store.setters.removeToyHex();
+
+          // 结束游戏在提交报告函数里
+          $this.post_data();
+
+          $this.game_over();
+
+          
+          Toast.loading({
+              forbidClick: true,
+              mask: true,
+              message: "正在生成报告...",
+              duration: 2000,
+              onClose() {
+                $this.to_report();
+              }
+          });
         }
-      });
+        $this.executed = true;
     },
     to_report() {
       mpvue.redirectTo({
@@ -662,6 +667,7 @@ export default {
   onLoad(options) {
     if (options.end == 1) {
       $this.is_end = true;
+      $this.executed = true
     }
   },
   // 页面从前台切换到后台或者去别的页面时候触发的
@@ -680,6 +686,9 @@ export default {
       game_store.setters.setPlayedTime($this.played_time);
       //设置未结束游戏
       $this.is_end = false;
+      $this.executed = false
+    } else {
+      $this.executed = true
     }
   },
 };

+ 9 - 0
src/requests/user.js

@@ -125,6 +125,15 @@ export function getBannerList() {
   return fly.post('activity/activity-list', $params)
 }
 
+//获取联名轮播图
+export function getJointBanner() {
+  
+  let $params = {
+    access_token:wx.getStorageSync('token')
+  }
+  return fly.post('banner/index', $params)
+}
+
 //小程序登录一次就录入一次数据
 export function setUserLogin() {
  

+ 1 - 0
src/utils/index.js

@@ -771,6 +771,7 @@ export function timestampToTimeS(timestamp) {
   return Y + M + D + h + m + s;
 }
 
+
 export default {
   formatNumber,
   formatTime,