supp_clock.vue 5.9 KB

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