This commit is contained in:
yanran200730
2022-06-14 09:00:40 +08:00
4 changed files with 76 additions and 47 deletions

View File

@@ -5,7 +5,7 @@
</div>
<div class="form" v-show="current == 0 || isEdit">
<div class="form-group">
<div class="form-item">
<!-- <div class="form-item">
<div class="form-item__wrapper">
<div class="left">
<i>*</i>
@@ -15,7 +15,7 @@
<AiSelect dict="fpHouseType" v-model="form.houseType"></AiSelect>
</div>
</div>
</div>
</div> -->
<div class="form-item" v-if="!isEdit">
<div class="form-item__wrapper">
<div class="left">
@@ -588,7 +588,7 @@ export default {
methods: {
rules() {
return {
houseType: '请选择户类型',
// houseType: '请选择户类型',
objectType: '请选择监测对象类型',
name: '请输入户主姓名',
idNumber: '请输入身份证号',
@@ -630,8 +630,6 @@ export default {
}
}
if (!this.form.idNumber) {
return this.$u.toast('请输入身份证号')
}

View File

@@ -56,26 +56,28 @@ export default {
submit() {
var url = ''
var params = {
pass: this.pass || '',
opinion: this.opinion,
files: this.filesList,
id: this.id,
riskType: this.riskType,
riskEliminationMethod: this.riskEliminationMethod,
}
pass: this.pass || '',
opinion: this.opinion,
files: this.filesList,
id: this.id,
riskType: this.riskType,
riskEliminationMethod: this.riskEliminationMethod,
}
// 0待纳入、1监测中、2待解除、3已解除、4已驳回
if(this.pass == 1) { // 网格长
if(!this.riskEliminationMethod) {
if(this.status == 1) {
if(!this.riskEliminationMethod) {
return this.$u.toast('请选择风险消除方式')
}
if(this.status == 1) {
url = '/app/apppreventionreturntopoverty/relieve' // 解除
} else if (this.status == 4 || this.status == 3) {
} else if (this.status == 3 || this.status == 4) {
if(!this.riskType) {
return this.$u.toast('请选择风险因素')
}
url = `/app/apppreventionreturntopoverty/examine` // 纳入监测
}
} else { // 网格员
}
if (this.pass == '') { // 网格员
if(this.status == '0' || this.status == '3' || this.status == '4') {
if(!this.riskType) {
return this.$u.toast('请选择风险因素')
@@ -103,19 +105,19 @@ export default {
var formData = new FormData()
for (let key in params) {
formData.append(key, params[key])
formData.append(key, params[key])
}
this.$http.post(url , formData).then(res => {
if (res.code === 0) {
this.$u.toast('提交成功')
uni.$emit('reload')
setTimeout(() => {
uni.navigateBack({
delta: 2
})
},600)
}
})
if (res.code === 0) {
this.$u.toast('提交成功')
uni.$emit('reload')
setTimeout(() => {
uni.navigateBack({
delta: 2
})
},600)
}
})
}
},
}

View File

@@ -10,12 +10,7 @@ export const config = {
mutations: {
getConfig(state, params) {
for (const key in params) {
Vue.set(state, key, user[key])
}
},
clearConfig(state) {
for (const key in state) {
delete state[key]
Vue.set(state, key, params[key])
}
}
},
@@ -26,7 +21,6 @@ export const config = {
if (state.agentSignURL == url) {
return Promise.resolve()
} else {
commit("clearConfig")
commit("getConfig", {agentSignURL: url})
let action = "/app/wxcp/portal/agentSign"
if (!!params?.action) {
@@ -59,18 +53,22 @@ export const config = {
}
},
getCode({state, dispatch}, tryAgentSign = false) {
let {corpId} = state, url = location.href, REDIRECT_URI = encodeURIComponent(url), scope = "snsapi_base"
let {corpid: corpId, suiteId} = state, url = location.href, REDIRECT_URI = encodeURIComponent(url), scope = "snsapi_base"
if (/\/AppForm\//.test(location.search)) {
scope = "snsapi_userinfo"
} else if (suiteId) {
corpId = suiteId
scope = "snsapi_privateinfo"
}
return new Promise((resolve, reject) => {
if (corpId && scope) {
location.replace('https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE#wechat_redirect'
.replace(/APPID/g, cid)
let oauthURL = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE#wechat_redirect'
.replace(/APPID/g, corpId)
.replace(/REDIRECT_URI/g, REDIRECT_URI)
.replace(/SCOPE/g, scope))
.replace(/SCOPE/g, scope)
location.replace(oauthURL)
} else if (!tryAgentSign) {
dispatch("agentSign").then(() => dispatch("getCode", true))
dispatch("agentSign").then(() => dispatch("getCode", true)).then(() => resolve())
} else reject("URL缺少必要参数(corpId)")
})
},
@@ -90,8 +88,11 @@ export const config = {
return encrypted.toString();
}
}
let {module} = params
return http.post("/auth/oauth/token", null, {
let {module, code} = params, action = "/auth/oauth/token"
if (!!code) {
action = "/auth/wechatcp/token"
}
return http.post(action, params, {
withoutToken: true,
module,
params: {
@@ -104,9 +105,7 @@ export const config = {
}).then(res => {
if (res?.access_token) {
return [res?.token_type, res?.access_token].join(" ").trim()
}
}).catch(err => {
uni.showToast({title: err, icon: 'none'})
} else return Promise.reject(res.msg)
})
}
}

View File

@@ -46,7 +46,7 @@ export default {
}
},
methods: {
...mapActions(['getToken','getAccount']),
...mapActions(['getToken', 'getAccount', 'getCode']),
...mapMutations(['login', 'logout']),
handleLogin() {
this.$refs.loginForm.validate(v => {
@@ -61,7 +61,7 @@ export default {
}
this.getToken({...this.form, module, corpId}).then(token => {
this.login(token)
if( module != 'AppCountryAlbum'){
if (module != 'AppCountryAlbum') {
this.getAccount({module})
}
this.target ? uni.reLaunch({url: this.target}) : uni.navigateBack({})
@@ -74,7 +74,37 @@ export default {
}
},
onShow() {
this.handleLogout()
if (/wxwork/.test(navigator.userAgent)) {
//在企微端
if (this.$route.query.code) {
let {name: module, libPath} = this.currentApp,
corpId = 'ww596787bb70f08288'
if (/\/project\/police\//.test(libPath)) {
module = 'hnjc'
} else if (/\/project\/beta\//.test(libPath)) {
corpId = 'ww2a667717a70164f1'
module = 'wangge'
}
let {code} = this.$route.query
this.getToken({code}).then(token => {
if (token) {
this.login(token)
if (module != 'AppCountryAlbum') {
this.getAccount({module})
}
this.target ? uni.reLaunch({url: this.target}) : uni.navigateBack({})
}
}).catch(err => {
this.err = err
})
} else {
this.getCode().catch(err => {
this.err = err
})
}
} else {
this.handleLogout()
}
},
mounted() {
this.$refs.loginForm.setRules(this.rules)