123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- <template>
- <view>
- <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 style='position:relative;' class="row no-boder">
- <u-input class='textarea' v-model="personInfo.message" :type="type" :border="border" :height="height"
- :auto-height="autoHeight" />
- <view style='position:absolute;right:10px;bottom:20px;color:#AFB3BF;'>{{personInfo.message.length}}/150个字</view>
- </view>
-
- </view>
-
- </view>
- <view class="bottom">
- <u-button type="primary" class="submit" hover-class="none" @click="submit">提交</u-button>
- </view>
- <u-toast ref="uToast" />
- </view>
-
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- export default {
- components: {
- },
- data() {
- return {
- isShowAlert: false,
- content: '当前登入信息验证失败,是否重新登录?',
- 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") {
- this.isShowAlert = true;
- // uni.showModal({
- // title: '提示',
- // content: '当前登入信息验证失败,是否重新登录?',
- // 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
- })
- },
- alertBtn() {
- uni.navigateTo({
- url: '/pages/public/login'
- })
- },
- cancelClick() {
- this.isShowAlert = false
- },
- 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 {
- width:100%;
- padding: 21rpx 0;
-
- input {
- background:#F9F9FA;
- font-size: 28rpx;
- color: #333333;
- border:1px solid #EEEEEE;
- width:100%;
- padding:21px;
- border-radius:3px;
- }
- }
- .row-bottom {
- .right-bottom {
- width: 100%;
- margin-top:10px;
- }
- }
- .no-boder {
- border: 0;
- }
- }
- .submit {
- margin:20px;
- margin-top: 160rpx;
- background: #22C572;
- border-radius: 60rpx;
- }
- .textarea{
- background:#F9F9FA;
- border:1px solid #EEEEEE;
- }
- </style>
|