|
@@ -4,42 +4,83 @@
|
|
|
<block slot="backText">返回</block>
|
|
|
<block slot="content">活动报名</block>
|
|
|
</cu-custom>
|
|
|
- <form>
|
|
|
+ <form @submit="formSubmit()">
|
|
|
<view class="cu-form-group margin-top">
|
|
|
- <view class="title">姓名</view>
|
|
|
- <input placeholder="请输入姓名" name="name"></input>
|
|
|
+ <view class="title"><text class="red-color ">* </text>姓名</view>
|
|
|
+ <input placeholder="请输入姓名" name="name" v-model="inputForm.name"></input>
|
|
|
</view>
|
|
|
- <view class="cu-form-group margin-top">
|
|
|
- <view class="title">部门</view>
|
|
|
- <input placeholder="请输入部门" name="officeName"></input>
|
|
|
+ <view class="cu-form-group ">
|
|
|
+ <view class="title"><text class="red-color ">* </text>部门</view>
|
|
|
+ <picker @change="changeOffice" :value="officeIndex" :range="officeList">
|
|
|
+ <view class="picker">
|
|
|
+ {{officeIndex>-1?officeList[officeIndex]:'请选择'}}
|
|
|
+ </view>
|
|
|
+ </picker>
|
|
|
</view>
|
|
|
- <view class="cu-form-group margin-top">
|
|
|
- <view class="title">电话号码</view>
|
|
|
- <input placeholder="请输入电话号码" name="mobile"></input>
|
|
|
+ <view class="cu-form-group ">
|
|
|
+ <view class="title"><text class="red-color ">* </text>电话号码</view>
|
|
|
+ <input placeholder="请输入电话号码" name="phone" v-model="inputForm.phone"></input>
|
|
|
</view>
|
|
|
- <view class=" margin-top" style="padding-left: 10px;padding-right: 10px;">
|
|
|
- <button style="width: 100%;" class='cu-btn lg bg-green shadow ' @click="submit()">提交</button>
|
|
|
+ <view class=" margin-top" style="padding-left: 7px;padding-right: 7px;">
|
|
|
+ <button style="width: 100%;" class='cu-btn lg bg-gradual-blue shadow ' form-type="submit">提交</button>
|
|
|
</view>
|
|
|
</form>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ var graceChecker = require("@/common/graceChecker.js");
|
|
|
+ import LuckyDrawMembersService from '@/api/test/luckyDraw/LuckyDrawMembersService.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- isCard: false
|
|
|
+ eventId: '',
|
|
|
+ inputForm: {
|
|
|
+ name: '',
|
|
|
+ officeName: '',
|
|
|
+ mobile: '',
|
|
|
+ eventId: ''
|
|
|
+ },
|
|
|
+ officeList: [
|
|
|
+ '工程一部','工程二部','工程三部','工程四部','工程五部','其他'
|
|
|
+ ],
|
|
|
+ officeIndex: -1
|
|
|
};
|
|
|
},
|
|
|
+ luckyDrawMembersService: null,
|
|
|
+ onLoad(option) {
|
|
|
+ this.luckyDrawMembersService = new LuckyDrawMembersService()
|
|
|
+ let { eventId } = option
|
|
|
+ this.inputForm.eventId = eventId
|
|
|
+ },
|
|
|
methods: {
|
|
|
- IsCard(e) {
|
|
|
- this.isCard = e.detail.value
|
|
|
+ formSubmit: function(e) {
|
|
|
+ //定义表单规则
|
|
|
+ var rule = [
|
|
|
+ {name:"name", checkType : "notnull", checkRule:"", errorMsg:"姓名不能为空"},
|
|
|
+ {name:"officeName", checkType : "notnull", checkRule:"", errorMsg:"部门不能为空"},
|
|
|
+ {name:"phone", checkType : "notnull", checkRule:"", errorMsg:"电话号码不能为空"},
|
|
|
+ {name:"phone", checkType : "isMobile", checkRule:"", errorMsg:"电话号码格式不正确"}
|
|
|
+ ];
|
|
|
+ //进行表单检查
|
|
|
+ var formData = this.inputForm;
|
|
|
+ var checkRes = graceChecker.check(formData, rule);
|
|
|
+ if(checkRes){
|
|
|
+ uni.showLoading()
|
|
|
+ this.luckyDrawMembersService.save(this.inputForm).then(({data}) => {
|
|
|
+ uni.showToast({title:data, icon:"success"});
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/test/luckyDraw/LuckyDrawEvents?is_sucess='+'200'
|
|
|
+ })
|
|
|
+ }).catch((e)=>{
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uni.showToast({ title: graceChecker.error, icon: "none" });
|
|
|
+ }
|
|
|
},
|
|
|
- submit() {
|
|
|
- let is_sucess = '200'
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/test/luckyDraw/LuckyDrawEvents?is_sucess=200'
|
|
|
- })
|
|
|
+ changeOffice(e){
|
|
|
+ this.officeIndex = e.target.value;
|
|
|
+ this.inputForm.officeName = this.officeList[this.officeIndex]
|
|
|
}
|
|
|
}
|
|
|
}
|