Browse Source

大转盘

XUYangWei 3 months ago
parent
commit
4e739833be

+ 1 - 1
AppScope/resources/base/element/string.json

@@ -2,7 +2,7 @@
   "string": [
     {
       "name": "app_name",
-      "value": "YTSketch"
+      "value": "樱桃小决定"
     }
   ]
 }

+ 2 - 2
commons/basic/src/main/ets/apis/YTRequest.ets

@@ -13,8 +13,8 @@ import { yTRouter } from '../utils/YTRouter';
 
 // export const baseURL: string = 'https://hm-test.ytpm.net/prod-api'
 
-export const baseURL: string = 'http://192.168.1.160:9900'
-
+export const baseURL: string = 'http://192.168.1.160:48097'
+// export const baseURL: string = 'https://hm.ytpm.net/prod-decision/decisionApUser'
 export const instance = axios.create({
   baseURL,
   timeout: 5000

+ 12 - 11
commons/basic/src/main/ets/apis/YTUserRequest.ets

@@ -15,7 +15,7 @@ export class YTUserRequest extends YTRequest {
   //获取验证码
   static getLoginCaptcha(phonenumber: string, result: ResultCallBack<LoginCollect>) {
     YTUserRequest.post<LoginCollect, LoginCollect>(
-      `/warehouseApUser/sendSmsCode`,
+      `/decisionApUser/sendSmsCode`,
       new LoginCollect('login')
         .setPhonenumber(phonenumber)
     )
@@ -30,7 +30,7 @@ export class YTUserRequest extends YTRequest {
   //验证码登录
   static phonenumberLogin(param: LoginCollect, result?: ResultCallBack<UserInfo>) {
     if (param.getUuid() !== undefined) {
-      YTUserRequest.post<ReqString, LoginCollect>(`/warehouseApUser/phoneLogin`, param)
+      YTUserRequest.post<ReqString, LoginCollect>(`/decisionApUser/phoneLogin`, param)
         .then(res => {
           userInfo.setToken(res[AppStorageKeyCollect.TOKEN])
           YTUserRequest.refreshUserInfo((res) => {
@@ -47,7 +47,7 @@ export class YTUserRequest extends YTRequest {
   //注册
   static register(param: LoginCollect) {
     if (param.getUuid() !== undefined) {
-      YTUserRequest.post<ReqString, LoginCollect>(`/warehouseApUser/phoneSave`, param)
+      YTUserRequest.post<ReqString, LoginCollect>(`/decisionApUser/phoneSave`, param)
         .then(res => {
           userInfo.setToken(res[AppStorageKeyCollect.TOKEN])
           YTUserRequest.refreshUserInfo(() => {
@@ -62,7 +62,7 @@ export class YTUserRequest extends YTRequest {
 
   //密码登录
   static passwordLogin(param: LoginCollect, result?: ResultCallBack<UserInfo>) {
-    YTUserRequest.post<ReqString, LoginCollect>(`/warehouseApUser/passwordLogin`, param)
+    YTUserRequest.post<ReqString, LoginCollect>(`/decisionApUser/passwordLogin`, param)
       .then(res => {
         userInfo.setToken(res[AppStorageKeyCollect.TOKEN])
         YTUserRequest.refreshUserInfo((res) => {
@@ -75,7 +75,7 @@ export class YTUserRequest extends YTRequest {
 
   //重置密码
   static resetPassword(param: LoginCollect, result?: ResultCallBack<undefined>) {
-    YTUserRequest.post<ReqString, LoginCollect>(`/warehouseApUser/resetPwd`, param)
+    YTUserRequest.post<ReqString, LoginCollect>(`/decisionApUser/resetPwd`, param)
       .then(() => {
         result?.()
       })
@@ -88,7 +88,7 @@ export class YTUserRequest extends YTRequest {
       HuaweiAuthPlugin.requestAuth()
         .then(code => {
           instance.setCode(code!)
-          YTUserRequest.post<ReqString, LoginCollect>(`/warehouseApUser/hmLogin`,
+          YTUserRequest.post<ReqString, LoginCollect>(`/decisionApUser/hmLogin`,
             instance)
             .then(data => {
               const token = data['token']
@@ -119,7 +119,7 @@ export class YTUserRequest extends YTRequest {
 
   //刷新用户信息
   static refreshUserInfo(result?: ResultCallBack<UserInfo>) {
-    YTUserRequest.post<UserInfo, null>(`/warehouseApUser/info`)
+    YTUserRequest.post<UserInfo, null>(`/decisionApUser/info`)
       .then(res => {
         userInfo.setUserInfoAndLogin(res)
         YTLog.info(userInfo)
@@ -163,7 +163,7 @@ export class YTUserRequest extends YTRequest {
     })
       .then(res => {
         const url = res['url']
-        YTUserRequest.post<null, ReqString>(`/warehouseApUser/modifyMemberIcon`,
+        YTUserRequest.post<null, ReqString>(`/decisionApUser/modifyMemberIcon`,
           { 'memberIcon': url })
           .then(() => {
             success()
@@ -180,7 +180,7 @@ export class YTUserRequest extends YTRequest {
 
   // 修改用户昵称
   static changeNickname(name: string, success: () => void) {
-    YTUserRequest.post<null, ReqString>(`/warehouseApUser/modifyMemberName`,
+    YTUserRequest.post<null, ReqString>(`/decisionApUser/modifyMemberName`,
       { 'memberName': name })
       .then(() => {
         YTUserRequest.refreshUserInfo(() => {
@@ -191,10 +191,11 @@ export class YTUserRequest extends YTRequest {
 
   //问题反馈
   static questionBack(des: string, createBy: string) {
-    YTUserRequest.post<null, ReqString>(`/warehouseBack/saveQuestion`, {
+    YTUserRequest.post<null, ReqString>(`/decisionBack/saveQuestion`, {
       'backQuestion': des,
       'createBy': createBy,
-      'createTime': new YTDate().formatDate(),
+      // 'createTime': new YTDate().formatDate(),
+      // 'createTime': new YTDate().toString()
     })
       .then(() => {
         IBestToast.show("反馈成功")

+ 12 - 10
commons/basic/src/main/ets/utils/YTRequest.ets

@@ -14,7 +14,8 @@ import { userInfo, UserInfo } from '../models/UserInfo';
 import { HuaweiAuthPlugin } from './HuaWeiAuthPlugin';
 
 
-export const baseURL: string = 'https://hm-test.ytpm.net/prod-api'
+// export const baseURL: string = 'https://hm-test.ytpm.net/prod-api'
+export const baseURL: string = 'https://hm.ytpm.net/prod-decision'
 
 export const instance = axios.create({
   baseURL,
@@ -61,7 +62,7 @@ instance.interceptors.response.use((response: AxiosResponse) => {
 
 
 export class YTRequest {
-  private static productName: string = 'chat'
+  private static productName: string = 'decisionApUser'
 
   static get<T>(url: string, params?: Record<string, string | number | boolean>,
     headers?: Record<string, string>): Promise<T> {
@@ -78,7 +79,7 @@ export class YTRequest {
 
   //获取验证码
   static getCaptcha(phonenumber: string, success: (res: string) => void, fail: (err: Error) => void) {
-    YTRequest.post<ReqString, ReqString>(`/api/${YTRequest.productName}/member/sendSmsCode`,
+    YTRequest.post<ReqString, ReqString>(`/${YTRequest.productName}/sendSmsCode`,
       { 'phonenumber': phonenumber })
       .then(res => {
         success(res['uuid'])
@@ -92,7 +93,7 @@ export class YTRequest {
   static phonenumberLogin(param: ReqString) {
     const uuid = AppStorage.get<string>('uuid')
     if (uuid !== undefined) {
-      YTRequest.post<ReqString, ReqString>(`/api/${YTRequest.productName}/member/phoneLogin`, {
+      YTRequest.post<ReqString, ReqString>(`/${YTRequest.productName}/phoneLogin`, {
         'phonenumber': param['phonenumber'],
         'smsCode': param['captcha'],
         'uuid': uuid
@@ -113,7 +114,7 @@ export class YTRequest {
       IBestToast.showLoading()
       HuaweiAuthPlugin.requestAuth()
         .then(res => {
-          YTRequest.post<ReqString, ReqString>(`/api/${YTRequest.productName}/member/hmLogin`,
+          YTRequest.post<ReqString, ReqString>(`/${YTRequest.productName}/hmLogin`,
             { 'code': res } as ReqString)
             .then(data => {
               const token = data['token']
@@ -147,7 +148,7 @@ export class YTRequest {
 
   //刷新用户信息
   static refreshUserInfo(success?: (res: UserInfo) => void) {
-    YTRequest.post<UserInfo, null>(`/api/${YTRequest.productName}/member/info`)
+    YTRequest.post<UserInfo, null>(`/${YTRequest.productName}/info`)
       .then(res => {
         userInfo.setUserInfoAndLogin(res)
         YTLog.info(userInfo)
@@ -188,7 +189,7 @@ export class YTRequest {
     })
       .then(res => {
         const url = res['url']
-        YTRequest.post<null, ReqString>(`/api/${YTRequest.productName}/member/modifyMemberIcon`, { 'memberIcon': url })
+        YTRequest.post<null, ReqString>(`/${YTRequest.productName}/modifyMemberIcon`, { 'memberIcon': url })
           .then(() => {
             success()
           })
@@ -204,7 +205,7 @@ export class YTRequest {
 
   // 修改用户昵称
   static changeNickname(name: string, success: () => void) {
-    YTRequest.post<null, ReqString>(`/api/${YTRequest.productName}/member/modifyMemberName`, { 'memberName': name })
+    YTRequest.post<null, ReqString>(`/${YTRequest.productName}/modifyMemberName`, { 'memberName': name })
       .then(() => {
         YTRequest.refreshUserInfo(() => {
           success()
@@ -214,10 +215,11 @@ export class YTRequest {
 
   //问题反馈
   static questionBack(des: string, createBy: string) {
-    YTRequest.post<null, ReqString>(`/api/${YTRequest.productName}/question/saveQuestion`, {
+    YTRequest.post<null, ReqString>(`/decisionBack/saveQuestion`, {
       'backQuestion': des,
       'createBy': createBy,
-      'createTime': new YTDate().formatDate(),
+      // 'createTime': new YTDate().formatDate(),
+      // 'createTime': new YTDate().toString()
     })
       .then(() => {
         IBestToast.show("反馈成功")

BIN
commons/basic/src/main/resources/base/media/eatwhatGai.png


BIN
commons/basic/src/main/resources/base/media/huaweiicon.png


BIN
commons/basic/src/main/resources/base/media/qiehuan.png


BIN
commons/basic/src/main/resources/base/media/repeat.png


BIN
commons/basic/src/main/resources/base/media/voicemuisc.png


BIN
commons/basic/src/main/resources/base/media/xuanzhuankuang.png


BIN
commons/basic/src/main/resources/base/media/xuanzhuantime.png


BIN
commons/basic/src/main/resources/base/media/zhizheng.png


+ 8 - 2
features/feature/src/main/ets/utils/Sector.ets

@@ -25,10 +25,13 @@ export struct Sector {
     const largeArcFlag = angle / 2 > 180 ? 1 : 0;
     const sweepFlag = 1; // 设置弧线方向为顺时针
 
-    // 生成SVG路径命令
     const pathCommands =
       `M${startX} ${startY} A${radius} ${radius} 0 ${largeArcFlag} ${sweepFlag} ${endX1} ${endY1} L${centerX} ${centerY} L${endX2} ${endY2} A${radius} ${radius} 0 ${largeArcFlag} ${1 -
         sweepFlag} ${startX} ${startY} Z`;
+    // 生成SVG路径命令
+    // const pathCommands =
+    //   `M${startX} ${startY} A${radius} ${radius} 0 ${largeArcFlag} ${sweepFlag} ${startX} ${startY} A${radius} ${radius} 0 ${largeArcFlag} ${1 -
+    //     sweepFlag} ${endX2} ${endY2} Z`;
     return pathCommands; // 返回路径命令
   }
 
@@ -42,6 +45,7 @@ export struct Sector {
         .commands(this.createSectorPath(this.radius, this.angle)) // 设置路径命令
         .fillOpacity(1) // 设置填充透明度
         .fill(this.color) // 设置填充颜色
+        // .stroke(Color.Black)
         .strokeWidth(0) // 设置边框宽度为0
         .rotate({ angle: this.angle / 4 - 90 }); // 旋转扇形
 
@@ -52,7 +56,9 @@ export struct Sector {
         .commands(this.createSectorPath(this.radius, this.angle)) // 设置路径命令
         .fillOpacity(1) // 设置填充透明度
         .fill(this.color) // 设置填充颜色
-        .strokeWidth(0) // 设置边框宽度为0
+        // .stroke('#f8edfa')
+        .stroke(Color.Black)
+        .strokeWidth(0.5) // 设置边框宽度为0
         .rotate({ angle: 180 - (this.angle / 4 - 90) }); // 旋转扇形
     }
   }

+ 24 - 14
features/feature/src/main/ets/view/BigWheelView.ets

@@ -16,7 +16,7 @@ struct BigWheelView{
   @StorageProp(YTAvoid.SAFE_TOP_KEY) safeBottom: number = 0
 
   @State cells: Cell[] = []; // 存储单元格的数组
-  @State wheelWidth: number = 600; // 转盘的宽度
+  @State wheelWidth: number = 400; // 转盘的宽度
   @State currentAngle: number = 0; // 当前转盘的角度
   @State selectedName: string = ""; // 选中的名称
   @State isRepeat:boolean=false
@@ -129,21 +129,26 @@ struct BigWheelView{
         .rotate({ angle: this.currentAngle }); // 旋转转盘
 
         // 创建指针
-        Polygon({ width: 20, height: 10 })
-          .points([[0, 0], [10, -20], [20, 0]]) // 设置指针的点
-          .fill("#d72b0b") // 设置指针颜色
-          .height(20) // 设置指针高度
-          .margin({ bottom: '140lpx' }); // 设置指针底部边距
+        // Image({ width: 20, height: 10 })
+        //   .points([[0, 0], [10, -20], [20, 0]]) // 设置指针的点
+        //   .fill("#d72b0b") // 设置指针颜色
+        //   .height(20) // 设置指针高度
+        //   .margin({ bottom: '140lpx' }); // 设置指针底部边距
 
         // 创建开始按钮
-        Button('开始')
-          .fontColor("#c53a2c") // 设置按钮字体颜色
-          .borderWidth(10) // 设置按钮边框宽度
-          .borderColor("#dd2218") // 设置按钮边框颜色
-          .backgroundColor("#fde427") // 设置按钮背景颜色
-          .width('200lpx') // 设置按钮宽度
-          .height('200lpx') // 设置按钮高度
-          .borderRadius('50%') // 设置按钮为圆形
+        // Button('开始')
+        //   .fontColor("#c53a2c") // 设置按钮字体颜色
+        //   .borderWidth(10) // 设置按钮边框宽度
+        //   .borderColor("#dd2218") // 设置按钮边框颜色
+        //   .backgroundColor("#fde427") // 设置按钮背景颜色
+        //   .width('200lpx') // 设置按钮宽度
+        //   .height('200lpx') // 设置按钮高度
+        //   .borderRadius('50%') // 设置按钮为圆形
+        //   .clickEffect({ level: ClickEffectLevel.LIGHT }) // 设置点击效果
+        Image($r('[basic].media.zhizheng'))
+          .width('70lpx') // 设置按钮宽度
+          .height('70lpx') // 设置按钮高度
+          .objectFit(ImageFit.Contain)
           .clickEffect({ level: ClickEffectLevel.LIGHT }) // 设置点击效果
           .onClick(() => { // 点击按钮时的回调函数
             if (this.isAnimating) { // 如果正在动画中,返回
@@ -191,6 +196,11 @@ struct BigWheelView{
             });
           });
       }
+      .width(`${this.wheelWidth+26}lpx`)
+      .height(`${this.wheelWidth+26}lpx`)
+      .backgroundImage($r('[basic].media.xuanzhuankuang'))
+      .backgroundImageSize({width:'100%',height:'100%'})
+      .backgroundImagePosition(Alignment.Center)
 
       // 创建滚动区域
       Scroll() {

+ 57 - 0
features/feature/src/main/ets/view/EatWhatView.ets

@@ -11,9 +11,66 @@ function EatWhatViewBuilder(){
 @Component
 struct EatWhatView{
   @StorageProp(YTAvoid.SAFE_TOP_KEY) safeBottom: number = 0
+
+  @State
+  eat:string[]=['1111','2222','3333','33333','4444','55555','66666','77777','88888']
+  @State
+  eatEat:string=""
+  @State
+  isrun:boolean=false
+
+
+  eatRandom(){
+    return  this.eat[Math.floor(Math.random()*this.eat.length)]
+  }
   build() {
     Column() {
       YTHeader({ title: '吃什么' })
+      Row({ space: 20 }) {
+        // Stack() {
+        Image($r('[basic].media.voicemuisc')).width(30).height(30).margin({left:20,right:50})
+
+      }.width('100%').margin({top:20}).justifyContent(FlexAlign.Start); // 设置宽度和内容居中对齐
+
+
+      Column() {
+
+          Column(){
+            Text(this.eatEat).fontSize(20)
+          }.width(80)
+          .height(70)
+          .justifyContent(FlexAlign.Center)
+          .backgroundImage($r('[basic].media.number'))
+          .backgroundImageSize({width:'100%',height:"100%"})
+          .margin({bottom:40})
+
+        Image($r('[basic].media.eatwhatGai')).width(150)
+
+      }.width('100%').height(500).justifyContent(FlexAlign.Center).margin({bottom:100}) // 设置组件的宽度、权重、对齐方式和底部内边距
+
+
+
+
+        Button('换一个').fontColor(Color.White)
+        .backgroundColor('#fd54e3').width('70%')
+        .height(44).borderRadius(20)
+        .onClick(()=>{
+          this.isrun=true
+
+          setTimeout(()=>{
+            this.isrun=false
+          },3000)
+
+          if(this.isrun) {
+            setInterval(() => {
+              this.eatEat = this.eatRandom()
+            }, 100)
+          }
+
+        })
+
+
+
 
     }.padding({ bottom: this.safeBottom })
     .height('100%')

+ 7 - 7
features/feature/src/main/ets/view/RanNumberView.ets

@@ -119,7 +119,7 @@ struct RanNumberView{
       YTHeader({ title: '随机数' })
       //声音
       Row(){
-        Image($r('app.media.app_icon')).width(24)
+        Image($r('[basic].media.voicemuisc')).width(24)
       }.width('100%')
       .justifyContent(FlexAlign.Start)
       .padding({left:30})
@@ -257,17 +257,17 @@ struct RanNumberView{
       .backgroundColor('#e0f8ff')
       .justifyContent(FlexAlign.Start)
 
-      Text('生成范围为100以内,最多生成10个数')
+      Text('生成范围为100以内,最多生成10个数').margin({bottom:50})
 
 
-      Button('数字是否可以重复').onClick(()=>{
-        this.isUnique=!this.isUnique
-      })
-      Text(JSON.stringify(this.isUnique))
+      // Button('数字是否可以重复').onClick(()=>{
+      //   this.isUnique=!this.isUnique
+      // })
+      // Text(JSON.stringify(this.isUnique))
 
       YTButton({
         bgc:'#fd54e3',
-        btHeight:54,
+        btHeight:44,
         btBorderRadius:20,
         btWidth:300,
         btFontColor:Color.White,

+ 6 - 6
features/feature/src/main/ets/view/RollDiceView.ets

@@ -52,12 +52,12 @@ struct RollDiceView {
         //
         // }.width('100%')
         // .height(500)
-        //
-        //
-        //
-        //
-        //
-        //
+        // //
+        // //
+        // //
+        // //
+        // //
+        // //
         // Row(){
         //   Button('开始播放').onClick(()=>{
         //     this.controller.start()

+ 108 - 92
features/feature/src/main/ets/view/TossCoinView.ets

@@ -14,7 +14,7 @@ struct TossCoinView{
   @State cellWidth: number = 50 // 单元格宽度
   @State headsCount: number = 0 // 正面朝上的次数
   @State tailsCount: number = 0 // 反面朝上的次数
-  @State rotationAngle: number = 40 // 旋转角度
+  @State rotationAngle: number = 0 // 旋转角度
   @State verticalOffset: number = 0 // 纵向位移
   @State isAnimRun: boolean = false // 动画是否正在执行
 
@@ -22,71 +22,125 @@ struct TossCoinView{
   // 判断当前是否显示正面
   isHeadsFaceUp() {
     let normalizedAngle = this.rotationAngle % 360; // 规范化角度
-    // 判断角度范围,确定是否显示地鼠
+    // 判断角度范围,确定是否显示
     if (normalizedAngle >= 0 && normalizedAngle < 90 || normalizedAngle >= 270 && normalizedAngle <= 360) {
-      return true; // 显示地鼠
+      return true; // 显示
     }
     return false; // 显示反面
   }
+  runAnimation(){
+
+    if (this.isAnimRun) {
+      return;
+    }
+    this.isAnimRun = true
+
+    let maxAnimationSteps = 2 * (10 + Math.floor(Math.random() * 10)); // 计算最大动画次数
+    let totalAnimationDuration = 1500; // 动画总时长 2000
+
+    // 第一次动画,向上抛出
+    animateToImmediately({
+      duration: totalAnimationDuration / 2, // 动画时长为总时长的一半
+      onFinish: () => { // 动画完成后的回调
+        // 第二次动画,向下落
+        animateToImmediately({
+          duration: totalAnimationDuration / 2,
+          onFinish: () => {
+            this.rotationAngle = this.rotationAngle % 360; // 确保角度在0到360之间
+            // 判断当前显示的面
+            if (this.isHeadsFaceUp()) { // 如果是正面
+              this.tailsCount++; // 反面朝上的次数加1
+            } else { // 如果是反面
+              this.headsCount++; // 正面朝上的次数加1
+            }
+            this.isAnimRun = false
+          }
+        }, () => {
+          this.verticalOffset = 0; // 重置纵向位移
+        });
+      }
+    }, () => {
+      // 设置纵向位移,模拟抛硬币的效果
+      this.verticalOffset = -100 * (1 + Math.floor(Math.random() * 2)); // 随机设置向上的位移
+    });
+
+    // 循环动画,增加旋转效果
+    for (let i = 0; i < maxAnimationSteps; i++) {
+      animateToImmediately({
+        delay: i * totalAnimationDuration / maxAnimationSteps, // 设置每次动画的延迟
+        duration: 100, // 每次动画的持续时间
+        onFinish: () => {
+          // 动画完成后的回调
+        }
+      }, () => {
+        this.rotationAngle += 90; // 每次增加90度旋转
+      });
+    }
+  }
 
   build() {
     Column() {
       YTHeader({ title: '抛硬币' })
 
-      // Column(){
-      //   // Text('xxx').onClick(()=>{
-      //   //   router.back()
-      //   // })
-      // }
-      // 页面标题
-      Text('抛硬币')
-        .height(50)// 高度设置为50
-        .width('100%')// 宽度设置为100%
-        .textAlign(TextAlign.Center)// 文本居中对齐
-        .fontColor("#fefefe")// 字体颜色
-        .fontSize(20); // 字体大小
-
-      // 显示地鼠和计数
-      Row({ space: 20 }) {
-        Stack() {
-         Image($r('[basic].media.coinbefore')).width(20).height(20).borderRadius(10)
 
-        }
-        .borderRadius('50%') // 设置圆角
-        .width(20) // 设置宽度
-        .height(20) // 设置高度
-        .linearGradient({
-          // 设置线性渐变背景
-          direction: GradientDirection.LeftBottom,
-          colors: [['#ebcf2f', 0.0], ['#fef888', 0.5], ['#ebcf2f', 1.0]]
-        });
+
+      Row({ space: 20 }) {
+        // Stack() {
+         Image($r('[basic].media.voicemuisc')).width(30).height(30).margin({left:20,right:50})
+        //
+        // }
+        // .borderRadius('50%') // 设置圆角
+        // .width(20) // 设置宽度
+        // .height(20) // 设置高度
+        // .linearGradient({
+        //   // 设置线性渐变背景
+        //   direction: GradientDirection.LeftBottom,
+        //   colors: [['#ebcf2f', 0.0], ['#fef888', 0.5], ['#ebcf2f', 1.0]]
+        // });
+        Text('正')
 
         // 显示反面朝上的次数
         Text(`${this.tailsCount}`)
           .fontSize(20)
           .fontColor(Color.Black);
 
-        Stack() {
-          // 显示100
-          Image($r('[basic].media.coinback')).width(20).height(20).borderRadius(10)
-        }
-        .borderRadius('50%') // 设置圆角
-        .width(20) // 设置宽度
-        .height(20) // 设置高度
-        .linearGradient({
-          // 设置线性渐变背景
-          direction: GradientDirection.LeftBottom,
-          colors: [['#ebcf2f', 0.0], ['#fef888', 0.5], ['#ebcf2f', 1.0]]
-        });
+        // Stack() {
+        //   // 显示100
+        //   Image($r('[basic].media.coinback')).width(20).height(20).borderRadius(10)
+        // }
+        // .borderRadius('50%') // 设置圆角
+        // .width(20) // 设置宽度
+        // .height(20) // 设置高度
+        // .linearGradient({
+        //   // 设置线性渐变背景
+        //   direction: GradientDirection.LeftBottom,
+        //   colors: [['#ebcf2f', 0.0], ['#fef888', 0.5], ['#ebcf2f', 1.0]]
+        // });
+        Text('反')
 
         // 显示正面朝上的次数
         Text(`${this.headsCount}`)
           .fontSize(20)
           .fontColor(Color.Black);
+        Image($r('[basic].media.repeat')).width(30).height(30).margin({left:50,right:20}).onClick(()=>{
+          this.runAnimation()
+        })
+
+      }.width('100%').margin({top:20}).justifyContent(FlexAlign.Center); // 设置宽度和内容居中对齐
+
+      Column() {
+        if(!this.isAnimRun){
+          Column(){
+            Text(this.isHeadsFaceUp()?'正':"反").fontSize(20)
+          }.width(80)
+          .height(70)
+          .justifyContent(FlexAlign.Center)
+          .backgroundImage($r('[basic].media.number'))
+          .backgroundImageSize({width:'100%',height:"100%"})
+          .margin({bottom:40})
+        }
 
-      }.width('100%').justifyContent(FlexAlign.Center); // 设置宽度和内容居中对齐
 
-      Stack() {
         Stack() {
           // 创建放大版地鼠组件
           // Hamster({ cellWidth: this.cellWidth * 3 })
@@ -107,8 +161,8 @@ struct TossCoinView{
             });
         }
         .borderRadius('50%') // 设置圆角
-        .width(100) // 设置宽度
-        .height(100) // 设置高度
+        .width(180) // 设置宽度
+        .height(180) // 设置高度
         .shadow({
           radius:5,
           color:"#f8cd46",
@@ -129,55 +183,17 @@ struct TossCoinView{
         })
         .translate({ x: 0, y: this.verticalOffset }) // 设置纵向位移
         .onClick(() => { // 点击事件处理
+          this.runAnimation()
 
-          if (this.isAnimRun) {
-            return;
-          }
-          this.isAnimRun = true
-
-          let maxAnimationSteps = 2 * (10 + Math.floor(Math.random() * 10)); // 计算最大动画次数
-          let totalAnimationDuration = 1500; // 动画总时长 2000
-
-          // 第一次动画,向上抛出
-          animateToImmediately({
-            duration: totalAnimationDuration / 2, // 动画时长为总时长的一半
-            onFinish: () => { // 动画完成后的回调
-              // 第二次动画,向下落
-              animateToImmediately({
-                duration: totalAnimationDuration / 2,
-                onFinish: () => {
-                  this.rotationAngle = this.rotationAngle % 360; // 确保角度在0到360之间
-                  // 判断当前显示的面
-                  if (this.isHeadsFaceUp()) { // 如果是地鼠面
-                    this.tailsCount++; // 反面朝上的次数加1
-                  } else { // 如果是反面
-                    this.headsCount++; // 正面朝上的次数加1
-                  }
-                  this.isAnimRun = false
-                }
-              }, () => {
-                this.verticalOffset = 0; // 重置纵向位移
-              });
-            }
-          }, () => {
-            // 设置纵向位移,模拟抛硬币的效果
-            this.verticalOffset = -100 * (1 + Math.floor(Math.random() * 5)); // 随机设置向上的位移
-          });
-
-          // 循环动画,增加旋转效果
-          for (let i = 0; i < maxAnimationSteps; i++) {
-            animateToImmediately({
-              delay: i * totalAnimationDuration / maxAnimationSteps, // 设置每次动画的延迟
-              duration: 100, // 每次动画的持续时间
-              onFinish: () => {
-                // 动画完成后的回调
-              }
-            }, () => {
-              this.rotationAngle += 90; // 每次增加90度旋转
-            });
-          }
         });
-      }.width('100%').layoutWeight(1).align(Alignment.Bottom).padding({ bottom: 80 }); // 设置组件的宽度、权重、对齐方式和底部内边距
+      }.width('100%').height(500).justifyContent(FlexAlign.Center).margin({bottom:100}) // 设置组件的宽度、权重、对齐方式和底部内边距
+
+      Button('抛硬币').fontColor(Color.White)
+        .backgroundColor('#fd54e3').width('70%')
+        .height(44).borderRadius(20)
+        .onClick(()=>{
+          this.runAnimation()
+        })
 
 
     }.padding({ bottom: this.safeBottom })

+ 50 - 37
features/user/src/main/ets/pages/LoginPage.ets

@@ -43,11 +43,6 @@ struct LoginPage {
             .borderRadius(12)
             .backgroundColor('#4DFFFFFF')
             .margin({ bottom: 24, right: 28, top: 20 })
-          Text('你好,\n欢迎来到盒小仓')
-            .lineHeight(40)
-            .fontSize(28)
-            .fontWeight(600)
-            .fontColor($r('[basic].color.main_ac_color_dark'))
         }
         .padding({ left: 16, })
         .height(193)
@@ -55,45 +50,61 @@ struct LoginPage {
         .alignItems(HorizontalAlign.Start)
 
         Row() {
-          Text('注册')
-            .fontSize(16)
-            .fontWeight(600)
-            .layoutWeight(1)
-            .fontColor(this.tabBarIndex == 0 || this.tabBarIndex == 2 ? '#FF141111' : '#80141111')
-            .backgroundColor(this.tabBarIndex == 0 || this.tabBarIndex == 2 ? Color.White : Color.Transparent)
-            .textAlign(TextAlign.Center)
-            .height(48)
-            .borderRadius({ topLeft: 12, topRight: 12, bottomRight: this.tabBarIndex == 1 ? 12 : 0 })
-            .onClick(() => {
-              this.tabBarIndex = 0
-              this.tabController.changeIndex(0)
-            })
-          Text('登录')
-            .fontSize(16)
-            .fontWeight(600)
-            .borderRadius({
-              topLeft: 12,
-              topRight: 12,
-              bottomLeft: this.tabBarIndex == 0 || this.tabBarIndex == 2 ? 12 : 0
-            })
-            .backgroundColor(this.tabBarIndex == 1 ? Color.White : Color.Transparent)
-            .layoutWeight(1)
-            .height(48)
-            .textAlign(TextAlign.Center)
-            .fontColor(this.tabBarIndex == 1 ? '#FF141111' : '#80141111')
-            .onClick(() => {
-              this.tabBarIndex = 1
-              this.tabController.changeIndex(1)
-            })
+          Column() {
+              Text().width(30).height(8).backgroundColor(this.tabBarIndex==1?'#fd86eb':Color.Transparent).offset({y:35}).borderRadius(3)
+            Text('登录')
+              .fontSize(20)
+              .fontWeight(600)
+              .borderRadius({
+                topLeft: 12,
+                topRight: 12,
+                bottomLeft: this.tabBarIndex == 0 || this.tabBarIndex == 2 ? 12 : 0
+              })
+              // .backgroundColor(this.tabBarIndex == 1 ? Color.White : Color.Transparent)
+              .height(48)
+              .textAlign(TextAlign.Center)
+              .fontColor(this.tabBarIndex == 1 ? '#FF141111' : '#80141111')
+              .onClick(() => {
+                this.tabBarIndex = 1
+                this.tabController.changeIndex(1)
+              })
+
+          }.justifyContent(FlexAlign.End)
+          .alignItems(HorizontalAlign.Center)
+          .layoutWeight(1)
+          .height(48)
+
+
+          Column() {
+              Text().width(30).height(8).backgroundColor(this.tabBarIndex==0?'#fd86eb':Color.Transparent).offset({y:35}).borderRadius(3)
+            Text('注册')
+              .fontSize(20)
+              .fontWeight(600)
+              .fontColor(this.tabBarIndex == 0 || this.tabBarIndex == 2 ? '#FF141111' : '#80141111')
+              // .backgroundColor(this.tabBarIndex == 0 || this.tabBarIndex == 2 ? Color.White : Color.Transparent)
+              .textAlign(TextAlign.Center)
+              .height(48)
+              .borderRadius({ topLeft: 12, topRight: 12, bottomRight: this.tabBarIndex == 1 ? 12 : 0 })
+              .onClick(() => {
+                this.tabBarIndex = 0
+                this.tabController.changeIndex(0)
+              })
+
+
+          }.justifyContent(FlexAlign.End)
+          .alignItems(HorizontalAlign.Center)
+          .layoutWeight(1)
+          .height(48)
 
         }
         .alignItems(VerticalAlign.Center)
         .justifyContent(FlexAlign.SpaceBetween)
         .width('100%')
+        .margin({top:20})
 
       }
       .padding({ top: this.safeTop })
-      .linearGradient({ angle: 135, colors: [['#CAE2F9', -0.1571], ['#D4D1F4', 0.4709], ['#EDF5FD', 1.1235]] })
+      // .linearGradient({ angle: 135, colors: [['#CAE2F9', -0.1571], ['#D4D1F4', 0.4709], ['#EDF5FD', 1.1235]] })
       .margin({ bottom: 20 })
 
 
@@ -122,13 +133,15 @@ struct LoginPage {
       .scrollable(false)
       .layoutWeight(1)
       .barHeight(0)
+      .padding({left:10,right:20})
 
     }
-
     .padding({
 
       bottom: this.safeBottom
     })
+    .backgroundImage(this.tabBarIndex==1?$r('app.media.login'):$r('app.media.register'))
+    .backgroundImageSize({width:'100%',height:'100%'})
     .height('100%')
   }
 }

+ 76 - 71
features/user/src/main/ets/views/Mine.ets

@@ -61,91 +61,96 @@ export struct Mine {
 
   build() {
     Column() {
-      Row() {
+
+
+      Column() {
         Row() {
-          Image(this.userInfo.getHeadImg() ?? $r('app.media.app_icon'))
-            .aspectRatio(1)
-            .height(40)
-            .borderRadius(20)
-            .margin({ right: 9 })
+          Row() {
+            Image(this.userInfo.getHeadImg() ?? $r('app.media.app_icon'))
+              .aspectRatio(1)
+              .height(40)
+              .borderRadius(20)
+              .margin({ right: 9 })
 
-          Column({ space: 7 }) {
-            Text(this.userInfo.getName() ?? this.userInfo.getPhoneNumber() ?? this.userInfo.getId()?.toString() ??
-              '未登录')
-              .fontSize($r('[basic].float.page_text_font_size_16'))
-              .fontColor('Color.Black')
-            Text() {
-              Span('ID:' + (this.userInfo.getId()?.toString().padStart(8, '0') ?? '00000000'))
-              ImageSpan($r('app.media.copy'))
-                .width(7)
-                .height(8)
-                .margin({ left: 4 })
-                .onClick(() => {
-                  copyText((this.userInfo.getId()?.toString().padStart(8, '0') ?? '00000000'))
-                })
-                .offset({ bottom: 4 })
+            Column({ space: 7 }) {
+              Text(this.userInfo.getName() ?? this.userInfo.getPhoneNumber() ?? this.userInfo.getId()?.toString() ??
+                '未登录')
+                .fontSize($r('[basic].float.page_text_font_size_16'))
+                .fontColor('Color.Black')
+              Text() {
+                Span('ID:' + (this.userInfo.getId()?.toString().padStart(8, '0') ?? '00000000'))
+                ImageSpan($r('app.media.copy'))
+                  .width(7)
+                  .height(8)
+                  .margin({ left: 4 })
+                  .onClick(() => {
+                    copyText((this.userInfo.getId()?.toString().padStart(8, '0') ?? '00000000'))
+                  })
+                  .offset({ bottom: 4 })
+              }
+              .fontColor('#80000000')
+              .fontSize($r('[basic].float.page_text_font_size_10'))
             }
-            .fontColor('#80000000')
-            .fontSize($r('[basic].float.page_text_font_size_10'))
+            .alignItems(HorizontalAlign.Start)
           }
-          .alignItems(HorizontalAlign.Start)
-        }
-        .onClick(() => {
+          .onClick(() => {
 
-          if (this.userInfo.checkLogin()) {
-            yTRouter.router2SettingPage()
-            return
-          }
-          yTRouter.router2LoginPage()
-        })
-      }
-      .width('100%')
-      .margin({ bottom: 30 })
+            if (this.userInfo.checkLogin()) {
+              yTRouter.router2SettingPage()
+              return
+            }
+            yTRouter.router2LoginPage()
+          })
+        }
+        .width('100%')
+        .margin({ bottom: 30 })
 
-      // ShowBannerAd()
-      Column() {
-        List() {
-          ForEach(this.setArr, (item: BasicType<undefined>, index) => {
-            ListItem() {
-              Row() {
-                Text(item.text)
-                  .fontColor('#80000000')
-                  .fontSize(12)
-                if (!index) {
-                  Row() {
-                    Text(this.userInfo.getAiNum()?.toString() ?? '')
-                      .fontWeight(600)
-                      .fontSize($r('[basic].float.page_text_font_size_14'))
+        // ShowBannerAd()
+        Column() {
+          List() {
+            ForEach(this.setArr, (item: BasicType<undefined>, index) => {
+              ListItem() {
+                Row() {
+                  Text(item.text)
+                    .fontColor('#80000000')
+                    .fontSize(12)
+                  if (!index) {
+                    Row() {
+                      Text(this.userInfo.getAiNum()?.toString() ?? '')
+                        .fontWeight(600)
+                        .fontSize($r('[basic].float.page_text_font_size_14'))
+                      Image($r('app.media.right_arrow'))
+                        .width(24)
+                        .aspectRatio(1)
+                    }
+                  } else {
                     Image($r('app.media.right_arrow'))
                       .width(24)
                       .aspectRatio(1)
                   }
-                } else {
-                  Image($r('app.media.right_arrow'))
-                    .width(24)
-                    .aspectRatio(1)
                 }
+                .width('100%')
+                .height(36)
+                .justifyContent(FlexAlign.SpaceBetween)
+                .onClick(() => {
+                  item.click?.()
+                })
               }
-              .width('100%')
-              .height(36)
-              .justifyContent(FlexAlign.SpaceBetween)
-              .onClick(() => {
-                item.click?.()
-              })
-            }
-          })
+            })
+          }
+          .padding({ left: 12, right: 4 })
+          .divider({ strokeWidth: 1, color: '#0A000000', endMargin: 8 })
+          .margin({ top: 30 })
+          .width('100%')
+          .height('100%')
         }
-        .padding({ left: 12, right: 4 })
-        .divider({ strokeWidth: 1, color: '#0A000000', endMargin: 8 })
-        .margin({ top: 30 })
+        .layoutWeight(1)
         .width('100%')
-        .height('100%')
-      }
-      .layoutWeight(1)
-      .width('100%')
 
-    }
-    .padding({ top: this.safeTop + 22, left: 16, right: 16 })
-    .height('100%')
+      }
+      .padding({ top: this.safeTop + 22, left: 16, right: 16 })
+      .height('100%')
+    }.backgroundImage($r('[basic].media.back'))
+    .backgroundImageSize({width:'100%',height:'100%'})
   }
 }

BIN
features/user/src/main/resources/base/media/login.png


BIN
features/user/src/main/resources/base/media/register.png


+ 1 - 1
products/entry/src/main/resources/base/element/string.json

@@ -10,7 +10,7 @@
     },
     {
       "name": "EntryAbility_label",
-      "value": "label"
+      "value": "樱桃小决定"
     },
     {
       "name": "reason",