| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- import { setResources, setConfigs } from "@/store/common";
- import { API_CONFIGS, API_DEL_SESSION, API_GLOBAL_CONFIGS, API_STATIC_RESOURCES, API_SYSTEM_VERSION, API_UPLOAD_SESSION, API_USER_CLIENT, API_USER_LOCATION, APP_VERSION } from "./http/api";
- import { request } from "./http/request";
- import Taro from "@tarojs/taro";
- export const staticResources = () => (dispatch: any) => {
- request({
- url: API_STATIC_RESOURCES, method: 'GET', data: {}
- }).then(res => {
- // resolve(res);
- dispatch(setResources(res));
- })
- }
- export const systemVersion = () => {
- return new Promise((resolve, reject) => {
- var platform = Taro.getSystemInfoSync().platform == 'ios'?'IOS':'ANDROID'
- request({
- url: API_SYSTEM_VERSION + platform, method: 'GET', data: {}
- }).then(res => {
- resolve(res)
- }).catch(e => {
- reject(e)
- })
- })
- }
- export const gobalConfigs = () => (dispatch: any) => {
- request({
- url: API_GLOBAL_CONFIGS, method: 'GET', data: {
- keys: 'time_duration'
- }
- }).then(res => {
- // resolve(res);
- dispatch(setConfigs(res));
- })
- }
- export const clientInfo = (params) => {
- request({
- url: API_USER_CLIENT, method: 'POST', data: {
- ...params
- }
- }).then(res => {
- })
- }
- export const getConfigs = (params) => (dispatch: any) => {
- request({
- url: API_CONFIGS, method: 'GET', data: {
- keys: 'time_duration'
- }
- }).then(res => {
- // resolve(res);
- dispatch(setConfigs(res));
- })
- }
- export const uploadSessionKey = (params) => {
- request({
- url: API_UPLOAD_SESSION, method: 'POST', data: {
- ...params
- }
- }).then(res => {
- })
- }
- export const systemLocation = (params) => {
- return new Promise((resolve, reject) => {
- request({
- url: API_USER_LOCATION, method: 'POST', data: {
- ...params
- }
- }).then(res => {
- resolve(res)
- // dispatch(loginSuccess(res));
- }).catch(e => {
- reject(e)
- })
- })
- }
- export const delSession = (params) => {
- request({
- url: API_DEL_SESSION + '?type=WX_MP', method: 'DELETE', data: {
- ...params
- }
- }).then(_ => {
- Taro.showToast({
- title: '重置成功',
- icon: 'success',
- duration: 2000
- })
- })
- }
|