qinyan 1 year ago
parent
commit
d2b6625c8a

+ 5 - 0
src/App.vue

@@ -1,7 +1,9 @@
 <script>
+import { mapActions } from "vuex";
 export default {
   onLaunch: function () {
     console.log("App Launch");
+    this.getUserInfo();
   },
   onShow: function () {
     console.log("App Show");
@@ -9,6 +11,9 @@ export default {
   onHide: function () {
     console.log("App Hide");
   },
+  methods: {
+    ...mapActions(["getUserInfo"]),
+  },
 };
 </script>
 

+ 4 - 1
src/main.js

@@ -1,11 +1,14 @@
-import App from "./App.vue";
 import Vue from "vue";
+import App from "./App.vue";
 import { Dict_Apis } from "./dict/apis";
+import store from "./store";
 
 Vue.config.productionTip = false;
 Vue.prototype.$serverUrl = Dict_Apis.promotion;
 App.mpType = "app";
+
 const app = new Vue({
+  store,
   ...App,
 });
 app.$mount();

+ 8 - 8
src/pages.json

@@ -9,9 +9,9 @@
       }
     },
     {
-      "path": "pages/hot/hot",
+      "path": "pages/index/data",
       "style": {
-        "navigationBarTitleText": "最热",
+        "navigationBarTitleText": "数据统计",
         "enablePullDownRefresh": true
       }
     },
@@ -63,12 +63,12 @@
         "selectedIconPath": "static/index-1.png",
         "text": "推广"
       },
-      {
-        "pagePath": "pages/hot/hot",
-        "iconPath": "static/hot-0.png",
-        "selectedIconPath": "static/hot-1.png",
-        "text": "发现"
-      },
+      // {
+      //   "pagePath": "pages/hot/hot",
+      //   "iconPath": "static/hot-0.png",
+      //   "selectedIconPath": "static/hot-1.png",
+      //   "text": "发现"
+      // },
       {
         "pagePath": "pages/center/center",
         "iconPath": "static/center-0.png",

+ 16 - 22
src/pages/center/center.vue

@@ -3,17 +3,17 @@
     <view
       class="logo flex"
       @click="goLogin"
-      :hover-class="!login ? 'logo-hover' : ''"
+      :hover-class="!hasLogin ? 'logo-hover' : ''"
     >
       <image
         class="logo-img"
-        :src="login ? userInfo.avatar : avatarUrl"
+        :src="hasLogin ? userInfo.avatar : avatarUrl"
       ></image>
       <view class="logo-title flex">
         <text class="uer-name"
-          >Hi,{{ login ? userInfo.name : "您未登录" }}</text
+          >Hi,{{ hasLogin ? userInfo.name : "您未登录" }}</text
         >
-        <text class="go-login navigat-arrow" v-if="!login">&#xe65e;</text>
+        <text class="go-login navigat-arrow" v-if="!hasLogin">&#xe65e;</text>
       </view>
     </view>
 
@@ -25,44 +25,38 @@
       </view>
     </view>
 
-    <view class="center_footer">
-      <button class="btn" @click="goLogout">退出登录</button>
+    <view class="center_footer" v-if="hasLogin">
+      <button class="btn" @click="logout">退出登录</button>
     </view>
   </view>
 </template>
 
 <script>
-import { getUserInfo } from "../../services/https/user";
+import { mapState, mapActions } from "vuex";
+
 export default {
   data() {
     return {
-      login: false,
       avatarUrl: "/static/avatar.png",
-      userInfo: {},
     };
   },
+  computed: {
+    ...mapState(["hasLogin", "userInfo"]),
+  },
   onLoad() {
-    this.queryData();
+    //
   },
   methods: {
-    async queryData() {
-      const res = await getUserInfo();
-      if (res.errorNo !== 200) return;
-      this.login = true;
-      this.userInfo = res.result.user;
-    },
+    ...mapActions(["logout"]),
+
     goLogin() {
-      if (!this.login) {
+      if (!this.hasLogin) {
         uni.navigateTo({
           url: "/pages/login/index",
         });
       }
     },
-    goLogout() {
-      this.login = false;
-      this.userInfo = {};
-      uni.removeStorageSync("access-token");
-    },
+
     goAbout() {
       uni.navigateTo({
         url: "/pages/about/about",

+ 8 - 5
src/pages/detail/detail.vue

@@ -12,26 +12,29 @@ export default {
     return {
       id: "",
       url: "",
+      designData: {},
     };
   },
   onLoad(e) {
+    // console.error("e: ", e);
     this.id = e.id;
     this.url = `https://show.3dqueen.cloud/share.html?id=${e.id}`;
-    // this.url = `https://www.baidu.com`;
     this.getData();
   },
   onShareAppMessage() {
     return {
-      title: "",
-      path: "/pages/detail/detail?data=" + this.detailDec,
-      imageUrl: this.data[this.index],
+      title: this.designData.title,
+      desc: this.designData.desc,
+      path: "/pages/detail/detail?id=" + this.designData._id,
+      imageUrl: this.designData.thumbnail,
     };
   },
 
   methods: {
     async getData() {
       const res = await getDesignDetail(this.id);
-      console.log("data: ", res);
+      if (res.errorNo !== 200) return;
+      this.designData = res.result;
     },
   },
 };

+ 46 - 0
src/pages/index/data.vue

@@ -0,0 +1,46 @@
+<template>
+  <view class="index">
+    <web-view :src="url" class="main"></web-view>
+  </view>
+</template>
+
+<script>
+import { getDesignDetail } from "../../services/https/promotion";
+
+export default {
+  data() {
+    return {
+      id: "",
+      url: "",
+      designData: {},
+    };
+  },
+  onLoad(e) {
+    console.error("e: ", e);
+    this.id = e.id;
+    // this.url = `https://show.3dqueen.cloud/share.html?id=${e.id}`;
+    this.url = `https://cn.bing.com/`;
+    this.getData();
+  },
+
+  methods: {
+    async getData() {
+      const res = await getDesignDetail(this.id);
+      if (res.errorNo !== 200) return;
+      this.designData = res.result;
+    },
+  },
+};
+</script>
+
+<style>
+page {
+  background-color: #fff;
+  height: 100%;
+}
+.main {
+  height: 100%;
+  width: 750rpx;
+  overflow: hidden;
+}
+</style>

+ 166 - 43
src/pages/index/index.vue

@@ -2,18 +2,33 @@
   <view class="index">
     <view v-if="login">
       <block v-for="item in list" :key="item._id">
-        <view class="card" @click="goDetail(item)">
-          <image
-            class="card-img"
-            :src="item.thumbnail"
-            mode="aspectFill"
-          ></image>
-          <text class="card-num-view">{{ item.views }} 次浏览</text>
-          <view class="card-bottm row">
-            <view class="car-title-view row">
-              <text class="card-title">{{ item.title }}</text>
+        <view class="card">
+          <view @click="goDetail(item)">
+            <image
+              class="card-img"
+              :src="item.thumbnail"
+              mode="aspectFill"
+            ></image>
+            <view class="card_suffix" @click.stop="">
+              <view class="card-num-view">
+                <image class="icon_view" src="/static/browse.svg"></image>
+                <text>{{ item.views }} </text>
+              </view>
             </view>
           </view>
+
+          <view class="card-bottm flex items-center">
+            <view class="card-bottm-main">
+              <view class="flex-1">
+                <text class="card-title">{{ item.title }}</text>
+              </view>
+              <text class="card_time">{{ formatTime(item.updateTime) }}</text>
+            </view>
+            <view class="card_data_text" @click="goDataPage(item)">
+              <image class="icon_data" src="/static/data-view.svg"></image>
+            </view>
+            <view @click.stop="share(item)" class="card-share-view"></view>
+          </view>
         </view>
       </block>
       <view class="loadMore">
@@ -37,6 +52,7 @@ export default {
       refreshing: false,
       list: [],
       fetchPageNum: 1,
+      providerList: [],
     };
   },
   onLoad() {
@@ -45,6 +61,7 @@ export default {
       this.login = true;
       this.getData();
     }
+    this.getProvider();
   },
   onReachBottom() {
     // console.log("滑动到页面底部");
@@ -58,6 +75,47 @@ export default {
     this.getData();
   },
   methods: {
+    getProvider() {
+      uni.getProvider({
+        service: "share",
+        success: (e) => {
+          let data = [];
+          for (let i = 0; i < e.provider.length; i++) {
+            switch (e.provider[i]) {
+              case "weixin":
+                data.push({
+                  name: "分享到微信好友",
+                  id: "weixin",
+                });
+                data.push({
+                  name: "分享到微信朋友圈",
+                  id: "weixin",
+                  type: "WXSenceTimeline",
+                });
+                data.push({
+                  name: "复制链接",
+                  id: "weixin",
+                  type: "copyLink",
+                });
+                break;
+              default:
+                break;
+            }
+          }
+          this.providerList = data;
+        },
+        fail: (e) => {
+          console.log("获取分享通道失败", e);
+        },
+      });
+    },
+    formatTime(value) {
+      const date = new Date(value);
+      const y = date.getFullYear();
+      const m = date.getMonth() + 1;
+      const d = date.getDate();
+      return `${y}.${m}.${d}`;
+    },
     async getData() {
       const data = await getDesignList({
         page: this.fetchPageNum,
@@ -83,7 +141,52 @@ export default {
     },
     goDetail(data) {
       uni.navigateTo({
-        url: "../detail/detail?id=" + data._id,
+        url: "/pages/detail/detail?id=" + data._id,
+      });
+    },
+    goDataPage(data) {
+      uni.navigateTo({
+        url: "/pages/index/data?id=" + data._id,
+      });
+    },
+    share(record) {
+      const itemList = this.providerList.map(function (value) {
+        return value.name;
+      });
+      uni.showActionSheet({
+        itemList: itemList,
+        success: (res) => {
+          if (this.providerList[res.tapIndex].type == "copyLink") {
+            const url = `https://show.3dqueen.cloud/share.html?id=${record._id}`;
+            console.log("url: ", url);
+            return;
+          }
+          this.setShare(record, res);
+        },
+      });
+    },
+    setShare(record, res) {
+      uni.share({
+        provider: this.providerList[res.tapIndex].id,
+        scene:
+          this.providerList[res.tapIndex].type &&
+          this.providerList[res.tapIndex].type === "WXSenceTimeline"
+            ? "WXSenceTimeline"
+            : "WXSceneSession",
+        type: 0,
+        title: record.title,
+        summary: record.desc,
+        imageUrl: record.title,
+        href: "/pages/detail/detail?id=" + record._id,
+        success: (res) => {
+          console.log("success:" + JSON.stringify(res));
+        },
+        fail: (e) => {
+          uni.showModal({
+            content: e.errMsg,
+            showCancel: false,
+          });
+        },
       });
     },
   },
@@ -92,7 +195,6 @@ export default {
 
 <style>
 .card {
-  flex-direction: column;
   position: relative;
   margin: 20rpx;
   border-radius: 10rpx;
@@ -111,59 +213,80 @@ export default {
   text-align: center;
 }
 
-.card-num-view {
+.card_suffix {
   position: absolute;
   top: 20rpx;
   right: 20rpx;
-  line-height: 1;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+.card_data_text {
   display: inline-block;
+  margin-right: 30rpx;
+  border-radius: 4rpx;
+  padding: 2rpx 10rpx;
+}
+.icon_data {
+  width: 36rpx;
+  height: 36rpx;
+  line-height: 1;
+}
+.card-num-view {
+  line-height: 1;
+  display: inline-flex;
+  align-items: center;
+  justify-content: center;
   padding: 3px 6px;
   color: #ffffff;
   font-size: 12px;
   text-align: center;
   justify-content: center;
   align-items: center;
-  border-radius: 15px;
+  border-radius: 4rpx;
   background-color: #41969c;
 }
-
+.icon_view {
+  width: 30rpx;
+  height: 30rpx;
+  line-height: 1;
+  color: #fff;
+  margin-right: 6rpx;
+}
 .card-bottm {
-  justify-content: center;
-  align-items: center;
+  padding: 14rpx 20rpx;
+}
+.card-bottm-main {
+  flex: 1;
+  overflow: hidden;
+  margin-right: 50rpx;
 }
 
+.card-title {
+  display: -webkit-box;
+  overflow: hidden; /*隐藏溢出的文本  */
+  text-overflow: ellipsis;
+  word-break: break-all; /*自动换行*/
+  -moz-box-orient: vertical; /*从上到下自动排列子元素*/
+  -webkit-box-orient: vertical;
+  -webkit-line-clamp: 1; /*显示的行数*/
+  font-size: 30rpx;
+  color: #555555;
+}
+.card_time {
+  font-size: 24rpx;
+  color: #999;
+}
 .card-share-view {
-  justify-content: center;
-  align-items: center;
-  padding: 14rpx 0;
+  margin-right: 20rpx;
   color: #41969c;
-  margin: 20rpx 20rpx 20rpx;
-  font-size: 30rpx;
+  font-size: 30upx;
+  font-family: texticons;
 }
 
 .card-share-view:before {
   content: "\e62d";
 }
-
-.car-title-view {
-  flex: 1;
-  padding: 14rpx 0rpx 14rpx 20rpx;
-}
-
-.card-title {
-  flex: 1;
-  font-size: 30rpx;
-  text-align: left;
-  color: #555555;
-  text-overflow: ellipsis;
-  /* lines: 2; */
-  display: -webkit-box;
-  white-space: normal;
-  display: -webkit-box;
-  -webkit-box-orient: vertical;
-  -webkit-line-clamp: 2;
-  overflow: hidden;
-}
 .auth_card {
   height: 100vh;
   display: flex;

+ 120 - 60
src/pages/login/index.vue

@@ -1,96 +1,156 @@
 <template>
-  <view class="content">
-    <image class="bg" src="/static/gr_bg.png"></image>
-    <image class="logo" src="/static/logo.png"></image>
-    <view>
+  <form class="loginView" @submit="goLogin">
+    <view class="input-view">
+      <view class="label-view">
+        <text class="label">账号 </text>
+      </view>
+      <input
+        class="input"
+        type="text"
+        placeholder="请输入用户名"
+        name="nameValue"
+      />
+    </view>
+    <view class="input-view">
+      <view class="label-view">
+        <text class="label">密码</text>
+      </view>
+      <input
+        class="input"
+        type="password"
+        placeholder="请输入密码"
+        name="passwordValue"
+      />
+    </view>
+    <view class="button-view">
       <button
         type="default"
-        class="btn btn_phone"
-        @click="phoneLogin"
-        style="color: #fff; background-color: #5a7bef"
+        class="login"
+        hover-class="hover"
+        formType="submit"
       >
-        手机号登录
+        登录
       </button>
-      <button
-        open-type="getPhoneNumber"
-        @getphonenumber="getPhoneNumber"
-        class="btn btn_wechat"
-        type="primary"
+      <!-- <button
+        type="default"
+        class="register"
+        hover-class="hover"
+        @click="register"
       >
-        微信登录
-      </button>
+        免费注册
+      </button> -->
     </view>
-  </view>
+  </form>
 </template>
 
 <script>
-import { login } from "../../services/https/user";
+import { pwdLogin } from "../../services/https/user";
+import vuex, { mapActions, mapMutations } from "vuex";
 
 export default {
   data() {
-    return {
-      jsCode: "",
-      redirect: "",
-    };
-  },
-  onLoad(options) {
-    this.redirect = options.redirect;
-    wx.login({
-      success: (res) => {
-        this.jsCode = res.code;
-      },
-    });
+    return {};
   },
   methods: {
-    phoneLogin() {
-      uni.navigateTo({
-        url: "/pages/login/login",
+    ...mapActions(["login", "getUserInfo"]),
+
+    async goLogin(e) {
+      const res = await pwdLogin({
+        key: "queenshow",
+        password: e.detail.value.passwordValue,
+        phone: e.detail.value.nameValue,
       });
-    },
-    async getPhoneNumber(e) {
-      const res = await login({ jsCode: this.jsCode, code: e.detail.code });
       if (res.errorNo !== 200) return;
       const token = res.result.token;
+      this.login(token);
+      this.getUserInfo();
       uni.reLaunch({
-        url: `/pages/index/index?token=${token}&redirect=${this.redirect}`,
+        url: `/pages/index/index`,
       });
     },
+    register() {
+      console.log("前往注册页面");
+    },
   },
 };
 </script>
 
 <style>
-.content {
-  height: 100vh;
+.loginView {
   display: flex;
   flex-direction: column;
   align-items: center;
-  justify-content: center;
+  width: 750rpx;
+  min-height: 100vh;
+  padding-top: 30rpx;
 }
-.bg {
-  position: absolute;
-  left: 0;
-  bottom: 0;
-  display: block;
-  width: 100%;
-  height: 100%;
-  z-index: -999;
+
+.input-view {
+  border-bottom-style: solid;
+  border-bottom-width: 1rpx;
+  border-bottom-color: #ddd;
+  background-color: #fff;
+  flex-direction: row;
+  width: 710rpx;
+  margin: 0 20rpx;
+  padding: 20rpx 20rpx;
+  box-sizing: border-box;
+  /* border-radius: 8rpx; */
 }
-.logo {
-  width: 154rpx;
-  height: 176rpx;
+
+.label-view {
+  width: 100rpx;
+  height: 60rpx;
+  align-items: center;
+  margin-right: 30rpx;
 }
-.btn {
-  width: 600rpx;
-  border-radius: 48rpx;
-  overflow: hidden;
+
+.label {
+  flex: 1;
+  line-height: 60rpx;
+  font-size: 30rpx;
+  color: #555;
+  text-align: left;
 }
-.btn_phone {
-  margin-top: 100rpx;
-  background-color: #5a7bef;
+
+.input {
+  flex: 1;
+  height: 60rpx;
+  font-size: 30rpx;
+  align-items: center;
+}
+
+.button-view {
+  width: 750rpx;
+  margin-top: 50rpx;
+  padding: 0 20rpx;
+  box-sizing: border-box;
+  flex-direction: column;
+}
+
+button {
+  width: 710rpx;
+  height: 80rpx;
+  line-height: 80rpx;
+  text-align: center;
+  font-size: 30rpx;
+}
+
+button.login {
+  background-color: #41969c;
+  color: #fff;
 }
-.btn_wechat {
-  margin-top: 60rpx;
-  margin-bottom: 100rpx;
+
+button.register {
+  margin-top: 30rpx;
+  color: #41969c;
+  background-color: #fff;
+  border-color: #41969c;
+  border-width: 2rpx;
+}
+
+.register.hover,
+.login.hover {
+  opacity: 0.6;
 }
 </style>

+ 57 - 111
src/pages/login/login.vue

@@ -1,61 +1,53 @@
 <template>
-  <form class="loginView" @submit="login">
-    <view class="input-view">
-      <view class="label-view">
-        <text class="label">账号 </text>
-      </view>
-      <input
-        class="input"
-        type="text"
-        placeholder="请输入用户名"
-        name="nameValue"
-      />
-    </view>
-    <view class="input-view">
-      <view class="label-view">
-        <text class="label">密码</text>
-      </view>
-      <input
-        class="input"
-        type="password"
-        placeholder="请输入密码"
-        name="passwordValue"
-      />
-    </view>
-    <view class="button-view">
+  <view class="content">
+    <image class="bg" src="/static/gr_bg.png"></image>
+    <image class="logo" src="/static/logo.png"></image>
+    <view>
       <button
         type="default"
-        class="login"
-        hover-class="hover"
-        formType="submit"
+        class="btn btn_phone"
+        @click="phoneLogin"
+        style="color: #fff; background-color: #5a7bef"
       >
-        登录
+        手机号登录
       </button>
       <button
-        type="default"
-        class="register"
-        hover-class="hover"
-        @click="register"
+        open-type="getPhoneNumber"
+        @getphonenumber="getPhoneNumber"
+        class="btn btn_wechat"
+        type="primary"
       >
-        免费注册
+        微信登录
       </button>
     </view>
-  </form>
+  </view>
 </template>
 
 <script>
-import { pwdLogin } from "../../services/https/user";
+import { login } from "../../services/https/user";
+
 export default {
   data() {
-    return {};
+    return {
+      jsCode: "",
+    };
+  },
+  onLoad() {
+    wx.login({
+      success: (res) => {
+        this.jsCode = res.code;
+      },
+    });
   },
   methods: {
-    async login(e) {
-      const res = await pwdLogin({
-        key: "queenshow",
-        password: e.detail.value.passwordValue,
-        phone: e.detail.value.nameValue,
+    phoneLogin() {
+      uni.navigateTo({
+        url: "/pages/login/login",
       });
+    },
+    async getPhoneNumber(e) {
+      console.log("e: ", e);
+      const res = await login({ jsCode: this.jsCode, code: e.detail.code });
       if (res.errorNo !== 200) return;
       const token = res.result.token;
       uni.setStorageSync("access-token", token);
@@ -63,88 +55,42 @@ export default {
         url: `/pages/index/index`,
       });
     },
-    register() {
-      console.log("前往注册页面");
-    },
   },
 };
 </script>
 
 <style>
-.loginView {
+.content {
+  height: 100vh;
   display: flex;
   flex-direction: column;
   align-items: center;
-  width: 750rpx;
-  min-height: 100vh;
-  padding-top: 30rpx;
+  justify-content: center;
 }
-
-.input-view {
-  border-bottom-style: solid;
-  border-bottom-width: 1rpx;
-  border-bottom-color: #ddd;
-  background-color: #fff;
-  flex-direction: row;
-  width: 710rpx;
-  margin: 0 20rpx;
-  padding: 20rpx 20rpx;
-  box-sizing: border-box;
+.bg {
+  position: absolute;
+  left: 0;
+  bottom: 0;
+  display: block;
+  width: 100%;
+  height: 100%;
+  z-index: -999;
 }
-
-.label-view {
-  width: 100rpx;
-  height: 60rpx;
-  align-items: center;
-  margin-right: 30rpx;
+.logo {
+  width: 154rpx;
+  height: 176rpx;
 }
-
-.label {
-  flex: 1;
-  line-height: 60rpx;
-  font-size: 38rpx;
-  color: #555;
-  text-align: left;
+.btn {
+  width: 600rpx;
+  border-radius: 48rpx;
+  overflow: hidden;
 }
-
-.input {
-  flex: 1;
-  height: 60rpx;
-  font-size: 38rpx;
-  align-items: center;
-}
-
-.button-view {
-  width: 750rpx;
-  margin-top: 50rpx;
-  padding: 0 20rpx;
-  box-sizing: border-box;
-  flex-direction: column;
-}
-
-button {
-  width: 710rpx;
-  height: 80rpx;
-  line-height: 80rpx;
-  text-align: center;
-  font-size: 38rpx;
+.btn_phone {
+  margin-top: 100rpx;
+  background-color: #5a7bef;
 }
-
-button.login {
-  background-color: #41969c;
-  color: #fff;
-}
-
-button.register {
-  margin-top: 30rpx;
-  color: #41969c;
-  background-color: #fff;
-  border-color: #41969c;
-  border-width: 2rpx;
-}
-
-.register.hover,
-.login.hover {
-  opacity: 0.6;
+.btn_wechat {
+  margin-top: 60rpx;
+  margin-bottom: 100rpx;
 }
 </style>

+ 2 - 2
src/services/request.js

@@ -1,4 +1,5 @@
 import { Dict_Apis } from "../dict/apis";
+import store from "../store";
 
 const baseURL = Dict_Apis.auth;
 
@@ -7,7 +8,6 @@ export default function (url, options = {}) {
     if (options.method && options.method !== "GET")
       uni.showLoading({ title: "加载中" });
 
-    console.log("options: ", options);
     uni.request({
       ...options,
       url: (options.baseURL ? options.baseURL : baseURL) + url,
@@ -19,7 +19,7 @@ export default function (url, options = {}) {
         if (res.statusCode === 200) {
           let data = res.data;
           if (data.errorNo === 401) {
-            uni.clearStorageSync("access-token");
+            store.dispatch("logout");
           }
           resolve(data);
         } else {

+ 11 - 0
src/static/browse.svg

@@ -0,0 +1,11 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1689242050283"
+    class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="892"
+    xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64">
+    <path
+        d="M512 836.266667C230.4 836.266667 74.666667 533.333333 68.266667 520.533333c-4.266667-8.533333-4.266667-19.2 0-29.866666 6.4-12.8 164.266667-315.733333 443.733333-315.733334 281.6 0 437.333333 305.066667 443.733333 317.866667 4.266667 8.533333 4.266667 19.2 0 29.866667-6.4 10.666667-162.133333 313.6-443.733333 313.6zM132.266667 505.6c34.133333 57.6 170.666667 266.666667 379.733333 266.666667s345.6-209.066667 379.733333-266.666667c-34.133333-57.6-170.666667-266.666667-379.733333-266.666667S166.4 448 132.266667 505.6z"
+        fill="#fff" p-id="893"></path>
+    <path
+        d="M512 650.666667c-76.8 0-138.666667-61.866667-138.666667-138.666667s61.866667-138.666667 138.666667-138.666667 138.666667 61.866667 138.666667 138.666667-61.866667 138.666667-138.666667 138.666667z m0-213.333334c-40.533333 0-74.666667 34.133333-74.666667 74.666667s34.133333 74.666667 74.666667 74.666667 74.666667-34.133333 74.666667-74.666667-34.133333-74.666667-74.666667-74.666667z"
+        fill="#fff" p-id="894"></path>
+</svg>

+ 1 - 0
src/static/data-view.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1689243442086" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7832" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><path d="M85.312 938.688H1024V1024H0V0h85.312v938.688zM256 341.312h85.312V768H256V341.312zM512 128h85.312v640H512V128z m256 213.312h85.312V768H768V341.312z" fill="#41969c" p-id="7833"></path></svg>

+ 69 - 0
src/store/index.js

@@ -0,0 +1,69 @@
+import Vue from "vue";
+import Vuex from "vuex";
+import { getUserInfo } from "../services/https/user";
+
+Vue.use(Vuex);
+
+const store = new Vuex.Store({
+  state: {
+    hasLogin: true,
+    token: "",
+    userInfo: {},
+    openid: null,
+  },
+  mutations: {
+    login(state, token) {
+      state.hasLogin = true;
+      if (token) state.token = token;
+    },
+    setUserInfo(state, userinfo) {
+      state.userInfo = userinfo;
+    },
+    logout(state) {
+      state.hasLogin = false;
+      state.token = "";
+      state.userInfo = {};
+    },
+  },
+  getters: {},
+  actions: {
+    login({ commit }, token) {
+      commit("login");
+      uni.setStorageSync("access-token", token);
+    },
+    logout({ commit }) {
+      commit("logout");
+      uni.removeStorageSync("access-token");
+    },
+
+    async getUserInfo({ commit }) {
+      const res = await getUserInfo();
+      if (res.errorNo !== 200) return;
+      commit("login");
+      commit("setUserInfo", res.result.user);
+    },
+
+    getPhoneNumber: function ({ commit }, univerifyInfo) {
+      return new Promise((resolve, reject) => {
+        uni.request({
+          url: "https://97fca9f2-41f6-449f-a35e-3f135d4c3875.bspapp.com/http/univerify-login",
+          method: "POST",
+          data: univerifyInfo,
+          success: (res) => {
+            const data = res.data;
+            if (data.success) {
+              resolve(data.phoneNumber);
+            } else {
+              reject(res);
+            }
+          },
+          fail: (err) => {
+            reject(res);
+          },
+        });
+      });
+    },
+  },
+});
+
+export default store;