From 11812ec34931e78939e87effdc32a0d0b8d04b3b Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期三, 21 八月 2024 14:32:22 +0800
Subject: [PATCH] 提交
---
/dev/null | 0
pages/tabBar/count/count.vue | 261 ++++++++++++++++++++++++++++++++++---------
pages/tabBar/count/productDetail.vue | 2
pages/tabBar/firstPage/firstPage.vue | 31 +++-
static/avator.png | 0
manifest.json | 2
api/index.js | 13 +
pages/tabBar/count/countDetail.vue | 2
8 files changed, 242 insertions(+), 69 deletions(-)
diff --git a/api/index.js b/api/index.js
index 0a1a5a0..0d58ede 100644
--- a/api/index.js
+++ b/api/index.js
@@ -16,9 +16,9 @@
})
}
-export function getUserInfo(id) {
+export function getUserInfo() {
return service({
- url: `/api/app/student/${id}`,
+ url: '/api/app/config/getConfigByUser',
method: 'GET'
})
}
@@ -118,4 +118,13 @@
url: `/api/app/product/productSold/${productId}`,
method: 'POST',
})
+}
+
+// 重置密码
+export function resetPwd(data) {
+ return service({
+ url: '/api/app/user/resetPwd',
+ method: 'PUT',
+ data
+ })
}
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
index d1b8287..6f3eb62 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,5 +1,5 @@
{
- "name" : "危化品全生命周期管理平台",
+ "name" : "危化品管理",
"appid" : "__UNI__3D059D7",
"description" : "",
"versionName" : "1.0.0",
diff --git a/pages/tabBar/count/count.vue b/pages/tabBar/count/count.vue
index 56fb158..90a0b8f 100644
--- a/pages/tabBar/count/count.vue
+++ b/pages/tabBar/count/count.vue
@@ -15,7 +15,7 @@
<view class="m-p-15">
<view class="userInfo">
<view class="info-l">
- <image src="../../../static/companyLogo.png" mode="widthFix"></image>
+ <image :src="avator" mode="aspectFill"></image>
<!-- <view class="info-icons">-->
<!-- <u-icon v-if="user.sex==0" name="man" color="#0f7ff9" bold size="24"></u-icon>-->
<!-- <u-icon v-else-if="user.sex==1" name="woman" color="#ff69bf" bold size="24"></u-icon>-->
@@ -29,21 +29,21 @@
<span>{{username}}</span>
</view>
-<!-- <view class="info-id">-->
-<!-- ID:<span>{{user.idNo}}</span>-->
-<!-- </view>-->
+ <view class="info-id" @click="resetPwd()">
+ <span>重置密码</span><u-icon name="edit-pen" color="#e6e6e6" size="16"></u-icon>
+ </view>
</view>
</view>
<view class="card-list">
<view class="paper-card">
- <view class="menu-i" @click="toHazmat">
+ <view :class="user.useProd == 1?'menu-i':'menu-i-l'" @click="toHazmat">
<view class="menu-l">
<u-icon name="warning" color="#0f7ff9" size="32"></u-icon>
<view><span style="color: #ed6464">危化品</span>操作记录</view>
</view>
<u-icon name="arrow-right" color="#ccc" size="20"></u-icon>
</view>
- <view class="menu-i" @click="toProduct">
+ <view class="menu-i" @click="toProduct" v-if="user.useProd == 1">
<view class="menu-l">
<u-icon name="bag" color="#0f7ff9" size="32"></u-icon>
<view><span style="color: #5fb734">成品</span>操作记录</view>
@@ -57,14 +57,53 @@
<u-button @click="loginOut" type="primary" text="退出登录" style="width: 80%" shape="circle"></u-button>
</view>
</view>
+ <u-modal :show="showModal" title="重置密码" :showConfirmButton="false" :closeOnClickOverlay="true" ref="uModal" :asyncClose="true" @close="closeModal()">
+ <view>
+ <u--form labelPosition="top" labelWidth="120" :model="pwdForm" :rules="rules" ref="uForm">
+ <u-form-item
+ prop="password"
+ ref="password"
+ label="新密码"
+ >
+ <u--input
+ v-model="pwdForm.password"
+ placeholder="请输入新密码"
+ :type="codeType1"
+ >
+ <template slot="suffix">
+ <u-icon v-show="codeType1 == 'password'" name="eye" color="#999" size="20" @click="viewCode(1)"></u-icon>
+ <u-icon v-show="codeType1 == 'text'" name="eye-off" color="#999" size="20" @click="viewCode(1)"></u-icon>
+ </template>
+ </u--input>
+ </u-form-item>
+ <u-form-item
+ prop="rePassword"
+ ref="rePassword"
+ label="确认密码"
+ >
+ <u--input
+ v-model="pwdForm.rePassword"
+ placeholder="请确认密码"
+ :type="codeType2"
+ ><template slot="suffix">
+ <u-icon v-show="codeType2 == 'password'" name="eye" color="#999" size="20" @click="viewCode(2)"></u-icon>
+ <u-icon v-show="codeType2 == 'text'" name="eye-off" color="#999" size="20" @click="viewCode(2)"></u-icon>
+ </template></u--input>
+ </u-form-item>
+ </u--form>
+ <u-button type="primary" style="margin-top: 20px" text="确认" @click="confirmPwd()"></u-button>
+ </view>
+ </u-modal>
+ <u-toast ref="uToast"></u-toast>
<tabBar :currentPagePath="page"></tabBar>
</view>
</template>
<script>
import tabBar from '../tabBarIndex.vue'
- import {getExamList, getUserInfo, loginOut} from "../../../api";
- import {getCleanRecord} from "../../../api/wearhouse";
+ import {loginOut, postHazmatReturn, resetPwd} from "../../../api";
+ import VUE_APP_BASE_URL from 'common/constant.js'
+ import avatorPic from '../../../static/avator.png'
export default {
components:{
tabBar
@@ -80,7 +119,49 @@
completed: 1
},
examList: [],
- totalPage: 0
+ totalPage: 0,
+ user: {},
+ avator: '',
+ showModal: false,
+ pwdForm:{
+ id: null,
+ password: '',
+ rePassword: ''
+ },
+ rules: {
+ password: [
+ {
+ type: 'string',
+ required: true,
+ message: '新密码不可为空',
+ trigger: ['blur', 'change']
+ },
+ {
+ validator: (rule, value, callback) => {
+ return /^(?![a-zA-Z]+$)(?!\d+$)(?![!@#$%^&\.*]+$)(?![a-zA-Z\d]+$)(?![a-zA-Z!@#$%^&\.*]+$)(?![\d!@#$%^&\.*]+$)[a-zA-Z\d!@#$%^&\.*\-_]{6,16}$/.test(value)
+ },
+ message: '密码须同时包含字母、数字和特殊字符,长度在6-16之间',
+ trigger: ['change','blur'],
+ }
+ ],
+ rePassword: [
+ {
+ type: 'string',
+ required: true,
+ message: '请再次确认密码',
+ trigger: ['blur', 'change'],
+ },
+ {
+ validator: (rule, value, callback) => {
+ return value == this.pwdForm.password;
+ },
+ message: '两次输入密码不一致',
+ trigger: ['change','blur'],
+ }
+ ]
+ },
+ codeType1: 'password',
+ codeType2: 'password'
}
},
@@ -92,31 +173,19 @@
this.username = uni.getStorageSync('name')
// uni.hideTabBar();
// this.getUserInfo()
+ this.user = uni.getStorageSync('userSet')
+ if(this.user.logoPath && this.user.logoPath !== ''){
+ this.avator = VUE_APP_BASE_URL + '/api/' + this.user.logoPath
+ }else{
+ this.avator = avatorPic
+ }
},
methods: {
- goBack() {
- uni.switchTab({
- url:'/pages/tabBar/firstPage/firstPage'
- });
- },
-
- getUserInfo(){
- getUserInfo(uni.getStorageSync('uid')).then(res => {
- if(res.code == 200) {
- this.user = res.data
- }else{
- uni.$u.toast(res.message)
- }
- })
+ base64Encode(str) {
+ return btoa(unescape(encodeURIComponent(str)));
},
- toDetail(item,type){
- uni.setStorageSync("prevPage", '/pages/tabBar/count/count');
- uni.navigateTo({
- url: `/pages/tabBar/firstPage/exam?bank=` + encodeURIComponent(JSON.stringify(item)) + `&type=` + encodeURIComponent(JSON.stringify(type))
- })
- },
toHazmat(){
uni.setStorageSync("prevPage", '/pages/tabBar/count/count');
uni.navigateTo({
@@ -159,10 +228,77 @@
})
},
- getPhoneNumber(phone) {
- const firstThree = phone?phone.slice(0, 3):''
- const lastFour = phone?phone.slice(-4):''
- return `${firstThree}****${lastFour}`
+ resetPwd(){
+ const t = this
+ t.showModal = true
+ },
+
+ viewCode(type){
+ const t = this
+ if(type == 1){
+ if(this.codeType1 == 'password'){
+ this.codeType1 = 'text'
+ } else{
+ this.codeType1 = 'password'
+ }
+ }else{
+ if(this.codeType2 == 'password'){
+ this.codeType2 = 'text'
+ } else{
+ this.codeType2 = 'password'
+ }
+ }
+ },
+
+ confirmPwd(){
+ const t = this
+ t.$refs.uForm.validate().then(res => {
+ let data = {}
+ data.id = uni.getStorageSync("uid");
+ data.password = t.base64Encode(t.pwdForm.password)
+ resetPwd(data).then((r)=>{
+ if(r.code == 200){
+ t.$refs.uToast.show({
+ type: 'default',
+ message: '密码已重置,请重新登录',
+ duration: 1000
+ })
+ loginOut().then(res=>{
+ if(res.code == 200){
+ setTimeout(()=>{
+ uni.clearStorageSync();
+ uni.clearStorage();
+ uni.navigateTo({
+ url: '/pages/index/index'
+ })
+ },1000)
+ }
+ })
+ }else{
+ t.$refs.uToast.show({
+ type: 'default',
+ message: r.message
+ })
+ }
+ }).catch((err) => {
+ uni.showToast({
+ title: err,
+ duration: 2000
+ })
+ })
+ t.closeModal()
+ }).catch(errors => {
+ uni.$u.toast('请按要求完善信息')
+ })
+ },
+
+ closeModal(){
+ this.showModal = false
+ this.pwdForm = {
+ id: null,
+ password: '',
+ rePassword: ''
+ }
}
}
}
@@ -207,9 +343,20 @@
background-color:lightgrey;
}
-.myImg{
- width: 100%;
- height: 100%
+/deep/ .u-modal__title{
+ padding-top: 20px !important;
+}
+
+/deep/ .u-modal__content{
+ display: flex;
+ flex-direction: column !important;
+ align-items: center;
+ text-align: left;
+ padding-top: 0 !important;
+
+ &>view{
+ width: 100%;
+ }
}
.m-p-15{
@@ -227,26 +374,17 @@
.info-l{
width: 150rpx;
height: 150rpx;
- border-radius: 50%;
- position: relative;
+ border-radius: 75rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ overflow: hidden;
margin-right: 20px;
+ border: 2px solid #fff;
+ box-sizing: border-box;
image{
- width: 150rpx;
- height: 150rpx;
- border-radius: 50%;
- }
- .info-icons{
- width: 48rpx;
- height: 48rpx;
- border-radius: 90%;
- position: absolute;
- bottom: 10rpx;
- right: 0;
- background: #fff;
- display: flex;
- align-items: center;
- justify-content: center;
- box-shadow: 0 2px 4px rgba(0,0,0,.1);
+ width: calc(100% + 4px) !important;
+ height: calc(100% + 4px) !important;
}
}
@@ -263,6 +401,16 @@
margin-right: 10px;
}
}
+
+ .info-id{
+ display: flex;
+ align-items: center;
+
+ span{
+ font-size: 24rpx;
+ color: #e6e6e6;
+ }
+ }
}
}
@@ -277,7 +425,7 @@
align-items: center;
justify-content: space-between;
- .menu-i{
+ .menu-i,.menu-i-l{
width: calc(50% - 5px);
background: rgba(255,255,255,1);
border-radius: 12px;
@@ -307,6 +455,9 @@
}
}
}
+ .menu-i-l{
+ width: 100%;
+ }
}
}
}
diff --git a/pages/tabBar/count/countDetail.vue b/pages/tabBar/count/countDetail.vue
index ef721e2..14af158 100644
--- a/pages/tabBar/count/countDetail.vue
+++ b/pages/tabBar/count/countDetail.vue
@@ -8,7 +8,7 @@
<view style="display: flex; flex-direction: column;">
<view class="navBar">
<u-icon name="arrow-left" color="black" size="17" style="margin-left: 8px;" @click="goBack" />
- <view class="barText">我的操作</view>
+ <view class="barText">危化品操作记录</view>
</view>
</view>
</view>
diff --git a/pages/tabBar/count/productDetail.vue b/pages/tabBar/count/productDetail.vue
index 023173e..2efbccc 100644
--- a/pages/tabBar/count/productDetail.vue
+++ b/pages/tabBar/count/productDetail.vue
@@ -8,7 +8,7 @@
<view style="display: flex; flex-direction: column;">
<view class="navBar">
<u-icon name="arrow-left" color="black" size="17" style="margin-left: 8px;" @click="goBack" />
- <view class="barText">我的操作</view>
+ <view class="barText">成品操作记录</view>
</view>
</view>
</view>
diff --git a/pages/tabBar/firstPage/firstPage.vue b/pages/tabBar/firstPage/firstPage.vue
index 039b813..307761e 100644
--- a/pages/tabBar/firstPage/firstPage.vue
+++ b/pages/tabBar/firstPage/firstPage.vue
@@ -13,7 +13,7 @@
</view>
</view>
<u-toast ref="uToast"></u-toast>
- <view class="cardList">
+ <view class="cardList" v-if="user.useProd == 1">
<view class="switchPanel">
<view class="switchBtns">
<view class="btnItem" @click="changeTab(1)">
@@ -100,7 +100,8 @@
postHazmatUse,
postHazmatUsed,
postHazmatDiscard,
- postProductDiscard, getProductByCode, postProductSold
+ postProductDiscard, getProductByCode, postProductSold,
+ getUserInfo
} from '../../../api/index.js'
import VUE_APP_BASE_URL from 'common/constant.js'
import take from '../../../static/take.png'
@@ -159,6 +160,7 @@
id: null,
remaining: ''
},
+ user: {},
rules: {
remaining: {
type: 'string',
@@ -168,7 +170,7 @@
}
},
tabNum: 1,
- blockText: '原材料',
+ blockText: '危化品',
blockStyle: {
transform: 'translateX(0px)'
}
@@ -188,11 +190,23 @@
},
created(){
uni.hideTabBar()
+ this.getUserInfo()
},
mounted() {
},
methods: {
+ getUserInfo(){
+ getUserInfo().then(res => {
+ if(res.code == 200) {
+ this.user = res.data
+ uni.setStorageSync('userSet', res.data)
+ }else{
+ uni.$u.toast(res.message)
+ }
+ })
+ },
+
scanCode(title){
const t = this
t.modalTitle = title
@@ -265,7 +279,7 @@
duration: 2000
})
})
- t.showModal = false
+ t.closeModal()
},
confirmBack() {
@@ -291,8 +305,7 @@
duration: 2000
})
})
- t.showModal = false
- t.hazmatBack.remaining = ''
+ t.closeModal()
}).catch(errors => {
uni.$u.toast('请完善必填信息')
})
@@ -318,7 +331,7 @@
duration: 2000
})
})
- t.showModal = false
+ t.closeModal()
},
confirmSell(){
@@ -341,7 +354,7 @@
duration: 2000
})
})
- t.showModal = false
+ t.closeModal()
},
confirmCancle(){
@@ -385,7 +398,7 @@
})
})
}
- t.showModal = false
+ t.closeModal()
},
closeModal(){
diff --git a/static/avator.png b/static/avator.png
index 74760f9..b1134b7 100644
--- a/static/avator.png
+++ b/static/avator.png
Binary files differ
diff --git a/static/companyLogo.png b/static/companyLogo.png
deleted file mode 100644
index b01a93a..0000000
--- a/static/companyLogo.png
+++ /dev/null
Binary files differ
--
Gitblit v1.9.2