产品库开发环境已调整好

This commit is contained in:
aixianling
2021-11-15 15:53:44 +08:00
parent aa4f0c8837
commit f975d9c7b9
10 changed files with 6130 additions and 127 deletions

View File

@@ -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) {