Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

dazhaxie 1 hete
szülő
commit
360a3f22c5
3 módosított fájl, 70 hozzáadás és 91 törlés
  1. 41 28
      pages/equipment-detail/equipment-status.vue
  2. 3 2
      pages/home/home.vue
  3. 26 61
      pages/login/login.vue

+ 41 - 28
pages/equipment-detail/equipment-status.vue

@@ -2,11 +2,8 @@
     <view class="mx3" style="padding-bottom: 100rpx">
         <u-toast ref="uToast" />
         <view class="main-color-bg" style="height: 100rpx; margin: 0 -30rpx"></view>
-        <view
-            class="p3 bg-color-white"
-            style="margin-top: -50rpx; border-radius: 20rpx"
-        >
-            <u-form :model="form" ref="uForm" >
+        <view class="p3 bg-color-white" style="margin-top: -50rpx; border-radius: 20rpx">
+            <u-form :model="form" ref="uForm">
                 <view class="main-color-text f-size-32 f-weight-6 mt-2">设备信息</view>
                 <u-form-item label="设备名称" :label-width="150">
                     <u-input v-model="form.sbName" disabled />
@@ -15,13 +12,13 @@
                     <u-input v-model="form.sbNo" disabled />
                 </u-form-item>
                 <view class="main-color-text f-size-32 f-weight-6 mt-2">变更信息</view>
-                <u-form-item label="变更时间" required :label-width="150">
+                <u-form-item label="变更时间" required prop="changeTime" :label-width="150">
                     <u-input v-model="form.changeTime" @click="handleClick" :cursor-spacing="cursorSpacing" />
                 </u-form-item>
                 <u-form-item label="变更原因" :label-width="150">
                     <u-input v-model="form.changeReason" :cursor-spacing="cursorSpacing" />
                 </u-form-item>
-                <u-form-item label="变更人" required :label-width="150">
+                <u-form-item label="变更人" required prop="actualUser" :label-width="150">
                     <u-input v-model="form.actualUser" :cursor-spacing="cursorSpacing" />
                 </u-form-item>
                 <u-form-item label="变更前状态" required :label-width="150">
@@ -31,14 +28,11 @@
                     <text class="f-size-26 mr-3 state-r">{{ statusMap[form.afterStatus] }}</text>
                 </u-form-item>
             </u-form>
-            <u-picker @confirm="confirm" @cancel="cancel" mode="time" v-model="isShow" :params="pickerParams"></u-picker>
+            <u-picker @confirm="confirm" @cancel="cancel" mode="time" v-model="isShow"
+                :params="pickerParams"></u-picker>
             <!-- <button class="main-color-bg text-color-white" @tap='handleSubmit'>提交</button> -->
             <view class="p-fixed d-flex j-around a-center footer">
-                <view
-                    class="main-color-bg text-color-white common"
-                    @tap="handleSubmit"
-                >提交</view
-                >
+                <view class="main-color-bg text-color-white common" @tap="handleSubmit">提交</view>
             </view>
         </view>
     </view>
@@ -73,6 +67,22 @@ export default {
                 timestamp: true
             },
             statusMap: {},
+            rules: {
+                changeTime: [
+                    {
+                        required: true,
+                        message: '请选择变更时间',
+                        trigger: ['blur', 'change']
+                    }
+                ],
+                actualUser: [
+                    {
+                        required: true,
+                        message: '请输入变更人',
+                        trigger: ['blur', 'change']
+                    }
+                ]
+            },
             // #ifdef MP-WEIXIN
             cursorSpacing: 50,
             // #endif
@@ -94,7 +104,8 @@ export default {
             this.$DictCache.TYPE.SB_INFO_STATUS
         );
         if (options && options.sbId) {
-            this.sbId = options.sbId;
+            console.log(options)
+            this.form.sbId = options.sbId;
             this.form.sbNo = options.sbNo;
             this.form.sbName = options.sbName;
             this.form.preStatus = options.preStatus;
@@ -103,6 +114,7 @@ export default {
         }
     },
     onReady() {
+        this.$refs.uForm.setRules(this.rules);
     },
     methods: {
         handleClick() {
@@ -123,6 +135,7 @@ export default {
             if (this.form.changeTime != null) {
                 time = this.$BaseTool.Date.formatter(this.form.changeTime, BaseTool.Date.PICKER_NORM_DATETIME_PATTERN);
             }
+            console.log(this.form)
             const params = {
                 sbId: this.form.sbId,
                 actualUser: this.form.actualUser,
@@ -132,7 +145,7 @@ export default {
                 remarks: this.form.remarks,
                 changeReason: this.form.changeReason
             };
-
+            console.log(params)
             // this.form.photo = a.join(',');
             var that = this;
             this.$refs.uForm.validate((valid) => {
@@ -157,19 +170,19 @@ export default {
 
 <style lang="less">
 .footer {
-  bottom: 0;
-  left: 0;
-  right: 0;
-  background-color: #fff;
-  z-index: 10000;
-  border-top: 1rpx solid #f4f4f4;
-  height: 100rpx;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    background-color: #fff;
+    z-index: 10000;
+    border-top: 1rpx solid #f4f4f4;
+    height: 100rpx;
 
-  .common {
-    padding: 15rpx 200rpx;
-    border-radius: 30rpx;
-    background-color: #0082ff;
-    color: #fff;
-  }
+    .common {
+        padding: 15rpx 200rpx;
+        border-radius: 30rpx;
+        background-color: #0082ff;
+        color: #fff;
+    }
 }
 </style>

+ 3 - 2
pages/home/home.vue

@@ -121,7 +121,8 @@
       </view>
       <view class="px3 py3 f-size-24 f-weight-bold text-color-6">请选择以下账号做为你的登录账号</view>
       <view class="accounts">
-        <view class="account-item" v-for="item in accounts" :key="item" @click="handleSelectLogin(item)">{{ item }}</view>
+        <view class="account-item" v-for="item in accounts" :key="item" @click="handleSelectLogin(item)">{{ item }}
+        </view>
       </view>
     </u-popup>
     <u-tabbar :list="tabbar" :mid-button="true" active-color="#0082ff"></u-tabbar>
@@ -307,7 +308,7 @@ export default {
     // 去详情
     handleDetail(detail) {
       if (detail.status == 1) {
-        this.$Http.updateWorkplaceBacklog({ id: detail.backlogId }).then(res => {
+        this.$Http.updateWorkplaceBacklog({ id: detail.id }).then(res => {
           console.log('已置为已办')
         })
       }

+ 26 - 61
pages/login/login.vue

@@ -7,18 +7,8 @@
         </view>
         <view class="f-weight-bold name text-center">账号登录</view>
         <view class="input">
-            <input
-                type="text"
-                v-model="userName"
-                placeholder="请输入用户名"
-                placeholder-class="placeholder-class"
-            />
-            <input
-                type="password"
-                v-model="passWord"
-                placeholder="请输入密码"
-                placeholder-class="placeholder-class"
-            />
+            <input type="text" v-model="userName" placeholder="请输入用户名" placeholder-class="placeholder-class" />
+            <input type="password" v-model="passWord" placeholder="请输入密码" placeholder-class="placeholder-class" />
         </view>
         <view class="tip" @tap="forgetPass">
             忘记密码
@@ -28,20 +18,15 @@
         </view>
         <view class=" mui-input-row mui-checkbox ">
             <checkbox-group @change="checkboxChange">
-                <checkbox
-                    id="chkRem"
-                    type="checkbox"
-                    :checked="rememberPsw"
-                    @tap="rememberPsw = !rememberPsw"
-                    class="RememberCheck"
-                >
+                <checkbox id="chkRem" type="checkbox" :checked="rememberPsw" @tap="rememberPsw = !rememberPsw"
+                    class="RememberCheck">
                     记住密码
                 </checkbox>
             </checkbox-group>
         </view>
         <button class="main-color-bg text-color-white login" @tap="login">登录</button>
         <view class="wechat p-fixed left0 right0" style="bottom: 60rpx;">
-            <button open-type="getUserInfo" @click="getUserInfo" class="d-flex j-center a-center">
+            <button @click="quickLogin" class="d-flex j-center a-center">
                 <image src="/static/images/weixin.png" mode=""></image>
             </button>
         </view>
@@ -56,10 +41,7 @@ export default {
         return {
             userName: '', // 用户名
             passWord: '', // 密码
-            rememberPsw: true, // 记住密码
-            Code: '',
-            session_key: '',
-            openid: ''
+            rememberPsw: true // 记住密码
         };
     },
     // 页面初始加载
@@ -90,7 +72,7 @@ export default {
         forgetPass() {
         },
         // 复选框
-        checkboxChange: function(e) {
+        checkboxChange: function (e) {
             if (e.detail.value.length == 1) {
                 // 获取缓存的账号
                 uni.getStorageSync('cache_userName', this.userName);
@@ -142,37 +124,14 @@ export default {
                     }
                 });
         },
-        // 微信登录获取openid
-        getUserInfo() {
-            // 登录
-            uni.login({
-                provider: 'weixin',
-                success: res => {
-                    // console.log('登录成功:', res);
-                    // 获取临时登录凭证code
-                    this.Code = res.code;
-                    // 获取openid,session_key
-                    const appid = 'wx38f46845be704faa' // 需替换
-                    const secret = '9bt1F6ojLU6JLv76Boo4qaeEU6PcW75nGjjLyauDtAF' // 需替换
-                    const url = 'https://api.weixin.qq.com/sns/jscode2session?appid=' + appid + '&secret=' + secret +
-                        '&js_code=' +
-                        this.Code + '&grant_type=authorization_code';
-                    uni.request({
-                        url: url, // 请求路径
-                        success: res => {
-                            // console.log('openid session_key:', res.data);
-                            this.openid = res.data.openid
-                            this.session_key = res.data.session_key
-                            console.log('openid:', this.openid)
-                            uni.showToast({ title: this.openid, icon: 'none' })
-                        },
-                        fail: err => {
-                            console.log('请求失败:', err)
-                        }
-                    });
-                },
-                fail: err => {
-                    console.log('登录失败:', err)
+        // 微信快捷登录
+        quickLogin() {
+            this.$Http.loginQuickly().then(res => {
+                const url = res.data
+
+                if (url !== '' && url !== null && url != undefined) {
+                    // 请求用户授权
+                    window.location.href = url
                 }
             })
         }
@@ -222,14 +181,18 @@ export default {
     font-size: unit(26, rpx);
     font-weight: 500;
 }
-.wechat{
-    margin-top:  unit(90, rpx);
-    button{
+
+.wechat {
+    margin-top: unit(90, rpx);
+
+    button {
         background-color: #FFFFFF;
-        &::after{
+
+        &::after {
             border: none;
         }
-        image{
+
+        image {
             width: unit(90, rpx);
             height: unit(90, rpx);
         }
@@ -239,10 +202,12 @@ export default {
 .mui-checkbox input[type='checkbox']:checked:before {
     color: #00bbb1;
 }
+
 .RememberPass {
     color: #adadad;
     margin-top: 5px;
 }
+
 .RememberCheck {
     margin-left: 30px;
     color: #adadad;