share.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. </template>
  3. <script>
  4. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  5. //例如:import 《组件名称》from ‘《组件路径》';
  6. import { getLogin } from "@/api/ajax";
  7. export default {
  8. //import引入的组件需要注入到对象中才能使用
  9. components: { },
  10. props: {},
  11. data() {
  12. //这里存放数据
  13. return {
  14. }
  15. },
  16. //计算属性 类似于data概念
  17. computed: {
  18. },
  19. //监控data中数据变化
  20. watch: {},
  21. //方法集合
  22. methods: {
  23. },
  24. //生命周期 - 创建完成(可以访问当前this实例)
  25. created() {
  26. let MethodName = "/ShopServer/Client/ShareManager/GetShareRecordInfo";
  27. let data = {
  28. id: this.$route.query.share_id
  29. }
  30. getLogin(MethodName, data)
  31. .then((res) => {
  32. if(res.status===1){
  33. if(new Date().getTime()>new Date(res.share_record.share_time_end).getTime()){
  34. this.$message.error('链接已过期')
  35. return
  36. }
  37. localStorage.setItem('share_person_name',res.share_record.person_name)
  38. localStorage.setItem('share_person_touxiang',res.share_record.person_image_url)
  39. this.$router.replace({
  40. path: "/articleShareDetail",
  41. query: {
  42. id: res.share_record.goods_id
  43. },
  44. })
  45. }
  46. })
  47. .catch(() => {
  48. });
  49. },
  50. //生命周期 - 挂载完成(可以访问DOM元素)
  51. mounted() {
  52. },
  53. //生命周期-创建之前
  54. beforeCreated() { },
  55. //生命周期-挂载之前
  56. beforeMount() { },
  57. //生命周期-更新之前
  58. beforUpdate() { },
  59. //生命周期-更新之后
  60. updated() { },
  61. //生命周期-销毁之前
  62. beforeDestory() { },
  63. //生命周期-销毁完成
  64. destoryed() { },
  65. //如果页面有keep-alive缓存功能,这个函数会触发
  66. activated() { }
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. /* @import url(); 引入css类 */
  71. </style>
  72. <style lang="scss">
  73. </style>