更新企微投放权限

This commit is contained in:
王博冉
2022-11-11 14:04:00 +08:00
parent c59abc0e5a
commit 252f87bc07
3 changed files with 56 additions and 37 deletions

View File

@@ -278,7 +278,7 @@ const constantRoutes = [
{ {
path: 'enterprise-weChat', path: 'enterprise-weChat',
name: 'enterprise-weChat', name: 'enterprise-weChat',
meta: { showPreview: false, showPublish: false, keepAlive: true, showShare: true }, meta: { showPreview: false, showPublish: false, keepAlive: true, showShare: true, permission:'super_admin_flag' },
component: () => import(/* webpackChunkName: "publish" */ '@/views/Publish/launch-center/launch-task/enterpriseWeChat') component: () => import(/* webpackChunkName: "publish" */ '@/views/Publish/launch-center/launch-task/enterpriseWeChat')
}, },
// { // {
@@ -424,6 +424,16 @@ router.beforeEach((to, from, next) => {
// window.parent.location.href = 'https://yip-uat.dctest.digitalyili.com/login'; // window.parent.location.href = 'https://yip-uat.dctest.digitalyili.com/login';
} }
} }
if(!to.meta.permission) {
next()
return
}
if(!JSON.parse(localStorage.getItem('plantUserInfo'))[to.meta.permission]) {
next({
path:'/error/404',
})
return
}
next() next()
}) })
export default router export default router

View File

@@ -55,6 +55,7 @@ export default defineComponent({
const { data } = await loginIn(); const { data } = await loginIn();
localStorage.setItem("plantUserInfo", JSON.stringify(data)); localStorage.setItem("plantUserInfo", JSON.stringify(data));
localStorage.setItem("plantId", JSON.stringify(data.id)); localStorage.setItem("plantId", JSON.stringify(data.id));
store.commit("common/M_COMMON_SET_USERINFO", JSON.stringify(data));
} catch (error) { } catch (error) {
this.$message.error( this.$message.error(
error.data?.message || error.message || "服务器错误" error.data?.message || error.message || "服务器错误"

View File

@@ -69,44 +69,44 @@
</div> </div>
<div v-else></div> <div v-else></div>
<a-modal <a-modal
v-model:visible="visible" v-model:visible="visible"
wrapClassName="custom-modal" wrapClassName="custom-modal"
width="624px" :width="userInfo.super_admin_flag?'624px':''"
style="height:368px" style="height:368px"
:destroyOnClose="true" :destroyOnClose="true"
:centered="true" :centered="true"
:maskClosable="false" :maskClosable="false"
:footer="null" :footer="null"
@cancel="onCancel" @cancel="onCancel"
title="选择投放类型" title="选择投放类型"
> >
<div class="delivery-type"> <div class="delivery-type">
<div class="wechat-type" :class="isSelected===1?'selected':''" @click="onSelected(1)"> <div class="wechat-type" :class="isSelected===1?'selected':''" @click="onSelected(1)" v-if="userInfo.super_admin_flag">
<div class="title"> <div class="title">
<img :src="require('@/assets/img/business_wechat.png')" alt=""> <img :src="require('@/assets/img/business_wechat.png')" alt="">
<span>企业微信</span> <span>企业微信</span>
</div>
<div class="present">
<p>适用于内部员工调研</p>
<p>可指定多成员多部门多标签参与</p>
</div>
<a-button class="custom-button" style="color: #000;" @click="onNewBuilt(1)">
开始新建
</a-button>
</div> </div>
<div class="wechat-type" :class="isSelected===2?'selected':''" @click="onSelected(2)"> <div class="present">
<div class="title">小程序</div> <p>适用于内部员工调研</p>
<div class="present program"> <p>可指定多成员多部门多标签参与</p>
<p>通过消息中心传递至小程序</p>
<p>请先联系小程序运营人员支持标签参与</p>
</div>
<div class="typeBtn"></div>
<a-button class="custom-button" style="color: #000;" @click="onNewBuilt(2)">
开始新建
</a-button>
</div> </div>
<a-button class="custom-button" style="color: #000;" @click="onNewBuilt(1)">
开始新建
</a-button>
</div> </div>
</a-modal> <div class="wechat-type" :class="isSelected===2?'selected':''" @click="onSelected(2)">
<div class="title">小程序</div>
<div class="present program">
<p>通过消息中心传递至小程序</p>
<p>请先联系小程序运营人员支持标签参与</p>
</div>
<div class="typeBtn"></div>
<a-button class="custom-button" style="color: #000;" @click="onNewBuilt(2)">
开始新建
</a-button>
</div>
</div>
</a-modal>
</div> </div>
</template> </template>
@@ -114,7 +114,7 @@
import launchListEmpty from "../components/launchListEmpty.vue"; import launchListEmpty from "../components/launchListEmpty.vue";
import shareLinks from "../components/shareLinks.vue"; import shareLinks from "../components/shareLinks.vue";
import SubTitle from "@/views/DataAnalyse/components/SubTitle.vue"; import SubTitle from "@/views/DataAnalyse/components/SubTitle.vue";
import { reactive, ref } from "@vue/reactivity"; import { reactive, ref, computed } from "@vue/reactivity";
// import { list } from "../api/api"; // import { list } from "../api/api";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import createQuantityLimit from "../components/createQuantityLimit.vue"; import createQuantityLimit from "../components/createQuantityLimit.vue";
@@ -125,6 +125,7 @@ import { Modal } from "ant-design-vue";
import Pagination, { getPagination } from "@components/Pagination.vue"; import Pagination, { getPagination } from "@components/Pagination.vue";
// import { getAnswerSetting } from "@/views/planetDesign/api/api"; // import { getAnswerSetting } from "@/views/planetDesign/api/api";
import { canPlanetPublish } from "@/Layouts/utils.js"; import { canPlanetPublish } from "@/Layouts/utils.js";
import { useStore } from "vuex";
export default { export default {
components: { components: {
@@ -293,6 +294,12 @@ export default {
const onCancel = () => { const onCancel = () => {
isSelected.value = 0 isSelected.value = 0
} }
const store = useStore();
// 判断超管权限
let userInfo = computed((state) => {
const info = store.state.common.userInfo
return info||{}
});
onMounted(async () => { onMounted(async () => {
await fetchInfo(route.query.sn); await fetchInfo(route.query.sn);
@@ -331,6 +338,7 @@ export default {
onCancel, onCancel,
onNewBuilt, onNewBuilt,
shareRef, shareRef,
userInfo,
}; };
}, },
}; };