123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- <template>
- <view class="wrap">
- <view class="content">
- <view class="row row-bottom">
- <view class="left">姓名</view>
- <input v-model="personInfo.name" class="right-bottom" placeholder="请输入姓名"></input>
- </view>
- <view class="row row-bottom">
- <view class="left">电话</view>
- <input class="right-bottom" v-model="personInfo.mobilePhone" placeholder="请输入电话"></input>
- </view>
- <view class="row no-boder">
- <view class="left">留言</view>
- </view>
- <view class="row no-boder">
- <u-input v-model="personInfo.message" :type="type" :border="border" :height="height"
- :auto-height="autoHeight" />
- </view>
- <view class="bottom">
- <u-button type="primary" class="submit" hover-class="none" @click="submit">提交</u-button>
- </view>
- </view>
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- export default {
- components: {
- },
- data() {
- return {
- personInfo: {
- name: '',
- mobilePhone: '',
- message: '',
- type: 1
- },
- type: 'textarea',
- border: true,
- height: 150,
- autoHeight: true,
- }
- },
- onLoad() {
- },
- // #ifndef MP
- onNavigationBarButtonTap(e) {
- const index = e.index;
- if (index === 0) {
- this.navTo('/pages/set/set');
- } else if (index === 1) {
- // #ifdef APP-PLUS
- const pages = getCurrentPages();
- const page = pages[pages.length - 1];
- const currentWebview = page.$getAppWebview();
- currentWebview.hideTitleNViewButtonRedDot({
- index
- });
- // #endif
- uni.navigateTo({
- url: '/pages/notice/notice'
- })
- }
- },
- // #endif
- computed: {
- ...mapState(['hasLogin', 'userInfo']),
- },
- onShow() {
- this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
- console.log("checkSession", res)
- if (res.data.data == "INVALID") {
- uni.showModal({
- title: '登录提示',
- content: 'Session过期需要重新登录,是否立即登录?',
- showCancel: true,
- confirmText: '登录',
- success: (e) => {
- if (e.confirm) {
- uni.navigateTo({
- url: '/pages/public/login'
- })
- }
- },
- fail: () => {},
- complete: () => {}
- })
- }
- })
- console.log("hasLogin", this.hasLogin)
- },
- methods: {
- /**
- * 统一跳转接口,拦截未登录路由
- * navigator标签现在默认没有转场动画,所以用view
- */
- navTo(url) {
- if (!this.hasLogin) {
- url = '/pages/public/login';
- }
- uni.navigateTo({
- url
- })
- },
- calculate() {},
- submit() {
- if (!this.personInfo.name) {
- this.$refs.uToast.show({
- title: '姓名不能为空!',
- type: 'error',
- })
- }
- if (!this.personInfo.mobilePhone) {
- this.$refs.uToast.show({
- title: '电话号码不能为空!',
- type: 'error',
- })
- }
- this.$api.doRequest('post', '/openServiceInfo/api/addInfo', this.personInfo).then(res => {
-
- if (res.data.code == 200) {
- this.$refs.uToast.show({
- title: '提交成功,客服人员会及时与您取得联系。!',
- type: 'success',
- back: true
- })
- }
- })
- }
- }
- }
- </script>
- <style lang='scss' scoped>
- page {
- background: #F5F6FA;
- overflow: hidden;
- }
- .wrap {
- background: #fff;
- margin: 10px;
- border-radius: 10px;
- padding: 20rpx;
- }
- .content {
- border-radius: 20rpx;
- background: white;
- padding: 20rpx;
- .row {
- display: flex;
- justify-content: space-between;
- border-bottom: 1px solid #EEEEEE;
- padding: 21rpx 0;
- .right,
- input {
- font-size: 28rpx;
- color: #333333;
- }
- }
- .row-bottom {
- .right-bottom {
- width: 300rpx;
- text-align: right;
- }
- }
- .no-boder {
- border: 0;
- }
- }
- .submit {
- margin-top: 200rpx;
- background: #22C572;
- border-radius: 10rpx;
- }
- </style>
|