<div>
  <h1>微信链接生成器</h1>
  <form>
    <label for="coder">课程代码:</label>
    <input type="number" name="coder" id="coder" required>
<pre><code>&lt;label for=&quot;timer&quot;&gt;增加时长(默认值即可):&lt;/label&gt;
&lt;input type=&quot;number&quot; name=&quot;timer&quot; id=&quot;timer&quot; value=&quot;7&quot;&gt;

&lt;label for=&quot;date&quot;&gt;指定时间:&lt;/label&gt;
&lt;input type=&quot;text&quot; name=&quot;date&quot; id=&quot;date&quot; required&gt;

&lt;button type=&quot;button&quot; onclick=&quot;getLink()&quot;&gt;点击生成&lt;/button&gt;

&lt;label for=&quot;link&quot;&gt;生成链接:&lt;/label&gt;
&lt;textarea name=&quot;link&quot; id=&quot;link&quot; cols=&quot;30&quot; rows=&quot;10&quot; readonly&gt;&lt;/textarea&gt;

&lt;button type=&quot;button&quot; onclick=&quot;copyLink()&quot;&gt;复制链接&lt;/button&gt;
</code></pre>
  </form>
  <script>
    const coder = document.getElementById('coder');
    const timer = document.getElementById('timer');
    const link = document.getElementById('link');
    const date = document.getElementById('date');
<pre><code>function getLink() {
  if (!coder.value || !timer.value || !date.value) {
    alert('请输入所有字段');
    return;
  }

  const timeStamp = Math.floor(new Date(date.value).getTime() / 1000) + timer.value * 3600;
  const timeStampMinutes = Math.floor(timeStamp / 60) * 60;
  const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx23e1a7bd726c18b8&amp;redirect_uri=http://www.jsscme.com/hyt/Home/qd.php?gid=${coder.value}-${timeStampMinutes}&amp;response_type=code&amp;scope=snsapi_userinfo&amp;state=STATE#wechat_redirect`;

  link.value = url;
}

function copyLink() {
  link.select();
  document.execCommand('Copy');
  alert('复制成功!');
}
</code></pre>
  </script>
</div>
微信链接生成器 - 快速生成微信链接

原文地址: https://www.cveoy.top/t/topic/lHL1 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录