video_collect.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <div class="flex">
  3. <div class="box">
  4. <div class="item">
  5. <img src="~@/assets/quan/icon/new_article.png" alt="">
  6. <div>投稿文章</div>
  7. </div>
  8. <div class="item">
  9. <img src="~@/assets/quan/icon/new_video.png" alt="">
  10. <div>投稿视频</div>
  11. </div>
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. import WxMixin from "@/mixins/wx";
  17. let container;
  18. let page = 1;
  19. export default {
  20. layout: "opacity_header",
  21. async asyncData({
  22. $axios,
  23. params,
  24. req
  25. }) {
  26. let id = params.id;
  27. let headers = req && req.headers;
  28. let res = await $axios.$get(
  29. `/api/user/getUserInfo?id=${id}&page=1&size=10`, {
  30. headers
  31. }
  32. );
  33. if (!res.data) {
  34. return {
  35. title: "的技术圈主页-程序员客栈"
  36. };
  37. }
  38. return {
  39. title: `${res.data.info.nickname}的技术圈主页-程序员客栈`
  40. };
  41. },
  42. head() {
  43. return {
  44. title: this.title,
  45. script: [{
  46. src: "https://res.wx.qq.com/open/js/jweixin-1.2.0.js"
  47. },
  48. {
  49. src: "https://hm.baidu.com/hm.js?18455f493c982100e5a82ec978a8d06e"
  50. }
  51. ]
  52. };
  53. },
  54. mixins: [WxMixin],
  55. data() {
  56. return {
  57. collect_title:'方案名称',
  58. collect_des:'解决方案名称介绍解决方案名称介绍解决方案名称介绍解决方案名称介绍解决方案名称介绍解决方案名称介绍解决方案名称介绍解决方案名称介绍解决方案名称介',
  59. company_info:{
  60. img:'',
  61. name:'公司的名字'
  62. },
  63. baseUrl: "",
  64. jishuBaseUrl: "",
  65. list: [],
  66. currentPage: 1,
  67. isLoading: false,
  68. noMore: false,
  69. idInfo: {},
  70. item: 'heji'
  71. };
  72. },
  73. computed: {
  74. info() {
  75. return this.idInfo.info || {};
  76. },
  77. arts() {
  78. return this.idInfo.topics || [];
  79. }
  80. },
  81. mounted() {
  82. container = this.$refs.container;
  83. this.getDetail();
  84. },
  85. methods: {
  86. changeitem(x) {
  87. this.item = x
  88. },
  89. async getDetail() {
  90. let res = await this.$axios.$get(
  91. `/api/user/getUserInfo?id=${this.$route.params.id}&page=1&size=10`
  92. );
  93. // console.log(res.data)
  94. if (res.data) {
  95. document.title = `${res.data.info.nickname}的技术圈主页-程序员客栈`;
  96. this.idInfo = res.data;
  97. }
  98. },
  99. async handleDelete(topic) {
  100. console.log(topic);
  101. await this.needLogin();
  102. if (!this.idInfo.has_edit_delete_access) {
  103. this.$message.error("你没有该文章的操作权限");
  104. }
  105. this.$confirm(`<p>确认删除该文章吗?</p>`, "提示", {
  106. dangerouslyUseHTMLString: true
  107. })
  108. .then(async () => {
  109. this.$axios
  110. .$post("/api/community/topic/delete", {
  111. topic_id: topic.id
  112. })
  113. .then(() => {
  114. this.$message({
  115. message: "删除成功",
  116. type: "success"
  117. });
  118. this.getDetail();
  119. })
  120. .catch(() => {
  121. this.$message.error("该文章不存在");
  122. setTimeout(() => location.reload(), 1000);
  123. });
  124. })
  125. .catch(err => {
  126. console.log("cancel");
  127. });
  128. },
  129. clickLancer({
  130. id
  131. }) {
  132. this.$router.push(`/cert/type/${id}`);
  133. },
  134. btnDisabled(item) {
  135. return item.btn_name !== "申请认证" || !item.can_click;
  136. },
  137. async getList() {
  138. let id = this.$route.params.id;
  139. this.isLoading = true;
  140. // console.log(id)
  141. let res = await this.$axios.$get(
  142. `/api/user/getUserInfo?id=${id}&page=${this.currentPage}&size=10`, {}, {
  143. neverLogout: true
  144. }
  145. );
  146. this.isLoading = false;
  147. if (res) {
  148. if (this.currentPage === 1 || this.$store.state.isPC) {
  149. this.idInfo = res.data;
  150. } else {
  151. if (!res.data.topics.length) {
  152. this.noMore = true;
  153. return;
  154. }
  155. this.idInfo.topics = [...this.idInfo.topics, ...res.data.topics];
  156. }
  157. }
  158. },
  159. canApply(item) {
  160. return item.end_date && item.is_cert_validate && item.cert_no;
  161. },
  162. configWx() {
  163. try {
  164. let conf = this.$store.state.wxConfig;
  165. wx.ready(function() {
  166. //需在用户可能点击分享按钮前就先调用
  167. wx.config({
  168. debug: true,
  169. appId: conf.appId,
  170. timestamp: conf.timestamp,
  171. nonceStr: conf.nonceStr,
  172. signature: conf.signature,
  173. jsApiList: [
  174. // 所有要调用的 API 都要加到这个列表中
  175. "onMenuShareTimeline", // 分享到朋友圈接口
  176. "onMenuShareAppMessage", // 分享到朋友接口
  177. "onMenuShareQQ", // 分享到QQ接口
  178. "onMenuShareWeibo" // 分享到微博接口
  179. ],
  180. success: function() {
  181. alert("wx.config ok");
  182. },
  183. error: function(d) {
  184. alert("wx.config err:" + JSON.stringify(d));
  185. }
  186. });
  187. wx.updateAppMessageShareData({
  188. title: "开发者资质认证", // 分享标题
  189. desc: "通过平台审核、认证,将获得更多接单机会", // 分享描述
  190. link: location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
  191. imgUrl: "https://stacdn.proginn.com/favicon.ico", // 分享图标
  192. success: function() {
  193. // 设置成功
  194. alert("微信图标设置成功");
  195. }
  196. });
  197. });
  198. } catch (error) {
  199. // alert(error);
  200. }
  201. },
  202. /**
  203. * 修改页码
  204. */
  205. changePagination(page) {
  206. this.currentPage = page;
  207. this.getList();
  208. },
  209. /**
  210. * 点击关注按钮
  211. */
  212. async doFollow() {
  213. // 移动端处理
  214. if (!this.$store.state.isPC && !this.$store.getters.isLogin) {
  215. location.href = "proginn://login";
  216. return;
  217. }
  218. let res = await this.$axios.$post(`/api/user/follow`, {
  219. follow_id: this.$route.params.id
  220. });
  221. if (res && res.data) {
  222. this.idInfo.has_follow = res.data.follow_status ? 1 : 0;
  223. } else {
  224. this.goLogin(1, true);
  225. }
  226. },
  227. /**
  228. * 点击文章
  229. */
  230. clickArt(art, index) {
  231. location.href = `/p/${art.hash_id}`;
  232. },
  233. /**
  234. * 监听滚动
  235. */
  236. containerScroll() {
  237. if (this.isLoading || this.noMore) return;
  238. // PC不监听
  239. if (this.$store.state.isPC) return;
  240. if (
  241. container.scrollHeight - container.scrollTop - container.clientHeight <
  242. 50
  243. ) {
  244. this.currentPage++;
  245. this.getList();
  246. }
  247. }
  248. },
  249. created() {
  250. this.baseUrl = this.$store.state.domainConfig.siteUrl;
  251. this.jishuBaseUrl = this.$store.state.domainConfig.jishuinUrl;
  252. }
  253. };
  254. </script>
  255. <style>
  256. body{
  257. background-color: white;
  258. }
  259. </style>
  260. <style lang='less' scoped>
  261. .flex{
  262. height: 100vh;
  263. display: flex;
  264. flex-direction: column;
  265. justify-content: space-around;
  266. }
  267. .item{
  268. text-align: center;
  269. font-size:0.3rem;
  270. font-family:PingFangSC-Semibold,PingFang SC;
  271. font-weight:600;
  272. color:rgba(34,34,34,1);
  273. line-height:0.35rem;
  274. }
  275. .box{
  276. height:5.5rem;
  277. display: flex;
  278. flex-direction: column;
  279. justify-content: space-around;
  280. }
  281. img{
  282. width:1.88rem;
  283. height:1.88rem;
  284. }
  285. </style>