diff --git a/config/index.js b/config/index.js index ed4a7d1..bdff777 100644 --- a/config/index.js +++ b/config/index.js @@ -63,7 +63,10 @@ const config = { generateScopedName: '[name]__[local]___[hash:base64:5]' } } - } + }, + router: { + mode: 'browser', // 或者是 'browser' + }, } } diff --git a/src/images/avatar.jpg b/src/images/avatar.jpg new file mode 100644 index 0000000..c46c0f7 Binary files /dev/null and b/src/images/avatar.jpg differ diff --git a/src/pages/index/index.jsx b/src/pages/index/index.jsx index 586c6f9..fe5aef1 100644 --- a/src/pages/index/index.jsx +++ b/src/pages/index/index.jsx @@ -22,6 +22,32 @@ const Index = () => { const [current, setcurrent] = useState(0); const [isOpened, setisOpened] = useState(false); + + // 获取openid + const getWxid = () => { + let newparams = Taro.getCurrentInstance().router.params; + let urlopenid = newparams.openid; + // window.alert(urlopenid) + let newOpenid = window.localStorage.getItem("openid"); + // window.alert(newOpenid) + + if (newOpenid || urlopenid) { + // window.alert('存在') + window.localStorage.setItem("openid", urlopenid); + // window.alert(urlopenid); + } else { + // window.alert('不存在') + let nowUrl = window.location.href; + window.alert(nowUrl) + let payUrl = `https://payjs.cn/api/openid?mchid=1561724891&callback_url=${nowUrl}`; + window.location.href = payUrl; + } + }; + + useEffect(() => { + getWxid(); + }, []); + const handleClick = (value) => { console.log("value", value); setcurrent(value); @@ -199,7 +225,7 @@ const Index = () => { - {/* + { onClick={(value) => handleClick(value)} current={current} /> - */} + ); }; diff --git a/src/pages/meetup/index.jsx b/src/pages/meetup/index.jsx index d6ecbeb..9576d4c 100644 --- a/src/pages/meetup/index.jsx +++ b/src/pages/meetup/index.jsx @@ -127,7 +127,7 @@ const Meetup = () => { - {/* + { onClick={(value) => handleClick(value)} current={current} /> - */} + ); }; diff --git a/src/pages/my/index.jsx b/src/pages/my/index.jsx index 4ade1b4..72797b0 100644 --- a/src/pages/my/index.jsx +++ b/src/pages/my/index.jsx @@ -9,12 +9,26 @@ import { AtCard } from "taro-ui"; import { AtImagePicker } from "taro-ui"; import Taro from "@tarojs/taro"; import { AtAvatar } from "taro-ui"; - +import { AtTag } from "taro-ui"; import { AtList, AtListItem } from "taro-ui"; +import avatar from "../../images/avatar.jpg"; // export default class Index extends Component { const My = () => { const [current, setcurrent] = useState(2); + const [wxid, setwxid] = useState(null); + + useEffect(()=>{ + getWxid() + },[]) + + const getWxid = () => { + let newWxid = window.localStorage.getItem("wxid"); + if (!!newWxid) { + setwxid(newWxid); + } + }; + const handleClick = (value) => { console.log("value", value); setcurrent(value); @@ -36,7 +50,13 @@ const My = () => { return ( {/* Hello world! */} - {/* */} + + + + + 新注册用户 + + { /> - {/* + { onClick={(value) => handleClick(value)} current={current} /> - */} + ); }; diff --git a/src/pages/my/index.scss b/src/pages/my/index.scss index 2ffc6a7..7ff7609 100644 --- a/src/pages/my/index.scss +++ b/src/pages/my/index.scss @@ -1,6 +1,19 @@ .my{ - +.myAtAvatar{ + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + width: 100%; + height: 300px; + // background-color: #f4ffb8; + // padding-left: 20px; + // padding-right: 20px; + .AtAvatar{ + margin-bottom: 10px; + } +} .indexTablebar { position: fixed;