index.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. "use strict";
  2. (wx["webpackJsonp"] = wx["webpackJsonp"] || []).push([["pages/index/index"],{
  3. /***/ "./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./src/pages/index/index.tsx":
  4. /*!********************************************************************************************************!*\
  5. !*** ./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./src/pages/index/index.tsx ***!
  6. \********************************************************************************************************/
  7. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  8. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  9. /* harmony export */ "default": function() { return /* binding */ IndexPage; }
  10. /* harmony export */ });
  11. /* harmony import */ var _Users_Work_hola_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js */ "./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js");
  12. /* harmony import */ var _Users_Work_hola_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */ "./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js");
  13. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  14. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  15. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  16. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tarojs/taro */ "webpack/container/remote/@tarojs/taro");
  17. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_1__);
  18. /* harmony import */ var _components_Rings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @components/Rings */ "./src/components/Rings.weapp.tsx");
  19. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-redux */ "webpack/container/remote/react-redux");
  20. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_redux__WEBPACK_IMPORTED_MODULE_3__);
  21. /* harmony import */ var _store_user__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/store/user */ "./src/store/user.tsx");
  22. /* harmony import */ var _services_permission__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/services/permission */ "./src/services/permission.tsx");
  23. /* harmony import */ var _services_common__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/services/common */ "./src/services/common.tsx");
  24. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  25. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__);
  26. // import './index.scss'
  27. // import ComponentA from './component'
  28. // import TabBar from '../../components/Tabbar';
  29. function IndexPage() {
  30. var dispatch = (0,react_redux__WEBPACK_IMPORTED_MODULE_3__.useDispatch)();
  31. var array = [];
  32. var user = (0,react_redux__WEBPACK_IMPORTED_MODULE_3__.useSelector)(function (state) {
  33. return state.user;
  34. });
  35. var permission = (0,react_redux__WEBPACK_IMPORTED_MODULE_3__.useSelector)(function (state) {
  36. return state.permission;
  37. });
  38. var common = (0,react_redux__WEBPACK_IMPORTED_MODULE_3__.useSelector)(function (state) {
  39. return state.common;
  40. });
  41. array.push('ffff');
  42. array.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
  43. children: "ffff"
  44. }));
  45. // array.push(<Rings radius={50}/>)
  46. (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
  47. dispatch((0,_services_common__WEBPACK_IMPORTED_MODULE_6__.staticResources)());
  48. }, []);
  49. (0,_tarojs_taro__WEBPACK_IMPORTED_MODULE_1__.useReady)( /*#__PURE__*/(0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_9__["default"])( /*#__PURE__*/(0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_10__["default"])().mark(function _callee() {
  50. var userData;
  51. return (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_10__["default"])().wrap(function _callee$(_context) {
  52. while (1) switch (_context.prev = _context.next) {
  53. case 0:
  54. _context.next = 2;
  55. return getStorage('userData');
  56. case 2:
  57. userData = _context.sent;
  58. if (userData) {
  59. dispatch((0,_store_user__WEBPACK_IMPORTED_MODULE_4__.getInfoSuccess)(JSON.parse(userData)));
  60. // return JSON.parse(userData as string) as UserState;
  61. setTimeout(function () {
  62. checkWXPubFollow();
  63. }, 200);
  64. }
  65. case 4:
  66. case "end":
  67. return _context.stop();
  68. }
  69. }, _callee);
  70. })));
  71. function checkWXPubFollow() {
  72. (0,_services_permission__WEBPACK_IMPORTED_MODULE_5__.wxPubFollow)().then(function (res) {
  73. console.log(res);
  74. });
  75. }
  76. function followWxPub() {
  77. var resource = common.resources.filter(function (item) {
  78. return item.code == 'follow_wx_pub';
  79. });
  80. _tarojs_taro__WEBPACK_IMPORTED_MODULE_1___default().showModal({
  81. title: '提示',
  82. content: '关注公众号后可接收提醒\n点击确定,前往关注',
  83. showCancel: true,
  84. success: function success(result) {
  85. if (result.confirm) {
  86. _tarojs_taro__WEBPACK_IMPORTED_MODULE_1___default().navigateTo({
  87. url: '/pages/H5?title=fast16cc 关注服务号&url=' + resource[0].url
  88. });
  89. }
  90. }
  91. });
  92. }
  93. function getStorage(_x) {
  94. return _getStorage.apply(this, arguments);
  95. }
  96. function _getStorage() {
  97. _getStorage = (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_9__["default"])( /*#__PURE__*/(0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_10__["default"])().mark(function _callee2(key) {
  98. var res;
  99. return (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_10__["default"])().wrap(function _callee2$(_context2) {
  100. while (1) switch (_context2.prev = _context2.next) {
  101. case 0:
  102. _context2.prev = 0;
  103. _context2.next = 3;
  104. return _tarojs_taro__WEBPACK_IMPORTED_MODULE_1___default().getStorage({
  105. key: key
  106. });
  107. case 3:
  108. res = _context2.sent;
  109. return _context2.abrupt("return", res.data);
  110. case 7:
  111. _context2.prev = 7;
  112. _context2.t0 = _context2["catch"](0);
  113. return _context2.abrupt("return", '');
  114. case 10:
  115. case "end":
  116. return _context2.stop();
  117. }
  118. }, _callee2, null, [[0, 7]]);
  119. }));
  120. return _getStorage.apply(this, arguments);
  121. }
  122. function goDetail() {
  123. _tarojs_taro__WEBPACK_IMPORTED_MODULE_1___default().navigateTo({
  124. // url: '/pages/index/detail'
  125. //src/moduleA/pages/third.tsx
  126. url: '../../moduleA/pages/third'
  127. });
  128. }
  129. function login() {
  130. if (user.isLogin) {
  131. _tarojs_taro__WEBPACK_IMPORTED_MODULE_1___default().navigateTo({
  132. url: '/pages/ChooseScenario'
  133. });
  134. } else {
  135. _tarojs_taro__WEBPACK_IMPORTED_MODULE_1___default().navigateTo({
  136. url: '/pages/ChooseAuth'
  137. });
  138. }
  139. }
  140. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
  141. style: {
  142. backgroundColor: '#fff',
  143. flex: 1,
  144. flexDirection: 'column',
  145. display: 'flex'
  146. },
  147. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
  148. children: "homepage12234"
  149. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
  150. children: user.isLogin ? '已登录' : '未登录'
  151. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
  152. children: user.isLogin ? "\u7528\u6237\u6635\u79F0\uFF1A".concat(user.nickname) : ''
  153. }), permission.wxPubFollow == false && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
  154. onClick: function onClick() {
  155. return followWxPub();
  156. },
  157. children: "\u53BB\u5173\u6CE8\u516C\u4F17\u53F7"
  158. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Button, {
  159. onClick: function onClick() {
  160. return goDetail();
  161. },
  162. children: "go detail"
  163. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_components_Rings__WEBPACK_IMPORTED_MODULE_2__["default"], {
  164. radius: 50
  165. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Input, {
  166. placeholder: "\u8BF7\u8F93\u5165\u7528\u6237\u540D1",
  167. style: {
  168. textAlign: 'left',
  169. backgroundColor: 'pink'
  170. }
  171. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
  172. className: "login",
  173. onClick: function onClick() {
  174. return login();
  175. },
  176. children: "sss"
  177. })]
  178. });
  179. }
  180. // export default class Index extends Component<PropsWithChildren> {
  181. // componentDidMount () { }
  182. // componentWillUnmount () { }
  183. // componentDidShow () { }
  184. // componentDidHide () { }
  185. // goDetail(){
  186. // Taro.navigateTo({
  187. // url: '/pages/index/detail'
  188. // })
  189. // }
  190. // render () {
  191. // return (
  192. // <View className='index'>
  193. // <Text>Hello world123!</Text>
  194. // <ComponentA value="A"/>
  195. // <Button onClick={()=>this.goDetail()}>detail</Button>
  196. // </View>
  197. // )
  198. // }
  199. // }
  200. /***/ }),
  201. /***/ "./src/pages/index/index.tsx":
  202. /*!***********************************!*\
  203. !*** ./src/pages/index/index.tsx ***!
  204. \***********************************/
  205. /***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
  206. /* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tarojs/runtime */ "webpack/container/remote/@tarojs/runtime");
  207. /* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__);
  208. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ruleSet_1_rules_5_use_0_index_tsx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./index.tsx */ "./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./src/pages/index/index.tsx");
  209. var config = {"navigationBarTitleText":"首页","usingComponents":{"demo":"../../components/demo"}};
  210. var inst = Page((0,_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__.createPageConfig)(_node_modules_babel_loader_lib_index_js_ruleSet_1_rules_5_use_0_index_tsx__WEBPACK_IMPORTED_MODULE_1__["default"], 'pages/index/index', {root:{cn:[]}}, config || {}))
  211. /* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_babel_loader_lib_index_js_ruleSet_1_rules_5_use_0_index_tsx__WEBPACK_IMPORTED_MODULE_1__["default"]);
  212. /***/ })
  213. },
  214. /******/ function(__webpack_require__) { // webpackRuntimeModules
  215. /******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
  216. /******/ __webpack_require__.O(0, ["taro","vendors","common"], function() { return __webpack_exec__("./src/pages/index/index.tsx"); });
  217. /******/ var __webpack_exports__ = __webpack_require__.O();
  218. /******/ }
  219. ]);
  220. //# sourceMappingURL=index.js.map