index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. <template>
  2. <div :class="{kaifainDetailMobile: mobile, kaifainDetail: !mobile}">
  3. <div class="kaifain-view">
  4. <Topnav :fixed="topnavFixed" @publish-click="isShowToast=true" />
  5. </div>
  6. <div class="topArea" :style="{backgroundImage: 'url(' + detail.bg_image + ')' }">
  7. <div class="topContent" :class="{noneMobileAPP: true}">
  8. <h1 class="title">{{detail.title}}</h1>
  9. <div class="desc">{{detail.description}}</div>
  10. <div class="btn" @click="isShowToast=true" v-if="!mobile">
  11. <p>咨询了解</p>
  12. </div>
  13. <div class="companyInfo" @click="jumpToCompany">
  14. <div class="left">
  15. <div class="userImage" :class="calcUserVip">
  16. <img :src="detail.company_info && detail.company_info.logo" alt />
  17. </div>
  18. <p
  19. class="cname"
  20. :class="{status: detail.company_info && Number(detail.company_info.company_verify) === 2}"
  21. >{{detail.company_info && detail.company_info.name}}</p>
  22. </div>
  23. <div class="right">
  24. <div class="icon"></div>
  25. </div>
  26. </div>
  27. </div>
  28. <div class="bgChange" @click="isShowToastChange=true" v-if="isSelf"></div>
  29. </div>
  30. <div class="contentArea">
  31. <div class="amountArea">
  32. <div class="left">
  33. <!--todo 观看数据,收藏数据 -->
  34. <div class="watchNum">{{detail.pv || 0}}</div>
  35. <div
  36. class="collectNum"
  37. :class="{isOk: detail.has_collected}"
  38. @click="collectKaifainHandler"
  39. >{{detail.collectCount || 0}}</div>
  40. </div>
  41. <div class="right" v-if="detail.is_author">
  42. <div
  43. class="setTop"
  44. :class="{isOk: Number(detail.is_top) !== 0}"
  45. @click="setToTopHandler"
  46. >{{Number(detail.is_top) !== 0 ? "已置顶" : "列表置顶"}}</div>
  47. </div>
  48. </div>
  49. <!-- <div class="bannerSelect">
  50. <div class="cell selected">方案首页</div>
  51. <a
  52. class="cell"
  53. :href="jishuinUrl + '/c/' + detail.hash_id"
  54. >文章({{detail.jishuin && detail.jishuin.topics_count || 0}})</a>
  55. <a
  56. class="cell"
  57. :href="jishuinUrl + '/c/' + detail.hash_id + '?type=video'"
  58. >视频({{detail.jishuin && detail.jishuin.videos_count || 0}})</a>
  59. </div> -->
  60. <div class="introArea">
  61. <div class="title" v-if="!mobile">
  62. <p class="word">方案介绍</p>
  63. <p class="line"></p>
  64. </div>
  65. <div class="introContent ql-editor" v-html="detail.detail" style="padding-left: 0;"></div>
  66. </div>
  67. <div class="caseListArea" v-if="haveCase">
  68. <div class="title">
  69. <p class="word">成功案例</p>
  70. <p class="line"></p>
  71. </div>
  72. <div class="list">
  73. <nuxt-link
  74. class="cell"
  75. v-for="item in detail.successful_case"
  76. :key="item.id"
  77. :to="`/d/${item.hash_id}`"
  78. target="_blank"
  79. :title="item.name"
  80. >
  81. <div class="left">
  82. <img :src="item.logo" alt />
  83. </div>
  84. <div class="right">
  85. <div class="top">
  86. <div class="bTitle" v-if="!mobile">{{item.title}}</div>
  87. <div class="bStitle">【{{detail.title}}】帮助【{{item.title}}】提供解决方案</div>
  88. </div>
  89. <div class="bottom" @click.stop="openPDF(item)" v-if="!mobile">
  90. <div class="icon" />
  91. <div class="word">{{item.title}}.pdf</div>
  92. </div>
  93. </div>
  94. </nuxt-link>
  95. </div>
  96. </div>
  97. </div>
  98. <div class="mobileBottomArea" v-if="mobile">
  99. <div
  100. class="mobileLeftChat"
  101. v-if="calcUserVip.vip1 || calcUserVip.vip3"
  102. @click="onChatForKaifain"
  103. >
  104. <div class="icon chat"></div>
  105. <div class="word">和TA聊一聊</div>
  106. </div>
  107. <div class="mobileBottomBtn" @click="isShowToast=true">
  108. <p>咨询了解</p>
  109. </div>
  110. </div>
  111. <ConnectUs
  112. :source="'开发屋详情'"
  113. :isShowToast="isShowToast"
  114. @close="isShowToast=false"
  115. :sourceId="tid"
  116. ></ConnectUs>
  117. <KaifainFooter style="margin-top: 30px;" :data="footer" />
  118. <ChangeBgImage
  119. :pId="detail.id"
  120. :isShowToast="isShowToastChange"
  121. @close="isShowToastChange=false"
  122. @ok="getDetail"
  123. ></ChangeBgImage>
  124. </div>
  125. </template>
  126. <script lang="ts">
  127. import "quill/dist/quill.core.css";
  128. import "quill/dist/quill.snow.css";
  129. import ConnectUs from "@/components/common/connectUsKaifain.vue";
  130. import ChangeBgImage from "@/components/kaifain/ChangeBgImage.vue";
  131. import KaifainFooter from "@/components/SeoFooter.vue";
  132. import { HashIDUtil, GenType } from "../../../../plugins/genHashId";
  133. import Topnav from '@/kaifain_v2/components/Topnav.vue'
  134. import { genDocumentFooterData } from '@/kaifain_v2/helpers/seoHelper'
  135. export default {
  136. layout: "opacity_header",
  137. components: { ConnectUs, KaifainFooter, ChangeBgImage, Topnav },
  138. head() {
  139. const { title = '' } = this.detail || {}
  140. let docTitle = title ? `${title}介绍,功能,开发解决方案-开发屋` : '开发屋-开发解决方案'
  141. if (this.$deviceType.app) {
  142. docTitle = title
  143. }
  144. return {
  145. title: docTitle,
  146. meta: [
  147. {
  148. name: "keywords",
  149. content: title,
  150. },
  151. {
  152. name: "descrption",
  153. content: `${title}详细介绍,包括不限于功能、接口、企业开发着对接和布局${title}的方法和详细的开发文档说明。`,
  154. },
  155. {
  156. name: "h1",
  157. content: `${title}`,
  158. },
  159. ],
  160. bodyAttrs: {
  161. class: 'non-rem'
  162. }
  163. };
  164. },
  165. async asyncData(ctx) {
  166. const params = ctx
  167. let { tid: newTid } = params.app.context.route.params || {};
  168. let tid = newTid.replace(".html", "");
  169. if (process.server) {
  170. const { path, fullPath } =
  171. (params.app.context && params.app.context.route) || {};
  172. //将id都转到hashId
  173. if (tid && tid.length !== 12 && Number(tid) === Number(tid)) {
  174. let genHashId = new HashIDUtil();
  175. let nowId = genHashId.getHashID(GenType.TYPE_SERVICE_PROVIDER, tid);
  176. let path1 = path.replace(newTid, nowId);
  177. let reditUrl = path.replace(path, path1);
  178. params.redirect(301, reditUrl);
  179. return;
  180. }
  181. }
  182. let errInfo = "";
  183. let detail = {};
  184. let res = await params.$axios.post("/api/kaifawu/get_provider?id=" + tid, {
  185. id: tid,
  186. });
  187. if (Number(res.data.status) === 1) {
  188. let data = res.data.data;
  189. if (!data) {
  190. return;
  191. }
  192. if (!Array.isArray(data.successful_case)) {
  193. if (data.successful_case && typeof data.successful_case === "object") {
  194. data.successful_case = [data.successful_case];
  195. } else {
  196. data.successful_case = [];
  197. }
  198. }
  199. tid = data.id;
  200. detail = data || {};
  201. } else {
  202. errInfo = res.data.info;
  203. }
  204. try {
  205. params.store.commit("updateNoneCommonFooter", true);
  206. } catch (e) {
  207. console.log("updateNoneCommonFooter", e);
  208. }
  209. if (!ctx.store.state.kaifain.inited) {
  210. await ctx.store.dispatch('parameters:load')
  211. }
  212. const { classes } = ctx.store.state.kaifain
  213. const footer = genDocumentFooterData({
  214. ctx,
  215. classes
  216. })
  217. let isSelf = false;
  218. try {
  219. let uid = params.store.state.userinfo.uid;
  220. isSelf = Number(uid) === Number(detail.company_info.uid);
  221. } catch (e) {
  222. console.log("kaifaindetaile", e);
  223. }
  224. return {
  225. isSelf,
  226. tid,
  227. detail,
  228. errInfo,
  229. mobile: params.app.$deviceType.isMobile(),
  230. mobileApp: params.app.$deviceType.app,
  231. footer
  232. };
  233. },
  234. data() {
  235. return {
  236. tid: 0,
  237. isShowToast: false,
  238. isShowToastChange: false, //是否展示更换image
  239. jishuinUrl: "",
  240. kaifainUrl: "",
  241. siteUrl: "",
  242. topnavFixed: false,
  243. mobile: false
  244. };
  245. },
  246. created() {
  247. const { kaifainUrl, jishuinUrl, siteUrl } = this.$store.state.domainConfig;
  248. this.kaifainUrl = kaifainUrl;
  249. this.jishuinUrl = jishuinUrl;
  250. this.siteUrl = siteUrl;
  251. },
  252. mounted() {
  253. if (!this.detail || !this.detail.id) {
  254. this.$message.error(this.errInfo);
  255. }
  256. window.addEventListener('scroll', () => {
  257. this.topnavFixed = window.scrollY > 520
  258. })
  259. // this.getDetail()
  260. },
  261. computed: {
  262. haveCase() {
  263. const { successful_case = [] } = this.detail;
  264. return successful_case.length > 0;
  265. },
  266. calcUserVip() {
  267. const { is_vip, vip_type_id } = this.detail || {};
  268. if (is_vip) {
  269. return { ["vip" + vip_type_id]: is_vip };
  270. }
  271. return {};
  272. },
  273. },
  274. methods: {
  275. getDetail() {
  276. this.$axios
  277. .$post("/api/kaifawu/get_provider?id=" + this.tid, { id: this.tid })
  278. .then((res) => {
  279. console.log("refresh", res);
  280. if (Number(res.status) === 1) {
  281. let data = res.data;
  282. if (!data) {
  283. return;
  284. }
  285. if (!Array.isArray(data.successful_case)) {
  286. if (
  287. data.successful_case &&
  288. typeof data.successful_case === "object"
  289. ) {
  290. data.successful_case = [data.successful_case];
  291. } else {
  292. data.successful_case = [];
  293. }
  294. }
  295. console.log("update");
  296. this.detail = data || {};
  297. }
  298. });
  299. },
  300. openPDF(item) {
  301. const { file } = item;
  302. window.open(file, "pdf" + Math.random());
  303. return false;
  304. },
  305. jumpToCompany() {
  306. const { uid } = this.detail || {};
  307. if (this.$deviceType.app) {
  308. location.href = `proginn://resume?uid=${uid}&company=1`;
  309. } else {
  310. location.href = this.siteUrl + `/company/${uid}`;
  311. }
  312. },
  313. /** 与企业方聊天 **/
  314. onChatForKaifain() {
  315. const { id: kafainId, uid, title } = this.detail;
  316. if (!this.$deviceType.app) {
  317. this.$toast("请前往程序员客栈APP操作");
  318. return;
  319. }
  320. location.href = `proginn://recruit/chat?uid=${uid}&title=${encodeURIComponent(
  321. title
  322. )}&url=${encodeURIComponent(location.href)}`;
  323. },
  324. /** 置顶 **/
  325. setToTopHandler() {
  326. const { is_author, is_top, is_vip, vip_type_id, id } = this.detail;
  327. if (!is_author) {
  328. return;
  329. }
  330. // if (Number(is_top)) {
  331. // this.$message.info("您已置顶改方案,无需再次设置!")
  332. // return
  333. // }
  334. //是企业会员
  335. if (is_vip && (vip_type_id === 1 || vip_type_id === 3)) {
  336. this.$axios.post("/api/kaifawu/top", { id }).then((res) => {
  337. if (Number(res.data.status) === 1) {
  338. this.getDetail();
  339. this.$message.success(res.data.data);
  340. }
  341. });
  342. } else {
  343. this.openToast();
  344. }
  345. },
  346. /** 收藏/取消收藏 **/
  347. collectKaifainHandler() {
  348. const { id } = this.detail;
  349. this.$axios
  350. .post("/api/collection_center/create", {
  351. item_id: id,
  352. type: 2,
  353. })
  354. .then((res) => {
  355. //todo 收藏的变量还没接
  356. if (Number(res.data.status) === 1) {
  357. this.detail.has_collected = !this.detail.has_collected;
  358. let msg = this.detail.has_collected ? "收藏成功" : "取消收藏成功";
  359. this.detail.collectCount =
  360. Number(this.detail.collectCount) +
  361. (this.detail.has_collected ? 1 : -1);
  362. this.$message.success(msg);
  363. }
  364. });
  365. },
  366. openToast() {
  367. const h = this.$createElement;
  368. this.$msgbox({
  369. title: "开通会员",
  370. message: h("p", null, [
  371. h("span", null, "开通企业会员,即可置顶解决方案 "),
  372. ]),
  373. showCancelButton: true,
  374. confirmButtonText: "立即开通",
  375. cancelButtonText: "不了谢谢",
  376. beforeClose: (action, instance, done) => {
  377. if (action === "confirm") {
  378. if (this.$deviceType.isMobile()) {
  379. location.href = "/type/vip?activeName=enterprise&current=1";
  380. } else {
  381. location.href = "/type/vip/enterprise";
  382. }
  383. } else {
  384. done();
  385. }
  386. },
  387. }).then((action) => {
  388. this.$message({
  389. type: "info",
  390. message: "action: " + action,
  391. });
  392. });
  393. },
  394. },
  395. };
  396. </script>
  397. <style scope lang="scss">
  398. @import "../../../../assets/css/kaifain/detail.scss";
  399. </style>
  400. <style lang="scss">
  401. @media screen and (max-width: 750px) {
  402. .el-message-box {
  403. width: 95%;
  404. }
  405. }
  406. </style>