supp_clock.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <view>
  3. <view class="wrap">
  4. <view class="content">
  5. <view class="c-row">
  6. <view class="title">补卡原因</view>
  7. <view class="con-list">
  8. <u-radio-group v-model="typevalue">
  9. <u-radio key="1" label="上班" name="1">上班</u-radio>
  10. <u-radio key="3" label="下班" name="3">下班</u-radio>
  11. </u-radio-group>
  12. </view>
  13. </view>
  14. <view class="row no-boder">
  15. <view class="left">申请理由</view>
  16. </view>
  17. <view style='position:relative;' class="row no-boder">
  18. <u-input class='textarea' v-model="detailData.reasonForApplication" :type="type" :border="border"
  19. :height="height" :auto-height="autoHeight" />
  20. <view style='position:absolute;right:10px;bottom:20px;color:#AFB3BF;'>
  21. {{detailData.reasonForApplication.length}}/150个字</view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="bottom">
  26. <u-button type="primary" class="submit" hover-class="none" @click="submit">提交</u-button>
  27. </view>
  28. <u-toast ref="uToast" />
  29. </view>
  30. </template>
  31. <script>
  32. import {
  33. mapState
  34. } from 'vuex';
  35. export default {
  36. components: {
  37. },
  38. data() {
  39. return {
  40. isShowAlert: false,
  41. content: '当前登入信息验证失败,是否重新登录?',
  42. detailData: {
  43. supplementClockType: '',
  44. reasonForApplication: '',
  45. },
  46. typevalue: '1',
  47. type: 'textarea',
  48. border: true,
  49. height: 150,
  50. autoHeight: true,
  51. }
  52. },
  53. onLoad() {
  54. },
  55. // #ifndef MP
  56. onNavigationBarButtonTap(e) {
  57. const index = e.index;
  58. if (index === 0) {
  59. this.navTo('/pages/set/set');
  60. } else if (index === 1) {
  61. // #ifdef APP-PLUS
  62. const pages = getCurrentPages();
  63. const page = pages[pages.length - 1];
  64. const currentWebview = page.$getAppWebview();
  65. currentWebview.hideTitleNViewButtonRedDot({
  66. index
  67. });
  68. // #endif
  69. uni.navigateTo({
  70. url: '/pages/notice/notice'
  71. })
  72. }
  73. },
  74. // #endif
  75. computed: {
  76. ...mapState(['hasLogin', 'userInfo']),
  77. },
  78. onShow() {
  79. this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
  80. console.log("checkSession", res)
  81. if (res.data.data == "INVALID") {
  82. this.isShowAlert = true;
  83. // uni.showModal({
  84. // title: '提示',
  85. // content: '当前登入信息验证失败,是否重新登录?',
  86. // showCancel: true,
  87. // confirmText: '登录',
  88. // success: (e) => {
  89. // if (e.confirm) {
  90. // uni.navigateTo({
  91. // url: '/pages/public/login'
  92. // })
  93. // }
  94. // },
  95. // fail: () => {},
  96. // complete: () => {}
  97. // })
  98. }
  99. })
  100. console.log("hasLogin", this.hasLogin)
  101. },
  102. methods: {
  103. /**
  104. * 统一跳转接口,拦截未登录路由
  105. * navigator标签现在默认没有转场动画,所以用view
  106. */
  107. navTo(url) {
  108. if (!this.hasLogin) {
  109. url = '/pages/public/login';
  110. }
  111. uni.navigateTo({
  112. url
  113. })
  114. },
  115. cancelClick() {
  116. this.isShowAlert = false
  117. },
  118. alertBtn() {
  119. uni.navigateTo({
  120. url: '/pages/public/login'
  121. })
  122. },
  123. submit() {
  124. if (!this.typevalue) {
  125. this.$refs.uToast.show({
  126. title: '补卡原因不能为空!',
  127. type: 'error',
  128. })
  129. }
  130. if (!this.detailData.reasonForApplication) {
  131. this.$refs.uToast.show({
  132. title: '申请理由不能为空!',
  133. type: 'error',
  134. })
  135. }
  136. var that = this
  137. uni.showModal({
  138. content: "确定提交补卡信息?",
  139. showCancel: true,
  140. confirmText: '提交',
  141. success: function(res) {
  142. if (res.confirm) {
  143. that.detailData.compId = uni.getStorageSync('pcUserInfo').compId
  144. that.detailData.commonId = uni.getStorageSync('pcUserInfo').userId
  145. that.detailData.supplementClockType = that.typevalue
  146. that.$api.doRequest('post','/clockInfo/api/suppClock',that.detailData)
  147. .then(res => {
  148. if (res.data.code == 200) {
  149. that.$api.msg('提交成功')
  150. } else {
  151. that.$api.msg('提交失败')
  152. }
  153. })
  154. }
  155. }
  156. })
  157. }
  158. }
  159. }
  160. </script>
  161. <style lang='scss' scoped>
  162. page {
  163. background: #F5F6FA;
  164. overflow: hidden;
  165. }
  166. .wrap {
  167. background: #fff;
  168. margin: 10px;
  169. border-radius: 10px;
  170. padding: 20rpx;
  171. }
  172. .content {
  173. border-radius: 20rpx;
  174. background: white;
  175. padding: 20rpx;
  176. .row {
  177. width: 100%;
  178. padding: 21rpx 0;
  179. input {
  180. background: #F9F9FA;
  181. font-size: 28rpx;
  182. color: #333333;
  183. border: 1px solid #EEEEEE;
  184. width: 100%;
  185. padding: 21px;
  186. border-radius: 3px;
  187. }
  188. }
  189. .c-row {
  190. display: -webkit-box;
  191. display: -webkit-flex;
  192. display: flex;
  193. -webkit-box-align: center;
  194. -webkit-align-items: center;
  195. align-items: center;
  196. padding: 10rpx -1rpx;
  197. position: relative;
  198. }
  199. >.title {
  200. padding: 10px 16px;
  201. }
  202. .row-bottom {
  203. .right-bottom {
  204. width: 100%;
  205. margin-top: 10px;
  206. }
  207. }
  208. .no-boder {
  209. border: 0;
  210. }
  211. }
  212. .con-list {
  213. -webkit-box-flex: 1;
  214. -webkit-flex: 1;
  215. flex: 1;
  216. display: -webkit-box;
  217. display: -webkit-flex;
  218. display: flex;
  219. -webkit-box-orient: vertical;
  220. -webkit-box-direction: normal;
  221. -webkit-flex-direction: column;
  222. flex-direction: column;
  223. color: #303133;
  224. line-height: 40rpx;
  225. text-align: right;
  226. margin-left: 130px;
  227. }
  228. .submit {
  229. margin: 20px;
  230. margin-top: 160rpx;
  231. background: #22C572;
  232. border-radius: 60rpx;
  233. }
  234. .textarea {
  235. background: #F9F9FA;
  236. border: 1px solid #EEEEEE;
  237. }
  238. </style>