123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- <template>
- <view class="home">
- <view class="putWarp dffd">
- <view class="putin bb dfsb">
- <text class="fontmid flex1">姓名</text>
- <input type="text" v-model="name" placeholder="填写姓名" />
- </view>
- <view class="putin bb dfsb">
- <text class="fontmid flex1">学校</text>
- <input type="text" v-model="school" placeholder="填写学校" />
- </view>
- <view class="putin bb dfsb">
- <text class="fontmid flex1">电话</text>
- <input type="number" v-model="phone" placeholder="填写联系方式" />
- </view>
- <view class="putin spec ">
- <text class="fontmid flex1">留言内容</text>
- <textarea class="lyCon" maxlength="-1" v-model="content" placeholder="填写留言内容" />
- </view>
- </view>
- <u-button color="#ED742F" @click="clickHandle" throttleTime="2000" class="custom-style" text="提交"></u-button>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- name: '',
- phone: '',
- school: '',
- content: ''
- };
- },
- onLoad(opt) {},
- onShow() {},
- methods: {
- clickHandle() {
- let phoneReg = /^(1[3-9])\d{9}$/;
- if (!phoneReg.test(this.phone)) {
- return this.$api.toast('手机号码不合法!');
- }
- if (!this.phone) {
- return this.$api.toast('请输入手机号');
- }
- if (!this.name) {
- return this.$api.toast('请输入姓名');
- }
- if (!this.school) {
- return this.$api.toast('请输入学校');
- }
- if (!this.content) {
- return this.$api.toast('请输入留言内容');
- }
- this.$api
- .request('user/setMessage', {
- name: this.name,
- school: this.school,
- phone: this.phone,
- content: this.content,
- })
- .then(data => {
- if (data.code == '200') {
- this.$api.toast(data.msg);
- setTimeout(res => {
- uni.navigateBack({
- delta: 1
- });
- }, 300);
- } else {
- this.$api.toast(data.msg);
- }
- })
- }
- }
- };
- </script>
- <style lang="scss">
- .home {
- padding: 20rpx 0rpx 0;
- //yanzhengma
- .u-hairline-border[data-v-3bf2dba7]:after {
- border: 0;
- }
- .tips {
- padding: 0;
- color: $promain;
- font-size: 28rpx;
- line-height: 40rpx;
- height: 40rpx;
- }
- .putWarp {
- background-color: #fff;
- padding: 0rpx 32rpx;
- align-items: center;
- .putin {
- width: 100%;
- padding: 30rpx 0;
- &:nth-last-of-type(1) {
- border-bottom: 0px;
- }
- input {
- flex: 1;
- font-size: 28rpx;
- }
- .promain {
- border-left: 1px solid #dbdbdb;
- padding-left: 30rpx;
- }
- input {
- text-align: right;
- }
- }
- .spec {
- .lyCon {
- width: 100%;
- margin-top: 30rpx;
- height: 201rpx;
- padding: 24rpx;
- font-size: 22rpx;
- background: #f4f4f4;
- }
- }
- }
- .custom-style {
- background-color: #ED742E;
- color: #fff;
- width: 690rpx;
- margin-top: 200rpx;
- border-radius: 11rpx;
- }
- }
- </style>
|