| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- import http from '@/utils/http';
- import DictCache from '@/utils/dict';
- import { stringify } from 'qs';
- /**
- * 忘记密码
- * page func
- * parameter: { }
- * @param parameter
- * @returns {*}
- */
- export function forgetPwd(parameter) {
- return http({
- url: '/ignores/forget-pwd',
- method: 'put',
- data: parameter
- });
- }
- /**
- * 获取图片验证码
- */
- export function getCode(data) {
- return http({
- url: '/service/sms/sendSms',
- method: 'POST',
- data
- });
- }
- /**
- * 获取用户详情,包括权限
- */
- export function getUserInfo() {
- return http({
- url: '/upms/users/info',
- method: 'get'
- });
- }
- /**
- * 获取用户详情
- */
- export function getUserInfoModel() {
- return http({
- url: '/upms/users/info/model',
- method: 'get'
- });
- }
- /**
- * 退出登录
- */
- export function userLogout() {
- return http({
- url: '/upms/users/logout',
- method: 'delete'
- });
- }
- /**
- * 获取数据词典
- */
- export function getDictData() {
- return http({
- url: '/upms/dicts/data',
- method: 'get'
- });
- }
- /**
- * 登录
- */
- export function mobileLogin(data) {
- return new Promise((resolve, reject) => {
- http({
- url: '/oauth/token',
- method: 'GET',
- data
- })
- .then(res => {
- // 存入用户信息
- // 获取用户信息
- // TODO future 没有做容错,完成再调试
- // 存入token
- uni.setStorage({
- key: 'accessToken',
- data: res.data.access_token,
- success: function () {
- // 获取词典
- getDictData().then(response => {
- uni.switchTab({ url: '/pages/tidings/tidings' });
- uni.setStorage({
- key: DictCache.BASE_DATA_CACHE,
- data: response.data,
- success: function () {}
- });
- });
- // 获取登录人信息 这一步可以不用,移动端可以在使用用户的时候再获取,这个方法是留着渲染动态路由的
- getUserInfo().then(response => {
- uni.setStorage({
- key: 'userInfo',
- data: response.data,
- success: function () {
- resolve(res);
- }
- });
- });
- }
- });
- })
- .catch(err => reject(err));
- });
- }
- /**
- * fetch single func
- * parameter: { }
- * @param parameter
- * @returns {*}
- */
- export function fetchSbInfoIgnores(parameter) {
- return http({
- url: '/ignores/sb/' + parameter.id,
- method: 'get',
- headers: {
- 'Content-Type': 'application/json;charset=UTF-8'
- }
- });
- }
- /**
- * 更新设备图片
- */
- export function updateSbInfoImagesIgnores (parameter) {
- return http({
- url: '/ignores/sb/images/' + parameter.id,
- method: 'PUT',
- data: parameter
- })
- }
- /**
- * 添加报修
- */
- export function addRepairApplicationFormIgnores (parameter) {
- return http({
- url: '/ignores/repair/add',
- method: 'POST',
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json;charset=UTF-8'
- },
- data: parameter
- })
- }
- /**
- * page func
- * parameter: { }
- * @param parameter
- * @returns {*}
- */
- export function getSbTaskIgnores (parameter) {
- return http({
- url: '/ignores/sb/task2/' + parameter.id,
- method: 'get',
- headers: {
- 'Content-Type': 'application/json;charset=UTF-8'
- }
- })
- }
- // /**
- // * page func
- // * parameter: { }
- // * @param parameter
- // * @returns {*}
- // */
- // export function getSbTaskIgnores (parameter) {
- // return http({
- // url: '/ignores/sb/task/' + parameter.id,
- // method: 'get',
- // headers: {
- // 'Content-Type': 'application/json;charset=UTF-8'
- // }
- // })
- // }
- export function getCheckJobPageIgnores (parameter) {
- return http({
- url: '/ignores/check/sb/jobs/page?' + stringify(parameter),
- method: 'get',
- headers: {
- 'Content-Type': 'application/json;charset=UTF-8'
- }
- })
- }
- export function fetchCheckJobIgnores (parameter) {
- return http({
- url: '/ignores/check/jobs/' + parameter.id,
- method: 'get',
- headers: {
- 'Content-Type': 'application/json;charset=UTF-8'
- }
- })
- }
- export function executeJobIgnores (parameter) {
- return http({
- url: '/ignores/check/jobs/execute',
- method: 'PUT',
- data: parameter
- })
- }
- export function finishJobIgnores (parameter) {
- return http({
- url: '/ignores/check/jobs/finish',
- method: 'PUT',
- data: parameter
- })
- }
- /**
- * 添加设备状态变更记录
- */
- export function addSbStatusLogIgnores (parameter) {
- return http({
- url: '/ignores/sb/status-logs',
- method: 'POST',
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json;charset=UTF-8'
- },
- data: parameter
- })
- }
- export function getCheckJobDetail (parameter) {
- return http({
- url: '/check/jobs/getCheckJobVO/detail?' + stringify(parameter),
- method: 'get',
- headers: {
- 'Content-Type': 'application/json;charset=UTF-8'
- }
- })
- }
- export function getCheckJob (parameter) {
- return http({
- url: '/check/jobs/getCheckJobVO?' + stringify(parameter),
- method: 'get',
- headers: {
- 'Content-Type': 'application/json;charset=UTF-8'
- }
- })
- }
|