index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <div class="homePage" ref="homePage">
  3. <div class="content">
  4. <van-nav-bar class="navBar" left-arrow title="门店拜访" @click-left="onClickLeft" />
  5. <van-tabs
  6. class="myTab"
  7. type="card"
  8. v-model="tabVal"
  9. color="#0057ba"
  10. @click="onClickTabs"
  11. v-if="isGZorJZ">
  12. <van-tab title="提示类" name="-1" v-if="isGZorJZ == 'false'">
  13. <van-pull-refresh v-model="isLoading" @refresh="onRefresh">
  14. <hintTabPage :tabVal="tabVal" ref="hintTabPage"></hintTabPage>
  15. </van-pull-refresh>
  16. </van-tab>
  17. <van-tab title="A类指标" name="0">
  18. <ABtarget :tabVal="tabVal" ref="Atarget"></ABtarget>
  19. </van-tab>
  20. <van-tab title="B类指标" name="1">
  21. <ABtarget :tabVal="tabVal" ref="Btarget"></ABtarget>
  22. </van-tab>
  23. </van-tabs>
  24. <div class="bottomBtn">
  25. <bottomBtn :tabVal="tabVal" ref="bottomBtn"></bottomBtn>
  26. </div>
  27. </div>
  28. <div class="AIIcon" @click="deepseek">
  29. <van-icon class="img" :name="require('@/assets/ai.png')" size="50" />
  30. </div>
  31. <tab-bar></tab-bar>
  32. </div>
  33. </template>
  34. <script>
  35. import { getReportInfo, getDictOption } from '@/api/index';
  36. import hintTabPage from './hintTabPage/index.vue';
  37. import tabBar from '@/components/tabBar';
  38. import ABtarget from './ABtarget.vue';
  39. import { mapState } from 'vuex';
  40. import bottomBtn from './bottomBtn.vue';
  41. import { getTicketFun } from '@/utils/TXApiFun';
  42. export default {
  43. name: 'home',
  44. components: { tabBar, hintTabPage, ABtarget, bottomBtn },
  45. computed: {
  46. ...mapState({
  47. userInfo: (state) => state.user.userInfo,
  48. }),
  49. },
  50. data() {
  51. return {
  52. tabVal: '-1',
  53. hintTabPageIndex: 0,
  54. isGZorJZ: null,
  55. isLoading: false,
  56. };
  57. },
  58. watch: {
  59. // 监听切换用户
  60. 'userInfo.userName': {
  61. handler(val) {
  62. if (val) {
  63. this.getDict();
  64. // this.getReportInfo();
  65. }
  66. },
  67. immediete: true,
  68. },
  69. },
  70. activated() {
  71. if (this.tabVal == '-1') {
  72. // 从其他页面跳转过来如果;要重新获取对应tab数据
  73. // if (this.$refs.hintTabPage) this.$refs.hintTabPage.initData();
  74. } else if (this.tabVal == '0') {
  75. // if (this.$refs.Atarget) this.$refs.Atarget.initData();
  76. } else if (this.tabVal == '1') {
  77. // if (this.$refs.Btarget) this.$refs.Btarget.initData();
  78. }
  79. },
  80. created() {
  81. this.getDict();
  82. },
  83. mounted() {
  84. getTicketFun(['sendChatMessage'], 'agentConfig').then((res) => {
  85. wx.invoke(
  86. 'sendChatMessage',
  87. {
  88. msgtype: 'text', //消息类型,必填
  89. enterChat: true, //为true时表示发送完成之后顺便进入会话,仅移动端3.1.10及以上版本支持该字段
  90. text: {
  91. content: '你好', //文本内容
  92. },
  93. image: {
  94. mediaid: '', //图片的素材id
  95. },
  96. video: {
  97. mediaid: '', //视频的素材id
  98. },
  99. file: {
  100. mediaid: '', //文件的素材id
  101. },
  102. news: {
  103. link: '', //H5消息页面url 必填
  104. title: '', //H5消息标题
  105. desc: '', //H5消息摘要
  106. imgUrl: '', //H5消息封面图片URL
  107. },
  108. },
  109. function (res) {
  110. if (res.err_msg == 'sendChatMessage:ok') {
  111. //发送成功
  112. }
  113. }
  114. );
  115. });
  116. },
  117. methods: {
  118. onRefresh() {
  119. this.getDict(true);
  120. this.isLoading = false;
  121. },
  122. async getDict(isRefresh) {
  123. let postType = this.userInfo.postType;
  124. // postType:人员类型,JZ(家装)、GZ(公装)、YF(应服)、DIY(DIY)
  125. if (postType == 'JZ' || postType == 'GZ') {
  126. localStorage.setItem('isGZorJZ', 'true');
  127. this.isGZorJZ = 'true';
  128. } else {
  129. localStorage.setItem('isGZorJZ', 'false');
  130. this.isGZorJZ = 'false';
  131. }
  132. // 家装或工装不显示提示类tab
  133. this.$nextTick(() => {
  134. // 刷新状态
  135. if (!isRefresh) {
  136. if (this.isGZorJZ == 'true') {
  137. this.tabVal = '0';
  138. } else {
  139. this.tabVal = '-1';
  140. }
  141. }
  142. if (this.tabVal == '-1') {
  143. if (this.$refs.hintTabPage) this.$refs.hintTabPage.initData();
  144. } else if (this.tabVal == '0') {
  145. if (this.$refs.Atarget) this.$refs.Atarget.initData();
  146. } else if (this.tabVal == '1') {
  147. if (this.$refs.Btarget) this.$refs.Btarget.initData();
  148. }
  149. if (this.$refs.bottomBtn) this.$refs.bottomBtn.getReportInfo();
  150. });
  151. },
  152. onClickTabs(val) {
  153. this.$nextTick(() => {
  154. // this.tabVal == '-1' 有watch监听不需要在触发
  155. // if (this.tabVal == '0') {
  156. // if (this.$refs.Atarget) this.$refs.Atarget.initData();
  157. // } else
  158. if (this.tabVal == '1') {
  159. if (this.$refs.Btarget) this.$refs.Btarget.initData();
  160. }
  161. });
  162. },
  163. onClickLeft() {
  164. this.$router.go(-1);
  165. // window.location.href = process.env.VUE_APP_SSB_LINK + "/homeIndex"
  166. },
  167. getReportInfo() {
  168. getReportInfo({ isContent: false }).then((res) => {
  169. if (res.code == 200) {
  170. localStorage.setItem('powerGrade', res.data.positionId);
  171. localStorage.setItem('isDiy', res.data.diy);
  172. localStorage.setItem('uType', res.data.userType);
  173. localStorage.setItem('jzType', res.data.jzType);
  174. localStorage.setItem('customerVisits', res.data.customerManagerVisits);
  175. localStorage.setItem('postType', res.data.postType);
  176. } else {
  177. this.$toast(res.msg);
  178. }
  179. });
  180. },
  181. deepseek() {
  182. window.location.href = 'https://deepseek.nipponpaint.com.cn';
  183. },
  184. },
  185. };
  186. </script>
  187. <style scoped lang="scss">
  188. #app {
  189. width: 100%;
  190. height: 100%;
  191. overflow: hidden;
  192. .bgcolor {
  193. width: 100%;
  194. height: 100%;
  195. .homePage {
  196. height: 100%;
  197. width: 100%;
  198. display: flex;
  199. flex-direction: column;
  200. overflow: hidden;
  201. .content {
  202. flex: 1;
  203. overflow-y: auto;
  204. }
  205. .tabBar {
  206. height: 50px;
  207. }
  208. }
  209. }
  210. }
  211. </style>
  212. <style lang="scss">
  213. .homePage {
  214. display: flex;
  215. flex-direction: column;
  216. .myTab {
  217. /* flex: 1; */
  218. display: flex;
  219. flex-direction: column;
  220. /* position: sticky; */
  221. /* top: 0px; */
  222. .van-tabs__wrap {
  223. position: sticky;
  224. top: 0px;
  225. z-index: 10;
  226. }
  227. .van-tabs__content {
  228. flex: 1;
  229. /* margin-bottom: 50px; */
  230. }
  231. }
  232. .myTab .van-tabs__nav--card {
  233. margin: 0 !important;
  234. border-left: 0;
  235. border-right: 0;
  236. }
  237. .myTab .van-tabs__wrap,
  238. .van-tabs__nav--card {
  239. height: 39px;
  240. }
  241. .myTab .van-tab {
  242. line-height: 40px;
  243. }
  244. .bottomBtn {
  245. margin-bottom: 55px;
  246. }
  247. .AIIcon {
  248. position: fixed;
  249. /* color: #666; */
  250. display: inline-block;
  251. /* box-shadow: 0px 2px 7px -5px #000; */
  252. /* border-radius: 100px; */
  253. /* overflow: hidden; */
  254. right: 14px;
  255. cursor: pointer;
  256. bottom: 96px;
  257. /* background-color: white; */
  258. }
  259. .AIIcon .img {
  260. border-radius: 100px;
  261. float: left;
  262. }
  263. .AIIcon .img .van-icon__image {
  264. border-radius: 100px;
  265. }
  266. }
  267. </style>