zs 1 рік тому
батько
коміт
56257d72da

+ 56 - 9
pages/index/index.vue

@@ -1,24 +1,55 @@
 <template>
-	<view class="main"> </view>
+	<view class="main">
+		<view class="one">
+			<image class="logo" :src="logoUrl"></image>
+		</view>
+	</view>
 </template>
 
 <script>
 	export default {
 		data() {
-			return {};
+			return {
+				logoUrl: ''
+			};
 		},
-		onLoad: function() {
+		onLoad: async function() {
 			const that = this;
-			that.searchToken();
+			await that.searchConfig();
+			await that.searchOpenid();
 		},
 		methods: {
-			searchToken() {
+			// 查询基本设置
+			async searchConfig() {
+				const that = this;
+				let res = await that.$api(`/config`, 'GET', {});
+				if (res.errcode == '0') {
+					that.$set(that, `logoUrl`, res.data.logo_url[0].url);
+					uni.setStorage({
+						key: 'config',
+						data: res.data,
+						success: function(res) {},
+						fail: function(err) {
+							console.log(err);
+						}
+					})
+				}
+			},
+			async searchOpenid() {
 				const that = this;
 				try {
 					const res = uni.getStorageSync('openid');
-					uni.reLaunch({
-						url: `/pages/home/index`
-					})
+					const aee = await that.$api(`/login/wxapp/${res}`, 'POST', {})
+					if (aee.errcode == '0') {
+						uni.reLaunch({
+							url: `/pages/home/index`
+						})
+					} else {
+						uni.showToast({
+							title: aee.errmsg,
+							icon: 'none'
+						})
+					}
 				} catch (e) {
 					uni.showToast({
 						title: err.errmsg,
@@ -26,10 +57,26 @@
 						duration: 2000
 					});
 				}
-			},
+			}
 		},
 	}
 </script>
 
 <style lang="scss" scoped>
+	.main {
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		width: 100vw;
+		height: 100vh;
+
+		.one {
+			.logo {
+				width: 50vw;
+				height: 50vw;
+				border-radius: 90px;
+				box-shadow: 0 0 5px var(--f1Color);
+			}
+		}
+	}
 </style>

Різницю між файлами не показано, бо вона завелика
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/index/index.js.map


Різницю між файлами не показано, бо вона завелика
+ 143 - 21
unpackage/dist/dev/mp-weixin/pages/index/index.js


+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/index/index.wxml

@@ -1 +1 @@
-<view class="main data-v-57280228"></view>
+<view class="main data-v-57280228"><view class="one data-v-57280228"><image class="logo data-v-57280228" src="{{logoUrl}}"></image></view></view>

+ 17 - 0
unpackage/dist/dev/mp-weixin/pages/index/index.wxss

@@ -0,0 +1,17 @@
+@charset "UTF-8";
+/* 水平间距 */
+/* 水平间距 */
+.main.data-v-57280228 {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  width: 100vw;
+  height: 100vh;
+}
+.main .one .logo.data-v-57280228 {
+  width: 50vw;
+  height: 50vw;
+  border-radius: 90px;
+  box-shadow: 0 0 5px var(--f1Color);
+}
+