Authored by yyq

low version handle

... ... @@ -31,6 +31,22 @@ if (isYohoBuy && !$appLink) {
};
}
function getAppVersion(str, split) {
let res = '';
try {
const match = str.match(new RegExp('(^|)app_version=([^' + split + ']*)(' + split + '|$)'));
if (match) {
res = match.length ? match[2] : '';
}
} catch (e) {
console.log(e);
}
return res;
}
const yoho = {
/**
* 判断是否是 APP
... ... @@ -39,6 +55,7 @@ const yoho = {
isiOS: /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(navigator.userAgent || ''),
isAndroid: /Android/i.test(navigator.userAgent || ''),
isYohoBuy: isYohoBuy,
appVersion: getAppVersion(navigator.userAgent, ';') || getAppVersion(document.cookie, ';'),
/**
* JS 与 APP 共享的对象
... ...
... ... @@ -17,6 +17,7 @@
</template>
<script>
import version from 'utils/version';
import {createNamespacedHelpers} from 'vuex';
const {mapState: mapArticleState, mapActions: mapArticleActions} = createNamespacedHelpers('article');
const {mapActions: mapUserActions} = createNamespacedHelpers('user');
... ... @@ -64,8 +65,9 @@ export default {
const authorState = this.authorStates[`${article.authorUid}-${article.authorType}`] || article;
this.list[0].hide = authorState.hasAttention !== 'Y';
this.list[2].href = `?openby:yohobuy={"action":"go.editPost","params":{"articleId":"${article.articleId}"}}`;
this.list[2].hide = article.isAuthor !== 'Y';
this.list[2].hide = version(this.$yoho.appVersion, '6.9.5') < 0 || article.isAuthor !== 'Y';
this.list[3].hide = article.isAuthor !== 'Y';
this.list = [...this.list];
... ...
... ... @@ -27,6 +27,7 @@
</template>
<script>
import version from 'utils/version';
import YAS from 'utils/yas-constants';
export default {
data() {
... ... @@ -61,7 +62,7 @@ export default {
actionUrl() {
if (this.data.sort === 3) {
return this.data.actionUrl;
} else if (+this.data.authStatus === 2) {
} else if (+this.data.authStatus === 2 && version(this.$yoho.appVersion, '6.9.5') >= 0) {
return `?openby:yohobuy={"action":"go.editPost","params":{"articleId":"${this.data.articleId}"}}`;
}
... ...