index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <view class="body">
  3. <view class="date">
  4. <picker @change="datePickerBindchange" class="pickerdate" end="2999-12-12" mode="date" :start="starttimes">
  5. {{ xin }}
  6. </picker>
  7. <text class="fc99 candt">{{ date }}</text>
  8. </view>
  9. <view class="good">
  10. <view class="title">
  11. <text>宜</text>
  12. </view>
  13. <view class="content">
  14. <view class="content-max" v-for="(item, index) in goodlists" :key="index">
  15. <view class="content-name">{{ item.name }}</view>
  16. <view class="content-txt">{{ item.good }}</view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="split">
  21. <view class="title">
  22. <text>忌</text>
  23. </view>
  24. <view class="content">
  25. <view class="content-max" v-for="(item, index) in splitlists" :key="index">
  26. <view class="content-name">{{ item.name }}</view>
  27. <view class="content-txt">{{ item.bad }}</view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="shupai">
  32. <text class="strongtxt">座位朝向:</text>
  33. <text>面向</text>
  34. <text class="direction">{{ direction }}</text>
  35. <text>写程序,BUG 最少。</text>
  36. </view>
  37. <view class="shupai">
  38. <text class="strongtxt">今日宜饮:</text>
  39. <text>{{ drinks }}</text>
  40. </view>
  41. <view class="shupai">
  42. <text class="strongtxt">女神亲近指数:</text>
  43. <text class="start">{{ stars }}</text>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. var e = require('../../utils/u1.js');
  49. var t = e.drinks;
  50. var a = e.directions;
  51. getApp();
  52. function n(e) {
  53. var t;
  54. switch (e) {
  55. case 1:
  56. t = '星期一';
  57. break;
  58. case 2:
  59. t = '星期二';
  60. break;
  61. case 3:
  62. t = '星期三';
  63. break;
  64. case 4:
  65. t = '星期四';
  66. break;
  67. case 5:
  68. t = '星期五';
  69. break;
  70. case 6:
  71. t = '星期六';
  72. break;
  73. case 0:
  74. t = '星期日';
  75. }
  76. return t;
  77. }
  78. function r(e) {
  79. for (var t = '', a = 0; a < e; ) {
  80. t += '★';
  81. a++;
  82. }
  83. for (; a < 5; ) {
  84. t += '☆';
  85. a++;
  86. }
  87. return t;
  88. }
  89. function i(e, t) {
  90. for (var a = e % 11117, n = 0; n < 100 + t; n++) {
  91. a *= a;
  92. a %= 11117;
  93. }
  94. return a;
  95. }
  96. export default {
  97. data() {
  98. return {
  99. xin: '☰',
  100. date: '',
  101. starttimes: '',
  102. drinks: '',
  103. direction: '',
  104. stars: '',
  105. goodlists: '',
  106. splitlists: ''
  107. };
  108. },
  109. onLoad: function () {
  110. var e = new Date();
  111. var s = 10000 * e.getFullYear() + 100 * (e.getMonth() + 1) + e.getDate();
  112. var o = n(e.getUTCDay());
  113. var u = e.getFullYear();
  114. var c = e.getMonth() + 1;
  115. var d = e.getDate();
  116. this.date='今天是' + u + '年' + c + '月' + d + '日 ' + o;
  117. this.starttimes=u + '-' + c + '-' + d;
  118. this.drinks=l(s, t, 2);
  119. this.direction=a[i(s, 2) % a.length];
  120. this.stars=r((i(s, 6) % 5) + 1);
  121. this.goodlists=g(e, s, 1);
  122. this.splitlists= g(e, s, 0);
  123. },
  124. onShareAppMessage: function () {
  125. return {
  126. title: '程序员老黄历',
  127. desc: '程序员老黄历!',
  128. path: 'pages/index/index'
  129. };
  130. },
  131. methods: {
  132. datePickerBindchange: function (e) {
  133. var s = new Date(e.detail.value);
  134. var o = n(s.getUTCDay());
  135. var u = s.getFullYear();
  136. var c = s.getMonth() + 1;
  137. var d = s.getDate();
  138. var f = 10000 * s.getFullYear() + 100 * (s.getMonth() + 1) + s.getDate();
  139. this.date=u + '年' + c + '月' + d + '日 ' + o;
  140. this.starttimes=u + '-' + c + '-' + d;
  141. this.drinks=l(f, t, 2);
  142. this.direction=a[i(f, 2) % a.length];
  143. this.stars=r((i(f, 6) % 5) + 1);
  144. this.goodlists=g(s, f, 1);
  145. this.splitlists=g(s, f, 0);
  146. }
  147. }
  148. };
  149. var s = e.activities;
  150. var o = e.tools;
  151. var u = e.varNames;
  152. function g(e, t, a) {
  153. for (
  154. var n = [],
  155. r = [],
  156. o = (function (e, t) {
  157. var a = [];
  158. if (
  159. (function (e) {
  160. return 0 == e.getUTCDay() || 6 == e.getUTCDay();
  161. })(e)
  162. ) {
  163. for (var n = 0; n < t.length; n++) {
  164. if (t[n].weekend) {
  165. a.push(t[n]);
  166. }
  167. }
  168. return a;
  169. }
  170. return t;
  171. })(e, s),
  172. u = (i(t, 98) % 3) + 2,
  173. g = (i(t, 87) % 3) + 2,
  174. d = (function (e, t, a) {
  175. for (var n = l(e, t, a), r = 0; r < n.length; r++) {
  176. n[r] = c(e, n[r]);
  177. }
  178. return n;
  179. })(t, o, u + g),
  180. f = 0;
  181. f < u;
  182. f++
  183. ) {
  184. n.push(d[f]);
  185. }
  186. for (f = 0; f < g; f++) {
  187. r.push(d[u + f]);
  188. }
  189. return 1 == a ? n : 0 == a ? r : void 0;
  190. }
  191. function l(e, t, a) {
  192. for (var n = [], r = 0; r < t.length; r++) {
  193. n.push(t[r]);
  194. }
  195. for (var s = 0; s < t.length - a; s++) {
  196. var o = i(e, s) % n.length;
  197. n.splice(o, 1);
  198. }
  199. return n;
  200. }
  201. function c(e, t) {
  202. var a = {
  203. name: t.name,
  204. good: t.good,
  205. bad: t.bad
  206. };
  207. if (-1 != a.name.indexOf('%v')) {
  208. a.name = a.name.replace('%v', u[i(e, 12) % u.length]);
  209. }
  210. if (-1 != a.name.indexOf('%t')) {
  211. a.name = a.name.replace('%t', o[i(e, 11) % o.length]);
  212. }
  213. if (-1 != a.name.indexOf('%l')) {
  214. a.name = a.name.replace('%l', ((i(e, 12) % 247) + 30).toString());
  215. }
  216. return a;
  217. }
  218. </script>
  219. <style>
  220. @import './index.css';
  221. </style>