|
|
|
@ -47,6 +47,7 @@ |
|
|
|
|
<view>暂无动态</view> |
|
|
|
|
</view> |
|
|
|
|
<view |
|
|
|
|
v-if="userInfo.user_type == 40" |
|
|
|
|
id="publish" |
|
|
|
|
class="publish" |
|
|
|
|
:style="{'left': left === 0 ? '626rpx' : left + 'px', 'top': top === 0 ? 'calc(100% - 300rpx)' : top + 'px'}" |
|
|
|
@ -64,6 +65,10 @@ |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import * as Api from '@/api/squareDynamic/index.js' |
|
|
|
|
import { |
|
|
|
|
checkLogin |
|
|
|
|
} from '@/core/app' |
|
|
|
|
import * as UserApi from '@/api/user'; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
components: { |
|
|
|
@ -89,6 +94,8 @@ |
|
|
|
|
windowHeight: 0, |
|
|
|
|
isMove: true, |
|
|
|
|
edge: 20, |
|
|
|
|
userInfo: {}, |
|
|
|
|
isLogin: false, |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
@ -125,8 +132,45 @@ |
|
|
|
|
this.page = 1; |
|
|
|
|
this.dynamicList = []; |
|
|
|
|
this.getDynamicList(); |
|
|
|
|
if (uni.getStorageSync("userInfo").user_id) { |
|
|
|
|
this.isLogin = true |
|
|
|
|
this.onRefreshPage() |
|
|
|
|
} else { |
|
|
|
|
this.userInfo = {} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
// 刷新页面 |
|
|
|
|
onRefreshPage() { |
|
|
|
|
this.isLogin = checkLogin() |
|
|
|
|
console.log(this.isLogin, '是否登录') |
|
|
|
|
// 获取页面数据 |
|
|
|
|
this.getUserInfo(); |
|
|
|
|
}, |
|
|
|
|
// 获取当前用户信息 |
|
|
|
|
getUserInfo() { |
|
|
|
|
const that = this |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
!that.isLogin ? resolve(null) : UserApi.info({}, { |
|
|
|
|
load: false |
|
|
|
|
}) |
|
|
|
|
.then(result => { |
|
|
|
|
let data = result.data.userInfo |
|
|
|
|
|
|
|
|
|
that.userInfo = data |
|
|
|
|
uni.setStorageSync('userInfo', that.userInfo) |
|
|
|
|
resolve(that.userInfo) |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
if (err.result && err.result.status == 401) { |
|
|
|
|
that.isLogin = false |
|
|
|
|
resolve(null) |
|
|
|
|
} else { |
|
|
|
|
reject(err) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
async getDynamicList() { |
|
|
|
|
if (this.loading || this.finished) { |
|
|
|
|
return; |
|
|
|
|