提交 233715c0 authored 作者: 王鹏飞's avatar 王鹏飞

优化

上级 db504aba
VUE_APP_BASE_API= VUE_APP_BASE_API=https://alumni.ezijing.com
VUE_APP_WECHAT_REDIRECT_URL= VUE_APP_WECHAT_REDIRECT_URL=https://passport.ezijing.com/rest/wechat/oauth-callback
\ No newline at end of file
<template> <template>
<div class="list"> <div class="list">
<van-list <van-list v-model="loading" :finished="finished" @load="onLoad" v-if="list.length">
v-model="loading"
:finished="finished"
@load="onLoad"
v-if="list.length"
>
<activity-item <activity-item
v-for="(item, index) in list" v-for="(item, index) in list"
:data="item" :data="item"
...@@ -70,8 +65,7 @@ export default { ...@@ -70,8 +65,7 @@ export default {
}) })
}, },
onLoad() { onLoad() {
this.requestParams.offset = this.requestParams.offset = this.requestParams.offset + this.requestParams.limit
this.requestParams.offset + this.requestParams.limit
this.getList() this.getList()
}, },
// 刷新 // 刷新
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
</div> </div>
<slot name="member-before" :user="data"></slot> <slot name="member-before" :user="data"></slot>
<div class="member-item-content"> <div class="member-item-content">
<h4>{{ data.nickname || data.personal_name }}</h4> <h4>{{ data.personal_name }}</h4>
<p>{{ data.class_name }}</p> <p>{{ data.class_name }}</p>
</div> </div>
<slot name="member-after" :user="data"></slot> <slot name="member-after" :user="data"></slot>
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
<input <input
type="search" type="search"
class="search-input" class="search-input"
:class="classes"
:placeholder="placeholder" :placeholder="placeholder"
v-model="currentValue" v-model="currentValue"
v-bind="$attrs" v-bind="$attrs"
...@@ -20,7 +19,7 @@ export default { ...@@ -20,7 +19,7 @@ export default {
props: { props: {
value: String, value: String,
focus: { type: Boolean, default: false }, focus: { type: Boolean, default: false },
placeholder: { type: String, default: '' } placeholder: { type: String, default: '搜索校友、活动、组织' }
}, },
data() { data() {
return { return {
...@@ -70,9 +69,9 @@ export default { ...@@ -70,9 +69,9 @@ export default {
width: 100%; width: 100%;
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
background: #f3f4f5 url('~@/assets/img/icon_search.png') no-repeat center center; background: #f3f4f5 url('~@/assets/img/icon_search.png') no-repeat 14px center;
background-size: 15px; background-size: 15px;
padding: 0 20px; padding: 0 20px 0 40px;
border-radius: 15px; border-radius: 15px;
&.is-focus { &.is-focus {
background: #f3f4f5; background: #f3f4f5;
......
...@@ -161,9 +161,13 @@ const router = new VueRouter({ ...@@ -161,9 +161,13 @@ const router = new VueRouter({
mode: 'history', mode: 'history',
base: process.env.BASE_URL, base: process.env.BASE_URL,
routes, routes,
scrollBehavior() { scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
return savedPosition
} else {
return { x: 0, y: 0 } return { x: 0, y: 0 }
} }
}
}) })
export default router export default router
...@@ -4,7 +4,7 @@ import { Notify } from 'vant' ...@@ -4,7 +4,7 @@ import { Notify } from 'vant'
import router from '@/router' import router from '@/router'
import { logout } from '@/api/account' import { logout } from '@/api/account'
const httpRequest = axios.create({ const httpRequest = axios.create({
baseURL: process.env.VUE_APP_BASE_API, // baseURL: process.env.VUE_APP_BASE_API,
timeout: 60000, timeout: 60000,
withCredentials: true, withCredentials: true,
headers: { headers: {
...@@ -16,9 +16,7 @@ const httpRequest = axios.create({ ...@@ -16,9 +16,7 @@ const httpRequest = axios.create({
// 请求拦截 // 请求拦截
httpRequest.interceptors.request.use( httpRequest.interceptors.request.use(
function(config) { function(config) {
if ( if (config.headers['Content-Type'] === 'application/x-www-form-urlencoded') {
config.headers['Content-Type'] === 'application/x-www-form-urlencoded'
) {
config.data = qs.stringify(config.data) config.data = qs.stringify(config.data)
} }
return config return config
......
...@@ -48,7 +48,8 @@ export default { ...@@ -48,7 +48,8 @@ export default {
{ text: '去游学', value: '2' }, { text: '去游学', value: '2' },
{ text: '直播课', value: '3' }, { text: '直播课', value: '3' },
// { text: '找工作', value: '4' }, // { text: '找工作', value: '4' },
{ text: '运动家', value: '5' } { text: '运动家', value: '5' },
{ text: '其他', value: '9' }
] ]
}, },
{ {
......
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
<search-bar readonly @click.native="$router.push({ name: 'search' })"></search-bar> <search-bar readonly @click.native="$router.push({ name: 'search' })"></search-bar>
<!-- banner --> <!-- banner -->
<div class="banner"> <div class="banner">
<img src="img/home_banner.png" /> <van-swipe :autoplay="3000" indicator-color="white">
<van-swipe-item><img src="img/home_banner.png" /></van-swipe-item>
<van-swipe-item><img src="img/home_banner.png" /></van-swipe-item>
</van-swipe>
</div> </div>
<!-- 导航 --> <!-- 导航 -->
<div class="nav"> <div class="nav">
...@@ -60,7 +63,7 @@ export default { ...@@ -60,7 +63,7 @@ export default {
navList: [ navList: [
{ src: 'img/home_nav_01.png', title: '公益行', type: 1 }, { src: 'img/home_nav_01.png', title: '公益行', type: 1 },
{ src: 'img/home_nav_02.png', title: '去游学', type: 2 }, { src: 'img/home_nav_02.png', title: '去游学', type: 2 },
{ src: 'img/home_nav_03.png', title: '直播课', type: 3 }, // { src: 'img/home_nav_03.png', title: '直播课', type: 3 },
// { src: 'img/home_nav_04.png', title: '找工作', type: 4 }, // { src: 'img/home_nav_04.png', title: '找工作', type: 4 },
{ src: 'img/home_nav_04.png', title: '运动家', type: 5 } { src: 'img/home_nav_04.png', title: '运动家', type: 5 }
], ],
......
...@@ -7,12 +7,7 @@ ...@@ -7,12 +7,7 @@
<div class="login-bd"> <div class="login-bd">
<div class="login-form"> <div class="login-form">
<div class="login-form__item"> <div class="login-form__item">
<input <input type="text" class="login-input" placeholder="手机/邮箱/用户名" v-model="ruleForm.account" />
type="text"
class="login-input"
placeholder="手机/邮箱/用户名"
v-model="ruleForm.account"
/>
</div> </div>
<div class="login-form__item"> <div class="login-form__item">
<input <input
...@@ -24,9 +19,7 @@ ...@@ -24,9 +19,7 @@
/> />
</div> </div>
<div class="login-form__item"> <div class="login-form__item">
<van-checkbox v-model="ruleForm.RememberMe" shape="square" <van-checkbox v-model="ruleForm.RememberMe" shape="square">下次自动登录</van-checkbox>
>下次自动登录</van-checkbox
>
<!-- <div class="login-type">验证码登录</div> --> <!-- <div class="login-type">验证码登录</div> -->
</div> </div>
<div class="login-form__item"> <div class="login-form__item">
...@@ -37,9 +30,7 @@ ...@@ -37,9 +30,7 @@
<div class="login-ft"> <div class="login-ft">
<p class="login-tips"> <p class="login-tips">
登录遇到困难?请点击 登录遇到困难?请点击
<span class="forget-password" @click="passwordVisible = true" <span class="forget-password" @click="passwordVisible = true">找回密码</span>
>找回密码</span
>
</p> </p>
</div> </div>
<password v-model="passwordVisible" /> <password v-model="passwordVisible" />
...@@ -125,7 +116,6 @@ export default { ...@@ -125,7 +116,6 @@ export default {
} else { } else {
this.$router.replace('/') this.$router.replace('/')
} }
// this.$router.replace('/')
} else { } else {
this.$notify(response.msg) this.$notify(response.msg)
} }
...@@ -133,10 +123,9 @@ export default { ...@@ -133,10 +123,9 @@ export default {
wechatLogin() { wechatLogin() {
const appId = 'wx451c01d40d090d7a' const appId = 'wx451c01d40d090d7a'
// 回调地址 // 回调地址
const redirectURI = `${ const redirectURI = `${process.env.VUE_APP_WECHAT_REDIRECT_URL}?needCheck=false&identity=friend&redirectUrl=${
process.env.VUE_APP_WECHAT_REDIRECT_URL this.redirectURI || location.origin
}?needCheck=false&identity=friend&redirectUrl=${this.redirectURI || }`
location.origin}`
// 微信的地址 // 微信的地址
const wechatUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURIComponent( const wechatUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURIComponent(
redirectURI redirectURI
...@@ -145,17 +134,41 @@ export default { ...@@ -145,17 +134,41 @@ export default {
location.href = wechatUrl location.href = wechatUrl
}, },
checkWechatLogin() { checkWechatLogin() {
return !!( return !!(Cookies.get('wechat_login_error') || Cookies.get('wechat_login_no_phone_error'))
Cookies.get('wechat_login_error') ||
Cookies.get('wechat_login_no_phone_error')
)
}
}, },
created() { // 显示登录提示框
if (this.isWechat && !this.checkWechatLogin()) { showLoginDialog() {
this.$dialog
.confirm({
title: '您还未登录',
message: '请先登录再进行操作',
cancelButtonText: '暂不登录',
confirmButtonText: '立即登录'
})
.then(() => {
this.wechatLogin() this.wechatLogin()
})
}
},
beforeMount() {
this.$store.dispatch('checkLogin').then(isLogin => {
if (isLogin) {
this.loginSuccess({ code: 0 })
} else {
if (this.isWechat) {
if (!this.checkWechatLogin()) {
this.showLoginDialog()
return
}
const error = Cookies.get('wechat_login_error')
if (error) {
this.$toast(error)
Cookies.remove('wechat_login_error', { domain: '.ezijing.com' })
} }
} }
}
})
}
} }
</script> </script>
<style lang="scss"> <style lang="scss">
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<img :src="user.avatar | avatar" /> <img :src="user.avatar | avatar" />
</div> </div>
<div class="user-content"> <div class="user-content">
<div class="user-content__name">{{ user.nickname || user.personal_name }}</div> <div class="user-content__name">{{ user.personal_name }}</div>
<div class="user-content__info">{{ user.class_name }}</div> <div class="user-content__info">{{ user.class_name }}</div>
</div> </div>
<!-- <div class="user-aside"> <!-- <div class="user-aside">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论