123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- <template>
- <view>
- <view class="wrap">
- <view class="content">
- <view class="c-row">
- <view class="title">补卡原因</view>
- <view class="con-list">
- <u-radio-group activeColor="#22C572" v-model="typevalue">
- <u-radio key="1" label="上班" name="1">上班</u-radio>
- <u-radio key="3" label="下班" name="3">下班</u-radio>
- </u-radio-group>
- </view>
- </view>
- <view class="row no-boder">
- <view class="left">申请理由</view>
- </view>
- <view style='position:relative;' class="row no-boder">
- <u-input class='textarea' v-model="detailData.reasonForApplication" :type="type" :border="border"
- :height="height" :auto-height="autoHeight" />
- <view style='position:absolute;right:10px;bottom:20px;color:#AFB3BF;'>
- {{detailData.reasonForApplication.length}}/150个字
- </view>
- </view>
- </view>
- </view>
- <view class="bottom">
- <u-button type="primary" class="submit" hover-class="none" @click="submit">提交</u-button>
- </view>
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- export default {
- components: {
- },
- data() {
- return {
- isShowAlert: false,
- content: '当前登入信息验证失败,是否重新登录?',
- detailData: {
- supplementClockType: '',
- reasonForApplication: '',
- },
- typevalue: '1',
- type: 'textarea',
- border: true,
- height: 150,
- autoHeight: true,
- id: "",
- suppDay:'',
- }
- },
- onLoad(options) {
- this.id = options.id
- let _day = new Date();
- _day.setTime(_day.getTime());
- this.suppDay = _day.getFullYear() + "-" + (_day.getMonth() + 1) + "-" + _day.getDate();
- },
- // #ifndef MP
- onNavigationBarButtonTap(e) {
- const index = e.index;
- if (index === 0) {
- this.navTo('/pages/set/set');
- } else if (index === 1) {
- // #ifdef APP-PLUS
- const pages = getCurrentPages();
- const page = pages[pages.length - 1];
- const currentWebview = page.$getAppWebview();
- currentWebview.hideTitleNViewButtonRedDot({
- index
- });
- // #endif
- uni.navigateTo({
- url: '/pages/notice/notice'
- })
- }
- },
- // #endif
- computed: {
- ...mapState(['hasLogin', 'userInfo']),
- },
- onShow() {
- this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
- console.log("checkSession", res)
- if (res.data.data == "INVALID") {
- this.isShowAlert = true;
- // uni.showModal({
- // title: '提示',
- // content: '当前登入信息验证失败,是否重新登录?',
- // showCancel: true,
- // confirmText: '登录',
- // success: (e) => {
- // if (e.confirm) {
- // uni.navigateTo({
- // url: '/pages/public/login'
- // })
- // }
- // },
- // fail: () => {},
- // complete: () => {}
- // })
- }
- })
- console.log("hasLogin", this.hasLogin)
- },
- methods: {
- /**
- * 统一跳转接口,拦截未登录路由
- * navigator标签现在默认没有转场动画,所以用view
- */
- navTo(url) {
- if (!this.hasLogin) {
- url = '/pages/public/login';
- }
- uni.navigateTo({
- url
- })
- },
- cancelClick() {
- this.isShowAlert = false
- },
- alertBtn() {
- uni.navigateTo({
- url: '/pages/public/login'
- })
- },
- submit() {
- if (!this.typevalue) {
- this.$refs.uToast.show({
- title: '补卡原因不能为空!',
- type: 'error',
- })
- }
- if (!this.detailData.reasonForApplication) {
- this.$refs.uToast.show({
- title: '申请理由不能为空!',
- type: 'error',
- })
- }
- var that = this
- uni.showModal({
- content: "确定提交补卡信息?",
- showCancel: true,
- confirmText: '提交',
- success: function(res) {
- if (res.confirm) {
- uni.showLoading({
- mask: true,
- title: '加载中'
- })
- that.detailData.id = that.id
- that.detailData.compId = uni.getStorageSync('pcUserInfo').compId
- that.detailData.commonId = uni.getStorageSync('pcUserInfo').userId
- that.detailData.supplementClockType = that.typevalue
- that.detailData.suppDay = that.suppDay
- that.$api.doRequest('post', '/clockInfo/api/suppClock', that.detailData)
- .then(res => {
- if (res.data.code == 200) {
- that.$api.msg('提交成功')
- uni.hideLoading()
- uni.navigateTo({
- url: '/pages/clock/the_clock?value=1'
- })
- } else {
- // that.$api.msg('提交失败')
- }
- uni.hideLoading()
- })
- }
- }
- })
- }
- }
- }
- </script>
- <style lang='scss' scoped>
- page {
- background: #F5F6FA;
- overflow: hidden;
- }
- .wrap {
- background: #fff;
- margin: 10px;
- border-radius: 10px;
- padding: 20rpx;
- }
- .content {
- border-radius: 20rpx;
- background: white;
- padding: 20rpx;
- .row {
- width: 100%;
- padding: 21rpx 0;
- input {
- background: #F9F9FA;
- font-size: 28rpx;
- color: #333333;
- border: 1px solid #EEEEEE;
- width: 100%;
- padding: 21px;
- border-radius: 3px;
- }
- }
- .c-row {
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-align: center;
- -webkit-align-items: center;
- align-items: center;
- padding: 10rpx -1rpx;
- position: relative;
- }
- >.title {
- padding: 10px 16px;
- }
- .row-bottom {
- .right-bottom {
- width: 100%;
- margin-top: 10px;
- }
- }
- .no-boder {
- border: 0;
- }
- }
- .con-list {
- -webkit-box-flex: 1;
- -webkit-flex: 1;
- flex: 1;
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-orient: vertical;
- -webkit-box-direction: normal;
- -webkit-flex-direction: column;
- flex-direction: column;
- color: #303133;
- line-height: 40rpx;
- text-align: right;
- margin-left: 130px;
- }
- .submit {
- margin: 20px;
- margin-top: 160rpx;
- background: #22C572;
- border-radius: 60rpx;
- }
- .textarea {
- background: #F9F9FA;
- border: 1px solid #EEEEEE;
- }
- </style>
|