supp_clock.vue 5.4 KB

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