supp_clock.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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. }
  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. uni.showLoading({
  147. mask: true,
  148. title: '加载中'
  149. })
  150. that.detailData.id = that.id
  151. that.detailData.compId = uni.getStorageSync('pcUserInfo').compId
  152. that.detailData.commonId = uni.getStorageSync('pcUserInfo').userId
  153. that.detailData.supplementClockType = that.typevalue
  154. that.$api.doRequest('post', '/clockInfo/api/suppClock', that.detailData)
  155. .then(res => {
  156. if (res.data.code == 200) {
  157. that.$api.msg('提交成功')
  158. uni.hideLoading()
  159. uni.navigateTo({
  160. url: '/pages/clock/the_clock?value=1'
  161. })
  162. } else {
  163. that.$api.msg('提交失败')
  164. }
  165. })
  166. }
  167. }
  168. })
  169. }
  170. }
  171. }
  172. </script>
  173. <style lang='scss' scoped>
  174. page {
  175. background: #F5F6FA;
  176. overflow: hidden;
  177. }
  178. .wrap {
  179. background: #fff;
  180. margin: 10px;
  181. border-radius: 10px;
  182. padding: 20rpx;
  183. }
  184. .content {
  185. border-radius: 20rpx;
  186. background: white;
  187. padding: 20rpx;
  188. .row {
  189. width: 100%;
  190. padding: 21rpx 0;
  191. input {
  192. background: #F9F9FA;
  193. font-size: 28rpx;
  194. color: #333333;
  195. border: 1px solid #EEEEEE;
  196. width: 100%;
  197. padding: 21px;
  198. border-radius: 3px;
  199. }
  200. }
  201. .c-row {
  202. display: -webkit-box;
  203. display: -webkit-flex;
  204. display: flex;
  205. -webkit-box-align: center;
  206. -webkit-align-items: center;
  207. align-items: center;
  208. padding: 10rpx -1rpx;
  209. position: relative;
  210. }
  211. >.title {
  212. padding: 10px 16px;
  213. }
  214. .row-bottom {
  215. .right-bottom {
  216. width: 100%;
  217. margin-top: 10px;
  218. }
  219. }
  220. .no-boder {
  221. border: 0;
  222. }
  223. }
  224. .con-list {
  225. -webkit-box-flex: 1;
  226. -webkit-flex: 1;
  227. flex: 1;
  228. display: -webkit-box;
  229. display: -webkit-flex;
  230. display: flex;
  231. -webkit-box-orient: vertical;
  232. -webkit-box-direction: normal;
  233. -webkit-flex-direction: column;
  234. flex-direction: column;
  235. color: #303133;
  236. line-height: 40rpx;
  237. text-align: right;
  238. margin-left: 130px;
  239. }
  240. .submit {
  241. margin: 20px;
  242. margin-top: 160rpx;
  243. background: #22C572;
  244. border-radius: 60rpx;
  245. }
  246. .textarea {
  247. background: #F9F9FA;
  248. border: 1px solid #EEEEEE;
  249. }
  250. </style>