| | |
| | | </view> |
| | | </view> |
| | | <view class="password_footer"> |
| | | <button v-preventReClick class="password_footer_submit"> |
| | | <button class="password_footer_submit" @click="submit"> |
| | | <text>完成</text> |
| | | </button> |
| | | </view> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { updatePwd } from '@/util/api/PersonalAPI' |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | confirmPassword: '' |
| | | } |
| | | }; |
| | | }, |
| | | methods: { |
| | | // 忘记密码 |
| | | forgotPassword() { |
| | | |
| | | }, |
| | | // 提交修改 |
| | | submit() { |
| | | if (!this.form.originalPassword) { |
| | | uni.showToast({ title: '原密码不能为空', icon: 'none', duration: 2000 }); |
| | | } else if (!this.form.newPassword) { |
| | | uni.showToast({ title: '新密码不能为空', icon: 'none', duration: 2000 }); |
| | | } else if (!/^(?=.*[A-Za-z])(?=.*\d)(?=.*[$@$!%*#?&])[A-Za-z\d$@$!%*#?&]{6,}$/.test(this.form.newPassword)) { |
| | | uni.showToast({ title: '密码格式不正确', icon: 'none', duration: 2000 }); |
| | | } else if (!this.form.confirmPassword) { |
| | | uni.showToast({ title: '确认密码不能为空', icon: 'none', duration: 2000 }); |
| | | } else if (this.form.newPassword !== this.form.confirmPassword) { |
| | | uni.showToast({ title: '两次输入的密码不一致', icon: 'none', duration: 2000 }); |
| | | } else { |
| | | updatePwd({ |
| | | newPwd: this.form.newPassword, |
| | | oldPwd: this.form.originalPassword |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | uni.showToast({ title: '修改成功', icon: 'success', duration: 2000, mask: true }); |
| | | setTimeout(() => { |
| | | uni.navigateBack({ delta: 1 }); |
| | | }, 2000) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | let info = await getUserInfo() |
| | | if (info.code === 200) { |
| | | await that.$store.commit('setEntrance', 'WX') |
| | | await that.$store.commit('setUserInfo', info.data) |
| | | await that.$store.commit('SETUSERINFO', info.data) |
| | | await that.$store.dispatch('getMenuList', 2) |
| | | uni.switchTab({ |
| | | url: '/pages/workbench/workbench' |
| | |
| | | if (!this.from.password) return uni.showToast({ title: '密码不能为空', icon:"error", duration: 2000 }); |
| | | let res = await wxAccountLogin(this.from) |
| | | if (res.code === 200) { |
| | | await this.$store.commit('SETSESSION', res.data) |
| | | let user = await getUserInfo({}) |
| | | if (user.code === 200) { |
| | | await this.$store.commit('SETUSERINFO', user.data) |
| | |
| | | <view>
|
| | | <div class="box">
|
| | | <div class="box_info" :style="{background: 'url(' + img + ')'}">
|
| | | <image src="@/static/2@2x.png" mode="widthFix" />
|
| | | <image :src="userInfo.avatar ? userInfo.avatar : avatar" mode="widthFix" />
|
| | | <div class="box_info_box">
|
| | | <text>张三</text>
|
| | | <div class="box_info_box_x" @click="show = true">
|
| | | <text>豆米科技</text>
|
| | | <text>{{userInfo.realname}}</text>
|
| | | <div class="box_info_box_x" @click="switchOrganization">
|
| | | <text>{{userInfo.curComDepartment ? userInfo.curComDepartment.name : ''}}</text>
|
| | | <image src="@/static/mine_ic_change@2x.png" alt="" />
|
| | | </div>
|
| | | </div>
|
| | |
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <div class="box_out"><text>退出登录</text></div>
|
| | | <div class="box_out" @click="loginOut"><text>退出登录</text></div>
|
| | | </div>
|
| | | <!-- 部门选择器 -->
|
| | | <u-picker :show="show" :columns="columns" @confirm="confirm"></u-picker>
|
| | | <u-picker :show="show" :columns="columns" @confirm="onConfirm" @cancel="show = false"></u-picker>
|
| | | <myTabbar :index="2" />
|
| | | </view>
|
| | | </template>
|
| | |
|
| | | <script>
|
| | | import { changeCom, getDepartmentListByConditon } from '@/util/api/PersonalAPI'
|
| | | import myTabbar from "@/components/myTabber.vue"
|
| | | import { wxLoginOut } from '@/util/api'
|
| | | import { mapState } from 'vuex'
|
| | | export default {
|
| | | components: {
|
| | | myTabbar
|
| | | },
|
| | | computed: mapState([
|
| | | 'userInfo'
|
| | | ]),
|
| | | data() {
|
| | | return {
|
| | | MENU: [ |
| | |
| | | { name: '修改密码', url: '/pages/changePassword/changePassword', icon: require('@/static/mine_ic_xiugaimima@2x.png') }, |
| | | ],
|
| | | img: require('@/static/mine_bg@2x.png'),
|
| | | avatar: require('@/static/2@2x.png'),
|
| | | show: false,
|
| | | columns: [
|
| | | ['中国', '美国', '日本']
|
| | | ]
|
| | | columns: []
|
| | | }
|
| | | },
|
| | | onLoad() {
|
| | | uni.hideTabBar()
|
| | | },
|
| | | methods: {
|
| | | jump(url) {
|
| | | uni.navigateTo({ url })
|
| | | // 退出登录
|
| | | loginOut() {
|
| | | wxLoginOut({
|
| | | companyUserId: this.userInfo.companyUser.id
|
| | | }).then(res => {
|
| | | if (res.code === 200) {
|
| | | this.$store.commit('clearCache')
|
| | | uni.reLaunch({
|
| | | url: '/pages/login/login'
|
| | | });
|
| | | }
|
| | | })
|
| | | },
|
| | | confirm(val) {
|
| | | console.log(val)
|
| | | this.show = false
|
| | | // 确认切换组织
|
| | | onConfirm(e) {
|
| | | changeCom(e.value[0].id).then(res => {
|
| | | if (res.code === 200) {
|
| | | this.show = false
|
| | | uni.showToast({ title: '更新组织成功', icon: 'success', duration: 2000 });
|
| | | this.$store.dispatch('getUserInfos')
|
| | | }
|
| | | })
|
| | | },
|
| | | // 获取组织
|
| | | switchOrganization() {
|
| | | getDepartmentListByConditon({
|
| | | type: 0
|
| | | }).then(res => {
|
| | | if (res.code === 200) {
|
| | | this.columns = []
|
| | | let arr = []
|
| | | res.data.forEach((item) => {
|
| | | let obj = {
|
| | | text: item.name, id: item.id
|
| | | }
|
| | | arr.push(obj)
|
| | | })
|
| | | this.columns.push(arr)
|
| | | this.show = true
|
| | | }
|
| | | })
|
| | | },
|
| | | // 跳转页面
|
| | | jump(url) {
|
| | | if (!url) return
|
| | | uni.navigateTo({ url })
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | <template> |
| | | <view class="info"> |
| | | <view class="info_portrait"> |
| | | <image src="@/static/2@2x.png" mode="widthFix" /> |
| | | <image :src="userInfo.avatar ? userInfo.avatar : avatar" mode="widthFix" /> |
| | | <text>用户名</text> |
| | | </view> |
| | | <view class="info_list"> |
| | | <view class="info_list_item"> |
| | | <text>昵称</text> |
| | | <text>暂无昵称</text> |
| | | <text>{{userInfo.realname ? userInfo.realname : '暂无昵称'}}</text> |
| | | </view> |
| | | <view class="info_list_item"> |
| | | <text>手机号</text> |
| | | <text>暂无手机号</text> |
| | | <text>{{userInfo.companyUser.phone ? userInfo.companyUser.phone : '暂无手机号'}}</text> |
| | | </view> |
| | | <view class="info_list_item"> |
| | | <text>所属部门</text> |
| | | <text>暂无所属部门</text> |
| | | <text>{{userInfo.department.name ? userInfo.department.name : '暂无所属部门'}}</text> |
| | | </view> |
| | | <view class="info_list_item"> |
| | | <text>岗位</text> |
| | | <text>暂无岗位</text> |
| | | <text>{{userInfo.companyUser.positionName ? userInfo.companyUser.positionName : '暂无岗位'}}</text> |
| | | </view> |
| | | <view class="info_list_item"> |
| | | <text>当前组织</text> |
| | | <text>暂无组织</text> |
| | | <text>{{userInfo.rootDepartment.name ? userInfo.rootDepartment.name : '暂无组织'}}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import { mapState } from 'vuex' |
| | | export default { |
| | | data() { |
| | | return { |
| | | |
| | | avatar: require('@/static/2@2x.png'), |
| | | }; |
| | | } |
| | | }, |
| | | computed: mapState([ |
| | | 'userInfo' |
| | | ]) |
| | | } |
| | | </script> |
| | | |
| | |
| | | <view class="password_list_item"> |
| | | <text>当前绑定</text> |
| | | <view class="password_list_item_box"> |
| | | <input type="number" disabled v-model="form.currentPhone" maxlength="11"> |
| | | <input type="number" disabled v-model="userInfo.companyUser.phone" maxlength="11"> |
| | | </view> |
| | | </view> |
| | | <view class="password_list_item"> |
| | |
| | | <view class="password_list_item_box"> |
| | | <input type="text" v-model="form.verificationCode" maxlength="4" placeholder="请输入手机验证码"> |
| | | <p @click="getVerificationCode" v-if="!code.isOpen">获取验证码</p> |
| | | <p @click="getVerificationCode" v-else>{{code.num}}</p> |
| | | <p v-else>{{code.num}}</p> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { mapState } from 'vuex' |
| | | import { phoneRegular } from '@/common/config.js' |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: { |
| | | currentPhone: '', |
| | | newPhone: '', |
| | | verificationCode: '' |
| | | }, |
| | | code: { |
| | | num: 60, |
| | | isOpen: false, |
| | | timer: 0 |
| | | } |
| | | }; |
| | | }, |
| | | computed: mapState([ |
| | | 'userInfo' |
| | | ]), |
| | | methods: { |
| | | // 获取验证码 |
| | | getVerificationCode() { |
| | | this.code.isOpen = true |
| | | this.code.timer = setInterval(() => { |
| | | if (this.code.num === 0) { |
| | | clearInterval(this.code.timer) |
| | | this.code.isOpen = false |
| | | this.code.num = 60 |
| | | } |
| | | this.code.num = this.code.num - 1 |
| | | }, 1000) |
| | | }, |
| | | // 提交修改 |
| | | submit() { |
| | | if (!this.form.newPhone) { |
| | | uni.showToast({ title: '新手机号不能为空', icon: 'none', duration: 2000 }); |
| | | } else if (!phoneRegular.test(this.form.newPhone)) { |
| | | uni.showToast({ title: '手机号不合法', icon: 'none', duration: 2000 }); |
| | | } else if (!this.form.verificationCode) { |
| | | uni.showToast({ title: '验证码不能为空', icon: 'none', duration: 2000 }); |
| | | } else { |
| | | console.log('可以提交') |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | <template>
|
| | | <view class="index">
|
| | | <view class="menu">
|
| | | <!-- <view class="menu_list" v-for="(row, i) in Menu" :key="i">
|
| | | <view class="menu_list" v-for="(row, i) in Menu" :key="i">
|
| | | <view class="menu_list_head">
|
| | | <span>{{row.label}}</span>
|
| | | </view>
|
| | |
| | | <view class="menu_list_zw"></view>
|
| | | <view class="menu_list_zw"></view>
|
| | | </div>
|
| | | </view> -->
|
| | | </view>
|
| | | </view>
|
| | | <myTabbar :index="1" />
|
| | | </view>
|
| | |
| | | import Vue from 'vue'
|
| | | import Vuex from 'vuex' |
| | | import { pageCount, getTreeList } from '@/util/api/index.js'
|
| | | import Vuex from 'vuex'
|
| | | import {
|
| | | pageCount,
|
| | | getTreeList,
|
| | | getUserInfo
|
| | | } from '@/util/api/index.js'
|
| | |
|
| | | Vue.use(Vuex) // vue的插件机制
|
| | |
|
| | |
| | | const token = uni.getStorageSync('token');
|
| | | const userInfo = uni.getStorageSync('userInfo');
|
| | | const Menu = uni.getStorageSync('MenuList');
|
| | | const session = uni.getStorageSync('session'); |
| | | const session = uni.getStorageSync('session');
|
| | |
|
| | |
|
| | | // Vuex.Store 构造器选项
|
| | |
| | | // 为了不和页面或组件的data中的造成混淆,state中的变量前面建议加上$符号
|
| | | state: {
|
| | | // 用户信息
|
| | | userInfo: userInfo || null, |
| | | userInfo: userInfo || null,
|
| | | token: token || null,
|
| | | menuButtonWidth: menuButtonWidth || '0',
|
| | | statusbarHeight: statusbarHeight || '0',
|
| | | navHeight: navHeight || '0',
|
| | | session: session ? session : '',
|
| | | // 菜单权限
|
| | | Menu: Menu ? Menu : [], |
| | | // 待办数量 |
| | | upcomingNum: { |
| | | d: 0, |
| | | y: 0 |
| | | Menu: Menu ? JSON.parse(Menu) : [],
|
| | | // 待办数量
|
| | | upcomingNum: {
|
| | | d: 0,
|
| | | y: 0
|
| | | },
|
| | | },
|
| | | mutations: {
|
| | |
| | | uni.setStorageSync('statusbarHeight', val.statusbarHeight);
|
| | | uni.setStorageSync('menuButtonWidth', val.menuButtonWidth);
|
| | | },
|
| | | SETTOKEN(state, val) { |
| | | state.token = val |
| | | uni.setStorageSync('token', val); |
| | | }, |
| | | SETUSERINFO(state, val) { |
| | | state.userInfo = val |
| | | uni.setStorageSync('userInfo', val); |
| | | }, |
| | | SETNUM(state, val) { |
| | | state.upcomingNum.d = val.d |
| | | state.upcomingNum.y = val.y |
| | | SETTOKEN(state, val) {
|
| | | state.token = val
|
| | | uni.setStorageSync('token', val);
|
| | | },
|
| | | SETMENU (state, data) {
|
| | | SETUSERINFO(state, val) {
|
| | | state.userInfo = val
|
| | | uni.setStorageSync('userInfo', val);
|
| | | },
|
| | | SETNUM(state, val) {
|
| | | state.upcomingNum.d = val.d
|
| | | state.upcomingNum.y = val.y
|
| | | },
|
| | | SETMENU(state, data) {
|
| | | state.Menu = data
|
| | | uni.setStorageSync('MenuList', JSON.stringify(data));
|
| | | },
|
| | | SETSESSION (state, data) {
|
| | | SETSESSION(state, data) {
|
| | | state.session = data;
|
| | | uni.setStorageSync('session', data);
|
| | | },
|
| | | clearCache(state) {
|
| | | state.userInfo = ''
|
| | | state.token = ''
|
| | | state.session = ''
|
| | | state.Menu = []
|
| | | state.upcomingNum.d = 0
|
| | | state.upcomingNum.y = 0
|
| | | uni.clearStorageSync()
|
| | | }
|
| | | },
|
| | | actions: {
|
| | | // 向后端获取菜单栏权限
|
| | | async getMenuList (content, type) {
|
| | | let res = await getTreeList({ type: type })
|
| | | async getMenuList(content, type) {
|
| | | let res = await getTreeList({
|
| | | type: type
|
| | | })
|
| | | if (res.code === 200) {
|
| | | content.commit('SETMENU', res.data)
|
| | | }
|
| | |
| | | height,
|
| | | menuButtonWidth
|
| | | })
|
| | | }, |
| | | async getUpcomingNum() { |
| | | let res = await pageCount({}) |
| | | if (res.code === 200) { |
| | | content.commit('SETNUM', { d: res.data.startNum, y: res.data.endNum }) |
| | | } |
| | | } |
| | | },
|
| | | async getUpcomingNum() {
|
| | | let res = await pageCount({})
|
| | | if (res.code === 200) {
|
| | | content.commit('SETNUM', {
|
| | | d: res.data.startNum,
|
| | | y: res.data.endNum
|
| | | })
|
| | | }
|
| | | },
|
| | | // 向后端获取个人信息
|
| | | async getUserInfos(content) {
|
| | | let res = await getUserInfo()
|
| | | if (res.code === 200) {
|
| | | content.commit('SETUSERINFO', res.data)
|
| | | return true;
|
| | | }
|
| | | }
|
| | | }
|
| | | })
|
| | |
|
| | | export default store |
| | | export default store |
| | |
| | | // 微信小程序登录 |
| | | export function wxProgramLogin(params) { |
| | | return http.get('/system/wxProgramLogin', {params}) |
| | | } |
| | | |
| | | // 微信退出登录 |
| | | export function wxLoginOut(data) { |
| | | return http.post('/system/wxLoginOut', data) |
| | | } |
| | |
| | | */
|
| | | module.exports = (vm) => {
|
| | | uni.$u.http.interceptors.request.use((config) => { // 可使用async await 做异步操作
|
| | | console.log(config)
|
| | | config.header['Cookie'] = 'eva-auth-token=' + vm.$store.state.session
|
| | | if (vm.$store.state.session) {
|
| | | config.header['Cookie'] = 'eva-auth-token=' + vm.$store.state.session
|
| | | }
|
| | | uni.showLoading({ title: '请求中' });
|
| | | config.data = config.data || {}
|
| | | return config
|