Ver código fonte

组件优化

master
yxq 2 meses atrás
pai
commit
eb7c6f77a7
8 arquivos alterados com 21 adições e 68 exclusões
  1. +0
    -10
      monitorMobile/api/student/home/index.js
  2. +7
    -24
      monitorMobile/api/user.js
  3. +1
    -2
      monitorMobile/common/setting.js
  4. +11
    -8
      monitorMobile/components/selectRadio.vue
  5. +0
    -18
      monitorMobile/http/install.js
  6. +0
    -4
      monitorMobile/main.js
  7. +2
    -0
      monitorMobile/pages/login.vue
  8. +0
    -2
      monitorMobile/store/index.js

+ 0
- 10
monitorMobile/api/student/home/index.js Ver arquivo

@@ -1,10 +0,0 @@

import http from '@/http/api.js'
// 获取校历事件数据
export const getSchoolCalendarlist = (params) => {
return http.request({
url: '/api/blade-basic-data/semester/schoolCalendarlist',
method: 'get',
params
})
}

+ 7
- 24
monitorMobile/api/user.js Ver arquivo

@@ -1,7 +1,6 @@
import http from '@/http/api.js'

// 获取token
const token = (tenantId, username, password, type) => {
export const token = (tenantId, username, password, type) => {
return http.request({
url: '/api/blade-auth/oauth/token',
method: 'POST',
@@ -18,7 +17,7 @@ const token = (tenantId, username, password, type) => {
}
})
}
const getTenantId = (params) => {
export const getTenantId = (params) => {
return http.request({
url: '/api/blade-auth/oauth/getTenantId',
method: 'get',
@@ -28,7 +27,7 @@ const getTenantId = (params) => {
})
}

const refreshToken = (refresh_token, tenantId) => {
export const refreshToken = (refresh_token, tenantId) => {
return http.request({
url: '/api/blade-auth/oauth/token',
method: 'post',
@@ -45,7 +44,7 @@ const refreshToken = (refresh_token, tenantId) => {
}

// 获取用户信息
const userInfo = () => {
export const userInfo = () => {
return http.request({
url: '/api/blade-user/info',
method: 'GET',
@@ -60,14 +59,8 @@ export const getUser = (id) => {
params: { id }
})
}
export const getUserInfo = () => {
return http.request({
url: '/api/blade-user/info',
method: 'get',
})
}
/* 修改用户信息 */
const updateInfo = (row) => {
export const updateInfo = (row) => {
return http.request({
url: '/api/blade-user/update-info',
method: 'post',
@@ -75,7 +68,7 @@ const updateInfo = (row) => {
})
}
// 修改密码
const updatePassword = (data) => {
export const updatePassword = (data) => {
return http.request({
url: '/api/blade-user/update-password',
method: 'post',
@@ -83,20 +76,10 @@ const updatePassword = (data) => {
})
}
// 修改密码
const passwordCheck = (data) => {
export const passwordCheck = (data) => {
return http.request({
url: '/api/blade-user/passwordCheck',
method: 'post',
params: data
})
}

export default {
token,
userInfo,
refreshToken,
getTenantId,
updatePassword,
updateInfo,
passwordCheck
}

+ 1
- 2
monitorMobile/common/setting.js Ver arquivo

@@ -11,8 +11,7 @@ module.exports = {
// 应用logo,支持本地路径和网络路径
logo: '/static/images/icon/logo.png',
// 版本号
version: '2.0.0',
version: '2.0.1',
version: '1.0.0',


+ 11
- 8
monitorMobile/components/selectRadio.vue Ver arquivo

@@ -5,7 +5,8 @@
<u-popup :show="show" mode="center" :round="10" @close="close" @open="open">
<view style="max-height: 800rpx;overflow-y: auto;">
<u-radio-group v-model="value_" iconPlacement="right" placement="column" @change="change" borderBottom>
<u-radio v-for="(item,index) in options" :key="index" :label="item.label" :name="item.value"></u-radio>
<u-radio v-for="(item,index) in options" :key="index" :label="item.label"
:name="item.value"></u-radio>
</u-radio-group>
</view>
</u-popup>
@@ -48,9 +49,13 @@
};
},
mounted() {
if (this.value) {
let obj = this.options.find(e1 => e1.value == this.value)
if (obj) this.title_ = obj.label
this.value_ = this.value
if (this.value_) {
let obj = this.options.find(e1 => e1.value == this.value_)
this.title_ = obj?obj.label:''
this.$emit("update:title", this.title_)
}else{
this.$emit("update:title", '')
}
},
methods: {
@@ -65,16 +70,14 @@
this.show = false
},
open() {
let obj = this.options.find(e1 => e1.value == this.value)
this.title_ = obj ? obj.label : this.placeholder
this.value_ = this.value
this.show = true
},
change(e) {
this.$emit("input", e)
this.$emit("change", e)
let obj = this.options.find(e1 => e1.value == e)
this.title_ = obj ? obj.label : this.placeholder
this.title_ = obj.label
this.$emit("update:title", this.title_)
this.close()
},
}


+ 0
- 18
monitorMobile/http/install.js Ver arquivo

@@ -1,18 +0,0 @@
// 获取api目录所有js文件
const files = require.context('@/api', false, /\.js$/)
// 此处第二个参数vm,就是我们在页面使用的this,可以通过vm获取vuex等操作
const install = (Vue, vm) => {
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api下(因为vm就是this,也即this.$u.api)
// 自动将所有api挂载到vm.$u.api中
vm.$u.api = {}
files.keys().forEach(key => {
const api = files(key).default
for (let item in api) {
vm.$u.api[item] = api[item]
}
})
}

export default {
install
}

+ 0
- 4
monitorMobile/main.js Ver arquivo

@@ -34,10 +34,6 @@ export function createApp() {
}
// #endif

// 接口集中管理
import httpInstall from '@/http/install.js'
Vue.use(httpInstall, app)

import http from '@/http/api.js'
Vue.prototype.$http = http



+ 2
- 0
monitorMobile/pages/login.vue Ver arquivo

@@ -37,6 +37,7 @@
</template>

<script>
import {token} from '@/api/user.js'
export default {
data() {
return {
@@ -70,6 +71,7 @@
},
methods: {
login() {
token()
this.$refs.uForm.validate(valid => {
if (!valid) return
this.isLoading = true


+ 0
- 2
monitorMobile/store/index.js Ver arquivo

@@ -45,8 +45,6 @@ const store = new Vuex.Store({
},
accessToken: lifeData.accessToken ? lifeData.accessToken : '',
isLogin: lifeData.isLogin ? lifeData.isLogin : false,
// 如果version无需保存到本地永久存储,无需lifeData.version方式
version: '1.0.0',
},
mutations: {
$uStore(state, payload) {


Carregando…
Cancelar
Salvar