产品库开发环境已调整好

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

@@ -1,5 +1,5 @@
<template>
<div class="interview">
<div class="AppInterview">
<ai-top-fixed>
<div flex>
<ai-date placeholder="日期选择" mode="range" @change="handleDateSearch"/>
@@ -44,7 +44,8 @@ import AiDate from "../../components/AiDate";
import AiFixedBtn from "../../components/AiFixedBtn";
export default {
name: "interview",
name: "AppInterview",
label: "调查走访",
components: {AiFixedBtn, AiDate, AiImage, AiCard, AiTopFixed, AiSelect},
data() {
return {
@@ -113,7 +114,7 @@ export default {
</script>
<style lang="scss" scoped>
.interview {
.AppInterview {
width: 100%;
min-height: 100%;
box-sizing: border-box;

View File

@@ -4,14 +4,11 @@
<!-- <div class="iconfont iconfont-iconjuminxinxi"/>-->
<!-- <div class="iconfont iconfont-iconLogo"/>-->
<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"/>
<div class="codeBtn" @click="devGetCode">获取code</div>
<div flex class="appsPane wrap">
<b v-for="app in apps" :key="app.key" @tap="gotoApp(app.key)">{{ app.name }}</b>
</div>
</template>
<input v-if="!!$route.query.code" class="codeText" :value="$route.query.code"/>
<div class="codeBtn" @click="handleLogin">去登录</div>
<div flex class="appsPane wrap">
<b v-for="app in apps" :key="app.key" @tap="redirectTo(app.path)">{{ app.name }}</b>
</div>
</section>
</template>
@@ -28,9 +25,6 @@ export default {
...mapState(['token', 'apps', 'openUser', 'user']),
currentApp() {
return this.apps.find(e => e.key == this.$route.query.app) || {}
},
isDev() {
return this.$route.hash == "#dev"
}
},
data() {
@@ -40,49 +34,20 @@ export default {
},
methods: {
...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) {
let {query, hash} = this.$route
delete query.app
uni.redirectTo({
uni.navigateTo({
url: `/pages${path}`, success: () => {
this.$router.push({query, hash})
}
})
},
gotoApp(app) {
uni.reLaunch({url: '/pages/loading?app=' + app})
},
devGetCode() {
this.getCode(location.origin + '/pages/loading#dev')
handleLogin() {
uni.navigateTo({url: "./login"})
}
},
created() {
uni.showLoading({
title: "加载中"
})
uni.hideLoading()
this.result = {
tips: "欢迎进入开发应用",
}

View File

@@ -1,79 +1,51 @@
<template>
<section class="login">
<u-form :model="form" ref="loginForm" label-width="140">
<u-form-item label="账号" prop="phone" :errory-type="['message']">
<u-input v-model="form.phone" placeholder="请输入手机号"/>
<u-form-item label="账号" prop="username">
<u-input v-model="form.username" placeholder="请输入手机号"/>
</u-form-item>
<u-form-item label="验证码" prop="vcode">
<u-input v-model="form.vcode" placeholder="请输入短信验证码"/>
<u-verification-code ref="vcode" secords="60" @change="v=>tips=v"/>
<div class="vcode" @tap="$u.debounce(getVCode)">{{ tips }}</div>
<u-form-item label="码" prop="password">
<u-input type="password" v-model="form.password" placeholder="请输入码"/>
</u-form-item>
</u-form>
<div bottom>
<u-button type="primary" @tap="handleLogin">绑定并登录</u-button>
<u-button type="primary" @tap="handleLogin">登录</u-button>
</div>
</section>
</template>
<script>
import {mapActions, mapState} from "vuex";
import {mapActions, mapMutations} from "vuex";
export default {
name: "login",
inject: ['root'],
computed: {
...mapState(['lastPage']),
rules() {
return {
phone: [{required: true, message: "请选择分组"}],
vcode: [{required: true, message: "请选择快捷回复类型"}],
username: [{required: true, message: "请输入 手机号"}],
password: [{required: true, message: "请输入 密码"}],
}
}
},
data() {
return {
form: {},
tips: ''
form: {}
}
},
methods: {
...mapActions(['getCode']),
getVCode() {
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("请先填写手机号!")
}
},
...mapActions(['getToken']),
...mapMutations(['login']),
handleLogin() {
this.$refs.loginForm.validate(v => {
if (v) {
let params = {
...this.form, code: this.$route.query?.code, then: res => {
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)
this.getToken(this.form).then(() => {
uni.navigateBack({})
})
}
})
}
},
created() {
!this.$route.query?.code && this.getCode()
},
mounted() {
this.$nextTick(() => this.$refs.loginForm?.setRules(this.rules))
}