Commit 1b5560fd authored by haiyoucuv's avatar haiyoucuv

init

parent 804d01ec
......@@ -14,3 +14,14 @@
bottom: 0;
background: rgba(0, 0, 0, 0.7);
}
.getPhoneBtn {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
width: 100vw !important;
height: 100vh;
opacity: 0.5;
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ ComponentWithStore({
store,
fields: {
homeInfo: () => store.homeInfo,
showPhoneBtn: () => !store.homeInfo.mobile,
},
actions: {},
},
......
<!--pages/activity/activity.wxml-->
<view class="act_root">
<swiper class="act_swiper" autoplay >
<swiper class="act_swiper" autoplay>
<swiper-item class="act_swiper_item" wx:for="{{banner}}">
<image class="swiper_item_img" src="{{item}}" lazy-load />
<image class="swiper_item_img" src="{{item}}" lazy-load/>
</swiper-item>
</swiper>
......@@ -10,8 +10,8 @@
<view class="act_prod_item" wx:for="{{prodList}}">
<view class="prod_item_prompt">{{item.prompt}}</view>
<view class="prod_item_introduce">{{item.introduce}}</view>
<image class="prod_item_img" src="{{item.img}}" mode="aspectFit" lazy-load />
<image class="prod_item_logo" src="{{item.logo}}" mode="aspectFit" lazy-load />
<image class="prod_item_img" src="{{item.img}}" mode="aspectFit" lazy-load/>
<image class="prod_item_logo" src="{{item.logo}}" mode="aspectFit" lazy-load/>
<view
class="prod_item_btn"
hover-class="common_view_hover"
......@@ -20,5 +20,13 @@
/>
</view>
</view>
</view>
<!--获取手机号按钮-->
<button
type="primary"
wx:if="{{showPhoneBtn}}"
class="getPhoneBtn"
open-type="getPhoneNumber"
bindgetphonenumber="getPhoneNumber"
></button>
......@@ -157,7 +157,7 @@
bottom: 0;
width: 100vw !important;
height: 100vh;
opacity: 0;
opacity: 0.5;
}
......
......@@ -2,6 +2,7 @@
// 获取应用实例
import { ComponentWithStore } from "mobx-miniprogram-bindings";
import { store } from "../../store/store";
import { dbLogin } from "../../utils/request";
const app = getApp<IAppOption>()
const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
......@@ -11,13 +12,15 @@ ComponentWithStore({
store,
fields: {
homeInfo: () => store.homeInfo,
avatar: () => store.homeInfo.avatar || defaultAvatarUrl,
mobile: () => store.homeInfo.mobile || "-",
},
actions: {},
},
data: {
showPhoneBtn: true,
showGetPanel: false,
showAlGetPanel: false,
showPhoneBtn: false,
userInfo: {
avatarUrl: defaultAvatarUrl,
nickName: '',
......@@ -26,14 +29,35 @@ ComponentWithStore({
canIUseGetUserProfile: wx.canIUse('getUserProfile'),
canIUseNicknameComp: wx.canIUse('input.type.nickname'),
},
ready() {
store.updateHomeInfo();
async ready() {
this.updateHomeInfo();
},
methods: {
getPhoneNumber(e: any) {
console.log(e.detail)
console.log(e.detail.iv)
console.log(e.detail.encryptedData)
if (e.detail?.iv && e.detail?.encryptedData) {
wx.login({
success: async (res) => {
console.log(res.code)
await dbLogin({
code: res.code,
iv: e.detail.iv,
encryptedData: e.detail.encryptedData,
});
await this.updateHomeInfo();
},
});
}
},
async updateHomeInfo() {
await store.updateHomeInfo();
this.setData({
showPhoneBtn: !store.homeInfo.mobile,
});
},
closeGetPanel() {
this.setData({
......
<!-- index.wxml -->
<view class="home_container">
<swiper class="top_swiper" autoplay="{{homeInfo.banner.length == 1 ? false : true}}">
<swiper-item class="top_swiper_item" wx:for="{{homeInfo.banner}}" wx:key="{{index}}">
<swiper-item class="top_swiper_item" wx:for="{{homeInfo.topBanners}}" wx:key="{{index}}">
<image class="swiper_item_img" src="{{item}}" lazy-load />
</swiper-item>
</swiper>
<view class="user_info">
<view class="avatar_box">
<image class="avatar" src="{{userInfo.avatarUrl}}"></image>
<image class="avatar" src="{{avatar}}"></image>
</view>
<text class="nickname">我的用户名称</text>
<text class="tel">手机号:13409876765</text>
<text class="tel">手机号:{{homeInfo.mobile || "-"}}</text>
</view>
<view class="content_info">
<view class="content_info_bg"></view>
......@@ -19,7 +19,7 @@
<view class="content_act_list_title">热门活动</view>
<view class="content_act_list_more">查看更多 ></view>
<view class="act_list">
<image class="act_item" wx:for="{{homeInfo.actList}}" wx:key="{{index}}" src="{{item}}"></image>
<image class="act_item" wx:for="{{homeInfo.activities}}" wx:key="{{index}}" src="{{item}}"></image>
</view>
</view>
</view>
......
......@@ -6,28 +6,30 @@ import { API_PATH } from "../utils/config";
class Store {
homeInfo = {
name: '123123',
age: 123123,
banner: [
"https://yun.duiba.com.cn/polaris/banner.bf4a3033e8bb2cb9eb20c534d002879a2f6b5579.png",
nickname: '',
avatar: "",
mobile: "",
subscribe: "",
first: true,
topBanners: [
],
actList: [
"https://yun.duiba.com.cn/polaris/banner1.653abf8ac33740307cee1ddb6c69d3502b532f61.png",
"https://yun.duiba.com.cn/polaris/banner1.653abf8ac33740307cee1ddb6c69d3502b532f61.png",
"https://yun.duiba.com.cn/polaris/banner1.653abf8ac33740307cee1ddb6c69d3502b532f61.png",
"https://yun.duiba.com.cn/polaris/banner1.653abf8ac33740307cee1ddb6c69d3502b532f61.png",
"https://yun.duiba.com.cn/polaris/banner1.653abf8ac33740307cee1ddb6c69d3502b532f61.png",
"https://yun.duiba.com.cn/polaris/banner1.653abf8ac33740307cee1ddb6c69d3502b532f61.png",
activities: [
]
}
async updateHomeInfo() {
const res = await request({
// wx.showLoading({
// title: '加载中',
// mask: true,
// });
const {success, data} = await request({
url: API_PATH.index,
});
console.log(res)
if (!success) return;
this.homeInfo = data;
}
}
......
......@@ -15,7 +15,7 @@ interface IReqConfig {
interface IResData {
success: boolean;
data?: { [key in string]: any };
data?: any,
code?: string;
message?: string;
}
......@@ -79,10 +79,10 @@ export async function dbLogin(
};
code && (params.code = code);
encryptedData && (encryptedData.code = encryptedData);
iv && (iv.code = iv);
nickname && (nickname.code = nickname);
avatar && (avatar.code = avatar);
encryptedData && (params.encryptedData = encryptedData);
iv && (params.iv = iv);
nickname && (params.nickname = nickname);
avatar && (params.avatar = avatar);
const {success, data} = await request({
url: API_PATH.login,
......
......@@ -4,18 +4,20 @@
"message": "true",
"code": "0",
"data": {
"nickname": 1231231,
"avatar": 1231231,
"mobile": 17606542514,
"nickname": "",
"avatar": "",
"mobile": "",
"subscribe": false,
"first": false,
"first": true,
"topBanners": [
"https://yun.duiba.com.cn/polaris/%E5%9B%BE%E5%B1%82%20541.3c7ff6d4bed9f88be00c52551b05b54d94d1fd95.png",
"//yun.duiba.com.cn/polaris/%E5%96%9D%E9%B2%9C%E5%A5%B6.5815326bdfc25045c0a8ee71beb10c13b0147acd.png",
"//yun.duiba.com.cn/polaris/%E9%B2%9C%E7%89%9B%E5%A5%B6.fd352be87520d04261ba36348022c36836e4c819.png"
],
"activities": [
"111111111"
"https://yun.duiba.com.cn/polaris/%E5%9B%BE%E5%B1%82%20541.3c7ff6d4bed9f88be00c52551b05b54d94d1fd95.png",
"//yun.duiba.com.cn/polaris/%E5%96%9D%E9%B2%9C%E5%A5%B6.5815326bdfc25045c0a8ee71beb10c13b0147acd.png",
"//yun.duiba.com.cn/polaris/%E9%B2%9C%E7%89%9B%E5%A5%B6.fd352be87520d04261ba36348022c36836e4c819.png"
]
}
},
......
{
"useApiMock": true,
"apiMockConfig": {
"globalOpen": true,
"rules": [
{
"ruleId": "c129a286-f861-4501-a497-e6d77eaec4a3",
"ruleName": "home/coop_subscribe.do",
"apiName": "request",
"enable": true,
"verifyFail": false,
"filterList": [
{
"propName": "url",
"propRegString": "home/coop_subscribe.do",
"filterId": "75f5fc2a-b7c9-472d-aa6d-ca589ea27123",
"matchType": "regExp"
}
],
"returnConfig": {
"returnType": "succ",
"generateType": "manual",
"manual": {
"succ": {
"resStr": "{\r\n \"data\": {\r\n \"success\": true,\r\n \"message\": \"true\",\r\n \"code\": \"0\",\r\n \"data\": true\r\n },\r\n \"statusCode\": 200,\r\n \"header\": \"\"\r\n}"
},
"fail": {
"resStr": "{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"
}
},
"template": {
"succ": {
"templateStr": "{\n \"data\": \"\",\n \"statusCode\": \"\",\n \"header\": \"\"\n}"
},
"fail": {
"templateStr": "{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"
}
}
}
},
{
"ruleId": "aad0a1fd-193f-4326-9042-5f47af0a40bf",
"ruleName": "/wechat/jlb/login",
"apiName": "request",
"enable": true,
"verifyFail": false,
"filterList": [
{
"propName": "url",
"propRegString": "https://activity.m.duiba.com.cn/wechat/jlb/login",
"filterId": "9fd88798-d158-4f01-a972-1fbfee46354c",
"matchType": "regExp"
}
],
"returnConfig": {
"returnType": "succ",
"generateType": "manual",
"manual": {
"succ": {
"resStr": "{\n \"data\": {\n \"success\": true,\n \"message\": \"true\",\n \"code\": \"0\",\n \"desc\": \"desc\",\n \"timestamp\": 1719284416812,\n \"data\": {\n \"loginToken\": \"loginToken\",\n \"sessionId\": \"sessionId\"\n }\n },\n \"statusCode\": 200,\n \"header\": \"\"\n}"
},
"fail": {
"resStr": "{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"
}
},
"template": {
"succ": {
"templateStr": "{\n \"data\": \"\",\n \"statusCode\": \"\",\n \"header\": \"\"\n}"
},
"fail": {
"templateStr": "{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"
}
}
}
},
{
"ruleId": "8b763ea5-b2f8-4ef6-a354-00c5c01efe2f",
"ruleName": "coop_activity.do",
"apiName": "request",
"enable": true,
"verifyFail": false,
"filterList": [
{
"propName": "url",
"propRegString": "coop_activity.do",
"filterId": "bb1bcd0b-0e76-4154-8088-187938c36909",
"matchType": "regExp"
}
],
"returnConfig": {
"returnType": "succ",
"generateType": "manual",
"manual": {
"succ": {
"resStr": "{\n \"data\": {\n \"success\": true,\n \"message\": \"true\",\n \"code\": \"0\",\n \"data\": {\n \"topBanners\": [\n \"https://yun.duiba.com.cn/polaris/%E5%9B%BE%E5%B1%82%20541.3c7ff6d4bed9f88be00c52551b05b54d94d1fd95.png\",\n \"//yun.duiba.com.cn/polaris/%E5%96%9D%E9%B2%9C%E5%A5%B6.5815326bdfc25045c0a8ee71beb10c13b0147acd.png\",\n \"//yun.duiba.com.cn/polaris/%E9%B2%9C%E7%89%9B%E5%A5%B6.fd352be87520d04261ba36348022c36836e4c819.png\"\n ],\n \"productList\": [\n {\n \"name\": \"商品1\",\n \"img\": \"//yun.duiba.com.cn/polaris/%E5%96%9D%E9%B2%9C%E5%A5%B6.5815326bdfc25045c0a8ee71beb10c13b0147acd.png\",\n \"content\": \"商品1的内容\"\n },\n {\n \"name\": \"商品1\",\n \"img\": \"//yun.duiba.com.cn/polaris/%E9%B2%9C%E7%89%9B%E5%A5%B6.fd352be87520d04261ba36348022c36836e4c819.png\",\n \"content\": \"商品1的内容\"\n }\n ]\n }\n },\n \"statusCode\": 200,\n \"header\": \"\"\n}"
},
"fail": {
"resStr": "{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"
}
},
"template": {
"succ": {
"templateStr": "{\n \"data\": \"\",\n \"statusCode\": \"\",\n \"header\": \"\"\n}"
},
"fail": {
"templateStr": "{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"
}
}
}
},
{
"ruleId": "2d6801eb-239a-4a96-8527-66443e3ad98c",
"ruleName": "coop_index.do",
"apiName": "request",
"enable": true,
"verifyFail": false,
"filterList": [
{
"propName": "url",
"propRegString": "coop_index.do",
"filterId": "51c73046-cb33-426e-8148-71441386a42b",
"matchType": "regExp"
}
],
"returnConfig": {
"returnType": "succ",
"generateType": "manual",
"manual": {
"succ": {
"resStr": "{\n \"data\": {\n \"success\": true,\n \"message\": \"true\",\n \"code\": \"0\",\n \"data\": {\n \"nickname\": \"\",\n \"avatar\": \"\",\n \"mobile\": \"17606542514\",\n \"subscribe\": false,\n \"first\": true,\n \"topBanners\": [\n \"https://yun.duiba.com.cn/polaris/%E5%9B%BE%E5%B1%82%20541.3c7ff6d4bed9f88be00c52551b05b54d94d1fd95.png\",\n \"//yun.duiba.com.cn/polaris/%E5%96%9D%E9%B2%9C%E5%A5%B6.5815326bdfc25045c0a8ee71beb10c13b0147acd.png\",\n \"//yun.duiba.com.cn/polaris/%E9%B2%9C%E7%89%9B%E5%A5%B6.fd352be87520d04261ba36348022c36836e4c819.png\"\n ],\n \"activities\": [\n \"https://yun.duiba.com.cn/polaris/%E5%9B%BE%E5%B1%82%20541.3c7ff6d4bed9f88be00c52551b05b54d94d1fd95.png\",\n \"//yun.duiba.com.cn/polaris/%E5%96%9D%E9%B2%9C%E5%A5%B6.5815326bdfc25045c0a8ee71beb10c13b0147acd.png\",\n \"//yun.duiba.com.cn/polaris/%E9%B2%9C%E7%89%9B%E5%A5%B6.fd352be87520d04261ba36348022c36836e4c819.png\"\n ]\n }\n },\n \"statusCode\": 200,\n \"header\": \"\"\n}"
},
"fail": {
"resStr": "{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"
}
},
"template": {
"succ": {
"templateStr": "{\n \"data\": \"\",\n \"statusCode\": \"\",\n \"header\": \"\"\n}"
},
"fail": {
"templateStr": "{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"
}
}
}
}
]
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment