产品库开发环境已调整好
This commit is contained in:
@@ -2,11 +2,12 @@ import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
import perState from 'vuex-persistedstate'
|
||||
import http from '../common/axios'
|
||||
import CryptoJS from '../utils/crypto-js'
|
||||
|
||||
Vue.use(Vuex)
|
||||
let agentSignURL = "", apiList = [], agentConfig = {},
|
||||
apps = [
|
||||
{name: '调查走访', key: "interview", path: '/interview/interview'},
|
||||
{name: '调查走访', key: "interview", path: '/interview/AppInterview'},
|
||||
{name: '工作去向', key: "whereabouts", path: '/whereabouts/whereabouts'},
|
||||
{name: '随手拍', key: "snapshot", path: '/snapshot/snapshot'},
|
||||
{name: '随心问', key: "casuallyask", path: '/casuallyask/casuallyask'},
|
||||
@@ -179,21 +180,42 @@ const store = new Vuex.Store({
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
getToken(state, code) {
|
||||
getToken(state, params) {
|
||||
const encryptByDES = password => {
|
||||
let isIos = wx.getSystemInfoSync().system.toUpperCase === 'ios'
|
||||
let key = "thanks,villcloud"
|
||||
let iv = CryptoJS.enc.Latin1.parse(key)
|
||||
let encrypted = CryptoJS.AES.encrypt(password, iv, {
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.ZeroPadding
|
||||
})
|
||||
if (isIos) {
|
||||
return encodeURIComponent(encrypted.toString());
|
||||
} else {
|
||||
return encrypted.toString();
|
||||
}
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
http.post("/auth/wechatcp/token", {code}, {
|
||||
http.post("/auth/oauth/token", null, {
|
||||
withoutToken: true,
|
||||
params: {
|
||||
...params, grant_type: 'password',
|
||||
password: encryptByDES(params.password)
|
||||
},
|
||||
headers: {
|
||||
Authorization: "Basic d2VjaGF0OndlY2hhdA=="
|
||||
}
|
||||
}).then(res => {
|
||||
if (res?.code == 1) {
|
||||
// 鉴权失败,需要重新绑定账号
|
||||
} else {
|
||||
if (res?.access_token) {
|
||||
state.commit("login", [res?.token_type, res?.access_token].join(" ").trim())
|
||||
resolve(state.dispatch("getAccount"))
|
||||
state.dispatch("getAccount")
|
||||
resolve()
|
||||
}
|
||||
}).catch(() => reject())
|
||||
}).catch(err => {
|
||||
uni.showToast({title: err, icon: 'none'})
|
||||
reject()
|
||||
})
|
||||
})
|
||||
},
|
||||
getCode(store, url) {
|
||||
|
||||
Reference in New Issue
Block a user