|
@@ -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;
|