整合企微token变量
This commit is contained in:
@@ -18,7 +18,7 @@ export default {
|
|||||||
onPageNotFound() {
|
onPageNotFound() {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['token', 'user']),
|
...mapState(['user']),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(['initWaterMarker', 'logout', 'getConfig', 'setApps']),
|
...mapMutations(['initWaterMarker', 'logout', 'getConfig', 'setApps']),
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['user', 'token']),
|
...mapState(['user']),
|
||||||
showDetail() {
|
showDetail() {
|
||||||
return !!this.$route.query?.id && this.access
|
return !!this.$route.query?.id && this.access
|
||||||
},
|
},
|
||||||
@@ -40,11 +40,11 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['getCode', 'getToken']),
|
...mapActions(['getCode', 'getToken']),
|
||||||
checkAccess() {
|
checkAccess(review) {
|
||||||
let {corpId, code, suiteId, id} = this.$route.query
|
let {code, suiteId, id} = this.$route.query
|
||||||
if (this.isPreview) {
|
if (this.isPreview) {
|
||||||
this.access = true
|
this.access = true
|
||||||
} else if (!!this.token) {
|
} else if (!!this.user.token) {
|
||||||
this.$http.post("/app/appquestionnairetemplate/commitCheck", null, {
|
this.$http.post("/app/appquestionnairetemplate/commitCheck", null, {
|
||||||
params: {id}
|
params: {id}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
@@ -57,12 +57,10 @@ export default {
|
|||||||
this.err = err
|
this.err = err
|
||||||
})
|
})
|
||||||
} else if (code) {
|
} else if (code) {
|
||||||
this.getToken({code, corpId, suiteId, isAppForm: true}).then(() => {
|
this.getToken({code, suiteId}).then(() => this.checkAccess(true))
|
||||||
let {query, path, hash} = this.$route
|
} else if (!review) this.getCode()
|
||||||
delete query.code
|
else this.err = "登录失败!"
|
||||||
this.root.goto({query, path, hash})
|
|
||||||
})
|
|
||||||
} else this.getCode()
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export default {
|
|||||||
name: "formDetail",
|
name: "formDetail",
|
||||||
inject: {root: {}},
|
inject: {root: {}},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['openUser', 'token']),
|
...mapState(['openUser']),
|
||||||
isExam() {
|
isExam() {
|
||||||
return this.form?.type == 1
|
return this.form?.type == 1
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export default {
|
|||||||
name: "AppCreditPoints",
|
name: "AppCreditPoints",
|
||||||
appName: "我的积分",
|
appName: "我的积分",
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['user', 'token'])
|
...mapState(['user'])
|
||||||
},
|
},
|
||||||
components: {SysUserIntegral, userRank, familyRank},
|
components: {SysUserIntegral, userRank, familyRank},
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ export default {
|
|||||||
name: "userRank",
|
name: "userRank",
|
||||||
appName: "个人积分",
|
appName: "个人积分",
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['user', 'token'])
|
...mapState(['user'])
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
showDetail: { //true 积分明细 false积分排行
|
showDetail: { //true 积分明细 false积分排行
|
||||||
|
|||||||
@@ -27,14 +27,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import {mapActions, mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "sysUserIntegral",
|
name: "sysUserIntegral",
|
||||||
appName: "员工积分",
|
appName: "员工积分",
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['user', 'token']),
|
...mapState(['user'])
|
||||||
...mapActions(['selectEnterpriseContact'])
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ export default {
|
|||||||
name: "userRank",
|
name: "userRank",
|
||||||
appName: "个人积分",
|
appName: "个人积分",
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['user', 'token'])
|
...mapState(['user'])
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
showDetail: { //true 积分明细 false积分排行
|
showDetail: { //true 积分明细 false积分排行
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ import { mapState, mapActions } from 'vuex'
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'newsDetail',
|
name: 'newsDetail',
|
||||||
computed: {
|
|
||||||
...mapState(['token'])
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isShowComment: false,
|
isShowComment: false,
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ export default {
|
|||||||
name: "AppOnlineAnswer",
|
name: "AppOnlineAnswer",
|
||||||
appName: "党史题库",
|
appName: "党史题库",
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["user", "token"]),
|
...mapState(["user"]),
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ export default {
|
|||||||
name: "AppPartyHistoryEducation",
|
name: "AppPartyHistoryEducation",
|
||||||
appName: "党员学习",
|
appName: "党员学习",
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["user", "token"]),
|
...mapState(["user"]),
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import { mapState } from "vuex";
|
|||||||
export default {
|
export default {
|
||||||
name: "home",
|
name: "home",
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["user", "token"]),
|
...mapState(["user"]),
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import { mapState } from "vuex";
|
|||||||
export default {
|
export default {
|
||||||
name: "home",
|
name: "home",
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["user", "token"]),
|
...mapState(["user"]),
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -12,9 +12,6 @@
|
|||||||
import { mapState } from "vuex";
|
import { mapState } from "vuex";
|
||||||
export default {
|
export default {
|
||||||
name: "home",
|
name: "home",
|
||||||
computed: {
|
|
||||||
...mapState(["user", "token"]),
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tabList: ['全部', '一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
|
tabList: ['全部', '一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
|
||||||
|
|||||||
@@ -18,9 +18,6 @@
|
|||||||
import { mapState } from "vuex";
|
import { mapState } from "vuex";
|
||||||
export default {
|
export default {
|
||||||
name: "home",
|
name: "home",
|
||||||
computed: {
|
|
||||||
...mapState(["user", "token"]),
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
id: '',
|
id: '',
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import { mapState } from "vuex";
|
|||||||
export default {
|
export default {
|
||||||
name: "home",
|
name: "home",
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["user", "token"]),
|
...mapState(["user"]),
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import { mapState } from "vuex";
|
|||||||
export default {
|
export default {
|
||||||
name: "home",
|
name: "home",
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["user", "token"]),
|
...mapState(["user"]),
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ instance.interceptors.request.use(config => {
|
|||||||
} else if (/\/project\/police\//.test(location.pathname) || config.module == 'hnjc' || module == "hnjc") {
|
} else if (/\/project\/police\//.test(location.pathname) || config.module == 'hnjc' || module == "hnjc") {
|
||||||
config.baseURL = '/hnjc'
|
config.baseURL = '/hnjc'
|
||||||
config.url = config.url.replace(/(app|auth|admin)\//, "api/")
|
config.url = config.url.replace(/(app|auth|admin)\//, "api/")
|
||||||
} else if (!/^App/.test(module)) {
|
} else if (!/^App/.test(module) && module) {
|
||||||
config.baseURL = `/${module}`
|
config.baseURL = `/${module}`
|
||||||
if (['xaxc'].includes(module)) {
|
if (['xaxc'].includes(module)) {
|
||||||
config.url = config.url.replace(/(app|auth|admin)\//, "api/")
|
config.url = config.url.replace(/(app|auth|admin)\//, "api/")
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const instance = axios.create({
|
|||||||
})
|
})
|
||||||
const getToken = () => {
|
const getToken = () => {
|
||||||
let vuex = uni.getStorageSync("vuex")
|
let vuex = uni.getStorageSync("vuex")
|
||||||
return !!vuex ? JSON.parse(vuex).token : null
|
return !!vuex ? JSON.parse(vuex).user.token : null
|
||||||
}
|
}
|
||||||
const source = axios.CancelToken.source();
|
const source = axios.CancelToken.source();
|
||||||
instance.interceptors.request.use(config => {
|
instance.interceptors.request.use(config => {
|
||||||
|
|||||||
@@ -3,123 +3,16 @@ import Vue from "vue";
|
|||||||
import CryptoJS from "./crypto-js";
|
import CryptoJS from "./crypto-js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录方法
|
* 用户登录信息和方法
|
||||||
*/
|
|
||||||
export const config = {
|
|
||||||
state: () => ({}),
|
|
||||||
mutations: {
|
|
||||||
getConfig(state, params) {
|
|
||||||
for (const key in params) {
|
|
||||||
Vue.set(state, key, params[key])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
agentSign({state, commit}, params) {
|
|
||||||
//授权jssdk在url上使用,并获取corpId
|
|
||||||
let url = window.location.href
|
|
||||||
if (state.agentSignURL == url) {
|
|
||||||
return Promise.resolve()
|
|
||||||
} else {
|
|
||||||
commit("getConfig", {agentSignURL: url})
|
|
||||||
let action = "/app/wxcp/portal/agentSign"
|
|
||||||
if (!!params?.action) {
|
|
||||||
action = params.action
|
|
||||||
delete params.action
|
|
||||||
} else if (!!params?.suiteId) {
|
|
||||||
action = "/app/wxcptp/portal/agentSign"
|
|
||||||
}
|
|
||||||
return http.post(action, null, {
|
|
||||||
withoutToken: true,
|
|
||||||
params: {...params, url}
|
|
||||||
}).then(res => {
|
|
||||||
if (res?.data) {
|
|
||||||
let config = {
|
|
||||||
...params,
|
|
||||||
debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
|
||||||
beta: true,// 必须这么写,否则wx.invoke调用形式的jsapi会有问题
|
|
||||||
corpid: res.data.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
|
|
||||||
agentid: res.data.agentId, // 必填,企业微信的应用id (e.g. 1000247)
|
|
||||||
timestamp: Number(res.data.timestamp), // 必填,生成签名的时间戳
|
|
||||||
nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
|
|
||||||
signature: res.data.signature,// 必填,签名,见 附录-JS-SDK使用权限签名算法
|
|
||||||
...res.data,
|
|
||||||
agentSignURL: url
|
|
||||||
}
|
|
||||||
commit("getConfig", config)
|
|
||||||
return config
|
|
||||||
}
|
|
||||||
}).catch(err => {
|
|
||||||
console.error(err)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getCode({state, dispatch}, tryAgentSign = false) {
|
|
||||||
let {corpid: corpId, suiteId, agentid: agentId} = state, url = location.href, REDIRECT_URI = encodeURIComponent(url), scope = "snsapi_privateinfo"
|
|
||||||
if (/\/AppForm\//.test(location.pathname)) {
|
|
||||||
scope = "snsapi_base"
|
|
||||||
} else if (suiteId) {
|
|
||||||
corpId = suiteId
|
|
||||||
scope = "snsapi_privateinfo"
|
|
||||||
}
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
if (corpId && scope) {
|
|
||||||
let oauthURL = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&agentid=AGENTID#wechat_redirect'
|
|
||||||
.replace(/APPID/g, corpId)
|
|
||||||
.replace(/REDIRECT_URI/g, REDIRECT_URI)
|
|
||||||
.replace(/SCOPE/g, scope)
|
|
||||||
.replace(/AGENTID/g, agentId)
|
|
||||||
console.log(oauthURL)
|
|
||||||
location.replace(oauthURL)
|
|
||||||
} else if (!tryAgentSign) {
|
|
||||||
dispatch("agentSign", {corpId, suiteId}).then(() => dispatch("getCode", true)).then(() => resolve())
|
|
||||||
} else reject("URL缺少必要参数(corpId)")
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getToken({state, commit, dispatch}, params) {
|
|
||||||
const encryptByDES = password => {
|
|
||||||
let isIos = uni.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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let {module, code} = params, action = "/auth/oauth/token"
|
|
||||||
if (!!code) {
|
|
||||||
action = "/auth/wechatcp/token"
|
|
||||||
}
|
|
||||||
return http.post(action, params, {
|
|
||||||
withoutToken: true,
|
|
||||||
module,
|
|
||||||
params: {
|
|
||||||
...params, grant_type: 'password',
|
|
||||||
password: encryptByDES(params.password)
|
|
||||||
},
|
|
||||||
headers: {
|
|
||||||
Authorization: "Basic d2VjaGF0OndlY2hhdA=="
|
|
||||||
}
|
|
||||||
}).then(res => {
|
|
||||||
if (res?.access_token) {
|
|
||||||
return [res?.token_type, res?.access_token].join(" ").trim()
|
|
||||||
} else return Promise.reject(res.msg)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 用户登录信息
|
|
||||||
*/
|
*/
|
||||||
export const user = {
|
export const user = {
|
||||||
state: () => ({}),
|
state: () => ({
|
||||||
|
token: ""
|
||||||
|
}),
|
||||||
mutations: {
|
mutations: {
|
||||||
|
setToken(state, token) {
|
||||||
|
state.token = token
|
||||||
|
},
|
||||||
setUser(state, user) {
|
setUser(state, user) {
|
||||||
for (const key in user) {
|
for (const key in user) {
|
||||||
Vue.set(state, key, user[key])
|
Vue.set(state, key, user[key])
|
||||||
@@ -205,6 +98,44 @@ export const user = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
getToken({commit, dispatch}, params) {
|
||||||
|
const encryptByDES = password => {
|
||||||
|
let isIos = uni.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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let {module, code} = params, action = "/auth/oauth/token"
|
||||||
|
if (!!code) {
|
||||||
|
action = "/auth/wechatcp/token"
|
||||||
|
}
|
||||||
|
return http.post(action, params, {
|
||||||
|
withoutToken: true,
|
||||||
|
module,
|
||||||
|
params: {
|
||||||
|
...params, grant_type: 'password',
|
||||||
|
password: encryptByDES(params.password)
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
Authorization: "Basic d2VjaGF0OndlY2hhdA=="
|
||||||
|
}
|
||||||
|
}).then(res => {
|
||||||
|
if (res?.access_token) {
|
||||||
|
const token = [res?.token_type, res?.access_token].join(" ").trim()
|
||||||
|
commit("setToken", token)
|
||||||
|
return token
|
||||||
|
} else return Promise.reject(res.msg)
|
||||||
|
})
|
||||||
|
},
|
||||||
getAccount({dispatch, commit}, config) {
|
getAccount({dispatch, commit}, config) {
|
||||||
//获取企业微信后台账号信息
|
//获取企业微信后台账号信息
|
||||||
return http.post("/admin/user/detail-phone", null, config).then(res => {
|
return http.post("/admin/user/detail-phone", null, config).then(res => {
|
||||||
@@ -228,7 +159,7 @@ export const user = {
|
|||||||
/**
|
/**
|
||||||
* 企微jssdk功能
|
* 企微jssdk功能
|
||||||
*/
|
*/
|
||||||
let apiList = []
|
let timer = {}
|
||||||
export const wxwork = {
|
export const wxwork = {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
agentSignURL: "",
|
agentSignURL: "",
|
||||||
@@ -247,33 +178,87 @@ export const wxwork = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
injectJWeixin({commit, dispatch, rootState}, ops) {
|
agentSign({state, commit}, params) {
|
||||||
const inject = (jsApiList, config = rootState.config) => new Promise((resolve, reject) => {
|
//授权jssdk在url上使用,并获取corpId
|
||||||
setTimeout(() => {
|
let url = window.location.href
|
||||||
let sdk = wx?.agentConfig ? wx : jWeixin
|
if (state.agentSignURL == url && state.config.corpId) {
|
||||||
|
return Promise.resolve()
|
||||||
|
} else {
|
||||||
|
commit("setAgentSignURL", url)
|
||||||
|
commit("setApiList", [])
|
||||||
|
let action = "/app/wxcp/portal/agentSign"
|
||||||
|
if (!!params?.action) {
|
||||||
|
action = params.action
|
||||||
|
delete params.action
|
||||||
|
} else if (!!params?.suiteId) {
|
||||||
|
action = "/app/wxcptp/portal/agentSign"
|
||||||
|
}
|
||||||
|
return http.post(action, null, {
|
||||||
|
withoutToken: true,
|
||||||
|
params: {...params, url}
|
||||||
|
}).then(res => {
|
||||||
|
if (res?.data) {
|
||||||
|
let config = {
|
||||||
|
...params,
|
||||||
|
debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
||||||
|
beta: true,// 必须这么写,否则wx.invoke调用形式的jsapi会有问题
|
||||||
|
corpId: res.data.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
|
||||||
|
agentId: res.data.agentid, // 必填,企业微信的应用id (e.g. 1000247)
|
||||||
|
timestamp: Number(res.data.timestamp), // 必填,生成签名的时间戳
|
||||||
|
nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
|
||||||
|
signature: res.data.signature,// 必填,签名,见 附录-JS-SDK使用权限签名算法
|
||||||
|
...res.data
|
||||||
|
}
|
||||||
|
commit("setConfig", config)
|
||||||
|
return config
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
console.error(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getCode({state, dispatch}, tryAgentSign = false) {
|
||||||
|
let {corpid: corpId, suiteId, agentid: agentId} = state.config, url = location.href, REDIRECT_URI = encodeURIComponent(url), scope = "snsapi_privateinfo"
|
||||||
|
if (/\/AppForm/.test(location.pathname)) {
|
||||||
|
scope = "snsapi_base"
|
||||||
|
} else if (suiteId) {
|
||||||
|
corpId = suiteId
|
||||||
|
scope = "snsapi_privateinfo"
|
||||||
|
}
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (corpId && scope) {
|
||||||
|
let oauthURL = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&agentid=AGENTID#wechat_redirect'
|
||||||
|
.replace(/APPID/g, corpId)
|
||||||
|
.replace(/REDIRECT_URI/g, REDIRECT_URI)
|
||||||
|
.replace(/SCOPE/g, scope)
|
||||||
|
.replace(/AGENTID/g, agentId)
|
||||||
|
location.replace(oauthURL)
|
||||||
|
} else if (!tryAgentSign && corpId) {
|
||||||
|
dispatch("agentSign", {corpId, suiteId}).then(() => dispatch("getCode", true)).then(() => resolve())
|
||||||
|
} else reject("URL缺少必要参数(corpId)")
|
||||||
|
})
|
||||||
|
},
|
||||||
|
injectJWeixin({state, commit, rootState}, apis) {
|
||||||
|
const inject = (jsApiList) => new Promise((resolve, reject) => {
|
||||||
|
jsApiList = jsApiList || []
|
||||||
|
if (timer.injectJWeixin) {//节流设置,50ms内的多次请求合并到一处
|
||||||
|
clearTimeout(timer.injectJWeixin)
|
||||||
|
jsApiList = [...new Set([...state.apiList, ...jsApiList])]
|
||||||
|
commit("setApiList", jsApiList)
|
||||||
|
}
|
||||||
|
timer.injectJWeixin = setTimeout(() => {
|
||||||
|
const sdk = wx?.agentConfig ? wx : jWeixin
|
||||||
sdk?.agentConfig({
|
sdk?.agentConfig({
|
||||||
...config, jsApiList,
|
...state.config, jsApiList,
|
||||||
success: res => resolve(res),
|
success: res => resolve(res),
|
||||||
fail: err => {
|
fail: err => {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
reject(err)
|
reject(err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, 500)
|
}, 50)
|
||||||
})
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
let {config: {corpId, suiteId}} = rootState
|
|
||||||
dispatch("agentSign", {corpId, suiteId}).then(config => {
|
|
||||||
if (typeof ops == "object") {
|
|
||||||
ops?.map(api => {
|
|
||||||
if (!apiList?.includes(api)) apiList.push(api)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
if (!apiList?.includes(ops)) apiList.push(ops)
|
|
||||||
}
|
|
||||||
inject(apiList, config).then(r => resolve(r)).catch(err => reject(err))
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
return inject(apis)
|
||||||
},
|
},
|
||||||
wxInvoke(state, op) {
|
wxInvoke(state, op) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export default {
|
|||||||
limit: {default: 1000}
|
limit: {default: 1000}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['token']),
|
...mapState(['user']),
|
||||||
wordCount() {
|
wordCount() {
|
||||||
return this.content?.length || 0
|
return this.content?.length || 0
|
||||||
},
|
},
|
||||||
@@ -39,7 +39,7 @@ export default {
|
|||||||
return this.content || this.placeholder
|
return this.content || this.placeholder
|
||||||
},
|
},
|
||||||
isLogin() {
|
isLogin() {
|
||||||
return !!this.token
|
return !!this.user.token
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ export default {
|
|||||||
sourceType: {default: () => ['album', 'camera']}
|
sourceType: {default: () => ['album', 'camera']}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['token']),
|
|
||||||
errorImage() {
|
errorImage() {
|
||||||
return this.$cdn + 'file.png'
|
return this.$cdn + 'file.png'
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const app = new Vue({
|
|||||||
...App
|
...App
|
||||||
});
|
});
|
||||||
let params = {}
|
let params = {}
|
||||||
if (/saas/.test(location.pathname) > -1) {//上架版
|
if (/saas/.test(location.pathname)) {//上架版
|
||||||
params = {action: "/app/wxcptp/portal/agentSign", corpId: "ww596787bb70f08288"}
|
params = {action: "/app/wxcptp/portal/agentSign", corpId: "ww596787bb70f08288"}
|
||||||
}
|
}
|
||||||
if (/AppCountryAlbum/.test(location.pathname)) {//乡村相册版
|
if (/AppCountryAlbum/.test(location.pathname)) {//乡村相册版
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
},
|
},
|
||||||
"devServer": {
|
"devServer": {
|
||||||
"disableHostCheck": true,
|
"disableHostCheck": true,
|
||||||
"port": "10323",
|
"port": "80",
|
||||||
"open": true,
|
"open": true,
|
||||||
"proxy": {
|
"proxy": {
|
||||||
"/lan": {
|
"/lan": {
|
||||||
|
|||||||
@@ -64,14 +64,11 @@ export default {
|
|||||||
module = 'wangge'
|
module = 'wangge'
|
||||||
}
|
}
|
||||||
this.setModule(module)
|
this.setModule(module)
|
||||||
this.getToken({...this.form, module, corpId}).then(token => {
|
this.getToken({...this.form, module, corpId}).then(() => {
|
||||||
if (token) {
|
|
||||||
this.login(token)
|
|
||||||
if (module != 'AppCountryAlbum') {
|
if (module != 'AppCountryAlbum') {
|
||||||
this.getAccount({module})
|
this.getAccount({module})
|
||||||
}
|
}
|
||||||
this.target ? uni.reLaunch({url: this.target}) : uni.navigateBack({})
|
this.target ? uni.reLaunch({url: this.target}) : uni.navigateBack({})
|
||||||
}
|
|
||||||
}).catch(() => 0)
|
}).catch(() => 0)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -93,14 +90,11 @@ export default {
|
|||||||
module = 'wangge'
|
module = 'wangge'
|
||||||
}
|
}
|
||||||
let {code} = this.$route.query
|
let {code} = this.$route.query
|
||||||
this.getToken({code}).then(token => {
|
this.getToken({code}).then(() => {
|
||||||
if (token) {
|
|
||||||
this.login(token)
|
|
||||||
if (module != 'AppCountryAlbum') {
|
if (module != 'AppCountryAlbum') {
|
||||||
this.getAccount({module})
|
this.getAccount({module})
|
||||||
}
|
}
|
||||||
this.target ? uni.reLaunch({url: this.target}) : uni.navigateBack({})
|
this.target ? uni.reLaunch({url: this.target}) : uni.navigateBack({})
|
||||||
}
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.err = err
|
this.err = err
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -91,7 +91,7 @@
|
|||||||
import {mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name:"AppThreeSessions",
|
name: "AppThreeSessions",
|
||||||
appName: "三会一课",
|
appName: "三会一课",
|
||||||
data() {
|
data() {
|
||||||
const currentDate = this.getDate({
|
const currentDate = this.getDate({
|
||||||
@@ -248,7 +248,7 @@ export default {
|
|||||||
},
|
},
|
||||||
toSessionDetail(id, signStatus) {
|
toSessionDetail(id, signStatus) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `../threeSessions/threeSessionsDetail?id=${id}&signStatus=${signStatus}&token=${uni.getStorageSync("token")}`
|
url: `../threeSessions/threeSessionsDetail?id=${id}&signStatus=${signStatus}&token=${this.user.token}`
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
leave() {
|
leave() {
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import {mapState} from "vuex"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -24,10 +26,12 @@ export default {
|
|||||||
isSign: true
|
isSign: true
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(['user'])
|
||||||
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
if (uni.getStorageSync('token')) {
|
if (this.user.token) {
|
||||||
this.meetingId = this.$mp.query.scene
|
this.meetingId = this.$mp.query.scene
|
||||||
// this.meetingId = 'c29aacb54f074c14ab93532e384a6daa'
|
|
||||||
this.getUserInfo()
|
this.getUserInfo()
|
||||||
} else {
|
} else {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {mapState} from "vuex"
|
||||||
export default {
|
export default {
|
||||||
name: "fillLog",
|
name: "fillLog",
|
||||||
data() {
|
data() {
|
||||||
@@ -78,6 +79,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState(['user']),
|
||||||
user() {
|
user() {
|
||||||
return uni.getStorageSync("userInfo");
|
return uni.getStorageSync("userInfo");
|
||||||
},
|
},
|
||||||
@@ -133,6 +135,7 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const {token} = this.user
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
// 从相册选择或相机拍摄
|
// 从相册选择或相机拍摄
|
||||||
sourceType: that.sourceType[that.sourceTypeIndex],
|
sourceType: that.sourceType[that.sourceTypeIndex],
|
||||||
@@ -144,11 +147,6 @@ export default {
|
|||||||
// console.log(res.tempFilePaths)
|
// console.log(res.tempFilePaths)
|
||||||
for (let i = 0; i < that.tempFilePaths.length; i++) {
|
for (let i = 0; i < that.tempFilePaths.length; i++) {
|
||||||
let str = "";
|
let str = "";
|
||||||
let token = uni.getStorageSync("token");
|
|
||||||
// console.log('token',token)
|
|
||||||
let params = {
|
|
||||||
token: token,
|
|
||||||
};
|
|
||||||
// url String 是 开发者服务器 url
|
// url String 是 开发者服务器 url
|
||||||
// files Aarry 否 需要上传的文件列表。使用 files 时,filePath 和 name 不生效。 5+App
|
// files Aarry 否 需要上传的文件列表。使用 files 时,filePath 和 name 不生效。 5+App
|
||||||
// filePath String 是 要上传文件资源的路径。
|
// filePath String 是 要上传文件资源的路径。
|
||||||
|
|||||||
@@ -101,6 +101,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import {mapState} from "vuex"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -122,10 +124,10 @@ export default {
|
|||||||
user: {}
|
user: {}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(['user'])
|
||||||
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
if (!uni.getStorageSync("token")) {
|
|
||||||
uni.setStorageSync("token", options.token)
|
|
||||||
}
|
|
||||||
this.$dict.load('postStatus', 'meetingClassification', 'topicClassification').then(() => {
|
this.$dict.load('postStatus', 'meetingClassification', 'topicClassification').then(() => {
|
||||||
this.id = options.id
|
this.id = options.id
|
||||||
this.signStatus = options.signStatus
|
this.signStatus = options.signStatus
|
||||||
@@ -147,8 +149,7 @@ export default {
|
|||||||
uni.navigateTo({url: `./ylinkMeetingRoom?meetingNum=${this.data.onlineNum}&pwd=${this.data.onlinePwd}`})
|
uni.navigateTo({url: `./ylinkMeetingRoom?meetingNum=${this.data.onlineNum}&pwd=${this.data.onlinePwd}`})
|
||||||
},
|
},
|
||||||
copy() {
|
copy() {
|
||||||
var token = uni.getStorageSync('token')
|
uni.setClipboardData({data: `https://gdpartyh5.cunwuyun.cn/pages/party/threeSessions/threeSessionsDetail?id=${this.id}&signStatus=${this.signStatus}&token=${this.user.token}`});
|
||||||
uni.setClipboardData({data: `https://gdpartyh5.cunwuyun.cn/pages/party/threeSessions/threeSessionsDetail?id=${this.id}&signStatus=${this.signStatus}&token=${token}`});
|
|
||||||
},
|
},
|
||||||
signMeeting() {
|
signMeeting() {
|
||||||
this.$http.post(`/app/appthreemeetinguser/signByMeetingIdAndUserIdForWX?meetingId=${this.data.id}&userId=${this.user.id}`, null, {}).then(res => {
|
this.$http.post(`/app/appthreemeetinguser/signByMeetingIdAndUserIdForWX?meetingId=${this.data.id}&userId=${this.user.id}`, null, {}).then(res => {
|
||||||
@@ -333,7 +334,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sign-end {
|
.sign-end {
|
||||||
padding-left: 150 rpx;
|
padding-left: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-bottom {
|
.btn-bottom {
|
||||||
@@ -360,10 +361,9 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.detail-info {
|
.detail-info {
|
||||||
padding: 16px 0 8px 32px;
|
|
||||||
border-bottom: 2px solid #D8DDE6;
|
border-bottom: 2px solid #D8DDE6;
|
||||||
background-color: #D40A05;
|
background-color: #D40A05;
|
||||||
padding-bottom: 80px;
|
padding: 16px 0 80px 32px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.info-title {
|
.info-title {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['user', 'token']),
|
...mapState(['user']),
|
||||||
showDetail() {
|
showDetail() {
|
||||||
return !!this.$route.query?.id && this.access
|
return !!this.$route.query?.id && this.access
|
||||||
},
|
},
|
||||||
@@ -45,7 +45,7 @@ export default {
|
|||||||
if (this.isPreview) {
|
if (this.isPreview) {
|
||||||
this.access = true
|
this.access = true
|
||||||
} else if (this.access) {
|
} else if (this.access) {
|
||||||
} else if (!!this.token) {
|
} else if (!!this.user.token) {
|
||||||
this.$http.post("/app/appquestionnairetemplate/commitCheck", null, {
|
this.$http.post("/app/appquestionnairetemplate/commitCheck", null, {
|
||||||
params: {id}
|
params: {id}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export default {
|
|||||||
name: "formDetail",
|
name: "formDetail",
|
||||||
inject: {root: {}},
|
inject: {root: {}},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['openUser', 'token']),
|
...mapState(['openUser']),
|
||||||
isExam() {
|
isExam() {
|
||||||
return this.form?.type == 1
|
return this.form?.type == 1
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import * as modules from "../common/modules";
|
|||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
const store = new Vuex.Store({
|
const store = new Vuex.Store({
|
||||||
state: {
|
state: {
|
||||||
token: "",
|
|
||||||
openUser: {},
|
openUser: {},
|
||||||
apps: [],
|
apps: [],
|
||||||
module: ""
|
module: ""
|
||||||
@@ -19,11 +18,7 @@ const store = new Vuex.Store({
|
|||||||
setModule(state, mod) {
|
setModule(state, mod) {
|
||||||
state.module = mod
|
state.module = mod
|
||||||
},
|
},
|
||||||
login(state, token) {
|
|
||||||
state.token = token
|
|
||||||
},
|
|
||||||
logout(state) {
|
logout(state) {
|
||||||
state.token = ""
|
|
||||||
state.openUser = {}
|
state.openUser = {}
|
||||||
state.user = {}
|
state.user = {}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user