openService.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <view class="wrap">
  3. <view class="content">
  4. <view class="row row-bottom">
  5. <view class="left">姓名</view>
  6. <input @input='calculate' class="right-bottom" placeholder="请输入姓名"></input>
  7. </view>
  8. <view class="row row-bottom">
  9. <view class="left">电话</view>
  10. <input @input='calculate' class="right-bottom" placeholder="请输入电话"></input>
  11. </view>
  12. <view class="row no-boder">
  13. <view class="left">留言</view>
  14. </view>
  15. <view class="row no-boder">
  16. <u-input v-model="value" :type="type" :border="border" :height="height" :auto-height="autoHeight" />
  17. </view>
  18. <view class="bottom">
  19. <u-button type="primary" class="submit" hover-class="none" @click="submit">提交</u-button>
  20. </view>
  21. </view>
  22. <u-toast ref="uToast" />
  23. </view>
  24. </template>
  25. <script>
  26. import {
  27. mapState
  28. } from 'vuex';
  29. export default {
  30. components: {
  31. },
  32. data() {
  33. return {
  34. value: '',
  35. type: 'textarea',
  36. border: true,
  37. height: 100,
  38. autoHeight: true,
  39. }
  40. },
  41. onLoad() {
  42. },
  43. // #ifndef MP
  44. onNavigationBarButtonTap(e) {
  45. const index = e.index;
  46. if (index === 0) {
  47. this.navTo('/pages/set/set');
  48. } else if (index === 1) {
  49. // #ifdef APP-PLUS
  50. const pages = getCurrentPages();
  51. const page = pages[pages.length - 1];
  52. const currentWebview = page.$getAppWebview();
  53. currentWebview.hideTitleNViewButtonRedDot({
  54. index
  55. });
  56. // #endif
  57. uni.navigateTo({
  58. url: '/pages/notice/notice'
  59. })
  60. }
  61. },
  62. // #endif
  63. computed: {
  64. ...mapState(['hasLogin', 'userInfo']),
  65. },
  66. onShow() {
  67. this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
  68. console.log("checkSession", res)
  69. if (res.data.data == "INVALID") {
  70. uni.showModal({
  71. title: '登录提示',
  72. content: 'Session过期需要重新登录,是否立即登录?',
  73. showCancel: true,
  74. confirmText: '登录',
  75. success: (e) => {
  76. if (e.confirm) {
  77. uni.navigateTo({
  78. url: '/pages/public/login'
  79. })
  80. }
  81. },
  82. fail: () => {},
  83. complete: () => {}
  84. })
  85. }
  86. })
  87. console.log("hasLogin", this.hasLogin)
  88. },
  89. methods: {
  90. /**
  91. * 统一跳转接口,拦截未登录路由
  92. * navigator标签现在默认没有转场动画,所以用view
  93. */
  94. navTo(url) {
  95. if (!this.hasLogin) {
  96. url = '/pages/public/login';
  97. }
  98. uni.navigateTo({
  99. url
  100. })
  101. },
  102. calculate() {},
  103. submit() {
  104. this.$refs.uToast.show({
  105. title: '登录成功',
  106. type: 'error',
  107. url: '/pages/user/index'
  108. })
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang='scss' scoped>
  114. page {
  115. background: #F5F6FA;
  116. overflow: hidden;
  117. }
  118. .wrap {
  119. background: #fff;
  120. margin: 10px;
  121. border-radius: 10px;
  122. padding: 20rpx;
  123. }
  124. .content {
  125. border-radius: 20rpx;
  126. background: white;
  127. padding: 20rpx;
  128. .row {
  129. display: flex;
  130. justify-content: space-between;
  131. border-bottom: 1px solid #EEEEEE;
  132. padding: 21rpx 0;
  133. .right,
  134. input {
  135. font-size: 28rpx;
  136. color: #333333;
  137. }
  138. }
  139. .row-bottom {
  140. .right-bottom {
  141. width: 300rpx;
  142. text-align: right;
  143. }
  144. }
  145. .no-boder {
  146. border: 0;
  147. }
  148. }
  149. .submit {
  150. margin-top: 200rpx;
  151. background: #22C572;
  152. border-radius: 10rpx;
  153. }
  154. </style>