index.js 14 KB

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