产品库开发环境已调整好
This commit is contained in:
@@ -24,8 +24,6 @@ export default {
|
|||||||
initDev() {
|
initDev() {
|
||||||
let baseURL = 'http://192.168.1.87:9000'
|
let baseURL = 'http://192.168.1.87:9000'
|
||||||
this.getConfig({baseURL})
|
this.getConfig({baseURL})
|
||||||
|
|
||||||
// this.$store.commit('login', 'bearer 88dd207a-dfe3-4f81-b9bd-e379de427d0b')
|
|
||||||
},
|
},
|
||||||
initConfig() {
|
initConfig() {
|
||||||
if (process.env.NODE_ENV == 'development') this.initDev()
|
if (process.env.NODE_ENV == 'development') this.initDev()
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import store from '../store'
|
import store from '../store'
|
||||||
import util from "./util";
|
|
||||||
|
|
||||||
let instance = axios.create({
|
let instance = axios.create({
|
||||||
|
baseURL: process.env.NODE_ENV === "production" ? "/" : "/lan",
|
||||||
timeout: 600000,
|
timeout: 600000,
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
})
|
})
|
||||||
@@ -23,27 +23,7 @@ instance.interceptors.response.use(res => {
|
|||||||
return res.data
|
return res.data
|
||||||
} else if (res.data.code == 401) {
|
} else if (res.data.code == 401) {
|
||||||
store.commit("logout");
|
store.commit("logout");
|
||||||
let reg = new RegExp('.*code=(.+$)', "g")
|
uni.navigateTo({url: "/pages/login"})
|
||||||
if (reg.test(location.search)) {
|
|
||||||
let code = location.search.replace(reg, '$1')
|
|
||||||
store.commit('bindAccount', {
|
|
||||||
code, then: res => {
|
|
||||||
store.commit("login", [res?.token_type, res?.access_token].join(" ").trim())
|
|
||||||
location.href = location.href.replace('code=' + code, '')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else util.confirm("用户信息验证失效,是否要重新登录?").then(() => {
|
|
||||||
store.commit('redirectCode')
|
|
||||||
// let app = store.state.apps?.find(e => location.href.indexOf(e.path) > -1)
|
|
||||||
// const goto = path => {
|
|
||||||
// location.href = location.origin + "/pages/loading?" + path
|
|
||||||
// }
|
|
||||||
// if (app) {
|
|
||||||
// goto(location.search + `&app=${app.key}`)
|
|
||||||
// } else {
|
|
||||||
// goto(location.search + `#error`)
|
|
||||||
// }
|
|
||||||
}).catch(() => 0)
|
|
||||||
} else {
|
} else {
|
||||||
console.error(res.data.msg || "请求失败!")
|
console.error(res.data.msg || "请求失败!")
|
||||||
return Promise.reject(res.data.msg)
|
return Promise.reject(res.data.msg)
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import mixin from './uview/libs/mixin/mixin';
|
|||||||
Vue.config.productionTip = false;
|
Vue.config.productionTip = false;
|
||||||
Vue.prototype.$store = store;
|
Vue.prototype.$store = store;
|
||||||
//初始化接口工具类
|
//初始化接口工具类
|
||||||
axios.defaults.baseURL = store.state.baseURL;
|
|
||||||
Vue.prototype.$http = axios;
|
Vue.prototype.$http = axios;
|
||||||
Vue.prototype.$cdn = 'https://cdn.cunwuyun.cn/dvcp/h5/';
|
Vue.prototype.$cdn = 'https://cdn.cunwuyun.cn/dvcp/h5/';
|
||||||
Vue.prototype.imgHomeUrl = 'https://cdn.cunwuyun.cn/dvcp/h5/home/';
|
Vue.prototype.imgHomeUrl = 'https://cdn.cunwuyun.cn/dvcp/h5/home/';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "dv_cp_weixin",
|
"name": "dv-sass-app",
|
||||||
"description": "企业微信应用",
|
"description": "企业微信应用库",
|
||||||
"versionName": "1.0.0",
|
"versionName": "1.0.0",
|
||||||
"versionCode": "100",
|
"versionCode": "100",
|
||||||
"transformPx": true,
|
"transformPx": true,
|
||||||
@@ -25,7 +25,16 @@
|
|||||||
},
|
},
|
||||||
"devServer": {
|
"devServer": {
|
||||||
"disableHostCheck": true,
|
"disableHostCheck": true,
|
||||||
"port": "10323"
|
"port": "10323",
|
||||||
|
"proxy": {
|
||||||
|
"/lan": {
|
||||||
|
"target": "http://192.168.1.87:9000",
|
||||||
|
"changeOrigin": true,
|
||||||
|
"pathRewrite": {
|
||||||
|
"^/lan": "/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"optimization": {
|
"optimization": {
|
||||||
"preload": true,
|
"preload": true,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="interview">
|
<div class="AppInterview">
|
||||||
<ai-top-fixed>
|
<ai-top-fixed>
|
||||||
<div flex>
|
<div flex>
|
||||||
<ai-date placeholder="日期选择" mode="range" @change="handleDateSearch"/>
|
<ai-date placeholder="日期选择" mode="range" @change="handleDateSearch"/>
|
||||||
@@ -44,7 +44,8 @@ import AiDate from "../../components/AiDate";
|
|||||||
import AiFixedBtn from "../../components/AiFixedBtn";
|
import AiFixedBtn from "../../components/AiFixedBtn";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "interview",
|
name: "AppInterview",
|
||||||
|
label: "调查走访",
|
||||||
components: {AiFixedBtn, AiDate, AiImage, AiCard, AiTopFixed, AiSelect},
|
components: {AiFixedBtn, AiDate, AiImage, AiCard, AiTopFixed, AiSelect},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -113,7 +114,7 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.interview {
|
.AppInterview {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|||||||
@@ -4,14 +4,11 @@
|
|||||||
<!-- <div class="iconfont iconfont-iconjuminxinxi"/>-->
|
<!-- <div class="iconfont iconfont-iconjuminxinxi"/>-->
|
||||||
<!-- <div class="iconfont iconfont-iconLogo"/>-->
|
<!-- <div class="iconfont iconfont-iconLogo"/>-->
|
||||||
<ai-result v-if="result.tips" v-bind="result"/>
|
<ai-result v-if="result.tips" v-bind="result"/>
|
||||||
<template v-if="isDev">
|
<input v-if="!!$route.query.code" class="codeText" :value="$route.query.code"/>
|
||||||
<input v-if="!!$route.query.code" class="codeText" :value="$route.query.code"/>
|
<div class="codeBtn" @click="handleLogin">去登录</div>
|
||||||
<div class="codeBtn" @click="devGetCode">获取code</div>
|
<div flex class="appsPane wrap">
|
||||||
<div flex class="appsPane wrap">
|
<b v-for="app in apps" :key="app.key" @tap="redirectTo(app.path)">{{ app.name }}</b>
|
||||||
<b v-for="app in apps" :key="app.key" @tap="gotoApp(app.key)">{{ app.name }}</b>
|
</div>
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -28,9 +25,6 @@ export default {
|
|||||||
...mapState(['token', 'apps', 'openUser', 'user']),
|
...mapState(['token', 'apps', 'openUser', 'user']),
|
||||||
currentApp() {
|
currentApp() {
|
||||||
return this.apps.find(e => e.key == this.$route.query.app) || {}
|
return this.apps.find(e => e.key == this.$route.query.app) || {}
|
||||||
},
|
|
||||||
isDev() {
|
|
||||||
return this.$route.hash == "#dev"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -40,49 +34,20 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['getToken', 'getAccount', 'agentSign', 'getUserInfo', 'getCode', 'closeAgent']),
|
...mapActions(['getToken', 'getAccount', 'agentSign', 'getUserInfo', 'getCode', 'closeAgent']),
|
||||||
initAccess() {
|
|
||||||
if (this.$route.hash == "#error" || this.isDev) {
|
|
||||||
return Promise.resolve()
|
|
||||||
} else if (this.$route.hash == "#form") {
|
|
||||||
if (this.openUser?.openId || !!this.$route.query.preview) {
|
|
||||||
this.openForm()
|
|
||||||
} else if (this.$route.query?.code) {
|
|
||||||
this.getToken(this.$route.query?.code)
|
|
||||||
.then(() => this.getUserInfo())
|
|
||||||
.then(() => this.openForm())
|
|
||||||
} else this.getCode(location.href)
|
|
||||||
} else if (this.token) {//获取账号信息
|
|
||||||
return this.getAccount()
|
|
||||||
} else if (this.$route.query?.code) {//获取token
|
|
||||||
return this.getToken(this.$route.query?.code)
|
|
||||||
} else {//获取应用配置
|
|
||||||
this.getCode(location.href)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
openForm() {
|
|
||||||
this.redirectTo("/askForm/askForm")
|
|
||||||
},
|
|
||||||
redirectTo(path) {
|
redirectTo(path) {
|
||||||
let {query, hash} = this.$route
|
let {query, hash} = this.$route
|
||||||
delete query.app
|
delete query.app
|
||||||
uni.redirectTo({
|
uni.navigateTo({
|
||||||
url: `/pages${path}`, success: () => {
|
url: `/pages${path}`, success: () => {
|
||||||
this.$router.push({query, hash})
|
this.$router.push({query, hash})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
gotoApp(app) {
|
handleLogin() {
|
||||||
uni.reLaunch({url: '/pages/loading?app=' + app})
|
uni.navigateTo({url: "./login"})
|
||||||
},
|
|
||||||
devGetCode() {
|
|
||||||
this.getCode(location.origin + '/pages/loading#dev')
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
uni.showLoading({
|
|
||||||
title: "加载中"
|
|
||||||
})
|
|
||||||
uni.hideLoading()
|
|
||||||
this.result = {
|
this.result = {
|
||||||
tips: "欢迎进入开发应用",
|
tips: "欢迎进入开发应用",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,79 +1,51 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="login">
|
<section class="login">
|
||||||
<u-form :model="form" ref="loginForm" label-width="140">
|
<u-form :model="form" ref="loginForm" label-width="140">
|
||||||
<u-form-item label="账号" prop="phone" :errory-type="['message']">
|
<u-form-item label="账号" prop="username">
|
||||||
<u-input v-model="form.phone" placeholder="请输入手机号"/>
|
<u-input v-model="form.username" placeholder="请输入手机号"/>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="验证码" prop="vcode">
|
<u-form-item label="密码" prop="password">
|
||||||
<u-input v-model="form.vcode" placeholder="请输入短信验证码"/>
|
<u-input type="password" v-model="form.password" placeholder="请输入密码"/>
|
||||||
<u-verification-code ref="vcode" secords="60" @change="v=>tips=v"/>
|
|
||||||
<div class="vcode" @tap="$u.debounce(getVCode)">{{ tips }}</div>
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
</u-form>
|
</u-form>
|
||||||
<div bottom>
|
<div bottom>
|
||||||
<u-button type="primary" @tap="handleLogin">绑定并登录</u-button>
|
<u-button type="primary" @tap="handleLogin">登录</u-button>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapActions, mapState} from "vuex";
|
import {mapActions, mapMutations} from "vuex";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "login",
|
name: "login",
|
||||||
inject: ['root'],
|
inject: ['root'],
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['lastPage']),
|
|
||||||
rules() {
|
rules() {
|
||||||
return {
|
return {
|
||||||
phone: [{required: true, message: "请选择分组"}],
|
username: [{required: true, message: "请输入 手机号"}],
|
||||||
vcode: [{required: true, message: "请选择快捷回复类型"}],
|
password: [{required: true, message: "请输入 密码"}],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
form: {},
|
form: {}
|
||||||
tips: ''
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['getCode']),
|
...mapActions(['getToken']),
|
||||||
getVCode() {
|
...mapMutations(['login']),
|
||||||
if (this.form.phone) {
|
|
||||||
this.$http.post("/admin/user/sendCode", null, {
|
|
||||||
withoutToken: 1,
|
|
||||||
params: {phone: this.form.phone}
|
|
||||||
}).then(() => {
|
|
||||||
this.$u.toast("验证已发送!")
|
|
||||||
this.$refs.vcode?.start()
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.$u.toast("请先填写手机号!")
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleLogin() {
|
handleLogin() {
|
||||||
this.$refs.loginForm.validate(v => {
|
this.$refs.loginForm.validate(v => {
|
||||||
if (v) {
|
if (v) {
|
||||||
let params = {
|
this.getToken(this.form).then(() => {
|
||||||
...this.form, code: this.$route.query?.code, then: res => {
|
uni.navigateBack({})
|
||||||
let last = uni.getStorageSync("lastApp")
|
})
|
||||||
if (last) {
|
|
||||||
this.$store.commit("login", [res?.token_type, res?.access_token].join(" ").trim())
|
|
||||||
uni.removeStorageSync("lastApp")
|
|
||||||
// this.root.getCode(location.origin + last)
|
|
||||||
uni.reLaunch({url: "./loading?app=" + last})
|
|
||||||
} else this.$u.toast("绑定成功,请重新打开应用页面!")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.$store.commit("bindAccount", params)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
|
||||||
!this.$route.query?.code && this.getCode()
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$nextTick(() => this.$refs.loginForm?.setRules(this.rules))
|
this.$nextTick(() => this.$refs.loginForm?.setRules(this.rules))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ import Vue from 'vue'
|
|||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import perState from 'vuex-persistedstate'
|
import perState from 'vuex-persistedstate'
|
||||||
import http from '../common/axios'
|
import http from '../common/axios'
|
||||||
|
import CryptoJS from '../utils/crypto-js'
|
||||||
|
|
||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
let agentSignURL = "", apiList = [], agentConfig = {},
|
let agentSignURL = "", apiList = [], agentConfig = {},
|
||||||
apps = [
|
apps = [
|
||||||
{name: '调查走访', key: "interview", path: '/interview/interview'},
|
{name: '调查走访', key: "interview", path: '/interview/AppInterview'},
|
||||||
{name: '工作去向', key: "whereabouts", path: '/whereabouts/whereabouts'},
|
{name: '工作去向', key: "whereabouts", path: '/whereabouts/whereabouts'},
|
||||||
{name: '随手拍', key: "snapshot", path: '/snapshot/snapshot'},
|
{name: '随手拍', key: "snapshot", path: '/snapshot/snapshot'},
|
||||||
{name: '随心问', key: "casuallyask", path: '/casuallyask/casuallyask'},
|
{name: '随心问', key: "casuallyask", path: '/casuallyask/casuallyask'},
|
||||||
@@ -179,21 +180,42 @@ const store = new Vuex.Store({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
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) => {
|
return new Promise((resolve, reject) => {
|
||||||
http.post("/auth/wechatcp/token", {code}, {
|
http.post("/auth/oauth/token", null, {
|
||||||
withoutToken: true,
|
withoutToken: true,
|
||||||
|
params: {
|
||||||
|
...params, grant_type: 'password',
|
||||||
|
password: encryptByDES(params.password)
|
||||||
|
},
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: "Basic d2VjaGF0OndlY2hhdA=="
|
Authorization: "Basic d2VjaGF0OndlY2hhdA=="
|
||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res?.code == 1) {
|
if (res?.access_token) {
|
||||||
// 鉴权失败,需要重新绑定账号
|
|
||||||
} else {
|
|
||||||
state.commit("login", [res?.token_type, res?.access_token].join(" ").trim())
|
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) {
|
getCode(store, url) {
|
||||||
|
|||||||
@@ -6,9 +6,7 @@
|
|||||||
<meta name="viewport"
|
<meta name="viewport"
|
||||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||||
<meta name="format-detection" content="telephone=yes"/>
|
<meta name="format-detection" content="telephone=yes"/>
|
||||||
<title>
|
<title>企微应用产品库</title>
|
||||||
<%= htmlWebpackPlugin.options.title %>
|
|
||||||
</title>
|
|
||||||
<!-- 正式发布的时候使用,开发期间不启用。↓ -->
|
<!-- 正式发布的时候使用,开发期间不启用。↓ -->
|
||||||
<!-- <script src="/h5/touch-emulator.js"></script>
|
<!-- <script src="/h5/touch-emulator.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
6059
src/utils/crypto-js.js
Normal file
6059
src/utils/crypto-js.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user